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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #222;
}

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

#main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: #1a1a2e;
    color: #fff;
}

#main-nav a { color: #fff; text-decoration: none; }
#main-nav .nav-logo { font-weight: 700; font-size: 1.1rem; }
#main-nav .nav-links { display: flex; gap: 24px; font-size: 0.9rem; }
#main-nav .nav-links a:hover { opacity: 0.8; }

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

.page-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

.back-link {
    display: inline-block;
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.back-link:hover { color: #222; }

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin: 32px 0 16px;
}

/* ── DASHBOARD ────────────────────────────────────────────────────────────── */

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

.dashboard-header h2 { font-size: 1.6rem; }
.dashboard-header .subtitle { color: #666; margin-top: 4px; }

.points-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1a1a2e;
    color: #fff;
    border-radius: 12px;
    padding: 12px 24px;
    min-width: 90px;
}
.points-number { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.points-label  { font-size: 0.75rem; opacity: 0.7; margin-top: 2px; }

.dashboard-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}
.action-link {
    color: #1a1a2e;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}
.action-link:hover { text-decoration: underline; }

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

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e8e8e8;
    transition: box-shadow 0.15s, transform 0.15s;
    display: block;
    position: relative;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.card p  { font-size: 0.875rem; color: #666; line-height: 1.5; }

.course-card.completed { border-color: #22c55e; }

.completed-badge {
    display: inline-block;
    background: #22c55e;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 10px;
}

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

.progress-bar {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    margin-top: 14px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: #1a1a2e;
    border-radius: 3px;
    transition: width 0.3s;
}
.progress-label {
    font-size: 0.78rem;
    color: #888;
    margin-top: 6px;
}

/* ── EMPTY STATE ──────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #666;
}
.empty-state p { margin-bottom: 16px; }

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

.btn-primary {
    display: inline-block;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}
.btn-primary:hover    { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    display: inline-block;
    background: #fff;
    color: #1a1a2e;
    border: 1px solid #1a1a2e;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-secondary:hover { background: #f0f0f0; }

/* ── COURSE DETAIL ────────────────────────────────────────────────────────── */

.course-header { margin-bottom: 32px; }
.course-header h1 { font-size: 1.8rem; margin-bottom: 8px; }
.course-desc { color: #555; margin-bottom: 16px; line-height: 1.6; }

.units-list { display: flex; flex-direction: column; gap: 24px; }

.unit { background: #fff; border-radius: 12px; border: 1px solid #e8e8e8; overflow: hidden; }
.unit-title {
    font-size: 1rem;
    font-weight: 600;
    padding: 16px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
}

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

.lesson-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
    font-size: 0.9rem;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: #f9f9f9; }
.lesson-row.completed { color: #444; }

.lesson-check { font-size: 1rem; width: 20px; flex-shrink: 0; color: #22c55e; }
.lesson-title { flex: 1; font-weight: 500; }
.lesson-type  { font-size: 0.78rem; color: #888; text-transform: uppercase; letter-spacing: 0.04em; }
.lesson-points { font-size: 0.78rem; color: #1a1a2e; font-weight: 600; background: #eef; padding: 2px 8px; border-radius: 10px; }

/* ── LESSON PAGE ──────────────────────────────────────────────────────────── */

.lesson-page h1 { font-size: 1.6rem; margin-bottom: 24px; }

.video-wrap { margin-bottom: 24px; }
.video-wrap iframe { border-radius: 10px; width: 100%; aspect-ratio: 16/9; height: auto; }

.chapters { margin-top: 16px; }
.chapters h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; color: #444; }
.chapter-row { display: flex; gap: 12px; padding: 6px 0; font-size: 0.875rem; border-bottom: 1px solid #f0f0f0; }
.chapter-time  { color: #1a1a2e; font-weight: 600; min-width: 40px; }
.chapter-title { color: #333; }

.lesson-content { line-height: 1.8; font-size: 0.95rem; background: #fff; border-radius: 12px; padding: 24px; border: 1px solid #e8e8e8; }
.lesson-content p { margin-bottom: 12px; }

.lesson-actions { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e8e8e8; }

.completed-badge { display: inline-flex; align-items: center; gap: 6px; color: #22c55e; font-weight: 600; }

.points-toast {
    display: inline-block;
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
}

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

.quiz-wrap { background: #fff; border-radius: 12px; padding: 24px; border: 1px solid #e8e8e8; }
.quiz-info { font-size: 0.85rem; color: #666; margin-bottom: 20px; }

.quiz-question { margin-bottom: 24px; }
.question-text { font-weight: 600; margin-bottom: 12px; line-height: 1.5; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.1s, background 0.1s;
}
.choice:hover   { border-color: #1a1a2e; background: #f8f8ff; }
.choice.selected { border-color: #1a1a2e; background: #eef; font-weight: 500; }
.choice input   { accent-color: #1a1a2e; }

.quiz-result { text-align: center; padding: 32px; }
.quiz-result h2 { font-size: 1.4rem; margin-bottom: 8px; }
.quiz-result p  { color: #555; margin-bottom: 16px; }
.quiz-result.passed h2 { color: #22c55e; }
.quiz-result.failed h2 { color: #ef4444; }

/* ── MISC ─────────────────────────────────────────────────────────────────── */

.error { color: #ef4444; }
.loading { padding: 48px; text-align: center; color: #888; }
