/* ========== RESET & VARIABLES ========== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f8fafc;
    --sidebar-width: 260px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --sidebar-bg: #0f172a;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.8rem;
    opacity: 0.7;
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    border-left-color: var(--primary);
}

.nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.theme-toggle {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.2);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px;
    min-height: 100vh;
}

.mobile-header {
    display: none;
    align-items: center;
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    margin-right: 15px;
}

/* ========== SECTIONS ========== */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 25px;
}

.section-header h1 {
    font-size: 1.8rem;
    color: var(--text);
}

.section-header h1 i {
    margin-right: 10px;
    color: var(--primary);
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text);
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.info-card {
    text-align: center;
    padding: 25px 15px;
}

.card-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.big-text {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin: 10px 0 5px;
}

/* ========== TIMELINE ========== */
.cronograma-timeline {
    position: relative;
    padding-left: 30px;
}

.cronograma-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -25px;
    top: 5px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.timeline-content h4 {
    color: var(--text);
    margin-bottom: 5px;
}

.timeline-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== TABLES ========== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
}

.data-table tr:hover {
    background: var(--bg);
}

/* ========== BADGES ========== */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-info { background: #ecfeff; color: #0891b2; }
.badge-success { background: #f0fdf4; color: #16a34a; }

[data-theme="dark"] .badge-danger { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fcd34a; }
[data-theme="dark"] .badge-info { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-success { background: #14532d; color: #86efac; }

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.tab-btn:hover, .tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== ACCORDION ========== */
.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 15px 20px;
    background: var(--bg);
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: var(--text);
    transition: var(--transition);
}

.accordion-header:hover {
    background: var(--border);
}

.accordion-header.active {
    background: var(--primary);
    color: white;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--bg-card);
}

.accordion-content ul {
    padding: 15px 20px 15px 40px;
}

.accordion-content li {
    margin-bottom: 8px;
    color: var(--text);
}

/* ========== FORMS ========== */
.form-select, .form-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
    transition: var(--transition);
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== BUTTONS ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #0891b2; }

.btn-sm { padding: 6px 12px; font-size: 0.9rem; }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== CONFIG GRID ========== */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.config-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text);
}

/* ========== SIMULADOR ========== */
.simulador-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.simulador-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.simulador-timer {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.simulador-nav {
    display: flex;
    gap: 5px;
}

.questao-container {
    margin-bottom: 20px;
}

.questao-enunciado {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
}

.alternativas-container {
    margin-bottom: 20px;
}

.alternativa-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 15px;
    margin-bottom: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.alternativa-item:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.alternativa-item.selecionada {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.12);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.alternativa-item.selecionada .alternativa-label {
    background: var(--primary);
    color: white;
}

.alternativa-item.correta {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.alternativa-item.errada {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.alternativa-label {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.alternativa-texto {
    flex: 1;
    line-height: 1.5;
}

.explicacao-box {
    padding: 15px;
    background: #ecfeff;
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    margin-top: 15px;
    color: var(--text);
}

[data-theme="dark"] .explicacao-box {
    background: #1e3a5f;
}

.simulador-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.progresso-questoes {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.progresso-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.progresso-dot.atual {
    background: var(--primary);
    transform: scale(1.3);
}

.progresso-dot.respondida {
    background: var(--success);
}

.progresso-dot.marcada {
    background: var(--warning);
}

/* ========== RESULTADO ========== */
.resultado-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 30px;
}

.resultado-nota {
    text-align: center;
    padding: 30px;
    background: var(--bg);
    border-radius: var(--radius);
}

.nota-grande {
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary);
    margin: 10px 0;
}

.aprovado {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--success);
}

.reprovado {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--danger);
}

.resultado-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text);
}

.resultado-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ========== DESEMPENHO ========== */
.historico-list, .areas-fraques {
    max-height: 300px;
    overflow-y: auto;
}

.historico-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.historico-data {
    font-weight: 500;
}

.historico-stats {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.area-fraca-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

/* ========== DISCIPLINA BAR ========== */
.disciplina-bar {
    margin-bottom: 12px;
}

.disciplina-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ========== CALCULADORA ========== */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.calc-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.calc-resultado {
    margin-top: 15px;
}

.calc-result-card {
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}

/* ========== POMODORO ========== */
.pomodoro-timer {
    text-align: center;
}

.pomodoro-display {
    margin-bottom: 20px;
}

#pomodoroTempo {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

#pomodoroStatus {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.pomodoro-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ========== FLASHCARDS ========== */
.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.flashcard {
    width: 100%;
    max-width: 500px;
    height: 250px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard-inner.flipped {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.2rem;
    line-height: 1.5;
}

.flashcard-front {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.flashcard-back {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    color: var(--text);
    transform: rotateY(180deg);
}

.flashcard-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.flashcard-counter {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== QUESTAO DO DIA ========== */
.questao-dia-content {
    padding: 10px 0;
}

.questao-dia .questao-enunciado {
    font-size: 1.1rem;
    margin: 15px 0;
}

.questao-dia .alternativas-list {
    margin-bottom: 15px;
}

.questao-dia .alternativa-item {
    cursor: pointer;
}

/* ========== DICAS ========== */
.dicas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.dica-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
}

.dica-item i {
    font-size: 1.5rem;
    color: var(--primary);
}

/* ========== RESUMO ========== */
.resumo-content {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
    line-height: 1.6;
}

.resumo-content h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

.resumo-content ul {
    padding-left: 20px;
}

.resumo-content li {
    margin-bottom: 8px;
}

/* ========== LEGISLACAO ========== */
.legislacao-list {
    display: grid;
    gap: 10px;
}

.leg-item {
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.leg-item h4 {
    color: var(--primary);
    margin-bottom: 5px;
}

.leg-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== GABARITO ========== */
.gabarito-list {
    max-height: 400px;
    overflow-y: auto;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .resultado-grid {
        grid-template-columns: 1fr;
    }

    .resultado-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 80px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .simulador-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
