/* ============================================================
   PHP INTERVIEW PREP — Design System
   ============================================================ */

/* ============================================================
   1. VARIABLES
   ============================================================ */
:root {
    /* Colors — Light Theme */
    --bg: #f8f9fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;

    --surface: #ffffff;
    --surface-hover: #f8f9fb;
    --surface-active: #f1f3f5;

    --border: #e2e5ea;
    --border-light: #eef0f3;

    --text: #1a1d26;
    --text-secondary: #5f6577;
    --text-muted: #8b90a0;

    /* Brand */
    --primary: #5046e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-lighter: #f5f7ff;

    /* Semantic */
    --success: #16a34a;
    --success-light: #f0fdf4;
    --error: #dc2626;
    --error-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 60px;
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ============================================================
   2. RESET
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

select {
    font-family: inherit;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

/* ============================================================
   4. LAYOUT — Sidebar + Main
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: var(--surface-active);
    color: var(--text);
}

.sidebar-nav {
    flex: 1;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid var(--border-light);
}

.sidebar-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
}

.sidebar-badge svg {
    width: 14px;
    height: 14px;
}

/* Main */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 2rem;
}

/* ============================================================
   5. MOBILE HEADER
   ============================================================ */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 150;
    padding: 0 1rem;
    align-items: center;
    gap: 0.8rem;
}

.menu-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.menu-btn:hover {
    background: var(--surface-active);
}

.logo-mobile {
    flex: 1;
}

.mobile-spacer {
    width: 40px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 190;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================================
   6. LOGO
   ============================================================ */
.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-icon-sm {
    width: 30px;
    height: 30px;
}

.logo-icon-sm svg {
    width: 16px;
    height: 16px;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ============================================================
   7. VIEW HEADER
   ============================================================ */
.view-header {
    margin-bottom: 1.5rem;
}

.view-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.view-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* ============================================================
   8. DASHBOARD — Stats Cards
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: box-shadow 0.15s;
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-card-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* ============================================================
   9. CONTINUE CARD
   ============================================================ */
.continue-card {
    background: var(--primary);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    color: white;
}

.continue-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.continue-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.continue-sub {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.1rem;
}

.continue-card .btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    white-space: nowrap;
}

.continue-card .btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ============================================================
   10. CATEGORY GRID
   ============================================================ */
.section-header {
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.section-sub {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.1rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.category-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.category-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.6rem;
}

.category-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.category-card-count {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================================
   11. AI BANNER
   ============================================================ */
.ai-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ai-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.ai-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-banner-icon svg {
    width: 22px;
    height: 22px;
}

.ai-banner-text h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.ai-banner-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    line-height: 1.4;
}

.ai-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ============================================================
   12. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--surface-active);
    color: var(--text);
}

.btn-danger {
    color: var(--error);
    border-color: var(--error);
}

.btn-danger:hover {
    background: var(--error-light);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* ============================================================
   13. CONFIG PANEL
   ============================================================ */
.config-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.config-section {
    margin-bottom: 1.5rem;
}

.config-section:last-of-type {
    margin-bottom: 1.5rem;
}

.config-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.config-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.config-category-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
    background: var(--surface);
}

.config-category-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.config-category-chip.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.config-row {
    display: flex;
    gap: 1rem;
}

.config-field {
    flex: 1;
}

.config-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
    appearance: none;
    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='%238b90a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Resume Banner */
.resume-banner {
    margin-top: 1rem;
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.resume-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--primary);
}

.resume-info svg {
    width: 18px;
    height: 18px;
}

.resume-actions {
    display: flex;
    gap: 0.4rem;
}

/* ============================================================
   14. QUIZ
   ============================================================ */
.quiz-container {
    max-width: 680px;
    margin: 0 auto;
}

.quiz-header {
    margin-bottom: 1.5rem;
}

.quiz-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.quiz-counter {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.quiz-category-badge {
    font-size: 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.progress-bar-lg {
    height: 6px;
}

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

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.quiz-live-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.6rem;
}

.live-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.live-stat-correct { color: var(--success); }
.live-stat-wrong { color: var(--error); }
.live-stat-streak { color: var(--warning); }

/* Question Card */
.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    animation: slideUp 0.25s ease;
}

.question-text {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-size: 0.92rem;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    line-height: 1.5;
}

