/* ============================================================
   ROOT VARIABLES
============================================================ */
:root {
  --yellow: #ffcc00;
  --yellow-dim: rgba(255,204,0,.12);
  --yellow-glow: rgba(255,204,0,.25);
  --dark: #0a0a0a;
  --dark2: #111;
  --dark3: #1a1a1a;
  --border: rgba(255,255,255,.08);
  --text-primary: #f0f0f0;
  --text-muted: #888;
  --bg: #f5f5f5;
  --white: #ffffff;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 12px;
  --sidebar-w: 300px;
  --topbar-h: 64px;
  --mobile-nav-h: 56px;
  --transition: 0.2s ease;
  --shadow-card: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18);
}

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: #111;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Syne', sans-serif; }

/* ============================================================
   TOPBAR
============================================================ */
.topbar {
  background: var(--dark);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 120;
  height: var(--topbar-h);
}

.topbar-inner {
  max-width: 1400px;
  margin: auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: var(--yellow);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: #000;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-text h1 {
  color: var(--yellow);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-text p {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.controls input[type="text"],
.controls select {
  background: var(--dark3);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.controls input[type="text"] {
  padding: 8px 12px 8px 32px;
  width: 220px;
}

.controls input[type="text"]:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-dim);
}

.controls select {
  padding: 8px 10px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.controls select:focus {
  outline: none;
  border-color: var(--yellow);
}

/* ============================================================
   MOBILE NAV
============================================================ */
.mobile-nav {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--dark2);
  border-bottom: 1px solid var(--border);
  height: var(--mobile-nav-h);
  position: sticky;
  top: var(--topbar-h);
  z-index: 115;
}

#sidebarToggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

#sidebarToggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--yellow);
  border-radius: 2px;
  transition: var(--transition);
}

.mobile-nav-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.mobile-controls {
  margin-left: auto;
}

.mobile-controls input[type="text"] {
  width: 130px;
}

/* ============================================================
   OVERLAY
============================================================ */
#sidebarOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;
  z-index: 98;
  backdrop-filter: blur(2px);
}

/* ============================================================
   HERO BANNER
============================================================ */
.home-banner {
  height: 220px;
  background: var(--dark);
  background-image: url("./image/banner-img.png");
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 32px 24px;
  overflow: hidden;
}

.banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,.9) 0%, rgba(0,0,0,.5) 100%);
}

.banner-content, .banner-stats {
  position: relative;
  z-index: 2;
}

.banner-tag {
  display: inline-block;
  background: var(--yellow);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.banner-title {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.banner-sub {
  font-size: 13px;
  color: rgba(255,255,255,.6);
  margin-top: 4px;
}

.banner-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat {
  text-align: center;
}

.stat span {
  display: block;
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--yellow);
  line-height: 1;
}

.stat small {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.15);
}

/* ============================================================
   DASHBOARD LAYOUT
============================================================ */
.dashboard {
  display: flex;
  min-height: calc(100vh - 220px - var(--topbar-h) - 48px);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--dark);
  color: var(--text-primary);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--dark);
  z-index: 2;
}

