/* Trang học viên (/hoc) — một page, sidebar + khu vực chính. */

.lrn-wrap * { box-sizing: border-box; }

/* ── Đăng nhập ───────────────────────────────────────────────────────────── */
.lrn-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.lrn-auth-box {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--lrn-border);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 6px 32px rgba(0, 0, 0, .06);
}
.lrn-auth-logo { display: block; max-height: 44px; margin: 0 auto 16px; }
.lrn-auth-box h1 { font-size: 1.15rem; font-weight: 800; margin: 0 0 6px; text-align: center; }
.lrn-auth-sub { font-size: .87rem; color: var(--lrn-muted); text-align: center; margin: 0 0 20px; line-height: 1.6; }
.lrn-field { margin-bottom: 14px; }
.lrn-field label { display: block; font-size: .78rem; font-weight: 700; color: #4b5563; margin-bottom: 6px; }
.lrn-field input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--lrn-border);
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
}
.lrn-field input:focus { outline: none; border-color: var(--lrn-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lrn-accent) 18%, transparent); }
.lrn-field-hint { font-size: .75rem; color: var(--lrn-muted); margin: 6px 0 0; line-height: 1.5; }
.lrn-otp-input { text-align: center; font-size: 1.5rem !important; letter-spacing: .5em; font-weight: 800; font-family: ui-monospace, monospace !important; }
.lrn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    background: var(--lrn-accent);
    color: #fff;
    font-size: .93rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}
