/* =====================================================
   CSS ESPECÍFICO PARA A PÁGINA DO PRODUTO (LIMPO)
   ===================================================== */

.produto-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    max-width: 1200px;
    margin: 40px auto;
    font-family: var(--font, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
}

/* ---------- Lado Esquerdo - Galeria ---------- */
.produto-galeria {
    flex: 1;
    min-width: 350px;
}
.img-principal {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
    background: #fff;
}
.img-miniaturas {
    display: flex;
    gap: 10px;
}
.img-miniaturas img {
    width: 30%;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--gray);
}

/* ---------- Lado Direito - Detalhes ---------- */
.produto-info {
    flex: 1;
    min-width: 400px;
    color: var(--navy); 
}
.produto-titulo {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--navy);
}
.produto-rating {
    color: var(--navy);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* ---------- Preços e Meta Data ---------- */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.preco-destaque { 
    color: var(--navy); 
    font-weight: 800; 
    font-size: 30px; 
    margin-right: 12px; 
}
.preco-riscado { 
    color: var(--gray-mid); 
    font-size: 20px; 
    text-decoration: line-through; 
}
.meta-texto {
    font-size: 0.9rem;
    color: var(--navy);
}
.text-green { color: #10b981; font-weight: 500; }
.text-destaque-ref { color: var(--cor-principal); font-weight: bold; }
.text-destaque-red { color: var(--red); font-weight: bold; }

/* ---------- Descrição e Nutri-Score ---------- */
.produto-descricao {
    color: var(--gray-mid);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 20px 0;
}
.nutri-badge {
    display: inline-block;
    background-color: var(--black); 
    color: var(--navy);
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: bold;
    margin-bottom: 25px;
    border: 1px solid var(--gray);
}
.nutri-letra {
    font-size: 1.2rem;
    color: var(--red);
    margin-left: 5px;
}

/* ---------- Abas (Tabs) ---------- */
.tab-modo-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--gray);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--navy);
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}
.tab-modo-btn:hover { border-color: var(--navy); }
.tab-modo-btn.active {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* ---------- Caixas Cinzentas (Tabela de IVA e Afins) ---------- */
.caixa-resumo-iva {
    background: var(--gray-light);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 15px;
}
.resumo-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
}
.resumo-row:last-child { margin-bottom: 0; }
.resumo-row span { color: var(--gray-mid); }
.resumo-row strong { color: var(--navy); font-weight: 700; }

/* ---------- TABELA DE DESCONTOS (NOVA) ---------- */
.tabela-descontos-wrapper {
    background: var(--gray-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
}
.tabela-descontos-header {
    display: flex;
    justify-content: space-between;
    padding: 0 10px 10px;
    font-weight: 600;
    color: var(--navy);
    font-size: 14px;
    border-bottom: 1px solid var(--gray);
    margin-bottom: 8px;
}
.tabela-descontos-row {
    background: var(--white);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    border: 1px solid transparent;
}
.tabela-descontos-row:last-child {
    margin-bottom: 0;
}
.tabela-descontos-row span { color: var(--navy); }

.td-qtd { flex: 1.5; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.td-poupa { flex: 1; text-align: center; font-weight: 600; font-size: 13px; }
.td-preco { flex: 1; text-align: right; font-weight: 700; font-size: 15px; }
.td-icon { font-size: 20px; color: var(--navy); }

/* ---------- Selects Personalizados (Caixas / Paletes) ---------- */
.select-b2b-wrapper {
    margin-bottom: 15px;
    border: 1px solid var(--navy);
    border-radius: 6px;
    overflow: hidden;
}
.select-b2b {
    width: 100%;
    padding: 12px;
    border: none;
    font-weight: bold;
    color: var(--navy);
    background: var(--white);
    cursor: pointer;
    outline: none;
}
.select-b2b:focus { box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.15); }

/* ---------- Ações de Compra e Quantidade ---------- */
.acoes-row {
    display: flex;
    gap: 10px;
    height: 50px;
}
.qty-box-custom {
    border: 1px solid var(--cor-principal);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    background: var(--white);
    overflow: hidden;
}
.qty-btn {
    cursor: pointer;
    color: var(--red);
    font-weight: bold;
    padding: 10px 14px;
    user-select: none;
    transition: background var(--transition);
}
.qty-btn:hover { background: var(--gray-light); }
.qty-input {
    border: none;
    background: transparent;
    width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--cor-principal);
    outline: none;
}
.btn-comprar {
    flex: 1;
    background: var(--cor-principal); /* Fundo passa a azul por defeito */
    color: var(--white);
    border: 1px solid var(--cor-principal);
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}
.btn-comprar:hover {
    background: var(--cor-principal);
    color: var(--white);
}
.btn-esgotado { 
    background: var(--gray); 
    color: var(--gray-mid); 
    cursor: not-allowed; 
    border: none; 
}
.btn-esgotado:hover {
    background: var(--gray);
    color: var(--gray-mid);
}
.btn-icon {
    width: 50px;
    height: 50px;
    background: var(--white);
    border: 1px solid var(--cor-principal);
    border-radius: 6px;
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
}

