﻿/* =============================================================================
   Learning Platform — main.css
   Design system: tokens → reset → typography → layout → components → utilities

   Brand palette:
     royal purple  #6C3BAA   · sunset orange  #fe8714
     gold          #f4ac09   · tea green      #c1f7dc
     mauve         #c2aff0   · background     #DEF8EB

   Admin navbar uses dark-blue override (#1a1a2e) — kept intentionally.
   ============================================================================= */

/* ─── 1. Design Tokens ───────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Brand */
  --c-bg:          #DEF8EB;
  --c-tea:         #c1f7dc;
  --c-mauve:       #c2aff0;
  --c-purple:      #6C3BAA;
  --c-gold:        #f4ac09;
  --c-orange:      #fe8714;

  /* Derived tints */
  --c-purple-mid:   #8B5DC8;
  --c-purple-tint:  #f0eaff;
  --c-gold-tint:    #FDF8E8;
  --c-mauve-hover:  #a795d6;
  --c-white:        #FFFFFF;

  /* Admin navbar — dark blue override */
  --c-dark-blue:       #1a1a2e;
  --c-dark-blue-mid:   #252550;
  --c-dark-blue-border:#3a3a60;
  --t-on-dark:         #e4e4f8;
  --t-on-dark-muted:   #9898cc;

  /* Semantic text */
  --t-base:       #1C0A3B;
  --t-muted:      #7060A0;
  --t-on-purple:  #FFFFFF;
  --t-on-mauve:   #2D1060;
  --t-on-tea:     #143D28;
  --t-on-gold:    #3D1800;

  /* Radii */
  --r-sm:  6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Spacing */
  --sp-xs:   4px;
  --sp-sm:   8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  40px;
  --sp-2xl: 64px;

  /* Shadows */
  --shadow-xs:
    0  1px  3px rgba(108, 59, 170, 0.10),
    0  3px  7px rgba(108, 59, 170, 0.06),
    0  5px 14px rgba(0,   0,   0,   0.03);
  --shadow-sm:
    0  2px  4px rgba(108, 59, 170, 0.14),
    0  6px 12px rgba(108, 59, 170, 0.08),
    0 10px 24px rgba(0,   0,   0,   0.04);
  --shadow-md:
    0  3px  6px rgba(108, 59, 170, 0.16),
    0  8px 18px rgba(108, 59, 170, 0.10),
    0 14px 32px rgba(0,   0,   0,   0.05);
  --shadow-lg:
    0  4px  8px rgba(108, 59, 170, 0.18),
    0 12px 24px rgba(108, 59, 170, 0.11),
    0 20px 44px rgba(0,   0,   0,   0.07);
  --shadow-navbar:
    0 2px  6px rgba(108, 59, 170, 0.14),
    0 4px 16px rgba(0,   0,   0,   0.06);

  --focus-ring: 0 0 0 3px rgba(108, 59, 170, 0.22);
  --tx: 180ms ease;
}

/* ─── 2. Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button        { font: inherit; cursor: pointer; border: none; background: none; }
a             { text-decoration: none; color: inherit; }
ul, ol        { list-style: none; }
img           { max-width: 100%; display: block; }
input, select, textarea { font: inherit; }

/* ─── 3. Base ────────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--c-bg);
  color: var(--t-base);
  line-height: 1.6;
  min-height: 100vh;
}

/* Material Symbols baseline */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
  user-select: none;
}

/* ─── 4. Typography ──────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-purple);
  letter-spacing: -0.3px;
}
h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h2 { font-size: 1.15rem; margin: var(--sp-lg) 0 var(--sp-sm); }
h3 { font-size: 1rem; }
p  { color: var(--t-muted); line-height: 1.7; }
small { font-size: 0.8em; font-weight: 400; color: var(--t-muted); }

/* ─── 5. Layout ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}
.main-content { padding: var(--sp-xl) 0 var(--sp-2xl); }
.page-center {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl) var(--sp-md);
}

/* ─── 6. Admin shell (sidebar layout) ───────────────────────────────────── */
.admin-shell {
  display: flex;
  height: calc(100vh - 62px);
  overflow: hidden;
}

