/* ==========================================================================
   HocMoi - AI Course Factory
   Stylesheet duy nhất. Không phụ thuộc framework CSS.
   ========================================================================== */

:root {
    --brand:        #4f46e5;
    --brand-dark:   #4338ca;
    --brand-light:  #eef2ff;
    --accent:       #f59e0b;
    --success:      #10b981;
    --danger:       #ef4444;
    --warning:      #f59e0b;
    --info:         #3b82f6;

    --text:         #111827;
    --text-soft:    #4b5563;
    --text-muted:   #9ca3af;
    --border:       #e5e7eb;
    --bg:           #f9fafb;
    --surface:      #ffffff;
    --surface-alt:  #f3f4f6;

    --radius:       12px;
    --radius-sm:    8px;
    --radius-lg:    18px;
    --shadow-sm:    0 1px 2px rgba(16,24,40,.06);
    --shadow:       0 4px 12px rgba(16,24,40,.08);
    --shadow-lg:    0 12px 32px rgba(16,24,40,.12);

    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --header-h: 64px;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 { line-height: 1.3; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
li { margin-bottom: .35em; }

code, pre { font-family: var(--mono); font-size: .9em; }
code {
    background: var(--surface-alt);
    padding: .15em .4em;
    border-radius: 4px;
    color: #be185d;
}
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 780px; }
.container--wide   { max-width: 1400px; }

.section { padding: 56px 0; }
.section--tight { padding: 32px 0; }
.section--alt { background: var(--surface); }

.row { display: flex; flex-wrap: wrap; gap: 24px; }
.row > .col { flex: 1 1 0; min-width: 0; }

.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.stack > * + * { margin-top: 16px; }

.flex { display: flex; align-items: center; gap: 12px; }
.flex--between { justify-content: space-between; }
.flex--wrap { flex-wrap: wrap; }
.flex--column { flex-direction: column; align-items: stretch; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-soft   { color: var(--text-soft); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .78rem; }
.text-lg     { font-size: 1.125rem; }
.font-bold   { font-weight: 700; }
.mono        { font-family: var(--mono); }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: 8px; }  .mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; } .mb-3 { margin-bottom: 24px; }
.mt-4 { margin-top: 40px; } .mb-4 { margin-bottom: 40px; }

.hide { display: none !important; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 28px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -.02em;
    flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo__mark {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), #8b5cf6);
    color: #fff;
    border-radius: 9px;
    font-size: 1rem;
    font-weight: 800;
}

.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a {
    padding: 8px 13px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: .93rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.nav-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.5rem; cursor: pointer;
    padding: 4px 8px; color: var(--text);
}

