:root {
    /* Cores */
    --primary-light: #6FB1FC;
    --primary: #4364F7;
    --primary-dark: #0052D4;
    --bg-color: #f0f4f8;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(67, 100, 247, 0.15);
    --error: #ef4444;
    --success: #10b981;
    
    /* Tipografia */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Espaçamento e Bordas */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-glass: 0 8px 32px 0 rgba(0, 82, 212, 0.1);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(111, 177, 252, 0.1) 0%, rgba(240, 244, 248, 1) 90%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Barra de Navegação */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--primary-dark);
}

.logo img {
    height: 64px;
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.nav-link:hover {
    color: var(--primary);
}

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

.auth-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(67, 100, 247, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 100, 247, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(67, 100, 247, 0.05);
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-dark);
    cursor: pointer;
}

/* Área Principal do App */
#app-root {
    flex-grow: 1;
    padding: 3rem 0;
    animation: fadeIn 0.4s ease-out;
}

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

/* Seções e Cartões */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-glass);
    border-color: rgba(67, 100, 247, 0.3);
}

.card-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(67,100,247,0.1), rgba(111,177,252,0.1));
    border-radius: var(--radius-sm);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-desc {
    color: var(--text-muted);
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

/* Seção de Destaque (Hero) */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.hero-buttons .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Layout da Visualização de Matérias */
.subject-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 4rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.subject-header h1 {
    color: white;
    margin: 0;
    font-size: 3rem;
    position: relative;
    z-index: 2;
}

.subject-header .ph {
    position: absolute;
    right: -20px;
    bottom: -40px;
    font-size: 16rem;
    opacity: 0.1;
    z-index: 1;
}

.content-block {
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.content-block h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
    display: inline-block;
}

.content-block p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Layout da Visualização de Aulas (Sidebar + Content) */
.lesson-container {
    align-items: flex-start;
}

.lesson-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 100px;
    overflow: hidden;
}

.subject-sidebar-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(67,100,247,0.05), rgba(111,177,252,0.1));
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.subject-sidebar-header .ph {
    font-size: 2.5rem;
    color: var(--primary);
}

.subject-sidebar-header h2 {
    font-size: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.subject-progress-container {
    background: rgba(0,0,0,0.1);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.subject-progress-bar {
    height: 100%;
    background: var(--success);
    transition: width 0.4s ease;
}

.subject-progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.lesson-list {
    display: flex;
    flex-direction: column;
}

.lesson-btn {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lesson-btn:last-child {
    border-bottom: none;
}

.lesson-btn:hover {
    background: rgba(67, 100, 247, 0.05);
    color: var(--primary);
}

.lesson-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.lesson-btn.active:hover {
    color: white;
}

.lesson-content-area {
    flex-grow: 1;
    max-width: 850px;
    animation: fadeIn 0.4s ease-out;
}

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

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Opções de Exercícios Interativas */
.exercise-option {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-main);
    font-size: 1.05rem;
}

.exercise-option:hover {
    border-color: var(--primary-light);
    background: rgba(67, 100, 247, 0.02);
}

.exercise-option input[type="radio"] {
    display: none; /* Esconde o radio button padrão */
}

/* Quando o radio estiver checado (antes de responder) */
.exercise-option:has(input[type="radio"]:not(:disabled):checked) {
    border-color: var(--primary);
    background: rgba(67, 100, 247, 0.08);
    font-weight: 600;
    color: var(--primary-dark);
}

/* Quando as opções forem travadas após a resposta */
.exercise-option:has(input[type="radio"]:disabled) {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Indicador visual de seleção customizado */
.exercise-option::before {
    content: '';
    display: inline-block;
    flex-shrink: 0;
    width: 1.4rem;
    height: 1.4rem;
    border: 2px solid var(--border);
    border-radius: 50%;
    margin-right: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.exercise-option:has(input[type="radio"]:not(:disabled):checked)::before {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px white;
}

/* Feedback de Resposta: Correto / Errado */
.exercise-option.correct {
    border-color: var(--success) !important;
    background: rgba(16, 185, 129, 0.08) !important;
    color: var(--success) !important;
    font-weight: 600;
    opacity: 1 !important;
}
.exercise-option.correct::before {
    border-color: var(--success) !important;
    background: var(--success) !important;
    box-shadow: inset 0 0 0 4px white !important;
}

.exercise-option.wrong {
    border-color: var(--error) !important;
    background: rgba(239, 68, 68, 0.08) !important;
    color: var(--error) !important;
    font-weight: 600;
    opacity: 1 !important;
}
.exercise-option.wrong::before {
    border-color: var(--error) !important;
    background: var(--error) !important;
    box-shadow: inset 0 0 0 4px white !important;
}

/* Feedback Visual na Tela (Mensagem) */
.exercise-feedback {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    animation: fadeIn 0.4s ease-out;
}

.exercise-feedback h4 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exercise-feedback.feedback-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}
.exercise-feedback.feedback-success h4 {
    color: var(--success);
}
.exercise-feedback.feedback-success p {
    color: var(--text-main);
}

.exercise-feedback.feedback-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}
.exercise-feedback.feedback-error h4 {
    color: var(--error);
}
.exercise-feedback.feedback-error p {
    color: var(--text-main);
}


/* Formulários */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--surface-glass);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 100, 247, 0.2);
    background: white;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.error-text {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: none;
}

