/* =====================================================
   PDS Academy — Stylesheet
   Colour palette:
     Topbar bg         : #1c2e3d
     Topbar hover      : #243747
     Active nav text   : #f39c12  (amber)
     Content area bg   : #edf1f5
     Card bg           : #ffffff
     Card border       : #dde3e9
     Body text         : #333d47
     Muted             : #7f8c99
     Cyan accent       : #3ecfda
     Cyan dark         : #2ab0bb
     Green (complete)  : #27ae60
     Amber (in-prog)   : #f39c12
     Red (not-started) : #e74c3c
===================================================== */

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #edf1f5;
  color: #333d47;
  font-size: 15px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ───────────────────────────────────────────────────────────── */
.topbar {
  background: #003B5C;
  padding: 0 28px;
  display: flex;
  align-items: center;
  height: 112px;
  box-shadow: 0 2px 8px rgba(0,59,92,.25);
  position: sticky;
  top: 0;
  z-index: 200;
  flex-shrink: 0;
}

.logo-group { display: flex; align-items: center; flex-shrink: 0; }
.logo-group img { height: 76px; width: auto; padding: 4px; }
.topbar-divider { width: 1px; height: 60px; background: rgba(255,255,255,.18); margin: 0 24px; }

/* ── Top Nav ───────────────────────────────────────────────────────────── */
.topbar-nav { display: flex; align-items: stretch; flex: 1; }
.tab { padding: 0 20px; color: #fff; font-family: 'Inter', sans-serif; font-weight: 600;
       font-size: 14px; letter-spacing: .1px; cursor: pointer; display: flex;
       align-items: center; transition: color .2s; white-space: nowrap; }
