/* ======================================================
   RDFL Learn — learn.css  (LMS Edition)
   Inspired by Coursera / NextLearn / edX
   Colors: Blue #1a3a8f / Yellow #f5c518 / White
====================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #1a3a8f;
  --blue-dark:   #122a6e;
  --blue-mid:    #2855b8;
  --blue-light:  #eef2fd;
  --blue-pale:   #f5f7ff;
  --yellow:      #f5c518;
  --yellow-d:    #d4a915;
  --success:     #16a34a;
  --success-bg:  #f0fdf4;
  --danger:      #dc2626;
  --danger-bg:   #fff1f2;
  --text:        #111827;
  --text-2:      #374151;
  --muted:       #6b7280;
  --muted-2:     #9ca3af;
  --border:      #e5e7eb;
  --border-2:    #f3f4f6;
  --bg:          #f9fafb;
  --white:       #ffffff;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-xs:   6px;
  --shadow-xs:   0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:      0 4px 16px rgba(0,0,0,.07);
  --shadow-md:   0 8px 24px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.12);
  --nav-h:       64px;
}

body {
  font-family: 'Sarabun', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   NAV
============================================================ */
.lms-nav {
  background: var(--blue);
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.lms-nav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.lms-nav__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.lms-nav__logo  { height: 38px; width: auto; }
.lms-nav__title { color: #fff; font-weight: 700; font-size: 1rem; white-space: nowrap; }

.lms-nav__links { display: flex; gap: .25rem; flex: 1; }
.lms-nav__links a {
  color: rgba(255,255,255,.8);
  font-size: .9rem;
  padding: .4rem .75rem;
  border-radius: var(--radius-xs);
  transition: background .15s, color .15s;
  text-decoration: none;
}
.lms-nav__links a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }

.lms-nav__right { display: flex; align-items: center; gap: .75rem; margin-left: auto; }

.lms-nav__lang-btn {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-xs);
  padding: .3rem .7rem;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .15s;
}
.lms-nav__lang-btn:hover { background: rgba(255,255,255,.22); }

/* User menu */
.lms-nav__user { position: relative; }

.lms-nav__user-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 99px;
  padding: .3rem .75rem .3rem .35rem;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  transition: background .15s;
}
.lms-nav__user-btn:hover { background: rgba(255,255,255,.2); }

.lms-nav__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.4);
  flex-shrink: 0;
}
.lms-nav__avatar--placeholder {
  background: var(--yellow);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .875rem;
}
.lms-nav__user-name {
  font-size: .875rem;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lms-nav__user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  overflow: hidden;
  border: 1px solid var(--border);
  animation: menuFade .15s ease;
}
.lms-nav__user-menu.open { display: block; }

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

.lms-nav__user-header {
  padding: .9rem 1rem;
  background: var(--blue-pale);
  border-bottom: 1px solid var(--border);
}
.lms-nav__user-name-full { font-weight: 700; font-size: .9rem; color: var(--text); }
.lms-nav__user-email     { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.lms-nav__user-code      { font-size: .78rem; color: var(--blue); font-weight: 600; margin-top: .2rem; }

.lms-nav__user-menu a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1rem;
  color: var(--text-2);
  font-size: .875rem;
  transition: background .12s;
  text-decoration: none;
}
.lms-nav__user-menu a:hover { background: var(--blue-pale); text-decoration: none; }
.lms-nav__menu-divider { height: 1px; background: var(--border); margin: .25rem 0; }

.btn--outline-white {
  border: 1px solid rgba(255,255,255,.5);
  color: #fff;
  background: transparent;
  border-radius: 8px;
  padding: .4rem 1rem;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
}
.btn--outline-white:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* ============================================================
   LAYOUT
============================================================ */
.lms-main { flex: 1; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--narrow { max-width: 820px; }
.container--md     { max-width: 1024px; }

/* ============================================================
   FOOTER
============================================================ */
.lms-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 1.5rem;
  font-size: .85rem;
  margin-top: auto;
}
.lms-footer a { color: var(--yellow); }
.lms-footer a:hover { text-decoration: underline; }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: scale(.97); }

