/* ==========================================================================
   JAMB & WAEC CBT PLATFORM - DESIGN SYSTEM & ELEVATION TOKENS
   Crafted with authentic institutional polish: Crisp typography, physical elevations,
   hairline borders, and bespoke vector iconography.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Dark Slate Theme (Default) */
  --canvas-bg: #090d16;
  --surface-base: #0f172a;
  --surface-elevated: #162032;
  --surface-highlight: #1e293b;
  --surface-overlay: rgba(15, 23, 42, 0.88);

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;

  /* Official Institutional Brand Colors */
  --jamb-emerald: #10b981;
  --jamb-emerald-deep: #047857;
  --jamb-surface: rgba(16, 185, 129, 0.08);
  --jamb-border: rgba(16, 185, 129, 0.25);

  --waec-blue: #3b82f6;
  --waec-blue-deep: #1d4ed8;
  --waec-surface: rgba(59, 130, 246, 0.08);
  --waec-border: rgba(59, 130, 246, 0.25);

  --accent-gold: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  /* Functional Status */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Geometry & Physics */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 28px -6px rgba(0, 0, 0, 0.45);
  --shadow-glow-emerald: 0 0 20px -3px rgba(16, 185, 129, 0.22);
  --shadow-glow-blue: 0 0 20px -3px rgba(59, 130, 246, 0.22);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --canvas-bg: #f8fafc;
  --surface-base: #ffffff;
  --surface-elevated: #f1f5f9;
  --surface-highlight: #e2e8f0;
  --surface-overlay: rgba(255, 255, 255, 0.92);

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;

  --jamb-surface: rgba(16, 185, 129, 0.08);
  --jamb-border: rgba(16, 185, 129, 0.35);

  --waec-surface: rgba(59, 130, 246, 0.08);
  --waec-border: rgba(59, 130, 246, 0.35);

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px -4px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--canvas-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Institutional Top Navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-overlay);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  /* needed for mobile dropdown drawer */
  isolation: isolate;
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

/* Navigation Links */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface-elevated);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--surface-base);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--jamb-emerald);
}

/* Header Action Tools */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-tool-btn {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.icon-tool-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--surface-highlight);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.85rem 0.25rem 0.35rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-chip:hover {
  border-color: var(--border-medium);
  background: var(--surface-highlight);
}

.chip-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chip-dept-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Refined Buttons */
button {
  font-family: inherit;
  cursor: pointer;
}

.btn-primary {
  background: #10b981;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: #059669;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: var(--transition-fast);
}

.btn-outline:hover {
  background: var(--surface-highlight);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface-elevated);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.16s ease-out;
}

.modal-card {
  background: var(--surface-base);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-tertiary);
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-input, .custom-select {
  background: var(--canvas-bg);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .custom-select:focus {
  border-color: #10b981;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.text-success { color: var(--status-success) !important; }
.text-danger { color: var(--status-danger) !important; }
.text-accent { color: var(--accent-gold) !important; }
.hidden { display: none !important; }

/* Page view transition */
#main-app-container {
  animation: viewFadeIn 0.2s ease-out;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments (tablet handled in mobile.css) */
@media (max-width: 820px) {
  .header-inner { padding: 0.75rem 1rem; }
  .brand-sub { display: none; }
}
