/* ─────────────────────────────────────────────────────────────────────
   NHQA brand stylesheet — overrides on top of Bootstrap 5 + AdminLTE 4.
   New Horizons Nigeria · Quality Assurance platform.
   Palette extracted from the official New Horizons logo.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Brand colours */
  --brand-imperial:       #2c2a6b;
  --brand-imperial-dark:  #1f1d4d;
  --brand-imperial-light: #4a479a;
  --brand-pumpkin:        #f3700a;
  --brand-pumpkin-dark:   #c45a08;
  --brand-sky:            #21bddc;
  --brand-sky-tint:       #d4f1f8;
  --brand-white:          #fcfcfb;

  /* Neutrals */
  --brand-text:           #212529;
  --brand-muted:          #6c757d;
  --brand-border:         #e5e5ee;
  --brand-surface:        #ffffff;
  --brand-surface-alt:    #f7f7f9;

  /* Bootstrap 5 overrides */
  --bs-primary:           var(--brand-imperial);
  --bs-primary-rgb:       44, 42, 107;
  --bs-link-color:        var(--brand-imperial);
  --bs-link-color-rgb:    44, 42, 107;
  --bs-link-hover-color:  var(--brand-pumpkin);
  --bs-body-bg:           var(--brand-white);
  --bs-body-color:        var(--brand-text);
}

/* ── Typography ────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--brand-white);
  color: var(--brand-text);
}

/* ── AdminLTE 4 sidebar — imperial-blue brand ─────────────────────── */
.app-sidebar {
  --lte-sidebar-bg:                  var(--brand-imperial);
  --lte-sidebar-color:               rgba(255, 255, 255, .82);
  --lte-sidebar-header-color:        rgba(255, 255, 255, .45);
  --lte-sidebar-hover-bg:            rgba(255, 255, 255, .06);
  --lte-sidebar-hover-color:         #ffffff;
  --lte-sidebar-active-color:        #ffffff;
  --lte-sidebar-menu-active-bg:      rgba(243, 112, 10, .18);
  --lte-sidebar-menu-active-color:   #ffffff;
  --lte-sidebar-submenu-bg:          rgba(0, 0, 0, .12);
  --lte-sidebar-submenu-color:       rgba(255, 255, 255, .7);
  --lte-sidebar-submenu-hover-bg:    rgba(255, 255, 255, .06);
  --lte-sidebar-submenu-hover-color: #ffffff;
  --lte-sidebar-submenu-active-bg:   rgba(243, 112, 10, .25);
  --lte-sidebar-submenu-active-color:#ffffff;
  background-color: var(--brand-imperial) !important;
  color: var(--lte-sidebar-color);
  border-right: 0;
}
.app-sidebar .sidebar-brand {
  background: rgba(0, 0, 0, .15);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding: 14px 16px;
}
.app-sidebar .brand-link {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: .5px;
}
.app-sidebar .brand-link:hover { color: var(--brand-pumpkin); }
.app-sidebar .brand-image {
  max-height: 36px;
  max-width: 100%;
  border-radius: 4px;
  background: #fff;
  padding: 2px;
}
.app-sidebar .brand-image-placeholder {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-pumpkin);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
}
.app-sidebar .nav-header {
  padding: 14px 16px 6px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--lte-sidebar-header-color);
}
.app-sidebar .nav-link {
  color: var(--lte-sidebar-color);
  display: flex; align-items: center; gap: 10px;
  border-left: 3px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  transition: background .15s;
}
.app-sidebar .nav-link:hover {
  background: var(--lte-sidebar-hover-bg);
  color: var(--lte-sidebar-hover-color);
}
.app-sidebar .nav-link.active {
  background: var(--lte-sidebar-menu-active-bg);
  color: var(--lte-sidebar-menu-active-color);
  border-left-color: var(--brand-pumpkin);
  font-weight: 500;
}
.app-sidebar .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.app-sidebar .nav-link p { margin: 0; }

