* { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #e6eaf2;
  --text: #1a2233;
  --text-muted: #6b7585;
  --accent: #00658a;
  --accent-dark: #004c69;
  --accent-soft: #e8f4f8;
}
html { overflow-x: clip; }
.nav-login-icon { display: none; }
@media (max-width: 640px) {
  #navLogin { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0 !important; border-radius: 50%; }
  .nav-login-text { display: none; }
  .nav-login-icon { display: inline-block; font-size: 1.1rem; line-height: 1; }
}
body {
  font-family: 'Segoe UI', 'Sarabun', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  padding-top: 79px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1rem 3%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: rgba(255,255,255,0.92);
  background-image: linear-gradient(120deg, rgba(0,101,138,.06), rgba(253,144,0,.05) 55%, rgba(253,228,36,.08));
  background-blend-mode: normal;
  backdrop-filter: blur(8px);
  border-width: 0 0 3px 0;
  border-style: solid;
  border-image: linear-gradient(90deg, #00658a, #2caae1, #fd9000, #fde424) 1;
  z-index: 100;
  transition: background-color .3s, background-image .3s, border-color .3s, backdrop-filter .3s;
}
header.header-transparent {
  background-color: transparent;
  background-image: none;
  backdrop-filter: none;
  border-image: none;
  border-color: transparent;
}
.logo { font-weight: 800; font-size: 1.2rem; color: #00658a; flex-shrink: 0; letter-spacing: -.01em; }
.logo span { color: #fd9000; }
nav { flex-shrink: 0; }
nav button, nav a {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  margin-left: .6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all .15s;
}
nav button:hover, nav a:hover { border-color: var(--accent); color: var(--accent); }
nav > a#navLogin {
  background: #fd9000;
  border-color: #fd9000;
  color: #fff;
  font-weight: 700;
}
nav > a#navLogin:hover { background: #e08200; border-color: #e08200; color: #fff; }
.nav-user-area a#navMyCourses {
  background: #00658a;
  border-color: #00658a;
  color: #fff;
  font-weight: 700;
}
.nav-user-area a#navMyCourses:hover { background: #004c69; border-color: #004c69; color: #fff; }

.nav-user-area { display: flex; align-items: center; gap: .6rem; margin-left: .6rem; }
.nav-avatar-btn { position: relative; width: 38px; height: 38px; border-radius: 9999px; background: #00658a; color: #fff; border: 2px solid transparent; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; cursor: pointer; background-size: cover; background-position: center; padding: 0; flex-shrink: 0; transition: border-color .15s; }
.nav-avatar-btn:hover { border-color: #fd9000; }
.nav-dropdown { position: absolute; top: calc(100% + 10px); right: 0; min-width: 220px; background: #fff; border: 1px solid #ece7e6; border-radius: 1rem; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: .5rem; z-index: 200; display: none; }
.nav-dropdown.open { display: block; }
.nav-dropdown-email { padding: .6rem .75rem; font-size: .78rem; color: #9ca3af; border-bottom: 1px solid #f3f4f6; margin-bottom: .4rem; word-break: break-all; }
.nav-dropdown a, .nav-dropdown button { display: block; width: 100%; text-align: left; background: none; border: none; padding: .6rem .75rem; border-radius: .6rem; font-size: .85rem; font-weight: 600; color: #1d1b1b; cursor: pointer; text-decoration: none; margin: 0; }
.nav-dropdown a:hover, .nav-dropdown button:hover { background: #fef8f8; color: #00658a; border-color: transparent; }
.nav-dropdown-divider { height: 1px; background: #f3f4f6; margin: .4rem 0; }
.nav-dropdown button.nav-logout { color: #ba1a1a; }
.nav-dropdown button.nav-logout:hover { background: #fff1f1; color: #ba1a1a; }
main { width: 100%; padding: 2rem 3% 4rem; }
.view.hidden { display: none; }
h1 { font-size: 1.8rem; margin-bottom: 1.2rem; color: var(--text); }

.carousel {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 2.5rem;
  height: 260px;
}
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform .4s ease;
}
.carousel-slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}
.slide-1 { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.slide-2 { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.slide-3 { background: linear-gradient(135deg, #059669, #2563eb); }
.slide-content h1 { color: #fff; font-size: 2rem; margin-bottom: .6rem; }
.slide-content p { color: rgba(255,255,255,0.9); font-size: 1rem; }
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.carousel-btn:hover { background: rgba(255,255,255,0.4); }
.carousel-btn.prev { left: 1rem; }
.carousel-btn.next { right: 1rem; }
.carousel-dots { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; gap: .5rem; }
.carousel-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; }
.carousel-dots .dot.active { background: #fff; }

.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.2rem; }
.section-header h2 { font-size: 1.4rem; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem;
}
@media (max-width: 1100px) { .course-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .course-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .course-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 8px 24px rgba(37,99,235,0.1); transform: translateY(-2px); }
.card-thumb {
  height: 110px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--accent);
}
.card-body { padding: 1.1rem 1.2rem 1.3rem; }
.card h3 { font-size: 1rem; margin-bottom: .4rem; color: var(--text); line-height: 1.4; }
.card p { color: var(--text-muted); font-size: .85rem; margin-bottom: .8rem; }
.badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.badge {
  font-size: .7rem;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-weight: 600;
}
.badge.free { background: #d1fae5; color: #065f46; }
.badge.credit { background: #fef3c7; color: #92400e; }
.badge.cert { background: #dbeafe; color: #1e3a8a; }
.badge.mode { background: var(--accent-soft); color: var(--accent-dark); }
.back-link { color: var(--accent); text-decoration: none; display: inline-block; margin-bottom: 1.2rem; font-size: .9rem; }
.muted-text { color: var(--text-muted); }

.mc-tab { background: none; border: none; padding: .85rem 1.2rem; font-size: .95rem; font-weight: 600; color: #6e7880; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .2s, border-color .2s; }
.mc-tab:hover { color: #00658a; }
.mc-tab.active { color: #00658a; border-color: #fd9000; }

.auth-box { max-width: 400px; margin: 2rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: 0 8px 30px rgba(0,0,0,0.05); transition: max-width .2s; }
.auth-box.wide { max-width: 780px; }
.tabs { display: flex; margin-bottom: 1.2rem; border-bottom: 1px solid var(--border); }
.tab { flex: 1; background: none; border: none; color: var(--text-muted); padding: .7rem; cursor: pointer; font-size: .9rem; font-weight: 600; }
.tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: .8rem; }
.auth-form.hidden { display: none; }
.auth-form input, .auth-form textarea, .auth-form select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .7rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
}
.auth-form input:focus, .auth-form textarea:focus, .auth-form select:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .75rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.auth-form button:hover { background: var(--accent-dark); }
.form-msg { font-size: .85rem; color: #dc2626; min-height: 1.2em; }

.reg-section-title { font-size: 1.05rem; font-weight: 700; color: #00658a; margin: .4rem 0 .1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.reg-section-title:first-child { margin-top: 0; }
.reg-label { font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; display: block; }
.reg-label .req { color: #ba1a1a; }
.reg-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.reg-row-3 { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 1rem; }
@media (max-width: 640px) { .reg-row-2, .reg-row-3 { grid-template-columns: 1fr; } }
.reg-row-2 input, .reg-row-2 select, .reg-row-3 input, .reg-row-3 select { width: 100%; }
.reg-consent-title { font-size: .85rem; color: var(--text-muted); margin: .5rem 0 0; }
.reg-consent-option { display: flex; align-items: flex-start; gap: .5rem; font-size: .85rem; color: var(--text); cursor: pointer; line-height: 1.5; }
.reg-consent-option input { width: auto; margin-top: .2rem; flex-shrink: 0; }

.social-login-divider { display: flex; align-items: center; gap: .75rem; margin: .3rem 0; color: var(--text-muted); font-size: .8rem; }
.social-login-divider::before, .social-login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.social-login-buttons { display: flex; flex-direction: column; gap: .6rem; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .7rem; border-radius: 9999px; font-size: .85rem; font-weight: 600; text-decoration: none; transition: opacity .2s, transform .15s; }
.social-btn:hover { opacity: .9; transform: translateY(-1px); }
.social-btn-google { background: #fff; border: 1px solid var(--border); color: #1d1b1b; }
.social-btn-facebook { background: #1877F2; color: #fff; }
.social-btn-line { background: #06C755; color: #fff; }

.as-tab { display: block; width: 100%; text-align: left; background: none; border: none; padding: .75rem .9rem; border-radius: .65rem; font-size: .88rem; font-weight: 600; color: #6e7880; cursor: pointer; transition: background .15s, color .15s; }
.as-tab:hover { background: #fef8f8; }
.as-tab.active { background: #e8f4f8; color: #00658a; }
.as-card { background: #fff; border: 1px solid #ece7e6; border-radius: 1rem; padding: 1.75rem; }
.as-card label { display: block; font-size: .82rem; font-weight: 600; color: #6e7880; margin-bottom: .35rem; margin-top: .95rem; }
.as-card label:first-of-type { margin-top: 0; }
.as-card input, .as-card textarea { width: 100%; background: #fef8f8; border: 1px solid #ece7e6; padding: .7rem .9rem; border-radius: .5rem; font-size: .9rem; font-family: inherit; color: #1d1b1b; }
.as-card input:disabled { color: #9ca3af; cursor: not-allowed; }
.as-card input:focus, .as-card textarea:focus { outline: none; border-color: #00658a; }
.as-avatar-row { display: flex; align-items: center; gap: 1.25rem; }
.as-avatar-preview { width: 84px; height: 84px; border-radius: 9999px; background: #e8f4f8; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 2rem; flex-shrink: 0; overflow: hidden; }
.as-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.as-connection-row { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border: 1px solid #ece7e6; border-radius: .75rem; margin-bottom: .75rem; }
.as-connection-status { font-size: .78rem; font-weight: 700; padding: .3rem .75rem; border-radius: 9999px; }
.as-connection-status.linked { background: #dcfce7; color: #15803d; }
.as-connection-status.unlinked { background: #f3f4f6; color: #6b7280; }
.checkbox-line { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--text-muted); }
.checkbox-line input { width: auto; }
.field-label { font-size: .82rem; color: var(--text-muted); margin-bottom: -.4rem; font-weight: 600; }
.field-row { display: flex; gap: .6rem; }
.field-row input { flex: 1; }

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  margin-bottom: .6rem;
  transition: border-color .15s, box-shadow .15s;
}
.lesson-item.done { border-color: #10b981; }
.lesson-item.lesson-clickable:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37,99,235,0.08);
  transform: translateX(3px);
}
.progress-bar {
  background: var(--border);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar-fill { background: var(--accent); height: 100%; }
.btn-small {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .45rem 1rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-small:hover { background: var(--accent-dark); }
.btn-small:disabled { background: var(--border); color: var(--text-muted); cursor: default; }
.enroll-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .8rem 1.6rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  margin: 1rem 0;
  font-size: .95rem;
}
.enroll-btn:hover { background: var(--accent-dark); }
.enroll-btn:disabled { background: var(--border); color: var(--text-muted); cursor: default; }
.status-line { color: var(--text-muted); font-size: .85rem; margin-top: .4rem; }
.complete-box {
  background: #ecfdf5;
  border: 1px solid #10b981;
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  margin: 1rem 0;
}
.complete-title { color: #047857; font-weight: 700; margin-bottom: .6rem; }
.status-pill {
  font-size: .72rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  display: inline-block;
  font-weight: 600;
}
.status-pill.draft { background: var(--border); color: var(--text-muted); }
.status-pill.pending_review { background: #fef3c7; color: #92400e; }
.status-pill.published { background: #d1fae5; color: #065f46; }
.status-pill.archived { background: #fee2e2; color: #991b1b; }

.outcome-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0 1.2rem; }
.outcome-list li { display: flex; gap: .6rem; font-size: .9rem; align-items: flex-start; }
.outcome-list li .check { color: #059669; font-weight: 700; flex-shrink: 0; }
.info-box {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  font-size: .88rem;
}
.info-box h4 { font-size: .85rem; margin-bottom: .4rem; color: var(--accent-dark); }
.team-row, .prereq-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .6rem .9rem;
  margin-bottom: .5rem;
  font-size: .88rem;
}
.team-row .remove-link, .prereq-row .remove-link {
  color: #dc2626;
  cursor: pointer;
  font-size: .78rem;
  background: none;
  border: none;
}
.warning-box {
  background: #fef3c7;
  border: 1px solid #f3c969;
  color: #92400e;
  border-radius: 10px;
  padding: .9rem 1.1rem;
  margin: 1rem 0;
  font-size: .85rem;
}

/* ── Lesson Player (Vibrant Growth) ──────────────────────────────── */
.lesson-player-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .lesson-player-layout { grid-template-columns: 1fr; }
  .lesson-player-sidebar { order: -1; position: static; }
}
.lesson-player-back {
  color: #00658a;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 1rem;
}
.video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  color: #fff;
  background: linear-gradient(135deg,#00658a,#003b52);
  font-size: .95rem;
}
.video-placeholder .big-icon { font-size: 3rem; }
.lesson-info-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.1rem 0 .5rem;
  flex-wrap: wrap;
}
.lesson-info-bar h2 { font-size: 1.25rem; font-weight: 700; color: #1d1b1b; line-height: 1.4; flex: 1; }
.lesson-nav-btns { display: flex; gap: .5rem; flex-shrink: 0; }
.lesson-complete-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #ece7e6;
  border-radius: 1rem;
  margin-top: .9rem;
  flex-wrap: wrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.05);
}
.lesson-complete-bar.done {
  background: #f0faf4;
  border-color: #28a745;
}
.lesson-done-label { color: #1f8a3d; font-weight: 700; font-size: .9rem; }

/* Sidebar */
.lesson-player-sidebar {
  background: #fff;
  border: 1px solid #ece7e6;
  border-radius: 1.25rem;
  overflow: hidden;
  position: sticky;
  top: 80px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
}
.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #ece7e6;
  font-size: .9rem;
  font-weight: 700;
  color: #1d1b1b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-total-dur {
  font-size: .78rem;
  font-weight: 600;
  color: #6b7280;
}
.sidebar-progress-bar {
  height: 6px;
  background: #ece7e6;
}
.sidebar-progress-fill {
  height: 100%;
  background: #fd9000;
  border-radius: 9999px;
  transition: width .3s;
}
.sidebar-lesson-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background .15s;
  font-size: .85rem;
}
.sidebar-lesson-item:last-child { border-bottom: none; }
.sidebar-lesson-item:hover { background: #fef8f8; }
.sidebar-lesson-item.active { background: #e8f4f8; }
.sidebar-lesson-item.locked { opacity: .55; cursor: not-allowed; }
.sidebar-lesson-item.locked:hover { background: none; }
.sidebar-lesson-item.active .sli-title { color: #00658a; font-weight: 700; }
.sli-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; background: #ece7e6; color: #6e7880; }
.sli-icon.done { background: #fde424; color: #3e3700; }
.sli-icon.active { background: #00658a; color: #fff; }
.sli-info { flex: 1; min-width: 0; }
.sli-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; color: #1d1b1b; }
.sli-type { font-size: .72rem; color: #9ca3af; margin-top: .1rem; }

/* ── Section cards ──────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.2rem;
}
.section-card h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--border);
}
.optional-label { font-size: .75rem; font-weight: 400; color: var(--text-muted); }

/* ── Create course form ─────────────────────────── */
.create-layout { max-width: 740px; }
.create-form label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
  margin-top: .95rem;
}
.create-form label:first-of-type { margin-top: 0; }
.create-form input,
.create-form textarea,
.create-form select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .7rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
}
.create-form input:focus,
.create-form textarea:focus,
.create-form select:focus { outline: none; border-color: var(--accent); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row-2 { grid-template-columns: 1fr; } }

.rich-editor { background: var(--bg); border-radius: 8px; overflow: hidden; }
.rich-editor .ql-toolbar { border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: #fff; }
.rich-editor .ql-container { border: 1px solid var(--border); border-radius: 0 0 8px 8px; font-size: .9rem; font-family: inherit; min-height: 140px; }
.create-form input[type="file"],
.edit-pane-form input[type="file"] { padding: .5rem; background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; font-size: .85rem; }

.slug-input-group { display: flex; }
.slug-prefix {
  font-size: .85rem;
  color: var(--text-muted);
  background: var(--border);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: .7rem .75rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.slug-input-group input { border-radius: 0 8px 8px 0; }

.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
  cursor: pointer;
}
.checkbox-card input[type="checkbox"] { margin-top: .15rem; flex-shrink: 0; }
.checkbox-card strong { display: block; font-size: .88rem; }
.checkbox-card span { font-size: .78rem; color: var(--text-muted); }
.checkbox-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.thumb-preview-box {
  margin-top: .8rem;
  height: 150px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .85rem;
  overflow: hidden;
}
.thumb-preview-box img { width: 100%; height: 100%; object-fit: cover; }

/* ── Buttons ────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .72rem 1.6rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  font-size: .9rem;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger {
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  padding: .38rem .85rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #fee2e2; }
.btn-secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .38rem .85rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: none;
  border: none;
  color: var(--accent);
  padding: .38rem .7rem;
  font-size: .8rem;
  cursor: pointer;
}
.form-actions { margin-top: 1.5rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.save-msg { font-size: .83rem; color: #059669; }

/* ── Manage page tabs ───────────────────────────── */
.course-manage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.manage-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.manage-tab {
  background: none;
  border: none;
  padding: .65rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.manage-tab:hover { color: var(--text); }
.manage-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.manage-pane { display: none; }
.manage-pane.active { display: block; }

/* ── Instructor course list (rows) ──────────────── */
.inst-course-list { display: flex; flex-direction: column; gap: .75rem; }
.inst-course-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  transition: border-color .15s;
}
.inst-course-row:hover { border-color: var(--accent); }
.inst-course-thumb {
  width: 80px;
  height: 58px;
  border-radius: 8px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  overflow: hidden;
}
.inst-course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inst-course-info { flex: 1; min-width: 0; }
.inst-course-info h3 { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst-course-info p { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.inst-course-actions { display: flex; flex-shrink: 0; gap: .5rem; align-items: center; }

/* ── Lesson manage rows ─────────────────────────── */
.lesson-manage-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: .55rem;
}
.lesson-manage-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem 1rem;
}
.lesson-order-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lesson-manage-title { flex: 1; font-size: .9rem; font-weight: 600; }
.lesson-manage-meta { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; }
.lesson-manage-btns { display: flex; gap: .4rem; flex-shrink: 0; }
.lesson-edit-panel {
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--border);
  display: none;
  background: var(--bg);
  border-radius: 0 0 10px 10px;
}
.lesson-edit-panel.open { display: block; }
.lesson-edit-panel label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .3rem;
  margin-top: .75rem;
}
.lesson-edit-panel label:first-child { margin-top: 0; }
.lesson-edit-panel input,
.lesson-edit-panel select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .6rem .8rem;
  border-radius: 8px;
  font-size: .85rem;
  font-family: inherit;
}
.lesson-edit-panel input:focus,
.lesson-edit-panel select:focus { outline: none; border-color: var(--accent); }
.lesson-edit-actions { display: flex; gap: .6rem; margin-top: .85rem; align-items: center; }

.add-lesson-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--accent);
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  background: none;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: .75rem 1.2rem;
  width: 100%;
  margin-top: .8rem;
}
.add-lesson-btn:hover { background: var(--accent-soft); }
.add-lesson-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin-top: .6rem;
  display: none;
}
.add-lesson-form.open { display: block; }
.add-lesson-form label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .3rem;
  margin-top: .75rem;
}
.add-lesson-form label:first-child { margin-top: 0; }
.add-lesson-form input,
.add-lesson-form select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .6rem .8rem;
  border-radius: 8px;
  font-size: .85rem;
  font-family: inherit;
}
.add-lesson-form input:focus,
.add-lesson-form select:focus { outline: none; border-color: var(--accent); }
.add-lesson-form-actions { display: flex; gap: .6rem; margin-top: .85rem; }

/* ── Edit form inside tabs ──────────────────────── */
.edit-pane-form label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
  margin-top: .9rem;
}
.edit-pane-form label:first-child { margin-top: 0; }
.edit-pane-form input,
.edit-pane-form textarea,
.edit-pane-form select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .65rem .85rem;
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
}
.edit-pane-form input:focus,
.edit-pane-form textarea:focus,
.edit-pane-form select:focus { outline: none; border-color: var(--accent); }

/* ── Publish pane ───────────────────────────────── */
.publish-status-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.2rem;
}
.publish-status-card h4 { font-size: .9rem; margin-bottom: .5rem; }

footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 3%;
  background: var(--surface);
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
.footer-col h4 { font-size: .9rem; margin-bottom: .8rem; }
.footer-col p { font-size: .85rem; margin-bottom: .5rem; }
.footer-col a { color: var(--accent); text-decoration: none; }

/* ─── Quiz ─────────────────────────────────────────────────── */
.quiz-list-row { border-radius: 10px; overflow: hidden; margin: .35rem 0; }
.quiz-row-header {
  cursor: pointer; user-select: none;
  background: linear-gradient(90deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  transition: background .15s;
  margin: 0 !important;
}
.quiz-list-row:last-child .quiz-row-header { background: linear-gradient(90deg, #f0fdf4 0%, #dcfce7 100%); border-color: #86efac; }
.quiz-row-header:hover { filter: brightness(.97); }
.quiz-row-toggle { pointer-events: none; font-size: .78rem; }
.quiz-row-body { padding: 1rem 1rem 1.2rem; background: var(--surface); border: 1.5px solid #e5e7eb; border-top: none; border-radius: 0 0 10px 10px; }
.quiz-inline-inner { max-width: 640px; }

.quiz-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.quiz-progress-label { font-size: .85rem; color: var(--muted); }
.quiz-progress-bar { height: 6px; background: var(--border); border-radius: 99px; margin-bottom: 1.5rem; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--accent); transition: width .3s; }

.quiz-questions { display: flex; flex-direction: column; gap: 1.2rem; }
.quiz-question-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 1.2rem 1.4rem;
}
.quiz-q-num { font-size: .78rem; color: var(--muted); margin-bottom: .4rem; }
.quiz-q-text { font-weight: 600; font-size: 1rem; margin-bottom: .9rem; line-height: 1.5; }
.quiz-choices { display: flex; flex-direction: column; gap: .5rem; }
.quiz-choice {
  display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem;
  border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer;
  transition: border-color .15s, background .15s; user-select: none;
}
.quiz-choice:hover { border-color: var(--accent); }
.quiz-choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.quiz-choice-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; transition: border-color .15s, background .15s;
}
.quiz-choice.selected .quiz-choice-dot { border-color: var(--accent); background: var(--accent); }

.quiz-submit-row { margin-top: 1.5rem; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }

/* Result */
.quiz-result-header { display: flex; gap: 1.5rem; align-items: center; margin: 1rem 0 1.5rem; flex-wrap: wrap; }
.quiz-score-circle {
  width: 110px; height: 110px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.quiz-score-circle.pass { background: #dcfce7; color: #15803d; border: 3px solid #86efac; }
.quiz-score-circle.fail { background: #fee2e2; color: #b91c1c; border: 3px solid #fca5a5; }
.qsc-pct { font-size: 1.6rem; }
.qsc-label { font-size: .8rem; }
.text-success { color: #15803d; font-weight: 600; }
.text-danger  { color: #b91c1c; font-weight: 600; }

.quiz-result-detail { display: flex; flex-direction: column; gap: .75rem; margin-top: .75rem; }
.quiz-result-item { display: flex; gap: .9rem; padding: .9rem 1rem; border-radius: 10px; border: 1.5px solid var(--border); }
.quiz-result-item.correct { border-color: #86efac; background: #f0fdf4; }
.quiz-result-item.wrong   { border-color: #fca5a5; background: #fff1f2; }
.qri-num { font-weight: 700; min-width: 24px; }
.qri-text { margin-bottom: .3rem; font-weight: 500; }
.qri-answer { font-size: .87rem; }

/* Quiz manage (instructor) */
.quiz-manage-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.qmt-btn { padding: .45rem 1rem; border-radius: 8px; border: 1.5px solid var(--border); background: transparent; cursor: pointer; font-size: .87rem; }
.qmt-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.qmt-pane { }
.qmq-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.qmq-item { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: .9rem 1rem; }
.qmq-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .5rem; }
.qmq-num { font-size: .78rem; color: var(--muted); flex-shrink: 0; }
.qmq-text { flex: 1; font-weight: 500; }
.btn-sm { padding: .25rem .7rem; font-size: .78rem; }
.qmq-choices { display: flex; flex-direction: column; gap: .25rem; padding-left: .5rem; }
.qmq-choice { font-size: .85rem; color: var(--muted); }
.qmq-choice.correct { color: #15803d; font-weight: 600; }
.qmq-add-form { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 1rem; }
.qmq-add-form h4 { margin-bottom: .75rem; }
.qmq-text-input { width: 100%; resize: vertical; }
.qmq-choices-input { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.qmq-choice-row { display: flex; align-items: center; gap: .6rem; }
.qmq-correct-radio { display: flex; align-items: center; gap: .3rem; font-size: .82rem; white-space: nowrap; }
.qmq-choice-text { flex: 1; }

/* ─── Lesson Quiz Player ────────────────────────────────────── */
#lessonQuizArea { margin-top: 1rem; }
.lesson-quiz-card { background: var(--surface); border: 1.5px solid var(--accent); border-radius: 12px; overflow: hidden; }
.lqc-header { background: var(--accent-soft); padding: .75rem 1.2rem; font-weight: 700; font-size: .9rem; color: var(--accent); }
.lqc-body { padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .9rem; }
.lqc-question {}
.lqc-qnum { font-size: .75rem; color: var(--muted); }
.lqc-qtext { font-weight: 600; margin: .25rem 0 .6rem; }
.lqc-choices { display: flex; flex-direction: column; gap: .35rem; }
.lqc-choice {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem;
  border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer;
  transition: border-color .15s, background .15s; font-size: .88rem;
}
.lqc-choice:hover { border-color: var(--accent); }
.lqc-choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.lqc-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.lqc-choice.selected .lqc-dot { background: var(--accent); border-color: var(--accent); }
.lqc-submit-row { display: flex; align-items: center; gap: .6rem; margin-top: .4rem; }
.lqc-result { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; border-radius: 8px; font-weight: 700; }
.lqc-result.pass { background: #dcfce7; color: #15803d; }
.lqc-result.fail { background: #fee2e2; color: #b91c1c; }
.lqcr-score { font-size: 1.4rem; }
.lqc-detail { display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; font-size: .83rem; }
.lqcd-item { padding: .3rem .6rem; border-radius: 6px; }
.lqcd-item.ok { background: #f0fdf4; color: #15803d; }
.lqcd-item.ng { background: #fff1f2; color: #b91c1c; }

/* ─── Lesson quiz manage (inside edit panel) ─────────────────── */
.lesson-quiz-details { margin-top: 1rem; border-top: 1px dashed var(--border); padding-top: .75rem; }
.lesson-quiz-details summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--accent); user-select: none; }
.lesson-quiz-box { margin-top: .75rem; }
.qmq-add-form-sm { padding: .75rem; }
.qmq-sm .qmq-header { gap: .5rem; }
.qmq-sm .qmq-text { font-size: .85rem; }

/* ─── Shared-quiz toggle ─────────────────────────────────────── */
.qmq-shared-toggle { display: flex; align-items: center; gap: .4rem; font-size: .83rem; color: var(--muted); margin: .4rem 0; cursor: pointer; }

/* ─── Quiz edit panel & shuffle badge ─────────────────── */
.qmq-edit-panel { display: none; padding: .75rem; background: var(--bg); border-top: 1px dashed var(--border); border-radius: 0 0 8px 8px; margin-top: .5rem; }
.qmq-edit-panel.open { display: block; }
.qmq-edit-panel textarea, .qmq-edit-panel input[type="text"] { width: 100%; margin-bottom: .4rem; }
.qmq-actions { display: flex; gap: .35rem; margin-left: auto; flex-shrink: 0; }
.qmq-meta { margin: .2rem 0 .4rem; }
.qmq-shuffle-badge { font-size: .72rem; padding: .15rem .5rem; border-radius: 99px; font-weight: 600; }
.qmq-shuffle-badge.on  { background: #dbeafe; color: #1d4ed8; }
.qmq-shuffle-badge.off { background: #f1f5f9; color: #64748b; }

/* ─── Quiz order buttons ────────────────────────── */
.qmq-order-btns { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.qob {
  width: 22px; height: 18px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); font-size: .65rem; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s;
}
.qob:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.qob:disabled { opacity: .3; cursor: default; }

/* ─── Modal overlay (hero slide editor, etc.) ─────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: 16px; padding: 1.75rem;
  width: 100%; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.btn-outline {
  background: none; border: 1px solid var(--border); color: var(--text);
  padding: .55rem 1.1rem; border-radius: 8px; font-size: .9rem; cursor: pointer;
  font-family: inherit;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Hero slide admin list ───────────────────────────── */
.hero-slide-admin-card {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: .7rem;
  background: var(--surface);
}
.hero-slide-admin-card .hs-preview {
  width: 90px; height: 54px; border-radius: 8px; flex-shrink: 0;
  background-size: cover; background-position: center;
}
.hero-slide-admin-card .hs-info { flex: 1; min-width: 0; }
.hero-slide-admin-card .hs-info strong { display: block; font-size: .92rem; }
.hero-slide-admin-card .hs-info span { display: block; font-size: .78rem; color: var(--text-muted); }
.hero-slide-admin-card .hs-actions { display: flex; gap: .35rem; flex-shrink: 0; }
.hs-inactive-badge { font-size: .7rem; padding: .15rem .5rem; border-radius: 99px; background: #f1f5f9; color: #64748b; margin-left: .4rem; }

/* ─── Admin dashboard ──────────────────────────────────── */
.admin-stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.2rem; display: flex; flex-direction: column; gap: .5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.admin-stat-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 1.15rem; color: #fff;
}
.admin-stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text); line-height: 1; }
.admin-stat-label { font-size: .8rem; color: var(--text-muted); }

.admin-quick-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.1rem 1.2rem; display: flex; align-items: center; gap: 1rem; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.admin-quick-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0,101,138,.1); transform: translateY(-2px); }
.admin-quick-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.admin-quick-card h4 { font-size: .95rem; font-weight: 700; margin-bottom: .2rem; color: var(--text); }
.admin-quick-card p { font-size: .8rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.admin-quick-arrow { margin-left: auto; color: var(--text-muted); font-size: 1.1rem; flex-shrink: 0; }

.admin-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.6rem; margin-bottom: 1.5rem;
}
.admin-panel h3 { font-size: 1.05rem; color: var(--primary, var(--accent)); margin-bottom: 1rem; }