.btn--primary  { background: var(--blue); color: var(--white); }
.btn--primary:hover { background: var(--blue-mid); opacity: 1; }
.btn--yellow   { background: var(--yellow); color: var(--blue); }
.btn--yellow:hover { background: var(--yellow-d); opacity: 1; }
.btn--outline  { background: transparent; border: 2px solid var(--blue); color: var(--blue); }
.btn--outline:hover { background: var(--blue-light); opacity: 1; }
.btn--ghost    { background: transparent; color: var(--blue); }
.btn--ghost:hover { background: var(--blue-light); opacity: 1; }
.btn--danger   { background: var(--danger); color: var(--white); }
.btn--sm       { padding: .35rem .85rem; font-size: .82rem; border-radius: var(--radius-xs); }
.btn--lg       { padding: .8rem 2rem; font-size: 1.05rem; border-radius: var(--radius); }
.btn--full     { width: 100%; }
.btn--google {
  background: var(--white);
  color: #3c4043;
  border: 1px solid #dadce0;
  font-weight: 500;
  font-size: 1rem;
}
.btn--google:hover { background: #f8f9fa; opacity: 1; box-shadow: var(--shadow-sm); }
.btn--google img { width: 20px; height: 20px; }

/* ============================================================
   HERO — LMS Style
============================================================ */
.lms-hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 50%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 4rem 1.5rem 3.5rem;
  position: relative;
  overflow: hidden;
}
.lms-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.lms-hero__inner {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}
.lms-hero__tag {
  display: inline-block;
  background: rgba(245,197,24,.2);
  color: var(--yellow);
  border: 1px solid rgba(245,197,24,.4);
  border-radius: 99px;
  padding: .25rem .85rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: .85rem;
}
.lms-hero__title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: .75rem;
  max-width: 620px;
}
.lms-hero__sub {
  font-size: 1.1rem;
  opacity: .8;
  margin-bottom: 2rem;
  max-width: 520px;
  line-height: 1.7;
}
.lms-hero__stats {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.lms-hero__stats > div {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
  padding: .5rem 1.1rem;
  backdrop-filter: blur(6px);
}
.lms-hero__stat-label { font-size: .82rem; color: #fff; font-weight: 600; letter-spacing: .01em; }

/* ============================================================
   FILTER BAR
============================================================ */
.filter-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  padding: 1.5rem 0 .5rem;
  align-items: center;
}
.filter-bar__label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: .25rem;
}
.filter-btn {
  padding: .4rem 1.1rem;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  color: var(--text-2);
  font-weight: 500;
  transition: all .15s;
}
.filter-btn.active {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}
.filter-btn:not(.active):hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-pale);
}

/* ============================================================
   COURSE GRID & CARDS
============================================================ */
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.section-header a  { font-size: .875rem; color: var(--blue); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.course-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
}
.course-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: transparent;
  text-decoration: none;
  color: var(--text);
}

.course-card__thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.course-card__thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
}

