/* VIST LMS — shared theme: light background, blue text/accents, yellow
   highlights. Mobile-first. All colors live in CSS custom properties so
   the whole app (this file + dashboard.css) stays consistent from one
   place. */

:root {
  /* Surfaces */
  --bg-page: #f4f7fb;      /* app background — very light blue-gray, not stark white */
  --surface: #ffffff;      /* cards, panels, modals */
  --surface-alt: #f8fafc;  /* subtle secondary surface (table header, hover rows) */

  /* Dark sidebar (drawer) — the one deliberately dark surface in an
     otherwise light app, matching the approved reference design: a navy
     sidebar anchors the brand while the content area stays light. */
  --sidebar-bg: #0b1f4d;
  --sidebar-bg-alt: #112a63;
  --sidebar-text: #c3ccdf;
  --sidebar-text-active: #ffffff;

  /* Borders */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --text-primary: #0f1f3d;   /* near-black blue — main text */
  --text-secondary: #52627d; /* muted blue-gray — labels, secondary text */
  --text-muted: #64748b;     /* placeholders, faint text (4.7:1 on white, readable) */
  --white: #ffffff;

  /* Brand blue */
  --blue-700: #1c3fa8;
  --blue-600: #2454d6;
  --blue-500: #3b6df0;
  --blue-100: #dbe6fb;
  --blue-50: #eef3fd;

  /* Yellow — highlights, primary CTA buttons */
  --yellow-600: #b97f00;
  --yellow-500: #d99a00;
  --yellow-400: #f5b400;
  --yellow-100: #fdecc2;
  --yellow-50: #fff8e6;

  /* Status */
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  /* Stat-card accent palette — each card on the dashboard gets one of
     these (bg = pastel tint, icon = saturated circle color) */
  --accent-blue-bg: #eaf1ff;
  --accent-blue-icon: #2563eb;
  --accent-green-bg: #eafcf1;
  --accent-green-icon: #16a34a;
  --accent-purple-bg: #f4eefe;
  --accent-purple-icon: #7c3aed;
  --accent-orange-bg: #fef3e8;
  --accent-orange-icon: #ea8c1f;
  --accent-red-bg: #fdeeee;
  --accent-red-icon: #dc2626;
  --accent-teal-bg: #e9fbf8;
  --accent-teal-icon: #0d9488;

  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 61, 0.06);
  --shadow-md: 0 8px 24px -8px rgba(15, 31, 61, 0.14);
  --shadow-lg: 0 24px 60px -24px rgba(15, 31, 61, 0.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 48px 8px 44px;
}

.hero h1 {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  margin: 0 0 12px;
  line-height: 1.15;
  color: var(--text-primary);
}

.hero .accent { color: var(--blue-600); }

.hero p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
}

/* ---------- Role card grid ---------- */
.role-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 8px;
}

@media (min-width: 560px) {
  .role-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 820px) {
  .role-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.role-card:hover,
.role-card:focus-within {
  transform: translateY(-4px);
  border-color: var(--blue-500);
  box-shadow: var(--shadow-md);
}

.role-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--blue-50);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.role-card h2 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--text-primary);
}

.role-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex-grow: 1;
}

.role-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--yellow-400);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease;
}
.role-btn:hover { background: var(--yellow-500); }
.role-btn:active { transform: scale(0.98); }
.role-btn .arrow { transition: transform 0.15s ease; }
.role-btn:hover .arrow { transform: translateX(3px); }

.footer-note {
  text-align: center;
  margin-top: 46px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 28px;
  box-shadow: var(--shadow-lg);
}

.login-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--yellow-50);
  color: var(--yellow-600);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-role-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  color: var(--text-primary);
}

.login-card .sub {
  margin: 0 0 26px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }

.submit-btn {
  width: 100%;
  margin-top: 6px;
  background: var(--yellow-400);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.submit-btn:hover { background: var(--yellow-500); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.back-link:hover { color: var(--blue-600); }

.alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.alert.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.alert.visible { display: block; }

/* =====================================================================
   Sign-in (single page for every role) — mobile-first
   ===================================================================== */
[hidden] { display: none !important; }

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--blue-100) 0%, rgba(219, 230, 251, 0) 70%),
    var(--bg-page);
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 20px 22px;
  box-shadow: var(--shadow-md);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--blue-600);
  color: var(--white);
  font-weight: 800; font-size: 1.25rem; letter-spacing: 0.02em;
}
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.auth-brand-text strong { font-size: 1.05rem; color: var(--text-primary); }
.auth-brand-text small { color: var(--text-secondary); font-size: 0.78rem; }

.auth-card h1 { margin: 0 0 4px; font-size: 1.5rem; line-height: 1.2; }
.auth-sub { margin: 0 0 20px; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.45; }

.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; margin-bottom: 6px; font-size: 0.86rem; font-weight: 600; color: var(--text-primary); }

/* 16px font-size on inputs stops iOS Safari zooming the page on focus. */
.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.auth-input[aria-invalid="true"] { border-color: var(--danger); }
.auth-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-border); }

.auth-pw { position: relative; }
.auth-pw .auth-input { padding-right: 68px; }
.auth-pw-toggle {
  position: absolute; top: 0; right: 0;
  height: 48px; min-width: 60px; padding: 0 14px;
  background: none; border: 0; border-radius: 0 12px 12px 0;
  color: var(--blue-600); font: inherit; font-size: 0.86rem; font-weight: 600;
  cursor: pointer;
}
.auth-pw-toggle:hover { color: var(--blue-700); }
.auth-pw-toggle:focus-visible { outline: 2px solid var(--blue-500); outline-offset: -2px; }

.auth-field-error { margin: 6px 2px 0; color: var(--danger); font-size: 0.82rem; }

.auth-error {
  margin: 4px 0 14px;
  padding: 11px 13px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 12px;
}

.auth-submit {
  position: relative;
  width: 100%;
  height: 50px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-size: 1rem; font-weight: 700;
  color: var(--text-primary);
  background: var(--yellow-400);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.auth-submit:hover { background: var(--yellow-500); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }
.auth-submit[aria-busy="true"] { cursor: progress; opacity: 0.85; }

.auth-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(15, 31, 61, 0.25);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
.auth-submit[aria-busy="true"] .auth-spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-spinner { animation-duration: 2s; } .auth-submit { transition: none; } }

.auth-help { margin: 16px 0 0; text-align: center; color: var(--text-secondary); font-size: 0.85rem; line-height: 1.45; }
.auth-foot { color: var(--text-muted); font-size: 0.78rem; text-align: center; }

@media (min-width: 560px) {
  .auth-card { padding: 34px 32px 28px; }
  .auth-card h1 { font-size: 1.65rem; }
}
/* Public certificate check */
.verify-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 0.92rem; }
.verify-list dt { color: var(--text-secondary); }
.verify-list dd { margin: 0; overflow-wrap: anywhere; }