/**
 * ========================================
 * BANNER MODAL MODERNO - ULTRA PROFISSIONAL
 * ========================================
 * Sistema completo de banner modal com:
 * - Glassmorphism e blur effects
 * - Animações cinematográficas
 * - Carousel inteligente
 * - Timer visual progressivo
 * - Responsividade total
 */

/* ==== VARIÁVEIS CSS ==== */
:root {
    --banner-primary: #2c3e50;
    --banner-accent: #3498db;
    --banner-white: #ffffff;
    --banner-black: #000000;
    --banner-overlay: rgba(0, 0, 0, 0.75);
    --banner-glass: rgba(255, 255, 255, 0.1);
    --banner-glass-border: rgba(255, 255, 255, 0.2);
    
    /* Animações */
    --banner-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --banner-transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==== OVERLAY PRINCIPAL ==== */
.banner-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0 !important; /* Força esconder até abrir */
    visibility: hidden !important;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animação de ABERTURA */
.banner-modal-overlay.active {
    opacity: 1 !important; /* Força aparecer */
    visibility: visible !important;
    pointer-events: auto;
}

/* Estado durante abertura */
.banner-modal-overlay.opening {
    opacity: 1 !important; /* Força aparecer */
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Container com estado inicial ANTES da animação */
.banner-modal-overlay.opening .banner-modal-container {
    opacity: 0;
    transform: scale(0.85) translateY(30px);
}

/* Container APÓS adicionar 'active' */
.banner-modal-overlay.opening.active .banner-modal-container {
    animation: modalSlideInBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalSlideInBounce {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animação de fechamento - TODOS OS ELEMENTOS JUNTOS */
.banner-modal-overlay.closing {
    opacity: 0 !important;
    pointer-events: none !important;
}

.banner-modal-overlay.closing .banner-modal-container {
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ESCONDE IMEDIATAMENTE os botões ao fechar */
.banner-modal-overlay.closing .banner-modal-close,
.banner-modal-overlay.closing .banner-carousel-prev,
.banner-modal-overlay.closing .banner-carousel-next,
.banner-modal-overlay.closing .banner-carousel-counter,
.banner-modal-overlay.closing .banner-carousel-indicators,
.banner-modal-overlay.closing .banner-progress-bar {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease, visibility 0s 0.2s !important;
}

/* Impede scroll do body quando modal está ativo */
body.banner-modal-open {
    overflow: hidden !important;
    height: 100vh;
    position: fixed;
    width: 100%;
}

/* ==== BACKDROP COM BLUR (GLASSMORPHISM) ==== */
.banner-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    /* Animação removida - transição controlada pelo overlay pai */
    cursor: pointer;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==== CONTAINER PRINCIPAL ==== */
.banner-modal-container {
    position: relative;
    z-index: 2;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    /* Animação controlada via classes .opening e .active - não usa animation CSS */
    pointer-events: auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==== BARRA DE PROGRESSO DISCRETA (TOPO DO CARD) ==== */
.banner-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px; /* Mais discreto */
    background: rgba(0, 0, 0, 0.15);
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    z-index: 5;
    opacity: 0.7; /* Mais sutil */
}

.banner-progress-fill {
    height: 100%;
    width: 0%;
    /* Background aplicado via JS (harmonização) */
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.5) 0%, 
        rgba(255, 255, 255, 0.9) 50%, 
        rgba(255, 255, 255, 0.5) 100%);
    background-size: 200% 100%;
    transition: none; /* Controlado por JS */
    animation: progressShimmer 2s linear infinite;
    /* Box-shadow aplicado via JS (harmonização) */
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Progressbar em modo MANUAL (congelada) */
.banner-progress-fill.manual-control {
    animation: none; /* Remove shimmer */
    opacity: 0.5; /* Indica que está pausada */
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.3) 0%, 
        rgba(255, 255, 255, 0.5) 50%, 
        rgba(255, 255, 255, 0.3) 100%);
}

@keyframes progressShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==== BOTÃO FECHAR DISCRETO E PROFISSIONAL ==== */
.banner-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 40px;
    height: 40px;
    /* Background aplicado via JS (harmonização) - fallback neutro */
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Border aplicado via JS (harmonização) - fallback neutro */
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--banner-transition);
    /* Box-shadow aplicado via JS (harmonização) - fallback neutro */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

.banner-modal-close:hover {
    opacity: 1;
    transform: scale(1.15) rotate(90deg);
    /* Box-shadow e background de hover aplicados via JS (harmonização) */
}

.banner-modal-close svg {
    width: 20px;
    height: 20px;
    color: var(--banner-white);
    transition: var(--banner-transition-fast);
}

.banner-modal-close:hover svg {
    transform: scale(1.1);
}

/* ==== CARD DO MODAL (GLASSMORPHISM) ==== */
.banner-modal-card {
    background: var(--banner-white);
    border: 1px solid var(--banner-glass-border);
    border-radius: 20px;
    overflow: hidden;
    max-height: 85vh;
    position: relative;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 1px rgba(255, 255, 255, 0.2) inset;
    cursor: pointer;
}

/* ==== ESTILO DA BARRA DE ROLAGEM ==== */
.banner-image-container::-webkit-scrollbar {
    width: 8px;
}

.banner-image-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin: 4px;
}

.banner-image-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.banner-image-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Firefox */
.banner-image-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

/* ==== BANNER ÚNICO ==== */
.banner-single {
    position: relative;
}