/* ---------- Accordions (Características, Descrição, Avaliações) ---------- */
.produto-accordions {
    margin-top: 50px;
    border-top: 1px solid var(--gray);
    padding-bottom: 50px;
}
.accordion-item { border-bottom: 1px solid var(--gray); }
.accordion-header {
    width: 100%;
    padding: 18px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
}
.accordion-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #b01f43; 
    font-weight: bold;
    text-transform: uppercase;
}
.accordion-header i {
    color: #b01f43;
    transition: transform 0.3s ease;
}
.accordion-content {
    display: none;
    padding: 0 0 30px 0;
    color: #444;
    font-size: 0.95rem;
    line-height: 1.6;
}
.accordion-item.active .accordion-content { display: block; }
.accordion-item.active .accordion-header i { transform: rotate(180deg); }
.info-label {
    font-weight: bold;
    color: #333;
    display: block;
    margin-top: 15px;
}

/* ---------- Produtos Relacionados (Cards) ---------- */
.relacionados-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}
.card-relacionado {
    text-decoration: none;
    color: inherit;
    background: var(--white);
    border: 1px solid var(--gray);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card-relacionado:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.card-relacionado__icon {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #b01f43;
    color: var(--white);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.card-relacionado__img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 20px;
}
.card-relacionado__price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.price-now { color: #b01f43; font-weight: bold; font-size: 1.3rem; }
.price-was { color: var(--gray-mid); text-decoration: line-through; font-size: 1.1rem; }
.card-relacionado__rating { display: flex; align-items: center; gap: 5px; color: #666; font-size: 0.9rem; margin-bottom: 12px; }
.card-relacionado__rating i { color: #ffb400; }
.card-relacionado__name { color: var(--blue); font-size: 1.1rem; font-weight: 600; margin: 0; line-height: 1.3; }

 /* CSS Específico do Modal para ficar igual à tua imagem */
    .btn-outline-red {
        background-color: transparent;
        color: var(--cor-principal);
        border: 2px solid var(--cor-principal);
    }
    .btn-outline-red:hover {
        background-color: var(--cor-principal);
        color: var(--white);
    }

    .img-miniaturas {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
 
.img-miniaturas .miniatura {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    opacity: 0.65;
    transition: border-color 0.2s, opacity 0.2s;
}
 
.img-miniaturas .miniatura:hover {
    border-color: var(--cor-principal);
    opacity: 1;
}
 
.img-miniaturas .miniatura.active {
    border-color: var(--cor-principal);
    opacity: 1;
}

/* =========================================
   DARK MODE ADAPTATION (PRODUTO)
   ========================================= */

/* ── Textos e Títulos ── */
[data-bs-theme="dark"] .produto-info { color: var(--white); }
[data-bs-theme="dark"] .produto-titulo { color: var(--white); }
[data-bs-theme="dark"] .meta-texto { color: var(--white); }
[data-bs-theme="dark"] .produto-descricao { color: #cccccc; }
[data-bs-theme="dark"] .info-label { color: var(--white); }

/* ── Preços ── */
[data-bs-theme="dark"] .preco-destaque { color: var(--white); }
[data-bs-theme="dark"] .preco-riscado { color: #777777; }

/* ── Nutri-Badge ── */
[data-bs-theme="dark"] .nutri-badge { 
    background-color: #111111; 
    color: var(--white); 
    border-color: #333333; 
}

/* ── Abas (Tabs) ── */
[data-bs-theme="dark"] .tab-modo-btn {
    background: #1f1f1f;
    border-color: #333333;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .tab-modo-btn:hover,
[data-bs-theme="dark"] .tab-modo-btn.active {
    background: #000000;
    border-color: var(--white);
    color: var(--white);
}

/* ── Tabela de Descontos (Rappels) ── */
[data-bs-theme="dark"] .tabela-descontos-wrapper { background: #111111; }
[data-bs-theme="dark"] .tabela-descontos-header { color: var(--white); border-color: #333333; }
[data-bs-theme="dark"] .tabela-descontos-row { background: #1f1f1f; box-shadow: none; border-color: #333333; }
[data-bs-theme="dark"] .tabela-descontos-row span { color: var(--white); }
[data-bs-theme="dark"] .td-icon { color: var(--cor-principal); }

/* ── Caixa Resumo IVA ── */
[data-bs-theme="dark"] .caixa-resumo-iva { background: #111111; border: 1px solid #333333; }
[data-bs-theme="dark"] .resumo-row span { color: #999999; }
[data-bs-theme="dark"] .resumo-row strong { color: var(--white); }

/* ── Selects de Caixas/Paletes ── */
[data-bs-theme="dark"] .select-b2b-wrapper { border-color: #555555; }
[data-bs-theme="dark"] .select-b2b { 
    background: #1f1f1f; 
    color: var(--white); 
}

/* ── Quantidades (+ / -) ── */
[data-bs-theme="dark"] .qty-box-custom { background: #1f1f1f; border-color: #555555; }
[data-bs-theme="dark"] .qty-input { color: var(--white); }
[data-bs-theme="dark"] .qty-btn:hover { background: #333333; }

/* ── Botão Comprar Normal ── */
[data-bs-theme="dark"] .btn-comprar {
    background: #1f1f1f;
    color: var(--white);
    border-color: var(--white);
}
[data-bs-theme="dark"] .btn-comprar:hover {
    background: var(--white);
    color: #000000;
}
[data-bs-theme="dark"] .btn-esgotado { background: #222222; color: #555555; border-color: #333333; }

/* ── Botão Favoritos ── */
[data-bs-theme="dark"] .btn-icon { background: #1f1f1f; border-color: #555555; }
[data-bs-theme="dark"] .btn-icon:hover { background: #333333; border-color: var(--white); }

/* ── Accordions (Características/Avaliações) ── */
[data-bs-theme="dark"] .accordion-item { border-color: #333333; }
[data-bs-theme="dark"] .accordion-header h3 { color: var(--white); }
[data-bs-theme="dark"] .accordion-header i { color: var(--white); }
[data-bs-theme="dark"] .accordion-content { color: #cccccc; }

/* Adaptação Dark Mode para o Modal */
[data-bs-theme="dark"] .modal-carrinho-bg { background-color: #1f1f1f !important; border-color: #333333 !important; }
[data-bs-theme="dark"] .modal-content { background-color: #111111; border: 1px solid #333333 !important; }
[data-bs-theme="dark"] .text-dark { color: #ffffff !important; }
[data-bs-theme="dark"] .btn-outline-red { background-color: var(--red); color: var(--white); border: none; }

[data-bs-theme="dark"] .img-miniaturas .miniatura {
    border-color: #333;
}
[data-bs-theme="dark"] .img-miniaturas .miniatura.active,
[data-bs-theme="dark"] .img-miniaturas .miniatura:hover {
    border-color: #2b9eb3;
}