.form-container .btn {
    width: 100%;
    margin-top: 1rem;
}

/* Rodapé */
.footer {
    background: var(--surface);
    padding-top: 3rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-info h3 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: right;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .logo {
        font-size: 1.15rem;
        gap: 0.75rem;
    }

    .logo img {
        height: 48px;
    }

    .nav-links, .auth-buttons {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-links {
        text-align: center;
    }
    
    .subject-header h1 {
        font-size: 2rem;
    }

    .lesson-container {
        flex-direction: column;
    }

    .lesson-sidebar {
        width: 100%;
        position: static;
        margin-bottom: 2rem;
    }
}

/* Estilos do Modal Personalizado */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: overlayFadeIn 0.2s ease-out;
    padding: 1rem;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

body.modal-open {
    overflow: hidden !important;
    touch-action: none;
}

.custom-modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 450px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-glass);
    flex-shrink: 0;
}

.custom-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal-close:hover {
    color: var(--error);
}

.custom-modal-body {
    padding: 2rem 1.5rem;
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.6;
    overflow-y: auto;
    flex-grow: 1;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.custom-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    text-align: right;
    background: rgba(0,0,0,0.02);
    flex-shrink: 0;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 25vh;
    min-height: 200px;
    max-height: 300px;
    margin-bottom: 2rem;
}

/* Scrollbar customization for modals */
.custom-modal-body::-webkit-scrollbar {
    width: 6px;
}
.custom-modal-body::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
}
.custom-modal-body::-webkit-scrollbar-thumb {
    background: rgba(67, 100, 247, 0.2);
    border-radius: 10px;
}
.custom-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 100, 247, 0.4);
}

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

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

/* Animated Entrance */
.animated-entrance {
    animation: fadeInSlideUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

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

/* Progress bar fill animated */
.progress-bar-fill-animated {
    animation: progressFill 1.2s cubic-bezier(0.1, 0.7, 0.1, 1) forwards;
    transform-origin: left;
}

@keyframes progressFill {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* Continue Card Hover */
.continue-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

.continue-card:not(.empty-state):hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(67, 100, 247, 0.4) !important;
}

.continue-card.empty-state:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md) !important;
}

.continue-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2) !important;
}

/* =========================================
   SIMULADOS ENEM
   ========================================= */

.animated-entrance {
    animation: fadeInSlideUp 0.5s ease-out forwards;
}

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

.simulado-layout {
    background: var(--bg-color);
}

.simulado-header {
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.timer-badge {
    transition: all 0.3s ease;
}

.pulse-danger {
    animation: pulseDanger 1s infinite;
}

@keyframes pulseDanger {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.simulado-player-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 280px 1fr;
    align-items: start;
}

.question-nav-btn {
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.question-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.option-btn:hover {
    transform: translateX(4px);
    border-color: var(--primary) !important;
}

@media (max-width: 900px) {
    .simulado-player-grid {
        grid-template-columns: 1fr;
    }
    
    .simulado-sidebar {
        max-height: max-content !important;
    }
    
    #question-nav-grid {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .question-nav-btn {
        flex: 0 0 48px;
        height: 48px;
    }
}