/* ── AdminLTE 4 header (topbar) ───────────────────────────────────── */
.app-header.navbar {
  background: #fff !important;
  border-bottom: 1px solid var(--brand-border);
  padding: 8px 0;
}
.app-page-title {
  font-size: 1.15rem; font-weight: 600;
  color: var(--brand-imperial);
  margin: 0;
}
.role-chip {
  background: var(--brand-sky-tint);
  color: var(--brand-imperial);
  font-size: .72rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .5px;
}
.app-header .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-imperial); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .85rem;
}
.app-header .nav-link {
  color: var(--brand-text);
}
.app-header .dropdown-toggle::after { display: none; } /* avatar caret looks cleaner without */

/* ── AdminLTE 4 main / content / content-header ───────────────────── */
.app-content-header {
  padding: 12px 0 0;
}
.app-content {
  padding: 16px 0 24px;
}

/* ── AdminLTE 4 footer ────────────────────────────────────────────── */
.app-footer {
  background: #fff;
  border-top: 1px solid var(--brand-border);
  padding: 12px 24px;
  font-size: .9rem;
}
.app-footer .text-brand { color: var(--brand-imperial) !important; font-weight: 700; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-brand        { background: var(--brand-imperial); border-color: var(--brand-imperial); color: #fff; }
.btn-brand:hover,
.btn-brand:focus  { background: var(--brand-imperial-dark); border-color: var(--brand-imperial-dark); color: #fff; }
.btn-accent       { background: var(--brand-pumpkin); border-color: var(--brand-pumpkin); color: #fff; }
.btn-accent:hover,
.btn-accent:focus { background: var(--brand-pumpkin-dark); border-color: var(--brand-pumpkin-dark); color: #fff; }
.btn-outline-brand        { color: var(--brand-imperial); border-color: var(--brand-imperial); }
.btn-outline-brand:hover  { background: var(--brand-imperial); color: #fff; }

/* ── Utilities ────────────────────────────────────────────────────── */
.text-brand     { color: var(--brand-imperial) !important; }
.text-accent    { color: var(--brand-pumpkin)  !important; }
.text-info-brand{ color: var(--brand-sky)      !important; }
.bg-brand       { background: var(--brand-imperial); color: #fff; }
.bg-mist        { background: var(--brand-sky-tint); }
.border-brand   { border-color: var(--brand-imperial) !important; }

/* ── KPI / dashboard cards (QA dashboard hero numbers) ────────────── */
.kpi-card {
  background: #fff; border: 1px solid var(--brand-border); border-radius: 10px;
  padding: 18px; height: 100%;
}
.kpi-card .kpi-label { color: var(--brand-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.kpi-card .kpi-value { color: var(--brand-pumpkin); font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.kpi-card .kpi-sub   { color: var(--brand-muted); font-size: .85rem; margin-top: 4px; }

/* ── Cards & forms (generic polish) ───────────────────────────────── */
.card                  { border: 1px solid var(--brand-border); }
.card-header           { background: var(--brand-surface-alt); border-bottom: 1px solid var(--brand-border); }
.card-header strong    { color: var(--brand-imperial); }
.form-label.fw-semibold{ color: var(--brand-imperial); }
.form-control:focus,
.form-select:focus     { border-color: var(--brand-imperial-light); box-shadow: 0 0 0 .2rem rgba(44,42,107,.15); }

/* ── DataTables / Select2 polish ──────────────────────────────────── */
table.dataTable thead th { background: var(--brand-surface-alt); color: var(--brand-imperial); border-bottom: 2px solid var(--brand-border); }
.select2-container--bootstrap-5 .select2-selection { border-color: var(--brand-border); }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--brand-text); }

/* ── Logo upload preview (SuperAdmin Settings) ────────────────────── */
.company-logo-preview {
  border: 2px dashed var(--brand-border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-surface-alt); padding: 16px;
}
.company-logo-preview.has-logo { border-style: solid; background: #fff; }

/* ── Phase 4: Materials viewer + DRM watermark ────────────────────── */

/* Lesson type icons */
.lesson-type-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-imperial); color: #fff; font-size: 1rem;
  flex-shrink: 0;
}
.lesson-type-icon.type-pdf    { background: #d9534f; }
.lesson-type-icon.type-video  { background: var(--brand-imperial); }
.lesson-type-icon.type-slides { background: var(--brand-pumpkin); }
.lesson-type-icon.type-text   { background: var(--brand-sky); color: #002b34; }

/* Lesson list rows on /client/materials */
.lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 8px;
  background: #fff; border: 1px solid var(--brand-border);
  text-decoration: none; color: var(--brand-text); transition: background .12s;
}
.lesson-row:hover { background: var(--brand-surface-alt); color: var(--brand-text); }
.lesson-row.locked {
  opacity: .6; cursor: not-allowed; pointer-events: none;
  background: var(--brand-surface-alt);
}
.lesson-row .lesson-meta { flex: 1; min-width: 0; }
.lesson-row .lesson-title { font-weight: 600; color: var(--brand-imperial); }
.lesson-row .lesson-sub   { color: var(--brand-muted); font-size: .85rem; margin-top: 2px; }

.locked-module-card {
  border: 2px dashed var(--brand-border); background: var(--brand-surface-alt);
  border-radius: 10px; padding: 24px; text-align: center;
}
.locked-module-card .lock-icon {
  font-size: 2.5rem; color: var(--brand-pumpkin); display: block; margin-bottom: 8px;
}

/* ── DRM viewer page (full-screen with watermark) ─────────────────── */
.viewer-shell {
  position: relative; min-height: 100vh; background: #1a1933;
  color: #fff; overflow: hidden;
}
.viewer-shell .viewer-topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(26, 25, 51, .96); backdrop-filter: blur(6px);
  padding: 10px 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.viewer-shell .viewer-topbar .v-title { color: #fff; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-shell .viewer-topbar .v-meta  { color: rgba(255,255,255,.55); font-size: .8rem; }
.viewer-shell .viewer-content {
  position: relative; padding: 24px 16px; max-width: 1100px; margin: 0 auto;
}
.viewer-shell .pdf-pages canvas {
  display: block; margin: 0 auto 14px; background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
  max-width: 100%; height: auto;
}
.viewer-shell .markdown-body {
  background: #fff; color: var(--brand-text);
  border-radius: 8px; padding: 32px; line-height: 1.6;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.viewer-shell .markdown-body h1 { color: var(--brand-imperial); margin-top: 0; }
.viewer-shell .markdown-body h2,
.viewer-shell .markdown-body h3 { color: var(--brand-imperial); }
.viewer-shell .markdown-body code {
  background: var(--brand-surface-alt); color: var(--brand-pumpkin-dark);
  padding: 2px 5px; border-radius: 3px; font-size: .92em;
}
.viewer-shell .markdown-body pre {
  background: #f3f3f8; padding: 14px; border-radius: 6px; overflow-x: auto;
}
.viewer-shell video {
  display: block; max-width: 100%; margin: 0 auto; border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}

/* Watermark overlay — diagonal grid behind the content.
 * Tuned to be visible-on-inspection but unobtrusive while reading:
 *   3×4 grid (12 cells, fewer than before so spacing is wider)
 *   ~6% opacity (down from 14%) — readable text wins, watermark recedes
 *   400 weight (was 500) — thinner strokes
 *   no text-shadow (was making letters thicker against the dark viewer bg)
 */
.viewer-watermark {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr);
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 400;
  color: rgba(255, 255, 255, .06);
  user-select: none; letter-spacing: .3px;
}
.viewer-watermark span {
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-30deg); white-space: nowrap;
}
/* On the white markdown / PDF backgrounds the white text would disappear
 * entirely — switch to dark-on-light where the underlying content is light. */
.viewer-shell .markdown-body { position: relative; }
.viewer-shell .pdf-pages canvas,
.viewer-shell .markdown-body { /* let the watermark layer above any white content */ }

/* Print-blocking — if the user somehow triggers print, blank the page. */
@media print {
  body, .app-wrapper, .viewer-shell { display: none !important; }
}

/* No-context-menu feedback (optional visual hint) */
.viewer-shell, .viewer-shell * { -webkit-user-drag: none; }
