/* =========================================
   ARQUIVO: index/index.css
   PÁGINA: Inicial (Home) - COM LÓGICA DO SITE ANTIGO
   ========================================= */

/* =========================================
   1. CARROSSEL ESTÁTICO (Destaques/Pastas)
   ========================================= */
.dynamic-carousel-section {
    width: 100%;
    margin-bottom: 25px;
    position: relative;
}

.dynamic-carousel-container {
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--shadow-float, 0 12px 32px rgba(0, 51, 153, 0.12));
    position: relative;
    background: var(--bg-surface, #ffffff);
}

.dynamic-carousel-track {
    display: flex;
    width: 100%;
    transition: transform 0.4s ease-out;
}

.dyn-slide {
    flex: 0 0 100%;
    width: 100%;
}

.dyn-slide img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth, all 0.3s ease);
    z-index: 10;
}

.carousel-nav:hover { background: var(--brand-blue, #003399); }
.carousel-nav.prev { left: 15px; }
.carousel-nav.next { right: 15px; }

/* =========================================
   2. CARROSSEL DE NOTÍCIAS (FIREBASE)
   ========================================= */
.news-carousel-section {
    position: relative;
    width: 100%;
    height: 350px; 
    margin-bottom: 40px;
    border-radius: var(--radius-lg, 24px);
    overflow: hidden;
    box-shadow: var(--shadow-float, 0 12px 32px rgba(0, 51, 153, 0.12));
}

.carousel-container { width: 100%; height: 100%; position: relative; overflow: hidden; }
.carousel-track { display: flex; width: 100%; height: 100%; transition: transform 0.4s ease-out; }
.carousel-slide { flex: 0 0 100%; height: 100%; position: relative; }

.slide-link { text-decoration: none; display: block; width: 100%; height: 100%; }

.carousel-slide img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.carousel-slide:hover img { transform: scale(1.05); }

.slide-caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, transparent 100%);
    padding: 40px 25px 25px 25px;
    position: absolute; bottom: 0; width: 100%;
}

.slide-caption h2 {
    font-size: 1.4rem; font-weight: 800; color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6); margin-top: 8px; line-height: 1.3;
}

