/* ============================================================
   Kart Katalogus — estilos do carrinho e botões
   ============================================================ */

/* ---- Botões principais (padrão compartilhado) ---- */
.kart-add-btn,
#kart-enviar-btn {
    display: inline-block;
    min-width: 230px;
    width: 230px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 11px 20px;
    background: #ffffff;
    /* border injetado via wp_head (estilos_dinamicos) */
    border-radius: 6px;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: .2px;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
    transition: background .15s, color .15s, box-shadow .15s, transform .1s;
    flex-shrink: 0;
    white-space: nowrap;
}
.kart-add-btn:hover,
#kart-enviar-btn:hover {
    box-shadow: 0 3px 0 rgba(0, 0, 0, .20);
}
.kart-add-btn:active,
#kart-enviar-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.kart-add-btn:disabled,
#kart-enviar-btn:disabled {
    opacity: .6;
    cursor: default;
}

/* ---- Carrinho ---- */
.kart-container {
    font-family: system-ui, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
}

#kart-lista { margin-bottom: 20px; }

.kart-vazio {
    text-align: center;
    color: #888;
    padding: 24px 0;
    font-size: 15px;
}

/* ---- Item do carrinho ---- */
.kart-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}

/* Imagem — 40% maior que o original (60 → 84px) */
.kart-item-img {
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
}
.kart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Corpo do item: nome em cima, linha 2 (preço + controles) em baixo */
.kart-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* alinha verticalmente ao centro da imagem */
    justify-content: center;
    align-self: center;
}

.kart-item-nome {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.35;
    word-break: break-word;
}
.kart-item-var {
    font-weight: 500;
    color: #4b5563;
}

/* Linha 2: preço à esquerda, controles à direita */
.kart-item-row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.kart-item-preco {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

/* Grupo: qty + remover */
.kart-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.kart-item-qty {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ---- Botões de quantidade — centralização via line-height ---- */
/* Usar line-height = height é mais confiável para glifos (−, +) que flex */
.kart-qty-btn {
    display: inline-block !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    line-height: 28px !important;
    text-align: center !important;
    vertical-align: middle;
    border-radius: 4px;
    font-size: 16px !important;
    font-weight: 700;
    cursor: pointer;
    padding: 0 !important;
    margin: 0;
    box-sizing: border-box !important;
    font-family: inherit;
    transition: background .12s;
    user-select: none;
}

.kart-qty-btn.kart-qty-menos {
    border: 1px solid #fca5a5 !important;
    background: #fef2f2 !important;
    color: #dc2626 !important;
}
.kart-qty-btn.kart-qty-menos:hover { background: #fee2e2 !important; }

.kart-qty-btn.kart-qty-mais {
    border: 1px solid #86efac !important;
    background: #f0fdf4 !important;
    color: #16a34a !important;
}
.kart-qty-btn.kart-qty-mais:hover { background: #dcfce7 !important; }

/* Campo de quantidade — apenas 3 caracteres */
.kart-qty-input {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    flex: 0 0 36px !important;
    height: 28px !important;
    text-align: center !important;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    padding: 0 !important;
    -moz-appearance: textfield;
    color: #1a1a1a;
    box-sizing: border-box !important;
    vertical-align: middle;
    line-height: normal;
}
.kart-qty-input::-webkit-inner-spin-button,
.kart-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Botão × — vermelho sólido fixo (não usa cor do options page) */
.kart-remover {
    display: inline-block !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    line-height: 28px !important;
    text-align: center !important;
    vertical-align: middle;
    background: #dc2626 !important;
    border: 1px solid #dc2626 !important;
    border-radius: 4px;
    font-size: 14px !important;
    color: #fff !important;
    cursor: pointer;
    padding: 0 !important;
    box-sizing: border-box !important;
    transition: background .12s;
    user-select: none;
}
.kart-remover:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
}

/* ---- Campos do cliente (linha, 50/50) ---- */
#kart-carrinho .kart-cliente {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    margin-bottom: 20px;
}
#kart-carrinho .kart-cliente input {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: auto !important;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    background: #fff;
    color: #1a1a1a;
}
#kart-carrinho .kart-cliente input:focus {
    border-color: #6b7280;
}