/* Menu người dùng */
.user-menu { position: relative; }
.user-menu__trigger {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid var(--border);
    padding: 5px 12px 5px 5px;
    border-radius: 999px; cursor: pointer;
    font-family: inherit; font-size: .875rem;
}
.user-menu__trigger:hover { background: var(--surface-alt); }
.user-menu__avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.user-menu__panel {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: none;
}
.user-menu__panel.open { display: block; }
.user-menu__panel a, .user-menu__panel button {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text-soft); font-size: .9rem;
    background: none; border: none; cursor: pointer;
    font-family: inherit; text-decoration: none;
}
.user-menu__panel a:hover, .user-menu__panel button:hover {
    background: var(--surface-alt); color: var(--text); text-decoration: none;
}
.user-menu__head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--brand); color: #fff;
    font-family: inherit; font-size: .93rem; font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn--ghost { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn--outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn--outline:hover { background: var(--brand-light); color: var(--brand-dark); }

.btn--success { background: var(--success); }
.btn--success:hover { background: #059669; }
.btn--danger  { background: var(--danger); }
.btn--danger:hover { background: #dc2626; }
.btn--accent  { background: var(--accent); color: #78350f; }
.btn--accent:hover { background: #d97706; color: #fff; }

.btn--sm { padding: 6px 13px; font-size: .82rem; }
.btn--lg { padding: 14px 30px; font-size: 1.02rem; }
.btn--block { width: 100%; }

.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}
.card--flat { border: none; box-shadow: var(--shadow-sm); }
.card--pad-lg { padding: 32px; }
.card__title { font-size: 1.05rem; font-weight: 700; margin: 0 0 14px; }

/* Card khoá học */
.course-card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .18s, box-shadow .18s, border-color .18s;
    height: 100%;
}
.course-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: #c7d2fe;
    text-decoration: none;
}
.course-card__cover {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: grid; place-items: center;
    font-size: 2.6rem;
    position: relative;
}
.course-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.course-card__cat {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--brand); margin-bottom: 6px;
}
.course-card__title {
    font-size: 1.02rem; font-weight: 700; color: var(--text);
    margin: 0 0 8px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-card__desc {
    font-size: .875rem; color: var(--text-soft); margin: 0 0 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-card__meta {
    margin-top: auto; padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: .78rem; color: var(--text-muted);
}

/* Card danh mục */
.cat-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 22px;
    text-decoration: none;
    color: var(--text);
    transition: transform .18s, box-shadow .18s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.cat-card__icon {
    width: 52px; height: 52px;
    display: grid; place-items: center;
    background: var(--brand-light);
    border-radius: 14px;
    font-size: 1.7rem;
    margin-bottom: 14px;
}
.cat-card__name { font-weight: 700; font-size: 1.08rem; margin-bottom: 6px; }
.cat-card__desc {
    font-size: .85rem; color: var(--text-soft); margin: 0 0 12px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* --------------------------------------------------------------------------
   Badges & pills
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .74rem; font-weight: 600;
    background: var(--surface-alt); color: var(--text-soft);
    white-space: nowrap;
}
.badge--brand   { background: var(--brand-light); color: var(--brand-dark); }
.badge--success { background: #d1fae5; color: #065f46; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--info    { background: #dbeafe; color: #1e40af; }
.badge--ai      { background: linear-gradient(135deg,#ede9fe,#e0e7ff); color: #5b21b6; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field__label {
    display: block; margin-bottom: 6px;
    font-size: .88rem; font-weight: 600; color: var(--text);
}
.field__label .req { color: var(--danger); }
.field__hint { font-size: .8rem; color: var(--text-muted); margin-top: 5px; }
.field__error { font-size: .82rem; color: var(--danger); margin-top: 5px; font-weight: 500; }

.input, .select, .textarea {
    width: 100%;
    padding: 10px 13px;
    font-family: inherit; font-size: .95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.textarea--code { font-family: var(--mono); font-size: .875rem; min-height: 400px; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 36px;
}

.check { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 200px; margin-bottom: 18px; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
    padding: 13px 17px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    margin-bottom: 16px;
    font-size: .92rem;
}
.alert--success { background: #ecfdf5; border-color: var(--success); color: #065f46; }
.alert--error   { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert--warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert--info    { background: #eff6ff; border-color: var(--info);    color: #1e40af; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
    background: linear-gradient(150deg, #312e81 0%, #4f46e5 45%, #7c3aed 100%);
    color: #fff;
    padding: 76px 0 84px;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 78% 18%, rgba(255,255,255,.14), transparent 55%);
    pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; max-width: 760px; }
.hero__eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.16);
    padding: 6px 15px; border-radius: 999px;
    font-size: .8rem; font-weight: 600;
    margin-bottom: 22px;
}
.hero h1 {
    font-size: clamp(1.9rem, 5vw, 3.1rem);
    line-height: 1.15; margin-bottom: 18px;
    letter-spacing: -.03em;
}
.hero p { font-size: 1.1rem; opacity: .93; margin-bottom: 30px; max-width: 620px; }
.hero .btn--ghost { border-color: rgba(255,255,255,.45); color: #fff; }
.hero .btn--ghost:hover { background: rgba(255,255,255,.15); color: #fff; }
.hero .btn--accent { background: #fbbf24; color: #78350f; }

.hero-stats {
    display: flex; flex-wrap: wrap; gap: 40px;
    margin-top: 44px; position: relative; z-index: 1;
}
.hero-stat__num { font-size: 1.85rem; font-weight: 800; line-height: 1; }
.hero-stat__label { font-size: .85rem; opacity: .82; margin-top: 5px; }

/* --------------------------------------------------------------------------
   Section header
   -------------------------------------------------------------------------- */
.section-head { margin-bottom: 28px; }
.section-head h2 { margin-bottom: 6px; }
.section-head p { color: var(--text-soft); margin: 0; }
.section-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */
.progress {
    height: 8px;
    background: var(--surface-alt);
    border-radius: 999px;
    overflow: hidden;
}
.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #8b5cf6);
    border-radius: 999px;
    transition: width .4s ease;
}
.progress--lg { height: 12px; }
.progress--success .progress__bar { background: linear-gradient(90deg, var(--success), #34d399); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
    background: var(--surface-alt);
    padding: 11px 15px;
    text-align: left;
    font-weight: 600; font-size: .8rem;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-soft);
    white-space: nowrap;
}
tbody td { padding: 12px 15px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #fafafa; }

/* --------------------------------------------------------------------------
   Nội dung bài học (Markdown render)
   -------------------------------------------------------------------------- */
.lesson-content {
    font-size: 1.02rem;
    line-height: 1.8;
    color: #1f2937;
}
.lesson-content h2 {
    font-size: 1.42rem;
    margin: 2.1em 0 .7em;
    padding-bottom: .35em;
    border-bottom: 2px solid var(--brand-light);
}
.lesson-content h2:first-child { margin-top: 0; }
.lesson-content h3 { font-size: 1.16rem; margin: 1.7em 0 .55em; color: var(--brand-dark); }
.lesson-content h4 { font-size: 1.03rem; margin: 1.4em 0 .5em; }
.lesson-content p  { margin: 0 0 1.15em; }
.lesson-content ul, .lesson-content ol { margin: 0 0 1.2em; padding-left: 1.6em; }
.lesson-content li { margin-bottom: .5em; }
.lesson-content li > ul, .lesson-content li > ol { margin-top: .5em; }
.lesson-content strong { color: #111827; font-weight: 700; }
.lesson-content img { border-radius: var(--radius-sm); margin: 1.5em 0; box-shadow: var(--shadow); }
.lesson-content blockquote {
    margin: 1.5em 0;
    padding: 14px 20px;
    background: #fffbeb;
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #78350f;
}
.lesson-content blockquote p:last-child { margin-bottom: 0; }
.lesson-content table { margin: 1.5em 0; font-size: .93rem; }
.lesson-content .table-wrap { margin: 1.5em 0; }
.lesson-content a { text-decoration: underline; text-underline-offset: 2px; }

/* Khối code */
.code-block {
    margin: 1.6em 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #1e293b;
    box-shadow: var(--shadow);
}
.code-block__bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 14px;
    background: #0f172a;
    color: #94a3b8;
    font-size: .74rem;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.code-copy {
    background: rgba(255,255,255,.08);
    border: none; color: #cbd5e1;
    padding: 3px 11px; border-radius: 5px;
    font-size: .72rem; cursor: pointer;
    font-family: var(--sans); text-transform: none; letter-spacing: 0;
}
.code-copy:hover { background: rgba(255,255,255,.16); color: #fff; }
.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: #1e293b;
}
.code-block code {
    background: none; color: #e2e8f0; padding: 0;
    font-size: .875rem; line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Layout học bài (sidebar + nội dung)
   -------------------------------------------------------------------------- */
.learn {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: calc(100vh - var(--header-h));
}
.learn__sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 20px 0;
}
.learn__main { padding: 32px 40px 80px; max-width: 900px; }

.learn-head {
    padding: 0 20px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.learn-head__title { font-size: .98rem; font-weight: 700; margin: 0 0 10px; }

.curriculum { list-style: none; margin: 0; padding: 0; }
.curriculum__chapter { margin-bottom: 6px; }
.curriculum__chapter-title {
    padding: 9px 20px;
    font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
}
.curriculum__lessons { list-style: none; margin: 0; padding: 0; }
.curriculum__item a {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 20px;
    color: var(--text-soft);
    font-size: .875rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    line-height: 1.45;
}
.curriculum__item a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.curriculum__item a.current {
    background: var(--brand-light);
    color: var(--brand-dark);
    border-left-color: var(--brand);
    font-weight: 600;
}
.curriculum__check {
    flex-shrink: 0;
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .62rem;
    margin-top: 2px;
}
.curriculum__item a.done .curriculum__check {
    background: var(--success); border-color: var(--success); color: #fff;
}
.curriculum__item a.locked { opacity: .5; }

.lesson-header { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.lesson-header__crumb { font-size: .82rem; color: var(--text-muted); margin-bottom: 8px; }
.lesson-header h1 { font-size: 1.75rem; margin-bottom: 12px; }
.lesson-header__meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--text-muted); }

.lesson-nav {
    display: flex; justify-content: space-between; gap: 14px;
    margin-top: 44px; padding-top: 26px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Layout admin
   -------------------------------------------------------------------------- */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.admin__sidebar {
    background: #111827;
    color: #d1d5db;
    padding: 20px 0;
    position: sticky; top: 0;
    height: 100vh; overflow-y: auto;
}
.admin__logo {
    display: flex; align-items: center; gap: 9px;
    padding: 0 20px 20px;
    margin-bottom: 12px;
    border-bottom: 1px solid #1f2937;
    color: #fff; font-weight: 800; font-size: 1.08rem;
    text-decoration: none;
}
.admin__logo:hover { text-decoration: none; color: #fff; }

.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.admin-nav__label {
    padding: 14px 10px 6px;
    font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: #6b7280;
}
.admin-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    color: #d1d5db;
    font-size: .89rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
}
.admin-nav a:hover { background: #1f2937; color: #fff; text-decoration: none; }
.admin-nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.admin-nav__icon { width: 18px; text-align: center; flex-shrink: 0; }

.admin__main { background: var(--bg); min-width: 0; }
.admin__topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    position: sticky; top: 0; z-index: 50;
}
.admin__topbar h1 { font-size: 1.22rem; margin: 0; }
.admin__content { padding: 26px 28px 60px; }

/* Thẻ số liệu */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.stat-card__label {
    font-size: .76rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); margin-bottom: 7px;
}
.stat-card__value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-card__sub { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }

/* Bảng nội dung khoá học trong admin */
.outline-chapter {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 14px;
    overflow: hidden;
}
.outline-chapter__head {
    padding: 13px 18px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.outline-chapter__title { font-weight: 700; font-size: .96rem; margin: 0; }
.outline-lesson {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}
.outline-lesson:last-child { border-bottom: none; }
.outline-lesson__order {
    width: 26px; height: 26px; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--surface-alt); border-radius: 7px;
    font-size: .76rem; font-weight: 700; color: var(--text-soft);
}
.outline-lesson__body { flex: 1; min-width: 0; }
.outline-lesson__title { font-weight: 600; margin-bottom: 2px; }
.outline-lesson__summary {
    font-size: .8rem; color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.outline-lesson__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Timeline tiến trình
   -------------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 30px; position: relative; }
.timeline::before {
    content: ''; position: absolute;
    left: 9px; top: 8px; bottom: 8px;
    width: 2px; background: var(--border);
}
.timeline__item { position: relative; padding-bottom: 24px; }
.timeline__dot {
    position: absolute; left: -30px; top: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--border);
}
.timeline__item--done .timeline__dot { background: var(--success); border-color: var(--success); }
.timeline__item--current .timeline__dot { background: var(--brand); border-color: #c7d2fe; }
.timeline__title { font-weight: 600; font-size: .95rem; margin-bottom: 3px; }
.timeline__meta { font-size: .8rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Trang xác thực
   -------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    background: linear-gradient(150deg, #eef2ff, #f5f3ff 60%, #fdf4ff);
}
.auth-box {
    width: 100%; max-width: 430px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 38px 34px;
}
.auth-box__head { text-align: center; margin-bottom: 26px; }
.auth-box__head h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-box__head p { color: var(--text-soft); font-size: .92rem; margin: 0; }
.auth-box__foot {
    margin-top: 22px; padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center; font-size: .9rem; color: var(--text-soft);
}

/* --------------------------------------------------------------------------
   Phân trang
   -------------------------------------------------------------------------- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 34px; }
.pagination a, .pagination span {
    min-width: 38px; height: 38px;
    display: grid; place-items: center;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-soft);
    font-size: .88rem; font-weight: 500;
    text-decoration: none;
}
.pagination a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* --------------------------------------------------------------------------
   Trạng thái rỗng
   -------------------------------------------------------------------------- */
.empty {
    text-align: center;
    padding: 56px 24px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}
.empty__icon { font-size: 2.8rem; margin-bottom: 14px; opacity: .55; }
.empty h3 { font-size: 1.12rem; margin-bottom: 7px; }
.empty p { color: var(--text-soft); margin: 0 auto 20px; max-width: 440px; font-size: .93rem; }

/* --------------------------------------------------------------------------
   Trạng thái AI đang xử lý
   -------------------------------------------------------------------------- */
.ai-panel {
    background: linear-gradient(135deg, #f5f3ff, #eef2ff);
    border: 1px solid #ddd6fe;
    border-radius: var(--radius);
    padding: 22px;
}
.ai-panel__title {
    display: flex; align-items: center; gap: 9px;
    font-weight: 700; font-size: 1rem; margin-bottom: 8px; color: #5b21b6;
}

.spinner {
    width: 15px; height: 15px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
.spinner--dark { border-color: rgba(79,70,229,.25); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.gen-log {
    max-height: 260px; overflow-y: auto;
    background: #0f172a; color: #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    font-family: var(--mono); font-size: .8rem; line-height: 1.7;
    margin-top: 14px;
}
.gen-log__line--ok   { color: #6ee7b7; }
.gen-log__line--fail { color: #fca5a5; }
.gen-log__line--info { color: #93c5fd; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
    background: #111827;
    color: #9ca3af;
    padding: 48px 0 26px;
    margin-top: 60px;
    font-size: .9rem;
}
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 13px; }
.site-footer a { color: #9ca3af; display: block; padding: 4px 0; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.site-footer__grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(auto-fit, minmax(150px, 1fr));
    gap: 34px;
    margin-bottom: 34px;
}
.site-footer__bottom {
    border-top: 1px solid #1f2937;
    padding-top: 20px;
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    font-size: .84rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .learn { grid-template-columns: 1fr; }
    .learn__sidebar {
        position: static; height: auto; max-height: 340px;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .learn__main { padding: 26px 22px 60px; }
    .admin { grid-template-columns: 1fr; }
    .admin__sidebar { position: static; height: auto; }
    .admin-nav { flex-direction: row; flex-wrap: wrap; }
    .admin-nav__label { display: none; }
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute; top: var(--header-h); left: 0; right: 0;
        flex-direction: column; align-items: stretch;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 10px;
        box-shadow: var(--shadow);
        gap: 2px;
    }
    .nav.open { display: flex; }
    .nav-toggle { display: block; order: -1; }
    .site-header__inner { gap: 12px; }
    .logo { flex: 1; }
    .hero { padding: 52px 0 60px; }
    .hero-stats { gap: 26px; }
    .hero-stat__num { font-size: 1.5rem; }
    .section { padding: 40px 0; }
    .admin__content, .admin__topbar { padding-left: 18px; padding-right: 18px; }
    .card, .card--pad-lg { padding: 18px; }
    .auth-box { padding: 28px 22px; }
    h1 { font-size: 1.6rem; }
    .lesson-header h1 { font-size: 1.4rem; }
    .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

@media print {
    .site-header, .site-footer, .learn__sidebar, .lesson-nav, .btn { display: none !important; }
    .learn { grid-template-columns: 1fr; }
    .learn__main { padding: 0; max-width: none; }
    body { background: #fff; }
}
