/* ============================================
   CHIMICUM ORADEA - Light Theme
   Mobile-first, clean & professional
   ============================================ */

:root {
    --bg-primary: #f8f9fb;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f3f8;
    --bg-input: #f1f3f8;
    --bg-input-focus: #ffffff;
    --border: #e2e6ef;
    --border-hover: #c8cdd8;
    --text-primary: #1a1d2e;
    --text-secondary: #3d4255;
    --text-muted: #6b7194;
    --text-dim: #949bb5;
    --accent: #4f5ed6;
    --accent-light: #6672e8;
    --accent-pale: #eef0ff;
    --accent-bg: #eef0ff;
    --green: #1a9e56;
    --green-bg: #eafaf1;
    --green-border: #b8e6cc;
    --red: #d63c4a;
    --red-bg: #fdf0f0;
    --red-border: #f0c4c8;
    --yellow: #c08800;
    --yellow-bg: #fef8ea;
    --yellow-border: #f0dda0;
    --blue: #2b7de9;
    --blue-bg: #edf4fe;
    --purple: #7c5ec6;
    --purple-bg: #f3f0ff;
    --orange: #d97220;
    --orange-bg: #fff5eb;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--accent); }

/* ─── LAYOUT ─────────────────────────────── */

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 12px 16px calc(76px + var(--safe-bottom));
    min-height: 100vh;
    min-height: 100dvh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

/* ─── BOTTOM NAV ─────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 6px 0 calc(6px + var(--safe-bottom));
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--accent); }
.nav-item:hover { color: var(--text-secondary); }
.nav-icon { font-size: 20px; line-height: 1; }

/* ─── CARDS ──────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.card-clickable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.card-clickable:hover, .card-clickable:active {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── STAT GRID ──────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 18px; margin-bottom: 4px; }

.stat-value { font-size: 18px; font-weight: 700; }

.stat-label {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 2px;
    font-weight: 600;
}

/* ─── PROGRESS BAR ───────────────────────── */

.progress-bar {
    height: 6px;
    background: #eceef4;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
}

.progress-bar-thin { height: 3px; }

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

.progress-fill-purple { background: var(--purple); }
.progress-fill-blue { background: var(--blue); }
.progress-fill-yellow { background: #e6a817; }
.progress-fill-green { background: var(--green); }
.progress-fill-accent { background: linear-gradient(90deg, var(--accent), var(--blue)); }

/* ─── CHAPTER LIST ───────────────────────── */

.chapter-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--shadow-sm);
}

.chapter-item:hover, .chapter-item:active {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.chapter-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--accent-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.chapter-info { flex: 1; min-width: 0; }
.chapter-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.chapter-meta { display: flex; gap: 8px; font-size: 10px; color: var(--text-dim); margin-top: 4px; font-weight: 500; }

.chapter-pct {
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── QUIZ ───────────────────────────────── */

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.quiz-counter {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.quiz-badge {
    display: inline-block;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.quiz-badge-easy { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.quiz-badge-medium { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.quiz-badge-hard { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

.quiz-question {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    font-size: 14px;
    color: var(--text-secondary);
    min-height: 52px;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    box-shadow: var(--shadow-sm);
}

.quiz-option:hover { 
    background: var(--bg-card-hover); 
    border-color: var(--accent);
}
.quiz-option:active { transform: scale(0.98); }
.quiz-option.disabled { pointer-events: none; }

.quiz-option.selected {
    background: var(--accent-pale);
    border-color: var(--accent);
    color: var(--accent);
}

.quiz-option.correct {
    background: var(--green-bg);
    border-color: var(--green);
    color: var(--green);
}

.quiz-option.wrong {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--text-muted);
}

.quiz-option.correct .option-letter { background: var(--green); color: #fff; }
.quiz-option.wrong .option-letter { background: var(--red); color: #fff; }

.option-text { flex: 1; }

/* ─── EXPLANATION ────────────────────────── */

.explanation-box {
    background: #f0f1ff;
    border: 1px solid #d4d7f9;
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    animation: fadeUp 0.3s ease;
}

.explanation-label {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
    font-weight: 700;
}

.explanation-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ─── BUTTONS ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    text-decoration: none;
}

.btn-block { width: 100%; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,94,214,0.25);
}
.btn-primary:hover { 
    background: var(--accent-light); 
    transform: translateY(-1px); 
    box-shadow: 0 4px 12px rgba(79,94,214,0.3);
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-secondary:hover { 
    background: var(--bg-card-hover); 
    border-color: var(--border-hover); 
}

.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; border-radius: var(--radius-sm); }

.btn-back { 
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-back:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ─── FORMS ──────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 16px;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(79,94,214,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7194' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ─── ALERTS ─────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }

/* ─── LOGIN ──────────────────────────────── */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    background: linear-gradient(135deg, #f0f2ff 0%, #f8f9fb 50%, #eef5ff 100%);
}

.login-container {
    width: 100%;
    max-width: 380px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--accent);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ─── RESULTS ────────────────────────────── */

.results-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    border-width: 3px;
    border-style: solid;
}

.results-pct { font-size: 40px; font-weight: 800; line-height: 1; }
.results-sub { font-size: 12px; color: var(--text-muted); }

/* ─── TABLE (teacher) ────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-input);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

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

/* ─── DETAILS/SUMMARY ────────────────────── */

details summary {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: '+ ';
    font-weight: 700;
    color: var(--accent);
}

details[open] summary::before {
    content: '− ';
}

/* ─── ANIMATIONS ─────────────────────────── */

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

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

.anim-fade-up { animation: fadeUp 0.4s ease; }

/* ─── UTILITIES ──────────────────────────── */

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue { color: var(--blue); }
.text-purple { color: var(--purple); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ─── ACCENT CARD OVERRIDES (light) ──────── */

.card-accent {
    background: linear-gradient(135deg, #eef0ff, #f0f5ff);
    border-color: #d4d7f9;
}

/* ─── SCROLLBAR ──────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d4e0; border-radius: 3px; }

/* ─── DESKTOP ADJUSTMENTS ────────────────── */

@media (min-width: 768px) {
    .app-container {
        padding: 24px 24px 40px;
    }
    
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
}