/* public/assets/css/student.css */
    :root {
        --accent: #2563EB;
        --accent-dark: #1D4ED8;
        --accent-light: #EFF6FF;
        --success: #10B981;
        --error: #EF4444;
        --warning: #F59E0B;
        --text: #0F172A;
        --text-mid: #475569;
        --text-light: #94A3B8;
        --border: #E2E8F0;
        --bg: #F8FAFC;
        --surface: #FFFFFF;
        --radius: 12px;
        --radius-sm: 8px;
        --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
        --shadow-md: 0 4px 20px rgba(0, 0, 0, .08);
        --shadow-lg: 0 10px 40px rgba(0, 0, 0, .12);
    }

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sarabun', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;

    /* เพิ่ม 3 บรรทัดนี้ */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Navbar ──────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.5rem;
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-family: 'Prompt', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.navbar__brand svg {
    width: 32px;
    height: 32px;
}

.navbar__search {
    flex: 1;
    max-width: 360px;
    position: relative;
}

.navbar__search form {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 99px;
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s;
}

.navbar__search form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.navbar__search svg {
    width: 17px;
    height: 17px;
    color: var(--text-light);
    margin-left: .9rem;
    flex-shrink: 0;
}

.navbar__search input {
    flex: 1;
    padding: .55rem .9rem;
    border: none;
    background: transparent;
    font-family: 'Sarabun', sans-serif;
    font-size: .9rem;
    color: var(--text);
    outline: none;
}

.navbar__menu {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-link {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-mid);
    padding: .45rem .75rem;
    border-radius: var(--radius-sm);
    transition: color .15s, background .15s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.btn-nav-outline {
    font-size: .88rem;
    font-weight: 600;
    padding: .45rem 1rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    color: var(--text-mid);
    transition: all .15s;
}

.btn-nav-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-nav-fill {
    font-size: .88rem;
    font-weight: 600;
    padding: .45rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
    transition: background .15s;
}

.btn-nav-fill:hover {
    background: var(--accent-dark);
}

/* Avatar dropdown */
.nav-dropdown {
    position: relative;
}

.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Prompt', sans-serif;
    font-size: .85rem;
    font-weight: 700;
    overflow: hidden;
}

.nav-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-dropdown__menu {
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: .5rem 0;
    display: none;
    z-index: 200;
    animation: dropIn .15s ease;
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-6px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}


.nav-dropdown__header {
    padding: .6rem 1rem .5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
}

.nav-dropdown__header strong {
    display: block;
    font-size: .88rem;
}

.nav-dropdown__header small {
    color: var(--text-light);
    font-size: .78rem;
}
.nav-dropdown__menu {
    /* เดิมมี display:none อยู่แล้ว เพิ่ม transition */
    transition: opacity .15s ease, transform .15s ease;
}
.nav-dropdown__menu a {
    display: block;
    padding: .5rem 1rem;
    font-size: .875rem;
    color: var(--text-mid);
    transition: background .12s;
}

.nav-dropdown__menu a:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-dropdown__divider {
    height: 1px;
    background: var(--border);
    margin: .25rem 0;
}

.navbar__hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-mid);
    padding: .3rem;
}

.navbar__hamburger svg {
    width: 22px;
    height: 22px;
}

.navbar__mobile {
    display: none;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.navbar__mobile a {
    display: block;
    padding: .6rem 0;
    font-size: .95rem;
    color: var(--text-mid);
    border-bottom: 1px solid var(--border);
}

.navbar__mobile a:last-child {
    border-bottom: none;
}

.navbar__mobile.open {
    display: block;
}

/* ── Alert bar ──────────────────────────── */
.alert-bar {
    max-width: 1200px;
    margin: .75rem auto 0;
    padding: .75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
}

.alert-bar--success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-bar--error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-bar--info {
    background: #EFF6FF;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* ── Main content ──────────────────────── */
.main-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;

    /* เพิ่มบรรทัดนี้ */
    flex: 1;
}

/* ── Footer ────────────────────────────── */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}

.footer__brand {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
}

.footer p {
    font-size: .83rem;
    color: var(--text-light);
}

/* ── Card ──────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-family: 'Prompt', sans-serif;
    font-size: .95rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem 1.5rem;
}

/* ── Course grid ───────────────────────── */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.course-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.course-card__thumb {
    aspect-ratio: 16/9;
    background: #E2E8F0;
    overflow: hidden;
}

.course-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-card__thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 2.5rem;
}

