/* --------------------------------------------------- */
/* ESTILOS MODERNOS E VIBRANTES - DETALHE (AJUSTADO PARA COMPACTAÇÃO) */
/* --------------------------------------------------- */

html {
    box-sizing: border-box; 
}
*, *::before, *::after {
    box-sizing: inherit;
}
body {
    margin: 0; 
    padding: 0;
    max-width: 100vw;
    overflow-x: hidden; 
}

:root {
    /* --cor-principal é injetada via PHP no <style> do detalhe.php */
    --cor-secundaria: #172b4d; /* Azul escuro */
    --cor-sucesso: #28a745; /* Verde */
    --cor-alerta: #dc3545; /* Vermelho/Preço */
    --fundo-claro: #f4f7f6;
}

body {
    background-color: var(--fundo-claro); 
    font-family: "Poppins", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Layout Moderno de Detalhe */
.page-content-wrapper { 
    max-width: 1300px; 
    margin: 50px auto; 
    padding: 0 25px;
    display: flex;
    gap: 50px; 
    flex-wrap: wrap; 
    align-items: stretch;
}

/* Estilo para o link de voltar no topo */
.top-back-link {
    width: 100%; 
    text-align: center; 
    margin-bottom: 20px;
}
.top-back-link a {
    display: inline-block;
    font-size: 1.0em;
}

.product-image-large { 
    flex: 1 1 35%; 
    border-radius: 20px; 
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15); 
    align-self: flex-start;
    background-color: #fff;
    max-height: 450px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    position: relative; 
    /* Borda preta padrão */
    border: 1px solid #000000; 
}
.product-image-large img { 
    width: 100%; 
    max-width: 300px; 
    height: auto; 
    max-height: 400px; 
    object-fit: contain; 
}

/* --------------------------------------------------- */
/* NOVOS ESTILOS PARA DESTAQUE E PROMOÇÃO (DETALHE) */
/* --------------------------------------------------- */

.featured-badge {
    position: absolute;
    top: 15px; 
    right: 0; /* Canto superior direito */
    background-color: var(--cor-principal); /* Aplicando a cor principal */
    color: white;
    padding: 5px 10px;
    font-size: 0.9em;
    font-weight: 700;
    border-radius: 5px 0 0 5px; 
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.promo-badge {
    position: absolute;
    top: 15px; 
    left: 0; /* AJUSTE: Move para o canto superior esquerdo para não sobrepor o Destaque */
    right: auto;
    background-color: var(--cor-alerta); 
    color: white;
    padding: 5px 10px;
    font-size: 0.9em;
    font-weight: 700;
    border-radius: 0 5px 5px 0; /* AJUSTE: Arredondamento do canto esquerdo */
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* As bordas coloridas são mais grossas (3px) para sobrescrever a borda preta (1px) */
.product-image-large.featured-product,
.product-details.featured-product {
    border: 3px solid var(--cor-principal); /* Aplicando a cor principal */
    box-shadow: 0 10px 30px rgba(29, 78, 216, 0.2);
}

.product-image-large.promo-product,
.product-details.promo-product {
    border: 3px solid var(--cor-alerta);
}
/* --------------------------------------------------- */

/* Estilo para Produto SEM Foto Grande */
.no-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px; 
    max-height: 450px; 
    background-color: #e9ecef;
    color: #adb5bd;
    text-align: center;
    padding: 20px;
    border: 3px dashed #cfd4d9;
    border-radius: 20px;
}

.product-details {
    flex: 1 1 60%; 
    background-color: #ffffff;
    padding: 30px; 
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1); 
    /* Borda preta padrão */
    border: 1px solid #000000;
    position: relative; /* Para posicionamento do botão de cópia */
}
.product-details h1 { 
    color: var(--cor-secundaria); 
    border-bottom: 3px solid var(--fundo-claro); 
    padding-bottom: 10px; 
    /* AJUSTE AQUI: Margin-top será definido inline para desktop, mas mantido um valor base. */
    margin-bottom: 15px; 
    font-size: 2.5em; 
    font-weight: 900;
    line-height: 1.1;
}
.product-details p { color: #555; line-height: 1.8; margin-bottom: 15px; font-size: 1.1em; }
.product-details strong { color: var(--cor-secundaria); font-weight: 700; }

/* Estilos de Preço */
.product-price { 
    margin: 20px 0; 
    padding: 15px; 
    background: #fff3f5; 
    border-left: 6px solid var(--cor-alerta); 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.1);
}
.product-price h2 { 
    font-size: 2.8em; 
    margin-top: 5px; 
    margin-bottom: 5px; 
    font-weight: 900; 
    line-height: 1;
}
.original-price { 
    color: #aaa; 
    font-size: 1.1em; 
    text-decoration: line-through; 
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
}