.course-card__body {
  padding: 1rem 1.1rem 1.1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.course-card__dept {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .04em;
  width: fit-content;
}
.course-card__title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card__instructor {
  font-size: .8rem;
  color: var(--muted);
}
.course-card__desc {
  font-size: .82rem;
  color: var(--muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.course-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border-2);
  font-size: .78rem;
  color: var(--muted);
  gap: .5rem;
}
.course-card__footer-item { display: flex; align-items: center; gap: .25rem; }

/* ============================================================
   COURSE DETAIL PAGE
============================================================ */
.course-detail {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2.5rem;
  padding: 2rem 0 3rem;
  align-items: start;
}
@media (max-width: 900px) { .course-detail { grid-template-columns: 1fr; } }

.course-detail__thumb {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.course-detail__breadcrumb {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
.course-detail__breadcrumb a { color: var(--muted); }
.course-detail__breadcrumb a:hover { color: var(--blue); }

.course-detail__title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: .75rem;
}
.course-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  align-items: center;
}
.course-detail__meta-item { display: flex; align-items: center; gap: .3rem; }
.course-detail__desc {
  color: var(--text-2);
  line-height: 1.85;
  font-size: .95rem;
}

/* Enroll sidebar card */
.enroll-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
}
.enroll-card__preview {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: linear-gradient(135deg, var(--blue), var(--blue-mid));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.enroll-card__body { padding: 1.5rem; }
.enroll-card__free {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 1rem;
}

/* ============================================================
   LESSONS & PLAYER
============================================================ */
.lesson-list { list-style: none; }

.lesson-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: var(--text-2);
  font-size: .875rem;
}
.lesson-item:hover { background: var(--blue-pale); text-decoration: none; color: var(--text); }
.lesson-item.active { background: var(--blue-light); }
.lesson-item.active .lesson-item__title { font-weight: 700; color: var(--blue); }
.lesson-item.completed .lesson-item__icon { color: var(--success); }
.lesson-item__icon  { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.lesson-item__title { flex: 1; line-height: 1.4; }
.lesson-item__dur   { font-size: .75rem; color: var(--muted-2); white-space: nowrap; }
.lesson-item__badge {
  font-size: .68rem;
  background: var(--yellow);
  color: var(--blue);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Video player */
.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* ============================================================
   QUIZ
============================================================ */
.quiz-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.quiz-card__title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 1.25rem; }

.quiz-question { margin-bottom: 1.5rem; }
.quiz-question__text { font-weight: 600; margin-bottom: .75rem; line-height: 1.55; }

.quiz-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin-bottom: .5rem;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  font-size: .9rem;
}
.quiz-option:hover { border-color: var(--blue); background: var(--blue-pale); }
.quiz-option input[type=radio] { accent-color: var(--blue); flex-shrink: 0; }
.quiz-option.correct { border-color: var(--success); background: var(--success-bg); }
.quiz-option.wrong   { border-color: var(--danger);  background: var(--danger-bg); }

/* ============================================================
   PROGRESS BAR
============================================================ */
.progress-bar {
  background: var(--border-2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar--sm { height: 5px; }
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-mid));
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress-bar__fill--success { background: var(--success); }

/* ============================================================
   DASHBOARD / ENROLLED CARDS
============================================================ */
.enrolled-grid { display: flex; flex-direction: column; gap: 1rem; }

.enrolled-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.1rem 1.25rem;
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s;
}
.enrolled-card:hover { box-shadow: var(--shadow-md); border-color: transparent; text-decoration: none; color: var(--text); }
.enrolled-card__thumb {
  width: 120px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.enrolled-card__body { flex: 1; min-width: 0; }
.enrolled-card__title { font-weight: 700; font-size: .95rem; line-height: 1.4; margin-bottom: .3rem; }
.enrolled-card__meta  { font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }
.enrolled-card__pct   { font-size: .78rem; color: var(--muted); margin-top: .35rem; }

/* ============================================================
   CERTIFICATE
============================================================ */
.cert-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .15s;
}
.cert-card:hover { box-shadow: var(--shadow-md); }
.cert-card__header {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  padding: 1.25rem 1.5rem;
  text-align: center;
  color: var(--white);
}
.cert-card__body { padding: 1.1rem 1.25rem; }
.cert-card__code { font-size: .75rem; color: var(--muted); font-family: monospace; margin-top: .35rem; }

/* ============================================================
   FORMS
============================================================ */
.form-group   { margin-bottom: 1.1rem; }
.form-label   { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .4rem; color: var(--text-2); }
.form-control {
  width: 100%;
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,58,143,.1);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control   { cursor: pointer; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }

/* ============================================================
   TABLES
============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}
.data-table th {
  background: var(--blue-pale);
  font-weight: 700;
  color: var(--blue);
  font-size: .82rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--blue-pale); }

/* ============================================================
   ADMIN / INSTRUCTOR LAYOUT
============================================================ */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}
.app-sidebar {
  width: 230px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  flex-shrink: 0;
}
.app-sidebar__label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
  padding: .75rem 1.25rem .3rem;
}
.app-sidebar a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.25rem;
  color: var(--text-2);
  font-size: .875rem;
  transition: background .12s, color .12s;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.app-sidebar a:hover { background: var(--blue-pale); color: var(--blue); text-decoration: none; }
.app-sidebar a.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
  border-left-color: var(--blue);
}
.app-content { flex: 1; padding: 2rem 2.5rem; overflow-x: auto; background: var(--bg); }

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }
.card__title  { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.25rem;
  text-align: center;
}
.stat-card__num   { font-size: 2.2rem; font-weight: 700; color: var(--blue); line-height: 1; }
.stat-card__label { font-size: .82rem; color: var(--muted); margin-top: .35rem; }

/* ============================================================
   ALERTS
============================================================ */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert--success { background: var(--success-bg); color: #15803d; border: 1px solid #bbf7d0; }
.alert--error   { background: var(--danger-bg);  color: var(--danger); border: 1px solid #fecaca; }
.alert--info    { background: var(--blue-light);  color: var(--blue); border: 1px solid #bfdbfe; }
.alert--warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ============================================================
   LOGIN PAGE
============================================================ */
.login-page {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
}
.login-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.login-box__logo  { height: 56px; margin: 0 auto 1rem; }
.login-box__title { font-size: 1.35rem; font-weight: 700; color: var(--blue); margin-bottom: .25rem; }
.login-box__sub   { color: var(--muted); font-size: .875rem; margin-bottom: 2rem; line-height: 1.6; }

/* ============================================================
   PAGE HEADER
============================================================ */
.page-header {
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}
.page-header h1  { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-header p   { color: var(--muted); font-size: .9rem; margin-top: .3rem; }

/* ============================================================
   LEARN PLAYER LAYOUT (learn.php)
============================================================ */
.learn-layout {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}
.learn-sidebar {
  width: 300px;
  min-width: 300px;
  flex-shrink: 0;
  min-height: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.learn-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem;
}
.learn-sidebar-toggle { display: none; }
.learn-sidebar-overlay { display: none; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  .lms-nav__title  { display: none; }
  .lms-nav__links  { display: none; }
  .lms-nav__inner  { gap: .75rem; }

  .course-detail   { grid-template-columns: 1fr; }

  .app-layout      { flex-direction: column; }
  .app-sidebar     {
    width: 100%;
    padding: .5rem 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .5rem .75rem;
  }
  .app-sidebar__label { display: none; }
  .app-sidebar a   { padding: .45rem .65rem; font-size: .8rem; border-left: none; border-radius: var(--radius-xs); }
  .app-content     { padding: 1rem; }

  .lms-hero        { padding: 2.5rem 1rem 2rem; }
  .lms-hero__stats { gap: .5rem; }
  .lms-hero__stats > div { padding: .5rem .8rem; }

  /* Learn player: sidebar กลายเป็น slide-in drawer */
  .learn-layout {
    height: auto;
    overflow: visible;
  }
  .learn-sidebar {
    position: fixed;
    top: var(--nav-h);
    left: -100%;
    width: 85%;
    max-width: 300px;
    height: calc(100vh - var(--nav-h));
    z-index: 150;
    transition: left .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
  }
  .learn-sidebar.open {
    left: 0;
  }
  .learn-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--nav-h);
    background: rgba(0,0,0,.45);
    z-index: 149;
  }
  .learn-sidebar-overlay.visible {
    display: block;
  }
  .learn-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    background: var(--blue-light);
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: .55rem 1rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 1rem;
  }
  .learn-main {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .course-grid { grid-template-columns: 1fr; }
  .enrolled-card__thumb { width: 80px; }
}
