/* css/ads.css
 * Estilos para o sistema de afiliados (Atualizado: Jan/2026)
 * - Grade Fixa de 6 Itens (Inline)
 * - Vinheta Expandida com Hero de Alto Impacto
 * - Suporte a Modo Escuro (Dark Mode)
 * - Correções Mobile (Z-Index, Botões Fixos e Layout Hero)
 */

/* === SEÇÃO FIXA (INLINE) - ESTILO "DESTAQUE" === */
.offers-section {
    margin: 40px 0;
    padding: 20px 20px 10px 20px;
    background-color: #f8fbff; /* Fundo azul bem suave */
    border: 2px solid #2968c8; /* Borda de destaque na cor da marca */
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(41, 104, 200, 0.1);
    width: 100%;
    box-sizing: border-box;
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

.offers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.offers-title {
    text-align: left;
    font-size: 1.1em;
    margin: 0;
    color: #2968c8;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s;
}

.offers-title::before {
    content: '★';
    font-size: 1.2em;
    color: #ffca28; /* Amarelo ouro */
}

/* Controles do Cabeçalho */
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-see-more {
    background-color: #2968c8;
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.btn-see-more:hover {
    background-color: #1a4a9b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.offers-wrapper {
    position: relative;
    width: 100%;
}

/* === GRID FIXO DE 6 ITENS (INLINE) === */
.offers-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* 6 colunas no desktop */
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* === CARD DE PRODUTO === */
.offer-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    text-decoration: none;
    color: #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background-color 0.3s;
    box-sizing: border-box;
    height: 100%; 
    min-height: 200px; /* Altura mínima para consistência */
}

.offer-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.1);
    border-color: #2968c8;
    z-index: 1; 
}

.offer-img-wrapper {
    width: 100%;
    height: 80px; /* Um pouco maior para o grid fixo */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    background: #fff;
    padding: 2px;
    transition: background-color 0.3s;
}

.offer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.offer-name {
    font-size: 0.75em;
    line-height: 1.3;
    margin-bottom: 10px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3.9em;
    font-weight: 600;
    color: #333;
    transition: color 0.3s;
}

.offer-cta {
    background-color: transparent;
    color: #2968c8;
    font-size: 0.75em;
    padding: 6px 0;
    border: 1px solid #2968c8;
    border-radius: 4px;
    width: 100%;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.offer-card:hover .offer-cta {
    background-color: #2968c8;
    color: #fff;
}

/* === VINHETA / POP-UP === */
.vignette-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    /* Z-Index Máximo para garantir que fique acima de qualquer header */
    z-index: 2147483647;
    display: none; justify-content: center; align-items: center;
    padding: 20px; backdrop-filter: blur(4px);
    transition: background-color 0.3s;
}

.vignette-container {
    background: #f5f5f5;
    width: 100%;
    max-width: 900px; 
    border-radius: 12px;
    position: relative;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: zoomIn 0.4s ease;
    display: flex;
    flex-direction: column;
    max-height: 95vh;
    transition: background-color 0.3s, color 0.3s;
    box-sizing: border-box; /* Importante para não estourar largura */
}