/* Botão de Compra Destaque */
.btn-comprar { 
    background: linear-gradient(135deg, var(--cor-sucesso) 0%, #1a8335 100%);
    color: white; 
    padding: 15px 30px; 
    border-radius: 12px; 
    text-decoration: none; 
    font-weight: 800; 
    display: block; 
    width: 100%;
    box-sizing: border-box;
    margin-top: 30px; 
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px; 
    font-size: 1.2em;
    text-align: center;
    border: none;
    
}
.btn-comprar:hover { 
    background: linear-gradient(135deg, #1a8335 0%, var(--cor-sucesso) 100%); 
    transform: translateY(-5px); 
    box-shadow: 0 15px 40px rgba(40, 167, 69, 0.8);
    cursor: pointer;
}

/* NOVO ESTILO: Botão Voltar (Secundário) */
.btn-voltar {
    background-color: transparent;
    color: var(--cor-principal); /* Aplicando a cor principal */
    padding: 10px 20px;
    border: 2px solid var(--cor-principal); /* Aplicando a cor principal */
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 15px; 
    transition: all 0.3s;
    text-align: center;
    font-size: 1.0em;
}
.btn-voltar:hover {
    background-color: var(--cor-principal); /* Aplicando a cor principal */
    color: white;
    text-decoration: none;
}

/* Ajuste para o link de erro */
.error-link {
    display: inline-block;
    padding: 8px 15px; 
    border: 1px solid #dc3545; 
    border-radius: 6px; 
    color: #dc3545;
    text-decoration: none;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.3s;
}
.error-link:hover {
    background-color: #dc3545;
    color: white;
}

.product-description-title {
    color: var(--cor-secundaria);
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 10px;
    padding-top: 20px;
}

.product-description-text {
    color: #333; 
    font-size: 1.05em;
    padding: 10px 0;
    word-break: break-word; 
}

/* --------------------------------------------------- */
/* ESTILOS PARA FORMAS DE PAGAMENTO (CENTRALIZADO) */
/* --------------------------------------------------- */
.payment-methods-wrapper {
    margin-top: 20px; 
    padding-top: 15px;
    border-top: 1px dashed #ddd; 
    text-align: center;
}
.payment-methods-wrapper h3 {
    color: #777; 
    font-size: 1.0em; 
    font-weight: 600;
    margin-bottom: 10px; 
    line-height: 1.1;
}
.payment-methods-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 20px; 
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
    font-size: 0.95em; 
    justify-content: center;
}
.payment-methods-list li {
    display: flex;
    align-items: center;
    padding: 0; 
    /* ✅ AJUSTE CRÍTICO: Aplica a cor principal (Azul) ao texto */
    color: var(--cor-principal); 
    font-weight: 600; /* Aumenta a espessura para destaque */
    flex-shrink: 0; 
    border-right: none; 
}
.payment-methods-list li i {
    margin-right: 5px;
    color: var(--cor-principal); /* Aplicando a cor principal */
    font-size: 1.0em; 
}
/* --------------------------------------------------- */

/* ========================================================== */
/* ESTILOS PARA CAMPO QUANTIDADE COM BOTÕES (Compactado) - NOVO CSS */
/* ========================================================== */
.quantity-input-group {
    margin-top: 20px; 
    margin-bottom: 15px;
    display: flex;
    flex-direction: column; 
    align-items: center; 
}

.quantity-input-group label {
    display: block; 
    font-weight: 700; 
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
}

.quantity-control-compact {
    display: flex;
    align-items: center;
    width: 150px; /* Largura total do controle */
    margin: 0 auto;
}

.quantity-control-compact input {
    /* Sobrescreve o estilo inline anterior e padroniza */
    width: 100%; 
    padding: 10px 0; /* Padding lateral zero para dar espaço aos botões */
    border-radius: 0; 
    border: 1px solid #ccc;
    border-left: none;
    border-right: none;
    font-size: 1.1em; 
    text-align: center;
    
    /* === INÍCIO DA CORREÇÃO NA LINHA 355 === */
    /* Estilo para esconder os botões nativos do input type="number" */
    -webkit-appearance: none; 
    -moz-appearance: textfield; 
    appearance: none; 
}
/* === FIM DA CORREÇÃO === */

.quantity-control-compact input::-webkit-outer-spin-button,
.quantity-control-compact input::-webkit-inner-spin-button {
    /* -webkit-appearance: none; */ /* Pode ser removido daqui se a regra acima funcionar */
    margin: 0;
}

.btn-qty-control {
    background-color: var(--cor-principal); /* Aplicando a cor principal */
    color: white;
    border: none;
    padding: 10px 10px;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    transition: background-color 0.2s;
    flex-shrink: 0; /* Impede que o botão encolha */
    width: 40px;
    height: 40px;
}

.btn-qty-control:hover {
    background-color: var(--cor-secundaria);
}

#btn-decremento {
    border-radius: 8px 0 0 8px;
}