.sidebar-header span {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.sidebar-close:hover {
  color: var(--text-primary);
  background: var(--dark3);
}

/* Role section label */
.sidebar-role-label {
  padding: 16px 18px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.sidebar-role-label:first-child {
  border-top: none;
}

/* Topic header */
.sidebar-topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  user-select: none;
  gap: 8px;
}

.sidebar-topic-header:hover {
  background: var(--dark3);
}

.sidebar-topic-header .topic-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.sidebar-topic-header.is-open .topic-arrow {
  transform: rotate(90deg);
}

.sidebar-topic-count {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--dark3);
  padding: 1px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* Video list */
.sidebar-video-list {
  display: none;
  background: #0e0e0e;
}

.sidebar-video-list.open {
  display: block;
}

.sidebar-video {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px 10px 26px;
  font-size: 13px;
  cursor: pointer;
  color: rgba(255,255,255,.65);
  transition: background var(--transition), color var(--transition);
  border-bottom: 1px solid rgba(255,255,255,.04);
  line-height: 1.4;
}

.sidebar-video:hover {
  background: var(--dark3);
  color: #fff;
}

.sidebar-video.active {
  background: var(--yellow-dim);
  color: var(--yellow);
  font-weight: 600;
  border-left: 3px solid var(--yellow);
  padding-left: 23px;
}

.sidebar-video .video-num {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.sidebar-video.active .video-num {
  color: var(--yellow);
  opacity: .6;
}

/* ============================================================
   CONTENT AREA
============================================================ */
.content {
  flex: 1;
  padding: 28px;
  background: var(--bg);
  min-width: 0;
}

/* Placeholder */
.player-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 12px;
  color: #aaa;
  text-align: center;
}

.placeholder-icon {
  width: 64px;
  height: 64px;
  background: #e8e8e8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #bbb;
  margin-bottom: 4px;
}

.player-placeholder h3 {
  font-size: 18px;
  color: #555;
}

.player-placeholder p {
  font-size: 13px;
  color: #aaa;
}

/* Video player */
.video-wrapper {
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.video-meta {
  margin-bottom: 16px;
}

.video-meta .topic-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #000;
  background: var(--yellow);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.video-meta h2 {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  margin-bottom: 8px;
}

.video-meta p {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  max-width: 720px;
}

.video-frame {
  position: relative;
  padding-top: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}

.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ============================================================
   QUIZ
============================================================ */
.quiz {
  background: var(--white);
  border: 1px solid #e8e8e8;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.quiz-header-icon {
  width: 34px;
  height: 34px;
  background: #fff8db;
  border: 2px solid var(--yellow);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.quiz-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

.quiz-header p {
  font-size: 12px;
  color: #999;
}

.quiz-question {
  margin-bottom: 22px;
}

.quiz-question > p {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  margin-bottom: 12px;
  line-height: 1.5;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin: 6px 0;
  border: 1.5px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: #333;
  transition: border-color var(--transition), background var(--transition), transform 0.1s ease;
  user-select: none;
}

.quiz-option:hover {
  border-color: #ccc;
  background: #fafafa;
}

.quiz-option input { display: none; }

.quiz-option .opt-dot {
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-radius: 50%;
  flex-shrink: 0;
  transition: border-color var(--transition), background var(--transition);
}

.quiz-option.selected {
  border-color: var(--yellow);
  background: #fff8db;
}

.quiz-option.selected .opt-dot {
  border-color: var(--yellow);
  background: var(--yellow);
}

.quiz-option.correct {
  border-color: var(--green);
  background: #f0fdf4;
}

.quiz-option.correct .opt-dot {
  border-color: var(--green);
  background: var(--green);
}

.quiz-option.wrong {
  border-color: var(--red);
  background: #fef2f2;
}

.quiz-option.wrong .opt-dot {
  border-color: var(--red);
  background: var(--red);
}

.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.quiz-submit {
  padding: 10px 22px;
  background: #111;
  color: var(--yellow);
  border: none;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
  letter-spacing: 0.3px;
}

.quiz-submit:hover { background: #222; }
.quiz-submit:active { transform: scale(0.97); }
.quiz-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quiz-result {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-result.pass { color: var(--green); }
.quiz-result.fail { color: var(--red); }

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state {
  padding: 40px 18px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p { font-size: 13px; }

/* ============================================================
   FOOTER
============================================================ */
.footer {
  background: var(--dark);
  color: #555;
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.footer-dot { color: #333; }

/* ============================================================
   PASSWORD MODAL
============================================================ */
.password-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.password-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.lock-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.password-box h3 {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  margin-bottom: 6px;
}

.password-box > p {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  width: 100%;
  padding: 12px 42px 12px 14px;
  font-size: 14px;
  border-radius: 10px;
  border: 1.5px solid #e5e5e5;
  font-family: 'DM Sans', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.password-input-wrap input:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-dim);
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #999;
  padding: 0;
  line-height: 1;
}

.password-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.password-actions button {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  transition: background var(--transition), transform 0.1s;
}

.password-actions button:active { transform: scale(0.97); }

.btn-cancel { background: #f2f2f2; color: #555; }
.btn-cancel:hover { background: #e8e8e8; }
.btn-unlock { background: #111; color: var(--yellow); }
.btn-unlock:hover { background: #222; }

.password-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  min-height: 18px;
}

/* ============================================================
   RESPONSIVE – TABLET / MOBILE
============================================================ */
@media (max-width: 1024px) {
  .topbar { display: none; }

  .mobile-nav { display: flex; top: 0; }

  .home-banner { top: var(--mobile-nav-h); }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 290px;
    height: 100vh;
    z-index: 100;
    transition: left 0.3s cubic-bezier(.4,0,.2,1);
  }

  .sidebar.open { left: 0; }

  .sidebar-close { display: block; }

  #sidebar-root { padding-bottom: 40px; }

  body.sidebar-open { overflow: hidden; }

  .content { padding: 16px; }

  .home-banner {
    height: 160px;
    padding: 0 20px 16px;
  }

  .banner-title { font-size: 24px; }

  .banner-stats { display: none; }
}

@media (max-width: 600px) {
  .mobile-controls input[type="text"] { width: 100px; }

  .video-meta h2 { font-size: 18px; }

  .quiz { padding: 16px; }

  .content { padding: 12px; }

  .banner-content { display: block; }
}

@media (max-width: 380px) {
  .mobile-controls select { display: none; }
  .mobile-controls input[type="text"] { width: 85px; }
}