/* ── Left sidebar ── */
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--c-white);
  border-right: 1px solid rgba(108, 59, 170, 0.12);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg) 0;
  overflow-y: auto;
}
.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--t-muted);
  padding: var(--sp-sm) var(--sp-lg);
  margin-bottom: var(--sp-xs);
}
.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--t-base);
  transition: background var(--tx), color var(--tx);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: var(--c-purple-tint);
  color: var(--c-purple);
  border-left-color: var(--c-mauve);
}
.sidebar-nav a.active {
  background: var(--c-purple-tint);
  color: var(--c-purple);
  font-weight: 600;
  border-left-color: var(--c-purple);
}
.sidebar-nav .material-symbols-outlined { font-size: 20px; }

/* ── Main content area ── */
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-xl);
}
.admin-page-header {
  margin-bottom: var(--sp-xl);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-md);
}
.admin-page-header h2 { margin: 0 0 4px; }

/* ─── 7. Navbar — dark blue admin override ───────────────────────────────── */
.adm-navbar {
  background: var(--c-dark-blue);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 62px;
}
.navbar-inner {
  max-width: 100%;
  padding: 0 var(--sp-lg);
  height: 62px;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-shrink: 0;
  margin-right: auto;
}
.brand-badge {
  background: var(--c-purple);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}
.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--t-on-dark);
  letter-spacing: -0.3px;
}
.brand-name span {
  color: var(--c-orange);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 4px;
}

/* Nav links in dark navbar */
.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--t-on-dark-muted);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: background var(--tx), color var(--tx);
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  background: var(--c-dark-blue-mid);
  color: var(--t-on-dark);
}
.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--c-dark-blue-border);
  margin: 0 var(--sp-xs);
  flex-shrink: 0;
}

/* Nav avatar */
.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-purple);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}
.nav-username {
  font-size: 13px;
  font-weight: 500;
  color: var(--t-on-dark-muted);
}