.course-card__body {
    padding: 1.1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.course-card__title {
    font-family: 'Prompt', sans-serif;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.course-card__tutor {
    font-size: .82rem;
    color: var(--text-light);
}

.course-card__meta {
    display: flex;
    gap: .75rem;
    font-size: .8rem;
    color: var(--text-light);
    margin-top: auto;
}

.course-card__footer {
    padding: .9rem 1.1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.course-price {
    font-family: 'Prompt', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
}

.course-price--free {
    color: var(--success);
}

/* ── Btn ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: 'Sarabun', sans-serif;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, transform .12s;
}

.btn:active {
    transform: scale(.97);
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
}

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

.btn--success {
    background: var(--success);
    color: #fff;
}

.btn--success:hover {
    background: #059669;
}

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

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

.btn--lg {
    padding: .8rem 2rem;
    font-size: 1rem;
}

.btn--sm {
    padding: .38rem .85rem;
    font-size: .82rem;
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ── Badge ────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    border-radius: 99px;
    font-size: .74rem;
    font-weight: 600;
}

.badge--blue {
    background: #EFF6FF;
    color: #1E40AF;
}

.badge--green {
    background: #F0FDF4;
    color: #166534;
}

.badge--amber {
    background: #FFFBEB;
    color: #92400E;
}

.badge--red {
    background: #FEF2F2;
    color: #991B1B;
}

.badge--gray {
    background: #F1F5F9;
    color: #475569;
}

.badge--purple {
    background: #EEF2FF;
    color: #3730A3;
}

/* ── Form ─────────────────────────────── */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .4rem;
}

.form-input {
    width: 100%;
    padding: .7rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Sarabun', sans-serif;
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

textarea.form-input {
    resize: vertical;
    min-height: 90px;
}

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

/* ── Progress bar ─────────────────────── */
.progress-wrap {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width .4s;
}

/* ── Lesson list ──────────────────────── */
.lesson-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover {
    background: var(--bg);
}

.lesson-item.active {
    background: var(--accent-light);
}

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

.lesson-icon--vdo {
    background: #EFF6FF;
    color: var(--accent);
}

.lesson-icon--pdf {
    background: #FEF2F2;
    color: var(--error);
}

.lesson-icon--url {
    background: #F0FDF4;
    color: var(--success);
}

.lesson-icon svg {
    width: 18px;
    height: 18px;
}

.lesson-info {
    flex: 1;
    min-width: 0;
}

.lesson-info__title {
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-info__meta {
    font-size: .76rem;
    color: var(--text-light);
}

.lesson-done {
    color: var(--success);
}

.lesson-done svg {
    width: 18px;
    height: 18px;
}

/* ── Exam option ──────────────────────── */
.exam-option {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: .5rem;
}

.exam-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

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

.exam-option.correct {
    border-color: var(--success);
    background: #F0FDF4;
}

.exam-option.wrong {
    border-color: var(--error);
    background: #FEF2F2;
}

.exam-option input[type="radio"] {
    margin-top: .15rem;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* ── My Learning card ─────────────────── */
.learning-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    transition: box-shadow .2s;
}

.learning-card:hover {
    box-shadow: var(--shadow-md);
}

.learning-card__thumb {
    width: 160px;
    flex-shrink: 0;
    background: #E2E8F0;
    overflow: hidden;
}

.learning-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.learning-card__body {
    flex: 1;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.learning-card__title {
    font-family: 'Prompt', sans-serif;
    font-size: .95rem;
    font-weight: 600;
}

.learning-card__meta {
    font-size: .82rem;
    color: var(--text-light);
}

.learning-card__actions {
    display: flex;
    gap: .5rem;
    margin-top: auto;
}

/* ── Watch page layout ────────────────── */
.watch-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.watch-player {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    position: relative;
}

.watch-player iframe,
.watch-player video {
    width: 100%;
    height: 100%;
    border: none;
}

.watch-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    max-height: 600px;
}

.watch-sidebar__tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.watch-tab {
    flex: 1;
    padding: .65rem;
    font-size: .83rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    transition: color .15s;
}

.watch-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.watch-sidebar__body {
    overflow-y: auto;
    max-height: 530px;
}

/* ── Result circle ────────────────────── */
.result-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 6px solid;
    margin: 0 auto 1rem;
}

.result-circle--pass {
    border-color: var(--success);
    color: var(--success);
}

.result-circle--fail {
    border-color: var(--error);
    color: var(--error);
}

.result-circle__num {
    font-family: 'Prompt', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.result-circle__label {
    font-size: .75rem;
    font-weight: 600;
}

/* ── Exam Action Buttons ─────────────── */
.exam-actions {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.exam-actions__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
}
.result-actions {
    display: flex;
    gap: .5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.exam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: .8rem;
    font-weight: 600;
    font-family: 'Sarabun', sans-serif;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: .15s;
    white-space: nowrap;
}
.exam-btn:hover { filter: brightness(.92); transform: translateY(-1px); }
.exam-btn:active { transform: translateY(0) scale(.98); }
.exam-btn svg { flex-shrink: 0; }

.exam-btn--primary {
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.exam-btn--purple {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.25);
}
.exam-btn--amber {
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245,158,11,.25);
}
.exam-btn--ghost {
    background: #fff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
}
.exam-btn--ghost:hover { background: #f8fafc; border-color: #cbd5e1; }

@media (max-width: 480px) {
    .exam-actions__row { grid-template-columns: 1fr; }
    .result-actions { flex-direction: column; align-items: center; }
    .exam-btn { width: 100%; justify-content: center; }
}

/* ── Responsive ───────────────────────── */
@media (max-width:768px) {
    .navbar__search {
        display: none;
    }

    .navbar__menu {
        display: none;
    }

    .navbar__hamburger {
        display: flex;
    }

    .watch-layout {
        grid-template-columns: 1fr;
    }

    .learning-card__thumb {
        width: 100px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .main-content {
        padding: 1.25rem 1rem;
    }
}

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

    .learning-card {
        flex-direction: column;
    }

    .learning-card__thumb {
        width: 100%;
        height: 160px;
    }
}