.option:hover:not(.disabled) {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.option.correct {
    border-color: var(--success);
    background: var(--success-light);
}

.option.wrong {
    border-color: var(--error);
    background: var(--error-light);
}

.option.disabled {
    cursor: default;
}

.option.disabled.correct {
    opacity: 1;
}

.option-letter {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 1.4rem;
    flex-shrink: 0;
}

.option.correct .option-letter { color: var(--success); }
.option.wrong .option-letter { color: var(--error); }

/* Explanation */
.explanation {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

.explanation.show {
    display: block;
}

.explanation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.explanation-header svg {
    width: 16px;
    height: 16px;
    color: var(--warning);
}

.explanation-body {
    padding: 1rem;
}

.explanation-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.explanation-tip {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Quiz Nav */
.quiz-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
}

.quiz-nav .btn {
    min-width: 120px;
}

/* ============================================================
   15. RESULT
   ============================================================ */
.result-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.result-hero {
    margin-bottom: 2rem;
}

.result-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.result-circle.excellent {
    background: var(--success-light);
    border: 3px solid var(--success);
}

.result-circle.good {
    background: var(--primary-light);
    border: 3px solid var(--primary);
}

.result-circle.bad {
    background: var(--error-light);
    border: 3px solid var(--error);
}

.result-percent {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.result-circle.excellent .result-percent { color: var(--success); }
.result-circle.good .result-percent { color: var(--primary); }
.result-circle.bad .result-percent { color: var(--error); }

.result-msg {
    font-size: 1.3rem;
    font-weight: 700;
}

.result-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.result-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.5rem;
}

.result-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
}

.result-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.result-stat-correct .result-stat-value { color: var(--success); }
.result-stat-wrong .result-stat-value { color: var(--error); }

.result-breakdown {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.result-cat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.result-cat-row:last-child {
    border-bottom: none;
}

.result-cat-bar {
    width: 80px;
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 0.8rem;
    flex-shrink: 0;
}

.result-cat-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.result-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.result-actions .btn {
    min-width: 160px;
}

/* ============================================================
   16. STUDY
   ============================================================ */
.study-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-chip {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    transition: all 0.15s;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.study-content {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.study-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.study-card-header {
    padding: 1rem 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.study-card-header:hover {
    background: var(--surface-hover);
}

.study-card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.study-card-arrow {
    color: var(--text-muted);
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.study-card.open .study-card-arrow {
    transform: rotate(180deg);
}

.study-card-body {
    display: none;
    padding: 0 1.2rem 1.2rem;
}

.study-card.open .study-card-body {
    display: block;
}

.study-section {
    margin-bottom: 1rem;
}

.study-section:last-child {
    margin-bottom: 0;
}

.study-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.study-code {
    background: #1e1e2e;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    color: #cdd6f4;
    border: 1px solid var(--border);
}

.study-highlight {
    background: var(--primary-lighter);
    border-left: 3px solid var(--primary);
    padding: 0.7rem 0.8rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.study-highlight strong {
    color: var(--primary);
}

/* ============================================================
   17. HISTORY
   ============================================================ */
.history-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.summary-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s;
}

.history-item:hover {
    border-color: var(--primary);
}

.history-item-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.history-item-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-item-categories {
    font-size: 0.88rem;
    font-weight: 500;
}

.history-item-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.history-score {
    font-size: 1.1rem;
    font-weight: 700;
}

.history-score.excellent { color: var(--success); }
.history-score.good { color: var(--primary); }
.history-score.bad { color: var(--error); }

.history-item-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 0.5rem;
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    stroke: var(--border);
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ============================================================
   18. BOTTOM NAV (Mobile)
   ============================================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 150;
    padding: 0 0.5rem;
    align-items: center;
    justify-content: space-around;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    transition: all 0.15s;
    min-width: 56px;
}

.bottom-nav-item svg {
    width: 20px;
    height: 20px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

/* ============================================================
   19. ANIMATIONS
   ============================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   20. RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-close {
        display: flex;
    }

    .mobile-header {
        display: flex;
    }

    .main {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
        padding-bottom: calc(60px + 1rem);
    }

    .bottom-nav {
        display: flex;
    }

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

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

    .config-row {
        flex-direction: column;
    }

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

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

    .quiz-nav {
        flex-direction: column;
    }

    .quiz-nav .btn {
        width: 100%;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        width: 100%;
    }

    .continue-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .ai-banner {
        flex-direction: column;
        text-align: center;
    }

    .ai-banner-content {
        flex-direction: column;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .history-item-right {
        width: 100%;
        justify-content: space-between;
    }
}

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

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