:root {
    /* Colors - Zinc/Slate neutrals with Corporate Blue gradient */
    --bg-color: #fafafa;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    /* Blue Scheme - Conecta LD Reference */
    --accent-color: #0284c7; /* Sky Blue 600 */
    --accent-hover: #0369a1;
    --accent-gradient: linear-gradient(135deg, #0ea5e9, #0284c7);
    
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(226, 232, 240, 0.8);
    
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;

    --font-family: 'Outfit', sans-serif;
    
    /* Spacing & Radii */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
    /* Fundo Quadriculado */
    background-image: 
        linear-gradient(to right, rgba(15, 23, 42, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
}

/* --- PRELOADER SÊNIOR (WATER FILL) --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-text {
    font-size: clamp(1.2rem, 4vw, 3rem);
    font-weight: 800;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
    position: relative;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
}

.preloader-text::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    color: #0ea5e9;
    -webkit-text-stroke: 0px;
    overflow: hidden;
    animation: water-fill 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    border-right: 2px solid #0ea5e9;
}

@keyframes water-fill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* --- BARRA DE PROGRESSO STICKY --- */
#progress-container {
    position: fixed;
    bottom: 0; /* Movido para baixo para evitar a navbar */
    left: 0;
    width: 100%;
    z-index: 101; 
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(15, 23, 42, 0.05);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.03);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#progress-container.visible {
    transform: translateY(0);
}

.progress-bar-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    background: #ffffff;
    border-left: 4px solid var(--success);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast i {
    color: var(--success);
    font-size: 1.25rem;
}

.toast-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast.fade-out {
    animation: slideOutRight 0.4s ease-in forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Canvas de Partículas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* --- NAVBAR --- */
.app-nav {
    width: 100%;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    background: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--accent-color);
}

.nav-logo strong {
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-divider {
    color: #cbd5e1;
    font-weight: 300;
}

.logo-subtitle {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link-admin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-link-admin:hover {
    color: var(--accent-color);
    background-color: rgba(2, 132, 199, 0.05);
    border-color: rgba(2, 132, 199, 0.1);
}

.nav-link-admin i {
    font-size: 1.1rem;
}

/* Container Principal */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    min-height: calc(100dvh - 80px);
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* --- HERO SECTION --- */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 0;
    animation: fadeIn 0.8s ease-out forwards;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.hero-main-title {
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.title-line-1, .title-line-3 {
    font-size: clamp(2.5rem, 5vw, 60px);
    font-weight: 700;
}

.title-line-2 {
    font-size: clamp(3.5rem, 8vw, 96px);
    font-weight: 800;
}

.hero-typewriter {
    font-size: clamp(1.5rem, 3vw, 36px);
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.hero-subtext {
    font-size: 18px;
    color: var(--text-tertiary);
    font-weight: 400;
    margin-top: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Efeito Typewriter */
.text-accent, .text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.type-wrap {
    white-space: nowrap;
    position: relative;
    padding-right: 4px; /* espaço para o cursor */
}

.cursor {
    display: inline-block;
    color: var(--accent-color);
    animation: blink 1s step-end infinite;
    font-weight: 300;
    margin-left: 2px;
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.7;
}

/* Aviso LGPD */
.lgpd-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
    margin: 2rem auto 0;
    max-width: 800px;
}

.lgpd-notice i {
    color: var(--success);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.lgpd-notice span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.lgpd-notice strong {
    color: var(--text-primary);
}



/* --- BOTÕES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active {
    transform: scale(0.98);
}

.btn-ghost {
    background-color: #f1f5f9;
    color: var(--accent-color);
    border: 1px solid transparent;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background-color: #e2e8f0;
    color: var(--accent-hover);
}

/* --- SETORES E BENTO GRID --- */
.sector-block {
    margin-bottom: 4rem;
}

.sector-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.sector-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.sector-line {
    height: 1px;
    background: linear-gradient(to right, #cbd5e1, transparent);
    width: 100%;
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: stretch; /* Garante que todos os cards na mesma linha tenham a mesma altura */
}

@media (min-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- UIVERSE ANIMATED BORDER CARDS (Adaptado) --- */
.card {
    position: relative;
    border-radius: 10px; /* Levemente maior que 5px para não ficar muito afiado */
    padding: 2px; /* Espaço para a borda mágica rodar por trás */
    display: flex;
    flex-direction: column;
    height: 100%; /* Faz o card ocupar toda a altura da linha da grid */
    background-color: transparent;
    overflow: hidden; /* Corta a borda que roda fora */
}

/* A borda giratória mágica (O back pseudo-element original adaptado) */
.card::before {
    position: absolute;
    content: '';
    display: block;
    width: 150%; 
    height: 150%;
    left: -25%;
    top: -25%;
    /* Utilizando conic-gradient para uma rotação de borda perfeita e performática */
    background: conic-gradient(from 0deg, transparent 0%, transparent 40%, var(--accent-color) 50%, #38bdf8 60%, transparent 80%);
    animation: rotation_481 4s linear infinite;
    z-index: -1; /* Essencial para ficar atrás do .card-content */
    opacity: 0.9;
}

@keyframes rotation_481 {
    0% { transform: rotateZ(0deg); }
    100% { transform: rotateZ(360deg); }
}

/* O conteúdo do card que fica por cima tapando o centro da borda */
.card-content {
    position: relative;
    z-index: 1;
    background: #ffffff; /* Fundo totalmente branco solicitado */
    width: 100%;
    height: 100%;
    border-radius: 8px; /* Pouco menor que o card principal */
    padding: 2rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0px 0px 15px rgba(0,0,0,0.05);
}

/* Esferas Flutuantes de Fundo adaptadas */
.card .circle-bg-1 {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: rgba(2, 132, 199, 0.15); /* Azul */
    filter: blur(25px);
    animation: floating 3000ms infinite linear;
    z-index: 0;
    top: -20px;
    left: 20px;
}

.card .circle-bg-2 {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(56, 189, 248, 0.15); /* Azul claro */
    filter: blur(20px);
    animation: floating 4000ms infinite linear reverse;
    z-index: 0;
    bottom: -10px;
    right: -10px;
    animation-delay: -1000ms;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(15px); }
    100% { transform: translateY(0px); }
}

.card-header {
    margin-bottom: 1rem;
    flex-grow: 0;
    min-height: 110px; /* Garante que o título tenha um espaço mínimo uniforme */
    z-index: 2; /* Acima das esferas flutuantes */
}

.card-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    display: block;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

/* Radio Options */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.option-label:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.option-label input[type="radio"] {
    display: none;
}

.custom-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s ease;
}

.option-label input[type="radio"]:checked + .custom-radio {
    border-color: var(--accent-color);
}

.option-label input[type="radio"]:checked + .custom-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
}

.option-label input[type="radio"]:checked ~ .option-text {
    font-weight: 500;
    color: var(--text-primary);
}

.option-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Dynamic Justification */
.justification-area {
    display: none;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.justification-area.active {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.justification-area label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.justification-area textarea {
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.2s ease;
}

.justification-area textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Submit Area */
.submit-area {
    margin-top: auto; /* Empurra o botão para o final do card, mantendo o alinhamento visual */
    padding-top: 1rem;
}

.btn-submit {
    width: 100%;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-sm);
    padding: 0.875rem;
    font-weight: 500;
    font-size: 1rem;
}

.btn-submit:hover {
    background: #000;
}

.btn-submit:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Chart Container */
.chart-container {
    display: flex;
    flex-direction: column;
    height: 180px; /* Altura fixa para o gráfico não distorcer o card */
    justify-content: center;
    position: relative;
    animation: fadeIn 0.5s ease forwards;
    margin-bottom: 1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.voted-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Loading state */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.app-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 2rem;
    text-align: center;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.app-footer p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* --- SCROLL REVEAL ANIMATIONS --- */
.reveal-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Print / Export Adjustments */
@media print {
    body {
        background: white;
    }
    #particles-canvas {
        display: none;
    }
    .app-nav {
        display: none;
    }
    .card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        break-inside: avoid;
    }
}

/* Mobile Responsiveness Improvements */
@media (max-width: 768px) {
    .app-container {
        padding: 2rem 1rem;
        gap: 2.5rem;
    }
    
    .hero-section {
        padding: 2rem 0;
    }
    
    .title-line-1, .title-line-3 {
        font-size: clamp(2rem, 8vw, 40px);
    }
    
    .title-line-2 {
        font-size: clamp(2.5rem, 10vw, 56px);
    }
    
    .hero-subtext {
        font-size: 15px;
        white-space: normal;
        padding: 0 1rem;
    }
    
    #toast-container {
        bottom: 5rem; /* Acima da barra de progresso no mobile */
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        width: 100%;
        justify-content: center;
    }
}
