/* ============================================================
   PRODUTO.CSS — Estilo Shopee-inspired
   Mobile: galeria full-width no topo, detalhes abaixo
   Desktop: galeria à esquerda (sticky), detalhes à direita
   ============================================================ */

/* --- ESTRUTURA GERAL --- */
.product-page {
    padding-top: 20px;
    padding-bottom: 60px;
}

.breadcrumb {
    font-size: 13px;
    color: var(--gray-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.breadcrumb a:hover { opacity: 0.75; }

.breadcrumb i { font-size: 10px; }

/* Container principal: coluna única no mobile, lado a lado no desktop */
.product-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    background-color: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 40px;
}


/* ============================================================
   GALERIA
   ============================================================ */
.product-gallery {
    position: relative;
    display: flex;
    flex-direction: column;           /* mobile: thumb-strip abaixo da imagem */
    background: var(--white) !important;
}

/* Imagem Principal */
.main-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--white);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image-wrap #main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.18s ease;
    padding: 10px;
}

.img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--gray-dark);
}

.img-placeholder i  { font-size: 80px; }
.img-placeholder span { font-size: 14px; }

/* Badge de desconto */
.discount-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: #e53935;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    z-index: 2;
}

/* Botão favorito sobreposto (mobile) */
.btn-fav-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    color: #bbb;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    transition: all 0.25s;
    z-index: 2;
}

.btn-fav-overlay:hover  { color: #e53935; background: #fff; }
.btn-fav-overlay.active { color: #e53935; background: #fff1f1; }

/* Miniaturas — carrossel horizontal (mobile) */
.thumb-strip {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
    background: var(--white);
    border-top: 1px solid var(--gray-medium);
    scrollbar-width: none;
}

.thumb-strip::-webkit-scrollbar { display: none; }

/* Miniaturas — rail vertical (desktop, escondido no mobile) */
.thumbnail-rail {
    display: none;
}

/* Item miniatura compartilhado */
.thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    opacity: 0.7;
}

.thumb.active,
.thumb:hover {
    border-color: var(--blue);
    opacity: 1;
}


/* ============================================================
   DETALHES DO PRODUTO
   ============================================================ */
.product-details {
    padding: 24px 20px 30px;
    display: flex;
    flex-direction: column;
}

.product-category-tag {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--blue);
    margin-bottom: 8px;
}

.product-title-large {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.35;
    margin-bottom: 18px;
}