.slide-caption .tag {
    background: var(--brand-red, #cc0000); color: white;
    font-size: 0.75rem; font-weight: 800; padding: 4px 10px;
    border-radius: 6px; text-transform: uppercase;
}

.carousel-indicators { position: absolute; bottom: 15px; right: 20px; display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; background: rgba(255,255,255,0.5); border-radius: 50%; cursor: pointer; }
.dot.active { background: var(--white, #fff); width: 22px; border-radius: 10px; }

/* =========================================
   3. ÚLTIMAS NOTÍCIAS (SCROLL HORIZONTAL)
   ========================================= */
.latest-news-section { margin-bottom: 40px; }

.section-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
}

.section-title {
    font-size: 1.25rem; color: var(--brand-blue, #003399);
    border-left: 5px solid var(--brand-red, #cc0000);
    padding-left: 15px; text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px;
}

.see-all {
    color: var(--brand-blue, #003399); font-weight: 700; text-decoration: none;
    font-size: 0.9rem; transition: var(--transition-smooth, all 0.3s ease);
}
.see-all:hover { text-decoration: underline; color: var(--brand-blue-dark, #001a4d); }

/* Regras originais do site mescladas com o visual novo */
.horizontal-scroll-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 15px;
    scrollbar-width: thin; /* Firefox */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.horizontal-scroll-wrapper::-webkit-scrollbar { height: 8px; }
.horizontal-scroll-wrapper::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); border-radius: 10px; }
.horizontal-scroll-wrapper::-webkit-scrollbar-thumb { background: rgba(0, 51, 153, 0.25); border-radius: 10px; }
.horizontal-scroll-wrapper::-webkit-scrollbar-thumb:hover { background: rgba(0, 51, 153, 0.5); }

.news-card-link {
    text-decoration: none; display: block; scroll-snap-align: start; flex-shrink: 0;
}

.news-mini-card {
    min-width: 320px; width: 320px; /* Garante tamanho fixo para o scroll */
    background: var(--bg-surface, #ffffff); border-radius: var(--radius-md, 16px);
    box-shadow: var(--shadow-soft, 0 4px 12px rgba(0, 0, 0, 0.04));
    border: 1px solid var(--border-subtle, rgba(0, 51, 153, 0.05));
    transition: var(--transition-smooth, all 0.3s ease);
    display: flex; align-items: center; padding: 12px; gap: 15px;
}

.news-mini-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-float, 0 12px 32px rgba(0, 51, 153, 0.08)); }

.news-img { width: 90px; height: 90px; border-radius: var(--radius-sm, 10px); overflow: hidden; flex-shrink: 0; background: #e2e8f0; }
.news-img img { width: 100%; height: 100%; object-fit: cover; }

.news-info { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.news-info .date { font-size: 0.75rem; color: var(--text-secondary, #666); font-weight: 600; }
.news-info h4 { font-size: 0.95rem; color: var(--text-primary, #1a1a1a); font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* =========================================
   4. GRID DOS EXECUTIVOS E RANKINGS
   ========================================= */
.executivos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 900px) {
    .executivos-grid { grid-template-columns: 1fr 1fr; }
}

#senadores-eval-container { margin-bottom: 40px; }

/* Força a organização dos Senadores (2 colunas no PC, centralizando o ímpar) */
#senadores-eval-container .senadores-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 20px !important;
}

/* Padrão Celular: 1 coluna ocupando 100% */
#senadores-eval-container .senadores-grid > div {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

/* Padrão PC: 2 colunas exatas (50% menos a margem) */
@media (min-width: 900px) {
    #senadores-eval-container .senadores-grid > div {
        flex: 0 0 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
}

.rankings-grid-section .section-title { margin-bottom: 20px; }

.rankings-feed { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

.btn-see-more-rankings {
    background: var(--grad-blue-elegant, linear-gradient(135deg, #003399, #001a4d)); color: white;
    border-radius: var(--radius-md, 16px); padding: 18px; font-size: 1.05rem; font-weight: 800;
    margin-top: 30px; box-shadow: 0 8px 20px rgba(0, 51, 153, 0.2); border: none;
    transition: var(--transition-smooth, all 0.3s ease); display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
}
.btn-see-more-rankings:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(0, 51, 153, 0.3); filter: brightness(1.1); }

/* ESTADOS DINÂMICOS E SKELETON */
.loading-state, .empty-state, .error-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; text-align: center; border-radius: var(--radius-md, 16px); background: var(--bg-surface, #ffffff); border: 1px dashed var(--border-subtle, rgba(0, 51, 153, 0.15)); color: var(--text-secondary, #666); }
.loading-state i { font-size: 2.5rem; margin-bottom: 15px; color: var(--brand-blue, #003399); opacity: 0.5; }
.error-state { color: var(--brand-red, #cc0000); border-color: rgba(204, 0, 0, 0.2); }
.empty-state p { font-weight: 600; font-size: 0.95rem; }

.skeleton { animation: skeleton-loading 1.2s linear infinite alternate; background-color: #e2e8f0; border-radius: 4px; }
@keyframes skeleton-loading { 0% { background-color: #e2e8f0; } 100% { background-color: #f1f5f9; } }

/* =========================================
   5. MODO NOTURNO ADAPTATIVO
   ========================================= */
body.dark-theme .dynamic-carousel-container { background: #1a1d20; box-shadow: 0 12px 32px rgba(0,0,0,0.5); }
body.dark-theme .carousel-nav { background: rgba(0,0,0,0.8); }
body.dark-theme .carousel-nav:hover { background: #60a5fa; color: #1a1d20; }
body.dark-theme .news-mini-card { background: #1a1d20; border-color: rgba(255,255,255,0.05); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
body.dark-theme .news-mini-card:hover { box-shadow: 0 12px 32px rgba(0,0,0,0.5); }
body.dark-theme .news-img { background: #121212; }
body.dark-theme .section-title { color: #f8fafc; border-left-color: #f87171; }
body.dark-theme .news-info h4 { color: #f8fafc; }
body.dark-theme .news-info .date { color: #94a3b8; }
body.dark-theme .see-all { color: #60a5fa; }
body.dark-theme .see-all:hover { color: #93c5fd; }
body.dark-theme .btn-see-more-rankings { background: linear-gradient(135deg, #1e293b, #0f172a); border: 1px solid #334155; }
body.dark-theme .btn-see-more-rankings:hover { border-color: #60a5fa; color: #60a5fa; }
body.dark-theme .loading-state, body.dark-theme .empty-state, body.dark-theme .error-state { background: #1a1d20; border-color: rgba(255,255,255,0.05); color: #cbd5e1; }
body.dark-theme .error-state { background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.2); color: #fca5a5; }
body.dark-theme .horizontal-scroll-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
body.dark-theme .skeleton { animation: skeleton-loading-dark 1.2s linear infinite alternate; }
@keyframes skeleton-loading-dark { 0% { background-color: #2a2a2a; } 100% { background-color: #3a3a3a; } }

/* =========================================
   6. RESPONSIVIDADE MOBILE ESPECÍFICA
   ========================================= */
@media (max-width: 900px) {
    .news-carousel-section {
        height: 250px;
        border-radius: 0;
        margin: -15px -20px 30px -20px; /* Sangria para vazar na tela toda no mobile (considerando padding de 20 da raiz) */
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* =========================================
   7. MODAIS DE ONBOARDING (GLASSMORPHISM)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; justify-content: center; align-items: center;
    opacity: 1; transition: opacity 0.3s ease;
    z-index: 10050;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.modal-alert-card.custom-modal-dark {
    background: var(--bg-surface, #ffffff);
    width: 90%;
    border-radius: var(--radius-lg, 24px);
    padding: 35px 30px; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 1px solid var(--border-subtle, rgba(0, 51, 153, 0.05));
    transform: scale(1); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}
.modal-overlay.hidden .modal-alert-card.custom-modal-dark { transform: scale(0.95) translateY(20px); }

.catraca-input {
    width: 100%; padding: 12px 15px; border-radius: var(--radius-sm, 8px);
    border: 1px solid var(--border-subtle, rgba(0,0,0,0.1));
    background: #f8fafc; color: var(--text-primary, #1a1a1a);
    font-size: 1rem; outline: none; transition: var(--transition-smooth, all 0.3s ease);
    box-sizing: border-box;
}
.catraca-input:focus { border-color: var(--brand-blue, #003399); background: #ffffff; box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.1); }

.btn-outline-full {
    width: 100%; padding: 15px; background: transparent; color: var(--brand-blue, #003399);
    border: 2px solid var(--brand-blue, #003399); border-radius: var(--radius-sm, 12px);
    font-weight: 800; font-size: 0.95rem; cursor: pointer; transition: all 0.3s ease;
}
.btn-outline-full:hover { background: var(--brand-blue, #003399); color: #fff; transform: translateY(-2px); }

/* Dark Mode Onboarding */
body.dark-theme .modal-alert-card.custom-modal-dark { background: #1a1d20; border-color: rgba(255,255,255,0.05); box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
body.dark-theme .modal-alert-card.custom-modal-dark h3 { color: #f8fafc !important; }
body.dark-theme .modal-alert-card.custom-modal-dark p, body.dark-theme .modal-alert-card.custom-modal-dark label { color: #cbd5e1 !important; }
body.dark-theme .catraca-input { background: #0f172a; border-color: rgba(255,255,255,0.1); color: #f8fafc; }
body.dark-theme .catraca-input:focus { border-color: #60a5fa; background: #1e293b; box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15); }
body.dark-theme .btn-outline-full { color: #60a5fa; border-color: #60a5fa; }
body.dark-theme .btn-outline-full:hover { background: #60a5fa; color: #1a1d20; }