/* ---- Rodapé (total + enviar) ---- */
.kart-rodape {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Total — container com borda cinza */
.kart-total {
    display: inline-flex;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 18px;
    background: #f9fafb;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}

/* ---- Preço + total (página do produto) ---- */
.tam-preco-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.tam-preco-total {
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    line-height: 1;
}

/* ---- Links no carrinho (nome e foto do produto) ---- */
.kart-item-link {
    color: inherit;
    text-decoration: none;
}
.kart-item-link:hover {
    text-decoration: underline;
}
.kart-item-img a {
    display: block;
    width: 100%;
    height: 100%;
}
.kart-item-img a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Seletor de quantidade — página do produto ---- */
.kart-prod-qty-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}
.kart-prod-qty-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-right: 2px;
}
.kart-prod-qty-btn {
    display: inline-block !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    text-align: center !important;
    border-radius: 6px;
    font-size: 18px !important;
    font-weight: 700;
    cursor: pointer;
    padding: 0 !important;
    border: 1px solid #d1d5db !important;
    background: #f3f4f6 !important;
    color: #374151 !important;
    transition: background .12s;
    user-select: none;
    font-family: inherit;
}
.kart-prod-qty-btn:hover { background: #e5e7eb !important; }
.kart-prod-qty-input {
    width: 52px !important;
    height: 32px !important;
    text-align: center !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px;
    font-size: 15px !important;
    font-weight: 600;
    padding: 0 !important;
    -moz-appearance: textfield;
    color: #1a1a1a;
    box-sizing: border-box !important;
}
.kart-prod-qty-input::-webkit-inner-spin-button,
.kart-prod-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ---- Tabela Preço Atacado [kart_atacado] ---- */
.kart-atacado {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
    font-family: inherit;
}
.kart-atacado-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    background: #fff;
}
.kart-atacado-base {
    background: #f9fafb;
    color: #6b7280;
}
.kart-atacado-qty { font-weight: 500; }
.kart-atacado-preco { font-weight: 700; color: #1a1a1a; }
.kart-atacado-base .kart-atacado-preco { color: #6b7280; }
.kart-atacado-row.kart-atacado-ativa {
    border-color: var(--kart-cor-primaria, #1a3c34) !important;
    background: color-mix(in srgb, var(--kart-cor-primaria, #1a3c34) 8%, #fff) !important;
}
.kart-atacado-row.kart-atacado-ativa .kart-atacado-preco {
    color: var(--kart-cor-primaria, #1a3c34) !important;
}

/* ---- Seletor de variações (produto_tamanhos) ---- */
.prod-tamanhos { margin-bottom: 16px; }
.tam-label { font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.tam-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tam-btn {
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s;
    /* cores injetadas via wp_head (estilos_dinamicos) */
}
.tam-preco { font-size: 26px; font-weight: 700; }

/* ---- Info de estoque disponível (abaixo do seletor de variação) ---- */
.tam-estoque-info {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin: -6px 0 10px;
    min-height: 16px;
}
.tam-estoque-info.esgotado {
    color: #dc2626;
}

.kart-prod-qty-btn:disabled,
.kart-prod-qty-btn[disabled] {
    opacity: .4;
    cursor: not-allowed;
    background: #f3f4f6 !important;
}

/* ---- Responsivo ---- */
@media (max-width: 600px) {
    #kart-carrinho .kart-cliente {
        flex-direction: column !important;
    }
    #kart-carrinho .kart-cliente input {
        width: 100% !important;
    }
}
@media (max-width: 480px) {
    .kart-item-img { width: 64px; height: 64px; }
    .kart-rodape { flex-direction: column; align-items: stretch; }
    #kart-enviar-btn { width: 100% !important; min-width: unset; }
    .kart-total { width: 100%; justify-content: center; }
}