/* --- Caixa de Preço --- */
.product-price-box {
    background: var(--gray-light);
    padding: 16px 18px;
    border-radius: 14px;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.old-price {
    font-size: 13px;
    color: var(--gray-dark);
    text-decoration: line-through;
}

.current-price {
    font-size: 30px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -1px;
    line-height: 1.1;
}

.installments {
    font-size: 13px;
    color: var(--text-dark);
    margin-top: 2px;
}

/* --- Variações --- */
.variations-container {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.variation-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.variation-title {
    font-size: 14px;
    color: var(--text-dark);
}

.variation-title strong {
    color: var(--blue);
    font-weight: 700;
}

.variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.var-btn {
    background: var(--white);
    border: 1.5px solid var(--gray-medium);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.var-btn:hover {
    border-color: var(--blue);
    background: var(--gray-light);
}

.var-btn.active {
    border-color: var(--blue);
    background: rgba(30, 94, 255, 0.05);
    color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
}

/* --- Frete --- */
.shipping-box {
    border: 1px solid var(--gray-medium);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 22px;
}

.shipping-header {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.shipping-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.shipping-input-group input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-medium);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.shipping-input-group input:focus { border-color: var(--blue); }

.shipping-input-group button {
    background: var(--gray-dark);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 0 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.shipping-input-group button:hover { background: #333; }

.local-delivery-badge {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: #e8f0fe;
    color: var(--blue-dark);
    padding: 11px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.local-delivery-badge i { font-size: 15px; margin-top: 1px; }

/* --- Ações --- */
.product-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

/* Controle de Quantidade */
.qty-control {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--gray-medium);
    border-radius: 10px;
    overflow: hidden;
    background: var(--white);
    height: 48px;
}

.qty-control button {
    background: var(--gray-light);
    border: none;
    height: 100%;
    padding: 0 16px;
    cursor: pointer;
    color: var(--gray-dark);
    font-size: 15px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-control button:hover {
    background: var(--gray-medium);
    color: var(--text-dark);
}

.qty-control input {
    width: 52px;
    height: 100%;
    text-align: center;
    border: none;
    border-left: 1.5px solid var(--gray-medium);
    border-right: 1.5px solid var(--gray-medium);
    font-size: 16px;
    font-weight: 700;
    outline: none;
    color: var(--text-dark);
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Botão Favorito (desktop, dentro das ações) */
.btn-favorite {
    width: 48px;
    height: 48px;
    background: var(--white);
    border: 1.5px solid var(--gray-medium);
    border-radius: 10px;
    color: #aaa;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    flex-shrink: 0;
}

.btn-favorite:hover {
    border-color: #ffcdd2;
    color: #e53935;
    background: #fff8f8;
}

.btn-favorite.active {
    background: #fff1f1;
    border-color: #ffb1b1;
    color: #e53935;
}

@keyframes heartPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.btn-favorite.active i { animation: heartPop 0.45s ease; }
.btn-favorite:active   { transform: scale(0.92); }

/* Botões Comprar / Carrinho */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
}

.btn-buy-large {
    width: 100%;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(30, 94, 255, 0.25);
}

.btn-buy-large:hover {
    background: var(--blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 61, 179, 0.3);
}

.btn-add-cart {
    width: 100%;
    background: var(--white);
    color: var(--blue);
    border: 2px solid var(--blue);
    border-radius: 12px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-add-cart:hover { background: #f0f4ff; }

/* --- Descrição --- */
.product-description h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-dark);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-medium);
}

.product-description p {
    font-size: 14px;
    color: var(--gray-dark);
    line-height: 1.7;
}

.product-description ul {
    padding-left: 20px;
    font-size: 14px;
    color: var(--gray-dark);
    line-height: 1.9;
}


/* ============================================================
   DESKTOP (≥ 768px) — lado a lado, galeria com rail vertical
   ============================================================ */
@media (min-width: 768px) {

    .product-container {
        flex-direction: row;
        align-items: flex-start;
    }

    /* Galeria ocupa 45% */
    .product-gallery {
        flex: 0 0 45%;
        flex-direction: row;              /* rail vertical à esquerda + imagem */
        align-items: flex-start;
        position: sticky;
        top: 110px;
        max-height: calc(100vh - 130px);
        overflow: hidden;
        background: var(--gray-light);
    }

    /* Rail vertical visível só no desktop */
    .thumbnail-rail {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px 0 12px 12px;
        overflow-y: auto;
        max-height: 100%;
        scrollbar-width: none;
    }

    .thumbnail-rail::-webkit-scrollbar { display: none; }

    .thumbnail-rail .thumb {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    /* Imagem principal ocupa o resto */
    .main-image-wrap {
        flex: 1;
        aspect-ratio: 1 / 1;
        border-radius: 0;
    }

    /* Esconde a strip horizontal no desktop */
    .thumb-strip { display: none; }

    /* Botão favorito mobile — esconde no desktop */
    .btn-fav-overlay { display: none; }

    /* Detalhes ocupam 55% */
    .product-details {
        flex: 0 0 55%;
        padding: 36px 36px 40px 32px;
        overflow-y: auto;
        max-height: calc(100vh - 130px);
    }

    .product-title-large { font-size: 24px; }

    .current-price { font-size: 32px; }

    /* No desktop, botões comprar/carrinho em linha */
    .action-buttons {
        flex-direction: row;
    }

    .btn-buy-large,
    .btn-add-cart {
        flex: 1;
    }
}

@media (min-width: 1100px) {
    .product-gallery { flex: 0 0 42%; }
    .product-details  { flex: 0 0 58%; }
    .product-title-large { font-size: 26px; }
}
/* ── Variação sem estoque ────────────────────────────────── */
.var-btn.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* ── Frete: resultado e estados ─────────────────────────── */
.shipping-input-group button {
    min-width: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, opacity 0.2s;
}

.shipping-input-group button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

#produto-frete-resultado {
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
    animation: fadeInUp 0.2s ease;
}

#produto-frete-resultado.sucesso {
    background: #eaf3de;
    color: #27500a;
    border: 1px solid #c0dd97;
}

#produto-frete-resultado.erro {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Erro inline no produto (validação de variação) ──────── */
#produto-erro {
    animation: fadeInUp 0.2s ease;
}