/* Party button */
.btn-nav-party {
  background: var(--c-gold);
  color: var(--t-on-gold);
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  letter-spacing: 0.03em;
  transition: background var(--tx), transform var(--tx);
  white-space: nowrap;
  border: none;
  cursor: pointer;
}
.btn-nav-party:hover { background: #f4c842; transform: scale(1.04); }

/* ─── 8. Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition: background var(--tx), box-shadow var(--tx), transform var(--tx), color var(--tx);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:active        { transform: translateY(0) !important; }
.btn:disabled      { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn .material-symbols-outlined { font-size: 18px; }

/* Primary — royal purple */
.btn-primary {
  background: var(--c-purple);
  color: var(--t-on-purple);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--c-purple-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Form submit — mid purple */
.btn-form {
  background: var(--c-purple-mid);
  color: var(--t-on-purple);
  box-shadow: var(--shadow-sm);
  font-size: 15px;
  font-weight: 600;
}
.btn-form:hover {
  background: var(--c-purple);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.btn-form:disabled { opacity: 0.65; cursor: not-allowed; transform: none; box-shadow: none; }

/* Nav button — mauve */
.btn-nav {
  background: var(--c-mauve);
  color: var(--t-on-mauve);
  box-shadow: var(--shadow-xs);
  padding: 7px 14px;
}
.btn-nav:hover {
  background: var(--c-mauve-hover);
  color: var(--t-on-mauve);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: var(--c-purple-tint);
  color: var(--c-purple);
  box-shadow: none;
}
.btn-secondary:hover {
  background: var(--c-mauve);
  color: var(--t-on-mauve);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

/* Ghost / outline */
.btn-ghost {
  background: transparent;
  color: var(--c-purple);
  border: 1.5px solid rgba(108, 59, 170, 0.35);
}
.btn-ghost:hover {
  background: var(--c-purple-tint);
  border-color: var(--c-purple);
  transform: translateY(-1px);
}

/* Danger */
.btn-danger {
  background: #ef4444;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover { background: #dc2626; box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Warning */
.btn-warn {
  background: var(--c-orange);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-warn:hover { background: #e07000; box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Size variants */
.btn-sm { padding: 5px 12px; font-size: 0.8rem; gap: 4px; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── 9. Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--tx), transform var(--tx);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-flat  { box-shadow: var(--shadow-xs); }
.card-flat:hover,
.card-flat:active,
.card-flat:focus { transform: none !important; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
  flex-wrap: wrap;
}
.card-header h2 { margin: 0; }

/* ─── 10. Stat cards ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}
.stat-card {
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  transition: box-shadow var(--tx), transform var(--tx);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Stat icon wrap */
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon .material-symbols-outlined { font-size: 26px; }
.fi-purple { background: var(--c-purple-tint); color: var(--c-purple); }
.fi-gold   { background: var(--c-gold-tint);   color: #b47800; }
.fi-orange { background: #fff0e0;              color: #c55a00; }
.fi-green  { background: #e6faf0;              color: #1a7a42; }
.fi-tea    { background: var(--c-tea);         color: #143D28; }

.stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--t-base);
  line-height: 1;
}
.stat-lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--t-muted);
  margin-top: 4px;
}

/* ─── 11. Data table ─────────────────────────────────────────────────────── */
.data-table-wrap {
  background: var(--c-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  padding: 12px var(--sp-md);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--t-on-mauve);
  background: var(--c-mauve);
  border-bottom: 1px solid rgba(108, 59, 170, 0.25);
}
.data-table tbody td {
  padding: 12px var(--sp-md);
  color: var(--t-base);
  border-bottom: 1px solid rgba(108, 59, 170, 0.07);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--c-purple-tint); }

/* ─── 12. Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-admin   { background: var(--c-purple-tint); color: var(--c-purple); }
.badge-driver  { background: #e6faf0;              color: #1a7a42; }
.badge-ok      { background: #e6faf0;              color: #1a7a42; }
.badge-fail    { background: #fef2f2;              color: #dc2626; }
.badge-warn    { background: #fff7e6;              color: #b45309; border: 1px solid #fcd34d; }
.badge-purple  { background: var(--c-purple-tint); color: var(--c-purple); }
.badge-gold    { background: var(--c-gold-tint);   color: #7a5500; }
.badge-orange  { background: #fff0e0;              color: #c55a00; }
.badge-green   { background: #e6faf0;              color: #1a7a42; }
.badge-muted   { background: #f0edf7;              color: var(--t-muted); }

/* ─── 13. Filter chips (tab-style selector row) ──────────────────────────── */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid rgba(108, 59, 170, 0.22);
  background: var(--c-white);
  color: var(--t-muted);
  transition: background var(--tx), color var(--tx), border-color var(--tx), box-shadow var(--tx);
  user-select: none;
}
.filter-chip:hover {
  background: var(--c-purple-tint);
  color: var(--c-purple);
  border-color: var(--c-purple);
}
.filter-chip.active {
  background: var(--c-purple);
  color: var(--t-on-purple);
  border-color: var(--c-purple);
  box-shadow: var(--shadow-xs);
}
.filter-chip .material-symbols-outlined { font-size: 16px; }

/* ─── 14. Forms ──────────────────────────────────────────────────────────── */
.form-card {
  background: var(--c-gold-tint);
  border-radius: var(--r-lg);
  padding: var(--sp-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(244, 172, 9, 0.22);
}
.form-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--sp-lg);
}
.form-logo-wrap .brand-badge {
  width: 52px;
  height: 52px;
  font-size: 16px;
  margin-bottom: var(--sp-md);
}
.form-title    { font-size: 1.5rem; font-weight: 700; color: var(--c-purple); margin-bottom: 4px; text-align: center; }
.form-subtitle { font-size: 14px; color: var(--t-muted); text-align: center; line-height: 1.5; }
.form-group    { margin-bottom: var(--sp-md); }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-purple);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(108, 59, 170, 0.35);
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--t-base);
  background: var(--c-white);
  outline: none;
  transition: border-color var(--tx), box-shadow var(--tx);
}
.form-input::placeholder { color: #b0a0cc; }
.form-input:hover         { border-color: rgba(108, 59, 170, 0.55); }
.form-input:focus         { border-color: var(--c-purple); box-shadow: var(--focus-ring); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; }
.form-error {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-orange);
  text-align: center;
  margin-top: var(--sp-md);
  min-height: 20px;
}

/* ─── 15. Alerts ─────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--sp-md);
}
.alert-error   { background: #fef2f2; color: #9b1c1c; border-color: #fca5a5; }
.alert-success { background: #f0fdf4; color: #15532a; border-color: #86efac; }
.alert-warn    { background: #fff7ed; color: #854d0e; border-color: #fcd34d; }
.alert-info    { background: var(--c-purple-tint); color: var(--c-purple); border-color: var(--c-mauve); }

/* ─── 15b. Toast (fixed bottom popup) ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  max-width: 520px;
  min-width: 260px;
  animation: toast-in var(--tx);
}
.toast-error   { background: #fef2f2; color: #9b1c1c; border-color: #fca5a5; }
.toast-success { background: #f0fdf4; color: #15532a; border-color: #86efac; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  color: inherit;
  opacity: 0.65;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity var(--tx);
}
.toast-close:hover { opacity: 1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

/* ─── 16. User avatar cell ───────────────────────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-purple);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ─── 17. Context menu ───────────────────────────────────────────────────── */
.ctx-wrap    { position: relative; display: inline-block; }
.ctx-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--t-muted);
  transition: background var(--tx), color var(--tx), transform var(--tx), box-shadow var(--tx);
  cursor: pointer;
}
.ctx-trigger:hover,
.ctx-trigger.open {
  background: var(--c-purple-tint);
  color: var(--c-purple);
  transform: scale(1.12);
  box-shadow: var(--shadow-xs);
}
.ctx-trigger:active { transform: scale(0.88); box-shadow: none; background: var(--c-mauve); color: var(--t-on-mauve); }
.ctx-trigger:disabled { opacity: 0.35; cursor: default; }
.ctx-trigger:disabled:hover { background: none; color: var(--t-muted); transform: none; box-shadow: none; }
.ctx-menu {
  display: none;
  position: fixed;
  min-width: 190px;
  background: var(--c-white);
  border: 1px solid rgba(108, 59, 170, 0.12);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  z-index: 500;
  overflow: hidden;
  animation: ctxFadeIn 0.14s ease;
}
.ctx-menu.open { display: block; }
@keyframes ctxFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--t-base);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--tx), color var(--tx);
}
.ctx-item:hover     { background: var(--c-bg); color: var(--c-purple); }
.ctx-item.danger    { color: #dc2626; }
.ctx-item.danger:hover { background: #fef2f2; color: #dc2626; }
.ctx-sep {
  height: 1px;
  background: rgba(108, 59, 170, 0.08);
  margin: 3px 0;
}

/* ─── 18. Modal ──────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 20, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
  z-index: 400;
  animation: backdropIn 0.18s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--c-white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalSlideIn { from { transform: translateY(24px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: var(--sp-lg) var(--sp-lg) 0;
  margin-bottom: var(--sp-md);
}
.modal-title    { font-size: 1.05rem; color: var(--c-purple); }
.modal-subtitle { font-size: 0.82rem; color: var(--t-muted); margin-top: 2px; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--t-muted);
  font-size: 1.1rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--tx), color var(--tx);
  flex-shrink: 0;
}
.modal-close:hover { background: #fef2f2; color: #dc2626; }
.modal-body { padding: 0 var(--sp-lg) var(--sp-lg); }
.modal-footer {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
  padding: var(--sp-md) var(--sp-lg) var(--sp-lg);
  border-top: 1px solid rgba(108, 59, 170, 0.08);
}

/* ─── 19. Filter bar ─────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--sp-md) var(--sp-lg);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  align-items: flex-end;
  margin-bottom: var(--sp-lg);
}
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--t-muted);
}
.filter-input, .filter-select {
  padding: 8px 12px;
  border: 1.5px solid rgba(108, 59, 170, 0.25);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--t-base);
  background: var(--c-white);
  outline: none;
  transition: border-color var(--tx), box-shadow var(--tx);
}
.filter-input:focus, .filter-select:focus {
  border-color: var(--c-purple);
  box-shadow: var(--focus-ring);
}
.filter-actions { display: flex; gap: var(--sp-sm); align-items: flex-end; }

/* ─── 20. Spinner ────────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(108, 59, 170, 0.2);
  border-top-color: var(--c-purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 21. Utility ────────────────────────────────────────────────────────── */
.text-purple { color: var(--c-purple) !important; }
.text-gold   { color: #b47800 !important; }
.text-orange { color: var(--c-orange) !important; }
.text-muted  { color: var(--t-muted)  !important; }

.mt-xs { margin-top: var(--sp-xs); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }

/* nt — suppress lift transform on all interaction states */
.nt, .nt:hover, .nt:focus, .nt:active { transform: none !important; }
/* ns — suppress box-shadow lift */
.ns, .ns:hover, .ns:focus, .ns:active { box-shadow: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- GUIDES ---------------------------------------------------------------------------- */

/* ─── Guide upload shell ─────────────────────────────────────────────────── */
.guide-upload-shell {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  /* Fill the admin-content area vertically so the textarea can grow */
  height: calc(100vh - 62px - var(--sp-xl) * 2 - 56px); /* viewport - navbar - content padding - footer */
  min-height: 480px;
}
 
/* ─── Meta card (top row) ────────────────────────────────────────────────── */
.guide-meta-card {
  flex-shrink: 0;
}
 
.guide-top-row {
  display: grid;
  /* name takes remaining space, category fixed, file fixed */
  grid-template-columns: 1fr 200px auto;
  gap: var(--sp-md);
  align-items: end;  /* inputs sit on the same baseline */
}
 
.guide-top-row .form-group {
  margin-bottom: 0;  /* kill default bottom margin — grid gap handles spacing */
}
 
/* ─── File upload row ────────────────────────────────────────────────────── */
.guide-file-row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  min-width: 0;  /* let flex children truncate */
}
 
.guide-file-btn {
  flex-shrink: 0;
  white-space: nowrap;
}
 
.guide-file-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
 
.guide-file-clear-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  color: var(--t-muted);
  transition: background var(--tx), color var(--tx);
  padding: 0;
}
.guide-file-clear-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}
.guide-file-clear-btn .material-symbols-outlined { font-size: 16px; }
 
/* required star */
.guide-required {
  color: var(--c-orange);
  margin-left: 2px;
}
 
/* ─── Body card + textarea ───────────────────────────────────────────────── */
.guide-body-card {
  flex: 1;          /* grows to fill remaining vertical space */
  display: flex;
  flex-direction: column;
  min-height: 0;    /* critical: lets flex child shrink below content size */
  overflow: hidden;
}
 
.guide-textarea-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
 
.guide-textarea {
  flex: 1;
  resize: none;           /* no drag handle — size is managed by the flex layout */
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.65;
  min-height: 0;
  overflow-y: auto;       /* scrollable when content exceeds container */
  padding-bottom: 28px;   /* room for line counter */
 
  /* Two-finger scroll only on touch (prevents accidental single-finger scroll
     hijacking the page on mobile). `touch-action: pan-y` keeps vertical scroll
     but the `overscroll-behavior: contain` stops it bubbling to the page. */
  touch-action: pan-y;
  overscroll-behavior: contain;
}
 
/* Line counter badge — pinned inside the textarea wrap */
.guide-line-counter {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t-muted);
  background: var(--c-white);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(108,59,170,0.12);
  pointer-events: none;
  user-select: none;
}
 