#btn-incremento {
    border-radius: 0 8px 8px 0;
}

/* ✅ NOVO ESTILO: Estilo para o Subtotal */
#subtotal-produto {
    margin-top: 15px; 
    font-size: 1.2em; 
    font-weight: 700; 
    color: var(--cor-principal); /* Aplicando a cor principal */
    width: 100%; 
    text-align: center;
}
/* ========================================================== */

/* ========================================================== */
/* ✅ NOVO ESTILO: Botão de Copiar Link do Produto */
/* ========================================================== */
.btn-copy-product-link {
    background-color: #F3F4F6;
    color: var(--cor-secundaria);
    border: 1px solid #D1D5DB;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
    display: block; 
    width: 100%;
    box-sizing: border-box;
    margin-top: 15px; 
    text-align: center;
    font-size: 1.0em;
    cursor: pointer;
    outline: none;
}
.btn-copy-product-link:hover {
    background-color: #E5E7EB;
    transform: translateY(-2px);
}
.btn-copy-product-link.copy-success {
    background-color: var(--cor-sucesso) !important;
    color: white !important;
    border-color: var(--cor-sucesso) !important;
    transform: translateY(-2px); 
}
/* ========================================================== */


/* Responsividade */
@media (max-width: 900px) {
    .page-content-wrapper { 
        flex-direction: column; 
        gap: 20px;
        margin: 0;
        padding: 0 15px; 
    }
    
    .product-image-large { 
        flex: 1 1 100%; 
        max-width: 450px; 
        margin: 0 auto; 
        border-radius: 10px; 
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        max-height: 400px; 
    }
    
    .product-details { 
        flex: 1 1 100%; 
        max-width: 100%;
        padding: 20px;
        box-shadow: none;
        border-radius: 10px; 
        margin-top: 10px; 
    }
    
    .product-image-large img {
        max-width: 70%; 
        max-height: 350px; 
        min-height: 250px;
    }
    
    .product-details h1 { 
        font-size: 2.0em; 
        margin-bottom: 10px;
        padding-bottom: 8px;
        /* ✅ AJUSTE MOBILE: Garante que o H1 comece abaixo do topo da div */
        margin-top: 30px; 
    }
    .product-price h2 { 
        font-size: 2.2em; 
    } 
    
    .btn-comprar {
        padding: 18px 20px;
        margin-top: 30px;
        font-size: 1.1em;
        letter-spacing: 1px;
        cursor: pointer !important;
    }
    .btn-voltar {
        margin-top: 15px; 
    }
    .no-photo-placeholder, .product-image-large img {
        min-height: 300px;
    }
    
    /* ========================================================== */
    /* ✅ CORREÇÃO: CENTRALIZA O BOTÃO VOLTAR EM MOBILE */
    .top-back-link {
        padding: 0; 
        text-align: center; /* AGORA CENTRALIZADO */
        margin-left: 0; /* Remove o deslocamento */
    }
    /* ========================================================== */

    .featured-badge { /* Mantém o Destaque no canto direito */
        top: 10px; 
        right: 0; 
        left: auto;
        font-size: 0.8em;
        padding: 4px 8px;
        border-radius: 5px 0 0 5px;
    }
    
    .promo-badge { /* Ajusta o Promo para o canto esquerdo em mobile */
        top: 10px; 
        left: 0; 
        right: auto;
        font-size: 0.8em;
        padding: 4px 8px;
        border-radius: 0 5px 5px 0;
    }
    
    .payment-methods-list {
        justify-content: center; 
        gap: 10px 15px; 
    }
    .payment-methods-list li {
        font-size: 0.8em; 
    }
    
    /* ✅ AJUSTE: Garante que o botão de cópia tenha margem correta no mobile */
    .btn-copy-product-link {
        /* Este botão será mantido apenas o desktop/compartilhar (topo) */
        margin-top: 25px; /* Manter a margem interna do form */
        margin-bottom: 15px; 
    }
}
@media (min-width: 901px) {
    .page-content-wrapper {
        justify-content: flex-start;
    }
    .btn-voltar {
        width: 100%; 
    }
}