/* ==== CONTAINER DA IMAGEM (Banner Único) */
.banner-single .banner-image-container {
    position: relative;
    width: 100%;
    max-height: 75vh;
    min-height: 400px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f8f9fa;
    padding: 24px 24px 100px 24px; /* Padding inferior aumentado para não ficar atrás da barra */
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.banner-single .banner-image {
    width: 92%;
    height: auto;
    max-width: 92%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Animação de zoom removida - causava distorção */

/* ==== TÍTULO OVERLAY ==== */
.banner-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 30px 30px 30px; /* Aumenta padding inferior para não sobrepor indicadores */
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.85) 0%, 
        rgba(0, 0, 0, 0.5) 70%, 
        transparent 100%);
    backdrop-filter: blur(8px);
    transform: translateY(100%);
    transition: var(--banner-transition);
    z-index: 2; /* Fica ABAIXO dos indicadores (z-index: 3) */
}

.banner-modal-card:hover .banner-title-overlay {
    transform: translateY(0);
}

.banner-title {
    color: var(--banner-white);
    font-size: 1.3rem; /* Reduz um pouco o tamanho */
    font-weight: 600;
    margin: 0 0 10px 0; /* Adiciona margem inferior */
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    animation: titleSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
    line-height: 1.4; /* Melhora legibilidade */
}

@keyframes titleSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==== CAROUSEL (MÚLTIPLOS BANNERS) ==== */
.banner-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.banner-carousel-track {
    display: flex;
    width: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.banner-carousel-slide {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    position: relative;
}

/* Container da imagem DENTRO do slide do carousel */
.banner-carousel-slide .banner-image-container {
    position: relative;
    width: 100%;
    max-height: 75vh;
    min-height: 400px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f8f9fa;
    padding: 24px 24px 100px 24px; /* Padding inferior aumentado para não ficar atrás da barra */
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.banner-carousel-slide .banner-image {
    width: 92%;
    height: auto;
    max-width: 92%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==== BOTÕES DE NAVEGAÇÃO DO CAROUSEL ==== */
.banner-carousel-prev,
.banner-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: var(--banner-transition);
    opacity: 0.85;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.banner-carousel-prev {
    left: 20px;
}

.banner-carousel-next {
    right: 20px;
}

.banner-carousel-prev:hover,
.banner-carousel-next:hover {
    background: rgba(0, 0, 0, 0.75);
    opacity: 1;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
}

.banner-carousel-prev svg,
.banner-carousel-next svg {
    width: 24px;
    height: 24px;
    color: var(--banner-white);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ==== INDICADORES DO CAROUSEL ==== */
.banner-carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.banner-carousel-indicator {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--banner-transition);
}

.banner-carousel-indicator.active {
    background: var(--banner-white);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.banner-carousel-indicator:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

/* ==== CONTADOR DE SLIDES ==== */
.banner-carousel-counter {
    position: absolute;
    top: 15px;
    right: 60px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    color: var(--banner-white);
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.current-slide {
    color: #ffffff;
    font-size: 1.1rem;
}

/* ==== BADGE INFORMATIVO ==== */
.banner-modal-badge {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    color: var(--banner-primary);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: badgeBounce 2s ease-in-out infinite;
    z-index: 99999; /* À frente de tudo */
}

@keyframes badgeBounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.banner-badge-icon {
    width: 18px;
    height: 18px;
    color: #3498db;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ==== RESPONSIVIDADE ==== */
@media (max-width: 768px) {
    .banner-modal-container {
        max-width: 90%;
        width: 90%;
        max-height: 90vh;
    }
    
    .banner-modal-card {
        border-radius: 15px;
    }
    
    .banner-modal-close {
        width: 45px;
        height: 45px;
        top: -10px;
        right: -10px;
    }
    
    .banner-title {
        font-size: 1.2rem;
    }
    
    .banner-title-overlay {
        padding: 20px;
    }
    
    .banner-image-container {
        padding: 16px;
        min-height: 300px;
    }
    
    .banner-carousel-prev,
    .banner-carousel-next {
        width: 40px;
        height: 40px;
    }
    
    .banner-carousel-prev {
        left: 10px;
    }
    
    .banner-carousel-next {
        right: 10px;
    }
    
    .banner-modal-badge {
        bottom: -40px;
        font-size: 0.75rem;
        padding: 10px 20px;
    }
}

@media (max-width: 576px) {
    .banner-image-container {
        max-height: 65vh;
        padding: 12px;
        min-height: 250px;
    }
    
    .banner-image {
        border-radius: 6px;
    }
    
    .banner-title {
        font-size: 1rem;
    }
    
    .banner-carousel-counter {
        top: 10px;
        right: 55px;
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    /* Badge em mobile - reduz fonte mas mantém texto visível */
    .banner-modal-badge {
        padding: 6px 12px;
        font-size: 0.625rem; /* 10px - menor para não quebrar linha */
        gap: 5px;
        white-space: nowrap; /* Força ficar em uma linha */
    }
    
    .banner-badge-icon {
        width: 12px;
        height: 12px;
        flex-shrink: 0; /* Não encolhe o ícone */
    }
}

/* ==== ACESSIBILIDADE ==== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==== MODO ESCURO (SE NECESSÁRIO) ==== */
@media (prefers-color-scheme: dark) {
    :root {
        --banner-glass: rgba(0, 0, 0, 0.3);
        --banner-glass-border: rgba(255, 255, 255, 0.15);
    }
}