@keyframes zoomIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.vignette-close-btn {
    position: absolute; top: -12px; right: -12px;
    background: #ff4444; color: white; border: 2px solid #fff;
    border-radius: 50%; width: 36px; height: 36px; font-size: 20px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3); z-index: 10;
}
.vignette-close-btn:hover { background: #cc0000; transform: scale(1.1); }

.vignette-header { text-align: center; margin-bottom: 15px; flex-shrink: 0; }
.vignette-header span { font-size: 0.8em; text-transform: uppercase; letter-spacing: 1.5px; color: #666; font-weight: 700; }
.vignette-header h4 { margin: 5px 0 0; font-size: 1.6em; color: #333; transition: color 0.3s; }

/* HERO CAROUSEL (Destaque Ampliado - Desktop) */
.vignette-hero {
    width: 100%;
    height: 320px; 
    background: #fff;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02);
    transition: background-color 0.3s, border-color 0.3s;
    box-sizing: border-box; /* Contorno dentro da largura */
}

.hero-item {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: row;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
}

.hero-item.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.hero-img-container {
    width: 55%; 
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 20px;
}

.hero-img {
    max-height: 90%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.15)); 
}

.hero-content {
    width: 45%; 
    padding-left: 10px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.hero-title {
    font-size: 1.5em;
    font-weight: 800;
    margin-bottom: 20px;
    color: #222;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.hero-cta {
    background: #2968c8;
    color: #fff;
    border: none;
    padding: 12px 30px; 
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 1.1em;
    align-self: flex-start;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(41, 104, 200, 0.3);
}

.hero-cta:hover {
    background: #1a4a9b;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(41, 104, 200, 0.4);
}

/* Navegação por Pontos */
.vignette-hero-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.nav-dot {
    width: 12px;
    height: 12px;
    background-color: #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-dot.active {
    background-color: #2968c8;
    transform: scale(1.2);
}

/* Grid da Vinheta */
.vignette-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    overflow-y: auto;
    padding: 5px;
}

.vignette-grid .offer-card {
    border: 1px solid #ddd;
    box-shadow: none; 
    min-height: auto;
}

.vignette-footer { margin-top: 20px; text-align: center; flex-shrink: 0; }
.btn-continue {
    background: transparent; border: 2px solid #666; color: #444;
    padding: 10px 30px; border-radius: 30px; font-weight: 700; cursor: pointer;
    transition: all 0.2s; font-size: 0.95em;
}
.btn-continue:hover { background: #333; color: #fff; border-color: #333; }

/* === MODAL DE CATÁLOGO === */
.offers-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    /* Z-Index Supremo para o Modal de Catálogo */
    background: rgba(0,0,0,0.7); z-index: 2147483647; display: none;
    justify-content: center; align-items: center; backdrop-filter: blur(2px);
}
.offers-modal-content {
    background: #fff; width: 95%; max-width: 1000px; max-height: 85vh;
    border-radius: 12px; box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; overflow: hidden;
    animation: modalFadeIn 0.3s ease;
    transition: background-color 0.3s;
}
.offers-modal-header {
    padding: 15px 20px; border-bottom: 1px solid #eee; background: #f9f9f9;
    display: flex; justify-content: space-between; align-items: center;
    transition: background-color 0.3s, border-color 0.3s;
    flex-shrink: 0; 
}
.offers-modal-header h3 { margin: 0; font-size: 1.2em; color: #333; transition: color 0.3s; }
.offers-modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #666; line-height: 1; }

.offers-modal-body { 
    padding: 20px; 
    overflow-y: auto; 
    background-color: #fff; 
    transition: background-color 0.3s;
    flex-grow: 1; 
}

/* Novo Rodapé do Modal de Ofertas */
.offers-modal-footer {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    text-align: center;
    flex-shrink: 0; 
    transition: background-color 0.3s, border-color 0.3s;
}

.offers-modal-footer .btn-continue {
    display: inline-block;
    width: 100%;
    max-width: 300px;
}

.cat-title {
    font-size: 1.1em; color: #2968c8; border-bottom: 2px solid #f0f0f0;
    padding-bottom: 5px; margin: 30px 0 15px 0; font-weight: 700;
    transition: color 0.3s, border-color 0.3s;
}
.cat-title:first-child { margin-top: 0; }

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}
.modal-grid .offer-card { min-height: auto; }

/* === RESPONSIVIDADE === */

@media (max-width: 992px) {
    /* Tablet: Inline vira 3 colunas x 2 linhas */
    .offers-container { grid-template-columns: repeat(3, 1fr); }
    
    /* Vinheta grid reduzida */
    .vignette-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    /* Mobile Landscape: Inline 3 colunas */
    .offers-container { grid-template-columns: repeat(3, 1fr); }
    
    /* Vinheta 3 colunas */
    .vignette-grid { grid-template-columns: repeat(3, 1fr); }
    
    /* Vinheta Estilo Bottom Sheet */
    .vignette-overlay { align-items: flex-end; padding: 0; }
    
    .vignette-container {
        border-radius: 20px 20px 0 0;
        /* Padding inferior reduzido para 15px para economizar espaço (era 30px) */
        padding: 20px 15px 15px 15px !important;
        animation: slideUp 0.4s ease;
        max-height: 90vh;
        width: 100%; /* Garante largura total no mobile */
    }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    
    .vignette-close-btn { 
        /* CORREÇÃO MOBILE: Botão mais para baixo para não bater na barra de endereço */
        top: 55px !important; 
        right: 15px !important; 
        background: rgba(255, 68, 68, 0.9) !important;
        color: white !important; 
        border: none; 
        box-shadow: 0 2px 8px rgba(0,0,0,0.2); 
        font-size: 28px; 
        width: 32px; 
        height: 32px;
        z-index: 100 !important; 
        opacity: 1 !important;
    }
    
    /* CORREÇÃO HERO MOBILE: TOTAL REWORK */
    /* Removemos o layout absolute/fixed height do desktop */
    .vignette-hero { 
        height: auto !important; /* Permite crescer conforme conteúdo */
        min-height: auto !important;
        display: block !important; /* Bloco simples para fluxo natural */
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        margin-bottom: 15px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    /* HERO ITEM MOBILE: RELATIVE & STACKED */
    /* Apenas o ativo aparece. Os outros somem via display:none */
    .hero-item {
        position: relative !important;
        display: none !important; /* Esconde inativos */
        width: 100% !important;
        height: auto !important;
        flex-direction: column !important;
        /* Padding reduzido para 12px (era 15px) */
        padding: 12px !important;
        background: #fff;
        border-radius: 12px;
        border: 1px solid #ddd;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
        opacity: 1 !important; /* Força visibilidade se display:flex */
    }

    .hero-item.active {
        display: flex !important; /* Mostra apenas o ativo */
        z-index: 5;
    }
    
    .hero-img-container {
        width: 100% !important;
        /* Altura reduzida para 120px para dar espaço ao carrossel (era 140px) */
        height: 120px !important;
        padding: 0 !important;
        margin-bottom: 10px !important; /* Margem reduzida */
        flex-shrink: 0;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .hero-img {
        max-height: 100% !important;
        width: auto !important;
        max-width: 100% !important;
    }
    
    .hero-content {
        width: 100% !important;
        padding: 0 !important;
        text-align: center !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        height: auto !important;
    }

    .hero-title { 
        font-size: 1.2em !important; 
        -webkit-line-clamp: 3; 
        margin-bottom: 8px !important; /* Margem reduzida */
        text-align: center;
        color: #333 !important;
    }
    
    .hero-cta { 
        padding: 10px 0 !important; 
        font-size: 1em !important; 
        width: 100% !important;
        max-width: 280px !important;
        align-self: center !important;
    }

    /* AJUSTE DO RODAPÉ (FAIXA CONTINUAR) */
    .vignette-footer {
        /* Margem superior reduzida para 10px (era 20px) */
        margin-top: 10px !important;
    }

    .btn-continue {
        /* Padding reduzido para afinar a faixa */
        padding: 8px 30px !important;
        font-size: 0.9em !important;
    }
}

@media (max-width: 480px) {
    /* Mobile Portrait: Inline 2 colunas x 3 linhas */
    .offers-container { grid-template-columns: repeat(2, 1fr); }
    
    /* Vinheta 2 colunas */
    .vignette-grid { grid-template-columns: repeat(2, 1fr); }
    
    .offers-title { font-size: 1em; }
    .btn-see-more { padding: 5px 12px; font-size: 0.8em; }
}

/* === DARK MODE SUPPORT === */
/* Detecta classes comuns no body ou html (ex: .dark-mode, .dark, ou data-theme="dark") */
body.dark-mode .offers-section,
body.dark .offers-section,
[data-theme="dark"] .offers-section {
    background-color: #1e1e1e; /* Cinza escuro */
    border-color: #444;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .offers-title,
body.dark .offers-title,
[data-theme="dark"] .offers-title {
    color: #66b2ff; /* Azul mais claro para contraste */
}

body.dark-mode .offer-card,
body.dark .offer-card,
[data-theme="dark"] .offer-card {
    background-color: #2b2b2b;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .offer-card:hover,
body.dark .offer-card:hover,
[data-theme="dark"] .offer-card:hover {
    border-color: #66b2ff;
    box-shadow: 0 5px 12px rgba(0,0,0,0.6);
}

body.dark-mode .offer-name,
body.dark .offer-name,
[data-theme="dark"] .offer-name {
    color: #f0f0f0;
}

/* Mantém o fundo da imagem branco para garantir que o produto (geralmente JPG) não fique com borda branca feia */
body.dark-mode .offer-img-wrapper,
body.dark .offer-img-wrapper,
[data-theme="dark"] .offer-img-wrapper {
    background: #fff;
    border-radius: 4px;
}

body.dark-mode .offer-cta,
body.dark .offer-cta,
[data-theme="dark"] .offer-cta {
    color: #66b2ff;
    border-color: #66b2ff;
}

body.dark-mode .offer-card:hover .offer-cta,
body.dark .offer-card:hover .offer-cta,
[data-theme="dark"] .offer-card:hover .offer-cta {
    background-color: #66b2ff;
    color: #111;
}

/* Modal e Vinheta Dark Mode */
body.dark-mode .vignette-overlay,
body.dark .vignette-overlay,
[data-theme="dark"] .vignette-overlay {
    background: rgba(0,0,0,0.9);
}

body.dark-mode .vignette-container,
body.dark .vignette-container,
[data-theme="dark"] .vignette-container {
    background: #1e1e1e;
    color: #eee;
}

body.dark-mode .vignette-header h4,
body.dark .vignette-header h4,
[data-theme="dark"] .vignette-header h4 {
    color: #fff;
}

/* CORREÇÃO ESPECÍFICA: BOTÃO FECHAR NO DARK MODE */
body.dark-mode .vignette-close-btn,
body.dark .vignette-close-btn,
[data-theme="dark"] .vignette-close-btn {
    color: #fff !important; /* Força branco */
    border-color: #fff !important;
}

body.dark-mode .vignette-hero,
body.dark .vignette-hero,
[data-theme="dark"] .vignette-hero {
    background: transparent; /* No mobile ele é transparente, no desktop sobrescreve se precisar */
    border-color: #444;
}
/* Revert desktop background */
@media (min-width: 769px) {
    body.dark-mode .vignette-hero,
    body.dark .vignette-hero,
    [data-theme="dark"] .vignette-hero {
        background: #2b2b2b;
    }
}

body.dark-mode .hero-item,
body.dark .hero-item,
[data-theme="dark"] .hero-item {
    background-color: #2b2b2b; /* Fundo do card no mobile */
    border-color: #444;
}

body.dark-mode .hero-title,
body.dark .hero-title,
[data-theme="dark"] .hero-title {
    color: #fff !important;
}

body.dark-mode .hero-cta,
body.dark .hero-cta,
[data-theme="dark"] .hero-cta {
    background: #66b2ff;
    color: #000;
    box-shadow: 0 4px 10px rgba(102, 178, 255, 0.2);
}

body.dark-mode .hero-cta:hover,
body.dark .hero-cta:hover,
[data-theme="dark"] .hero-cta:hover {
    background: #99ccff;
}

body.dark-mode .vignette-grid .offer-card,
body.dark .vignette-grid .offer-card,
[data-theme="dark"] .vignette-grid .offer-card {
    background: #2b2b2b;
    border-color: #444;
}

body.dark-mode .offers-modal-content,
body.dark .offers-modal-content,
[data-theme="dark"] .offers-modal-content {
    background: #1e1e1e;
}

body.dark-mode .offers-modal-header,
body.dark .offers-modal-header,
[data-theme="dark"] .offers-modal-header {
    background: #252525;
    border-bottom-color: #333;
}

body.dark-mode .offers-modal-header h3,
body.dark .offers-modal-header h3,
[data-theme="dark"] .offers-modal-header h3 {
    color: #fff;
}

body.dark-mode .offers-modal-body,
body.dark .offers-modal-body,
[data-theme="dark"] .offers-modal-body {
    background: #1e1e1e;
}

/* Dark Mode Footer Modal */
body.dark-mode .offers-modal-footer,
body.dark .offers-modal-footer,
[data-theme="dark"] .offers-modal-footer {
    background: #252525;
    border-top-color: #333;
}

body.dark-mode .cat-title,
body.dark .cat-title,
[data-theme="dark"] .cat-title {
    color: #66b2ff;
    border-bottom-color: #333;
}

body.dark-mode .btn-see-more,
body.dark .btn-see-more,
[data-theme="dark"] .btn-see-more {
    background-color: #66b2ff;
    color: #000;
}

body.dark-mode .btn-continue,
body.dark .btn-continue,
[data-theme="dark"] .btn-continue {
    color: #ccc;
    border-color: #666;
}

body.dark-mode .btn-continue:hover,
body.dark .btn-continue:hover,
[data-theme="dark"] .btn-continue:hover {
    background: #eee;
    color: #000;
}