.lrn-btn:hover { filter: brightness(.93); color: #fff; }
.lrn-btn[disabled] { opacity: .6; cursor: progress; }
.lrn-btn-ghost { background: #fff; color: #374151; border: 1px solid var(--lrn-border); }
.lrn-btn-ghost:hover { background: #f9fafb; color: #374151; filter: none; }
.lrn-btn-link {
    background: none;
    border: none;
    color: var(--lrn-accent);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.lrn-auth-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #9ca3af; font-size: .76rem; }
.lrn-auth-sep::before, .lrn-auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--lrn-border); }
.lrn-auth-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.lrn-btn-google {
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; box-sizing: border-box;
    padding: 11px 20px; margin-top: 2px;
    border: 1px solid #747775; border-radius: 999px;
    background: #fff;
    font-family: Roboto, system-ui, -apple-system, sans-serif;
    font-size: 14px; font-weight: 500; line-height: 20px;
    color: #1f1f1f; text-decoration: none;
    transition: background .15s, box-shadow .15s;
}
.lrn-btn-google:hover { background: #f8f9fa; color: #1f1f1f; box-shadow: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px rgba(60,64,67,.15); }
.lrn-btn-google:active { background: #f1f3f4; }
.lrn-btn-google svg { flex-shrink: 0; display: block; }
.lrn-msg { padding: 10px 13px; border-radius: 9px; font-size: .84rem; line-height: 1.55; margin-bottom: 14px; }
.lrn-msg-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.lrn-msg-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.lrn-hidden { display: none !important; }

/* ── Khung học ───────────────────────────────────────────────────────────── */
.lrn-top {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    background: #fff;
    border-bottom: 1px solid var(--lrn-border);
}
.lrn-burger {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--lrn-border);
    border-radius: 9px;
    background: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
}
.lrn-crumb { flex: 1; min-width: 0; font-size: .85rem; color: var(--lrn-muted); }
.lrn-crumb-course { font-weight: 800; color: #111827; }
.lrn-crumb-lesson { display: block; font-size: .8rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrn-course-select {
    font: inherit;
    font-size: .85rem;
    font-weight: 800;
    color: #111827;
    border: 1px solid var(--lrn-border);
    border-radius: 8px;
    padding: 4px 8px;
    background: #fff;
    max-width: 260px;
}
.lrn-top-progress { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.lrn-bar { width: 140px; height: 8px; border-radius: 999px; background: #eceff3; overflow: hidden; }
.lrn-bar > i { display: block; height: 100%; background: var(--lrn-accent); border-radius: 999px; transition: width .35s ease; }
.lrn-percent { font-size: .82rem; font-weight: 800; color: var(--lrn-accent); min-width: 38px; }
.lrn-user { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--lrn-muted); flex-shrink: 0; }
.lrn-user a { color: var(--lrn-muted); text-decoration: none; font-weight: 600; }
.lrn-user a:hover { color: var(--lrn-accent); }

.lrn-body { display: flex; align-items: flex-start; }

/* Sidebar */
.lrn-side {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--lrn-border);
    padding: 16px 12px 24px;
}
.lrn-side-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--lrn-muted);
    padding: 0 8px 10px;
}
.lrn-lessons { list-style: none; margin: 0; padding: 0; }
.lrn-lesson-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    padding: 10px 10px;
    border: none;
    border-radius: 10px;
    background: none;
    font: inherit;
    font-size: .875rem;
    color: #374151;
    cursor: pointer;
    line-height: 1.45;
}
.lrn-lesson-item:hover { background: #f5f6f8; }
.lrn-lesson-item.is-active { background: color-mix(in srgb, var(--lrn-accent) 12%, #fff); color: #111827; font-weight: 700; }
.lrn-lesson-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #d7dbe0;
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 800;
    color: var(--lrn-muted);
}
.lrn-lesson-item.is-done .lrn-lesson-mark { background: #16a34a; border-color: #16a34a; color: #fff; }
.lrn-lesson-item.is-active .lrn-lesson-mark { border-color: var(--lrn-accent); color: var(--lrn-accent); }
.lrn-lesson-item.is-active.is-done .lrn-lesson-mark { color: #fff; }
.lrn-community {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 8px 0;
    padding: 11px 13px;
    border-radius: 10px;
    background: #f5f6f8;
    color: #374151;
    font-size: .83rem;
    font-weight: 700;
    text-decoration: none;
}
.lrn-community:hover { background: #eceff3; color: #111827; }

/* Khu vực chính */
.lrn-main { flex: 1; min-width: 0; padding: 20px 24px 80px; }
.lrn-notice {
    border: 1px solid #fde68a;
    background: #fffbeb;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: .88rem;
    color: #78350f;
    line-height: 1.7;
}
.lrn-notice-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.lrn-badge-new { background: #dc2626; color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .68rem; letter-spacing: 0; }
.lrn-notice-close { margin-left: auto; background: none; border: none; color: #92400e; cursor: pointer; font-size: .95rem; }
.lrn-notice p:first-child { margin-top: 0; }
.lrn-notice p:last-child { margin-bottom: 0; }

.lrn-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 18px;
}
.lrn-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lrn-video-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: .88rem;
}

.lrn-lesson-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.lrn-lesson-head h1 { flex: 1; font-size: 1.3rem; font-weight: 800; margin: 0; line-height: 1.35; }
.lrn-lesson-step { font-size: .75rem; font-weight: 700; color: var(--lrn-muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 4px; }
.lrn-done-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border: 1px solid var(--lrn-border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: .83rem;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
}
.lrn-done-btn:hover { background: #f9fafb; }
.lrn-done-btn.is-done { background: #16a34a; border-color: #16a34a; color: #fff; }

.lrn-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--lrn-border);
    margin-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: none;
}
.lrn-tabs::-webkit-scrollbar { display: none; }
.lrn-tab {
    flex-shrink: 0;
    padding: 10px 15px;
    border: none;
    background: none;
    font: inherit;
    font-size: .87rem;
    font-weight: 700;
    color: var(--lrn-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.lrn-tab.is-active { color: var(--lrn-accent); border-bottom-color: var(--lrn-accent); }
.lrn-pane { display: none; font-size: .93rem; line-height: 1.8; color: #374151; }
.lrn-pane.is-active { display: block; }
.lrn-pane img { max-width: 100%; height: auto; border-radius: 8px; }
.lrn-pane a { color: var(--lrn-accent); font-weight: 600; }
.lrn-pane table { width: 100%; border-collapse: collapse; }
.lrn-pane td, .lrn-pane th { border: 1px solid var(--lrn-border); padding: 8px 10px; }
.lrn-empty { color: #9ca3af; font-size: .88rem; font-style: italic; }

.lrn-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.lrn-foot .lrn-btn { width: auto; }

/* Chứng nhận */
.lrn-cert {
    margin-top: 28px;
    border: 2px solid var(--lrn-accent);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    background: #fff;
}
.lrn-cert-kicker { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--lrn-accent); margin: 0 0 10px; }
.lrn-cert h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 6px; }
.lrn-cert-name { font-size: 1.6rem; font-weight: 800; margin: 14px 0 4px; }
.lrn-cert-meta { font-size: .84rem; color: var(--lrn-muted); margin: 0; line-height: 1.7; }
.lrn-cert-code { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--lrn-muted); margin-top: 10px; }
.lrn-cert-actions { margin-top: 18px; }
.lrn-cert-actions .lrn-btn { width: auto; }

/* Trạng thái rỗng */
.lrn-blank { max-width: 520px; margin: 60px auto; text-align: center; padding: 0 20px; }
.lrn-blank h1 { font-size: 1.15rem; font-weight: 800; margin: 0 0 8px; }
.lrn-blank p { color: var(--lrn-muted); font-size: .9rem; line-height: 1.7; margin: 0 0 20px; }

.lrn-scrim { display: none; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .lrn-burger { display: block; }
    .lrn-top { padding: 10px 14px; gap: 10px; }
    .lrn-top-progress .lrn-bar { width: 70px; }
    .lrn-user span { display: none; }
    .lrn-side {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 60;
        max-height: none;
        width: 82vw;
        max-width: 330px;
        transform: translateX(-102%);
        transition: transform .25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .18);
    }
    .lrn-side.is-open { transform: none; }
    .lrn-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(17, 24, 39, .45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .lrn-scrim.is-open { opacity: 1; pointer-events: auto; }
    .lrn-main { padding: 16px 14px 96px; }
    .lrn-video { border-radius: 10px; margin-left: -14px; margin-right: -14px; width: auto; border-radius: 0; }
    .lrn-lesson-head { flex-direction: column; gap: 10px; }
    .lrn-lesson-head h1 { font-size: 1.1rem; }
    .lrn-done-btn { width: 100%; justify-content: center; }
    .lrn-foot { display: none; }
    .lrn-next-fixed {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .96);
        border-top: 1px solid var(--lrn-border);
        backdrop-filter: blur(6px);
    }
}
@media (min-width: 861px) {
    .lrn-next-fixed { display: none; }
}

/* ── Admin xem trước ─────────────────────────────────────────────────────── */
.lrn-preview-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 16px;
    font-size: .8rem;
    color: #1e3a8a;
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
}
.lrn-preview-bar a {
    font-weight: 600;
    color: #1d4ed8;
    text-decoration: none;
    white-space: nowrap;
}
.lrn-preview-bar a:hover { text-decoration: underline; }
.lrn-wrap-preview .lrn-top { top: 40px; }
.lrn-lesson-item.is-unpublished { opacity: .88; }
.lrn-lesson-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    background: #fef3c7;
    color: #92400e;
    vertical-align: middle;
}

/* ── In chứng nhận ───────────────────────────────────────────────────────── */
@media print {
    .lrn-preview-bar,
    .lrn-top, .lrn-side, .lrn-video, .lrn-tabs, .lrn-pane, .lrn-foot,
    .lrn-next-fixed, .lrn-notice, .lrn-lesson-head, .lrn-cert-actions, .lrn-scrim { display: none !important; }
    .lrn-main { padding: 0; }
    .lrn-cert { margin: 0; border-width: 3px; page-break-inside: avoid; }
}