.tab:hover  { color: #F08020; }
.tab.active { color: #F08020; }
.tab.disabled { opacity: 0.3; pointer-events: none; }

/* ── Topbar user badge (injected by JS) ────────────────────────────────── */
.topbar-user { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-user-name { color: #fff; font: 500 13px 'Inter', sans-serif; white-space: nowrap; }
.topbar-user-btns { display: flex; align-items: center; gap: 10px; }
.topbar-btn { padding: 8px 18px; background: #3ecfda; color: #003B5C;
              border: 1.5px solid #3ecfda; border-radius: 4px;
              font: 600 13px 'Inter', sans-serif; cursor: pointer;
              transition: all .2s; white-space: nowrap; }
.topbar-btn:hover { background: #fff; border-color: #fff; color: #003B5C; }

/* ── Body Layout ───────────────────────────────────────────────────────── */
#layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #edf1f5;
}
#content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Pages ─────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Section heading ───────────────────────────────────────────────────── */
.section-head {
  font-size: 15px;
  font-weight: 700;
  color: #333d47;
  padding-bottom: 8px;
  border-bottom: 2px solid #3ecfda;
  margin-bottom: 14px;
}

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border: 1px solid #dde3e9;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

/* ── Table ─────────────────────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #c8d4de;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th:first-child { border-radius: 8px 0 0 0; }
thead th:last-child  { border-radius: 0 8px 0 0; }
tbody tr:last-child td:first-child { border-radius: 0 0 0 8px; }
tbody tr:last-child td:last-child  { border-radius: 0 0 8px 0; }

thead th {
  background: #123a5a;
  color: #e2eff5;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 10px;
  text-align: left;
  border-bottom: 2px solid #0b2740;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: #3ecfda; }
thead th.sorted { color: #3ecfda; }

tbody tr { border-bottom: 1px solid #eceff3; transition: background 0.1s; }
tbody tr:hover { background: #f7fafc; }
tbody td { padding: 6px 8px; color: #333d47; vertical-align: middle; }

tbody tr.row-complete { background: #f0faf4; }
tbody tr.row-complete:hover { background: #e8f6ee; }

/* ── Status badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-ns     { background: #ecf0f1; color: #7f8c8d; }
.badge-ns-red { background: #fdedec; color: #e74c3c; border: 1px solid #f5c6c2; }
.badge-ip     { background: #fef9ec; color: #e67e22; border: 1px solid #f5d98e; }
.badge-cmp    { background: #eafaf1; color: #27ae60; border: 1px solid #a9dfbf; }
.badge-asgn   { background: #eaf4fb; color: #2980b9; border: 1px solid #aed6f1; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 13px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-cyan    { background: #3ecfda; color: #fff; border-color: #3ecfda; }
.btn-cyan:hover { background: #2ab0bb; border-color: #2ab0bb; }
.btn-outline { background: transparent; color: #3ecfda; border-color: #3ecfda; }
.btn-outline:hover { background: rgba(62,207,218,0.08); }
.btn-ghost   { background: transparent; color: #7f8c99; border-color: #dde3e9; }
.btn-ghost:hover { border-color: #b0c4d4; color: #333d47; }
.btn-red     { background: transparent; color: #e74c3c; border-color: #e74c3c; }
.btn-red:hover { background: rgba(231,76,60,0.08); }
.btn-green   { background: transparent; color: #27ae60; border-color: #27ae60; }
.btn-green:hover { background: rgba(39,174,96,0.08); }
.btn-sm      { padding: 3px 9px; font-size: 12px; }
.btn:disabled, .btn.dis { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.btn-group   { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid #dde3e9; margin-bottom: 16px; }
.tab-btn {
  padding: 8px 18px;
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; cursor: pointer;
  color: #7f8c99; font-family: 'Lato', sans-serif;
  font-size: 13px; font-weight: 700;
  transition: all 0.15s;
}
#page-management > .tabs > .tab-btn,
#page-administration > .tabs > .tab-btn {
  font-size: 16px;
  padding: 10px 22px;
}
.tab-btn:hover  { color: #333d47; }
.tab-btn.active { color: #3ecfda; border-bottom-color: #3ecfda; }
.tab-pane         { display: none; }
.tab-pane.active  { display: block; }

/* ── Form controls ─────────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=number],
input[type=email], select, textarea {
  background: #fff;
  border: 1px solid #ccd4dc;
  color: #333d47;
  padding: 6px 10px;
  border-radius: 3px;
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: #3ecfda; }

thead select {
  background: #24425d;
  border: 1px solid #2d5470;
  color: #e2eff5;
  padding: 3px 4px;
  font-size: 12px;
}
thead select option { background: #123a5a; color: #e2eff5; }
thead input[type=date] {
  background: #24425d;
  border: 1px solid #2d5470;
  color: #e2eff5;
  font-size: 11px;
  padding: 2px 4px;
}
input[type=checkbox] { accent-color: #3ecfda; width: 13px; height: 13px; cursor: pointer; }
label.cb-label {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 13px; font-weight: 400; color: #5a6878;
}

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.tbl-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; flex-wrap: wrap;
}

/* ── Filter row inputs ─────────────────────────────────────────────────── */
.filter-inp {
  padding: 4px 7px;
  font-size: 12px;
  width: 100%;
  border: 1px solid #2d5470;
  background: #24425d;
  color: #e2eff5;
  border-radius: 2px;
}
.filter-inp::placeholder { color: #7aaac4; }

/* ── Prereq tags ───────────────────────────────────────────────────────── */
.prereq-tag {
  display: inline-block;
  background: #eaf4fb; color: #2980b9;
  border: 1px solid #aed6f1;
  border-radius: 3px;
  font-size: 11px; padding: 1px 5px; margin: 1px;
  white-space: nowrap;
}
.prereq-overflow {
  display: inline-block;
  background: #f4f7fa; color: #4a6478;
  border: 1px solid #ccd4dc;
  border-radius: 3px;
  font-size: 11px; padding: 1px 5px; margin: 1px;
  white-space: nowrap;
  cursor: help;
}
.cell-truncate {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

/* ── Approval badge ────────────────────────────────────────────────────── */
.needs-approval {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: #e67e22;
  background: #fef9ec; border: 1px solid #f5d98e;
  border-radius: 3px; padding: 1px 6px; margin-top: 3px;
}

/* ══ MODAL ════════════════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(10,20,30,0.65);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: 8px;
  border-top: 3px solid #3ecfda;
  width: 100%; max-width: 860px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.modal-sm  { max-width: 420px; }
.modal-lg  { max-width: 1200px; }
.modal-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid #eceff3;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: #f8fafc;
}
.modal-hdr h3 { font-size: 14px; font-weight: 700; color: #1c2e3d; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: #7f8c99; font-size: 18px; padding: 2px 6px;
  border-radius: 3px; line-height: 1;
}
.modal-close:hover { background: #eceff3; color: #333d47; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-ftr {
  padding: 12px 18px;
  border-top: 1px solid #eceff3;
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0; background: #f8fafc;
}

/* ══ QUIZ OVERLAY ═════════════════════════════════════════════════════════ */
#quiz-overlay {
  display: none;
  position: fixed; inset: 0;
  background: #edf1f5;
  z-index: 600; overflow-y: auto; padding: 30px;
}
#quiz-overlay.active { display: block; }
.quiz-topbar {
  max-width: 760px; margin: 0 auto 20px;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.quiz-module-code  { font-size: 12px; font-weight: 700; color: #3ecfda; }
.quiz-module-title { font-size: 18px; font-weight: 900; color: #1c2e3d; margin: 2px 0 4px; }
.quiz-meta         { font-size: 12px; color: #7f8c99; }
.q-card {
  max-width: 760px; margin: 0 auto 12px;
  background: #fff; border: 1px solid #dde3e9;
  border-radius: 4px; padding: 18px;
}
.q-meta { font-size: 11px; font-weight: 700; color: #7f8c99; margin-bottom: 6px; }
.q-text { font-size: 15px; font-weight: 700; color: #1c2e3d; margin-bottom: 14px; }
.q-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid #dde3e9; border-radius: 3px;
  cursor: pointer; transition: all 0.12s; font-size: 14px;
}
.q-opt:hover { border-color: #3ecfda; background: rgba(62,207,218,0.06); }
.q-opt.sel   { border-color: #3ecfda; background: rgba(62,207,218,0.10); }
.q-opt.ok    { border-color: #27ae60; background: #eafaf1; }
.q-opt.wrong { border-color: #e74c3c; background: #fdedec; }
.q-opt-letter { font-weight: 900; color: #3ecfda; min-width: 18px; font-size: 13px; }
.quiz-actions { max-width: 760px; margin: 16px auto; display: flex; justify-content: flex-end; gap: 10px; }

/* ══ VIDEO OVERLAY ════════════════════════════════════════════════════════ */
#video-overlay {
  display: none;
  position: fixed; inset: 0;
  background: #000;
  z-index: 600;
  flex-direction: column;
}
#video-overlay.active { display: flex; }
.vid-bar {
  background: #1c2e3d; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  border-bottom: 2px solid #3ecfda;
}
.vid-bar .vid-title { font-size: 15px; font-weight: 700; color: #fff; }
.vid-bar .vid-sub   { font-size: 12px; color: #7fa8c0; }
#video-frame-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
#video-frame-wrap iframe { width: 100%; height: 100%; max-width: 1100px; }

/* ══ TOAST ════════════════════════════════════════════════════════════════ */
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: #1c2e3d; border: 1px solid #3ecfda; border-left: 4px solid #3ecfda;
  color: #fff; padding: 11px 16px; border-radius: 3px;
  font-size: 13px; z-index: 9999; max-width: 480px;
  transform: translateX(calc(100% + 40px)); transition: transform 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
#toast.show  { transform: translateX(0); }
#toast.t-ok  { border-color: #27ae60; border-left-color: #27ae60; }
#toast.t-err { border-color: #e74c3c; border-left-color: #e74c3c; }

/* ── Date Picker ───────────────────────────────────────────────────────── */
.date-picker-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: #24425d; border: 1px solid #2d5470;
  color: #e2eff5; padding: 3px 8px; border-radius: 3px;
  font-size: 12px; cursor: pointer; white-space: nowrap;
  font-family: 'Lato', sans-serif; transition: border-color 0.15s;
}
.date-picker-btn:hover, .date-picker-btn.active { border-color: #3ecfda; color: #3ecfda; }
.date-picker-btn .dp-icon { color: #ffffff; flex-shrink: 0; }
.date-popup {
  position: fixed; z-index: 8000;
  background: #fff; border: 1px solid #dde3e9;
  border-radius: 8px; border-top: 3px solid #3ecfda;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  width: 230px; padding: 0; display: none;
}
.date-popup.open { display: block; }
.dp-tabs { display: flex; border-bottom: 1px solid #eceff3; }
.dp-tab {
  flex: 1; padding: 8px 10px; text-align: center;
  font-size: 12px; font-weight: 700; cursor: pointer;
  color: #7f8c99; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s;
}
.dp-tab.active { color: #3ecfda; border-bottom-color: #3ecfda; }
.dp-body { padding: 12px; }
.dp-label { font-size: 11px; font-weight: 700; color: #4a6478; margin-bottom: 4px; }
.dp-input {
  width: 100%; padding: 6px 8px; font-size: 13px;
  border: 1px solid #ccd4dc; border-radius: 3px;
  font-family: 'Lato', sans-serif; color: #333d47;
  box-sizing: border-box; margin-bottom: 8px;
}
.dp-input:focus { border-color: #3ecfda; outline: none; }
.dp-input::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; opacity: 0.8; }
.dp-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 12px; border-top: 1px solid #eceff3; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #eceff3; }
::-webkit-scrollbar-thumb { background: #c0ccd8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3ecfda; }

/* ── Utilities ─────────────────────────────────────────────────────────── */
.cyan    { color: #3ecfda; }
.muted   { color: #7f8c99; }
.empty-msg { text-align: center; padding: 36px; color: #aab4be; font-size: 14px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: #4a6478; margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea { width: 100%; }