/* ─── Footer ─────────────────────────────────────────────────────────────── */
.guide-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-md);
  padding-top: var(--sp-sm);
}
 
.guide-status-msg {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--t-muted);
  flex: 1;
  min-width: 0;
}
.guide-status-success { color: #1a7a42; }
.guide-status-error   { color: #dc2626; }
 
/* ─── Category select min width ──────────────────────────────────────────── */
.guide-category-select {
  min-width: 0;   /* allow grid to constrain it */
}
 
/* ─── Mobile breakpoint ──────────────────────────────────────────────────── */
@media (max-width: 700px) {
 
  /* Stack the top row vertically */
  .guide-top-row {
    grid-template-columns: 1fr;
    gap: var(--sp-sm);
  }
 
  /* Shell height: let it be natural on mobile — page scrolls, textarea has fixed min */
  .guide-upload-shell {
    height: auto;
    min-height: unset;
  }
 
  .guide-textarea {
    min-height: 42vh;   /* ~half viewport — gives enough room without locking scroll */
    flex: none;
  }
 
  .guide-body-card {
    flex: none;
  }
 
  /* Footer stacks if narrow */
  .guide-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: var(--sp-sm);
  }
  .guide-footer .btn { width: 100%; justify-content: center; }
  .guide-status-msg  { text-align: center; }
}
