/* ============================================================
   HYPERION — Global Design System
   Shared tokens, reset, layout, and components used everywhere
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ── Custom Properties ───────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:      #0a0a0a;
  --bg-secondary:    #0f0f0f;
  --bg-card:         #161616;
  --bg-card-hover:   #1c1c1c;
  --bg-input:        #111111;
  --bg-sidebar:      #0d0d0d;

  /* Gold Accent */
  --gold:            #c9a84c;
  --gold-light:      #e2c97e;
  --gold-dim:        rgba(201, 168, 76, 0.12);
  --gold-border:     rgba(201, 168, 76, 0.25);
  --gold-glow:       rgba(201, 168, 76, 0.15);

  /* AI Glow */
  --glow-blue:       #6366f1;
  --glow-purple:     #a855f7;
  --glow-blue-dim:   rgba(99, 102, 241, 0.2);
  --glow-purple-dim: rgba(168, 85, 247, 0.15);
  --glow-blue-soft:  rgba(99, 102, 241, 0.08);

  /* Text */
  --text-primary:    #f0f0f0;
  --text-secondary:  #7a7a7a;
  --text-muted:      #444;
  --text-gold:       var(--gold);

  /* Borders */
  --border:          rgba(255, 255, 255, 0.06);
  --border-hover:    rgba(255, 255, 255, 0.12);
  --border-gold:     var(--gold-border);

  /* Status Colors */
  --success:         #10b981;
  --warning:         #f59e0b;
  --danger:          #ef4444;
  --info:            #6366f1;

  /* Radius */
  --radius-sm:       8px;
  --radius-md:       12px;
  --radius-lg:       16px;
  --radius-xl:       24px;
  --radius-full:     9999px;

  /* Spacing */
  --sidebar-width:   240px;
  --header-h:        60px;

  /* Spacing Scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 40px;
  --space-3xl: 48px;

  /* Transitions */
  --transition:      0.2s ease;
  --transition-slow: 0.35s ease;

  /* Easing Curves */
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth:    cubic-bezier(0.4, 0, 0.2, 1);

  /* 3-Level Shadow System */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.45);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.6);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-gold: 0 0 20px rgba(201,168,76,0.12);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.18);

  /* Strong Glow Variants */
  --gold-glow-strong:    rgba(201, 168, 76, 0.3);
  --glow-blue-strong:    rgba(99, 102, 241, 0.3);

  /* Z-Index Scale */
  --z-base:     1;
  --z-dropdown: 10;
  --z-sticky:   50;
  --z-sidebar:  100;
  --z-modal:    1000;
  --z-toast:    9999;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-glow);
}

/* ── Inner Page Layout (sidebar + main) ──────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

/* Stacked Logo Style System */
.logo-stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.logo-symbol {
  height: auto;
  object-fit: contain;
  display: block;
}

.logo-text {
  height: auto;
  object-fit: contain;
  display: block;
}

/* Sidebar Specific Logo Sizing */
.sidebar-logo .logo-symbol {
  width: 160px;
  height: auto;
}

.sidebar-logo .logo-text {
  width: 165px;
  height: auto;
  margin-top: -5px;
}

.sidebar-logo-img {
  width: 130px;
  height: auto;
  object-fit: contain;
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
}

/* Hide text-only logo if present anywhere */
.sidebar-logo-text { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.25s var(--ease-out-expo);
  position: relative;
  will-change: transform;
  transform: translateZ(0);
}

@media (hover: hover) {
  .nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    transform: translateX(4px) translateZ(0);
  }
}

.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}

/* Gold accent bar on active nav */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow-strong);
}

.nav-item.active svg { stroke: var(--gold); }

.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--transition); }
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

/* Gradient separator above user section */
.sidebar-bottom::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--glow-blue), var(--glow-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-details { overflow: hidden; flex: 1; min-width: 0; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  width: 100%;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}

.logout-btn svg { opacity: 0.7; transition: opacity var(--transition); }
.logout-btn:hover svg { opacity: 1; }

/* ── Mobile Header ───────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 99;
}

.mobile-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.menu-btn, .logout-btn-mobile {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.menu-btn:hover, .logout-btn-mobile:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

/* ── Main Content Area ───────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px 36px;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ── AI Status Indicator ─────────────────────────────────── */
.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  font-size: 12px;
  font-weight: 500;
  color: var(--glow-blue);
}

.ai-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--glow-blue);
  box-shadow: 0 0 8px var(--glow-blue);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ── Buttons ─────────────────────────────────────────────── */
/* ── Shared Button Base ──────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.25s var(--ease-spring);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  will-change: transform, box-shadow;
  transform: translateZ(0);
  min-height: 44px;
}

/* Shimmer sweep on hover (shared pseudo-element) */
.btn-primary::before,
.btn-secondary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: none;
  pointer-events: none;
}

/* ── Primary Button ─────────────────────────────────────── */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--gold), #a8822e);
  color: #0a0a0a;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
  pointer-events: none;
}

@media (hover: hover) {
  .btn-primary:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 6px 24px var(--gold-glow-strong), var(--shadow-md);
    filter: brightness(1.08);
  }
  .btn-primary:hover::before {
    animation: shimmerSweep 0.6s ease forwards;
  }
  .btn-primary:hover::after { background: rgba(255,255,255,0.06); }
}

.btn-primary:active {
  transform: translateY(0) scale(0.97) translateZ(0);
  box-shadow: var(--shadow-sm);
  transition-duration: 0.1s;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
  filter: none;
}

/* ── Secondary Button ───────────────────────────────────── */
.btn-secondary {
  padding: 9px 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
}

@media (hover: hover) {
  .btn-secondary:hover {
    transform: translateY(-2px) translateZ(0);
    background: rgba(255,255,255,0.08);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
  }
  .btn-secondary:hover::before {
    animation: shimmerSweep 0.6s ease forwards;
  }
}

.btn-secondary:active {
  transform: translateY(0) scale(0.97) translateZ(0);
  transition-duration: 0.1s;
}

/* ── Ghost Button ───────────────────────────────────────── */
.btn-ghost {
  padding: 9px 18px;
  color: var(--text-secondary);
}

@media (hover: hover) {
  .btn-ghost:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    transform: translateY(-1px) translateZ(0);
  }
}

.btn-ghost:active {
  transform: scale(0.97) translateZ(0);
  transition-duration: 0.1s;
}

/* ── Danger Button ──────────────────────────────────────── */
.btn-danger {
  padding: 9px 18px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #ef4444;
}

@media (hover: hover) {
  .btn-danger:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.35);
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 6px 24px rgba(239,68,68,0.2);
  }
}

.btn-danger:active {
  transform: translateY(0) scale(0.97) translateZ(0);
  transition-duration: 0.1s;
}

/* ── Form Inputs ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 7px; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.3s ease, transform 0.2s var(--ease-spring), background 0.2s ease;
  outline: none;
  will-change: border-color, box-shadow;
  min-height: 44px;
}

.form-input::placeholder {
  color: var(--text-muted);
  transition: opacity 0.2s ease;
}

.form-input:focus::placeholder {
  opacity: 0.4;
}

.form-input:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px var(--gold-dim), 0 0 16px rgba(201,168,76,0.08);
  transform: scale(1.01);
  background: rgba(22, 22, 22, 0.9);
}

.input-wrapper .form-input {
  padding-left: 40px;
}

.input-wrapper .form-input.has-toggle {
  padding-right: 44px;
}

.input-icon {
  position: absolute;
  left: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color var(--transition);
}

.form-input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--gold);
}

.toggle-password {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}

.toggle-password:hover { color: var(--text-primary); }

/* ── Textarea ────────────────────────────────────────────── */
textarea.form-input {
  resize: vertical;
  min-height: 88px;
  padding: 11px 14px;
  line-height: 1.6;
}

/* ── Date Input ──────────────────────────────────────────── */
input[type="date"].form-input,
input[type="datetime-local"].form-input {
  color-scheme: dark;
}

/* ── Form Error / Success ────────────────────────────────── */
.form-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: errorShake 0.4s ease;
}

.form-success {
  font-size: 12px;
  color: var(--success);
  min-height: 16px;
  margin-top: 2px;
  animation: fadeIn 0.3s ease;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s var(--ease-out-expo);
  will-change: transform, box-shadow;
  transform: translateZ(0);
  transform-style: preserve-3d;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px) translateZ(0);
  }
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-gold {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}

.badge-blue {
  background: rgba(99,102,241,0.1);
  color: var(--glow-blue);
  border: 1px solid rgba(99,102,241,0.2);
}

.badge-green {
  background: rgba(16,185,129,0.1);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.2);
}

.badge-orange {
  background: rgba(245,158,11,0.1);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.2);
}

.badge-red {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.2);
}

.badge-neutral {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ── Status Badges ───────────────────────────────────────── */
.status-graded    { @extend .badge-green; }
.status-processing { @extend .badge-orange; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Gold top accent border */
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-spring);
  min-height: 44px;
}

@media (hover: hover) {
  .modal-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    transform: rotate(90deg);
  }
}

.modal-close:active {
  transform: scale(0.9);
  transition-duration: 0.1s;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 260px;
  max-width: 380px;
  transform: translateX(120%) scale(0.9);
  opacity: 0;
  transition: all 0.4s var(--ease-out-expo);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast.toast-show {
  transform: translateX(0) scale(1);
  opacity: 1;
}

/* Toast progress bar drain */
.toast::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  width: 100%;
  background: currentColor;
  opacity: 0.3;
  animation: drainBar 4s linear forwards;
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: rgba(16,185,129,0.15); color: #10b981; }
.toast-error   .toast-icon { background: rgba(239,68,68,0.15);   color: #ef4444; }
.toast-info    .toast-icon { background: rgba(99,102,241,0.15);  color: var(--glow-blue); }
.toast-warning .toast-icon { background: rgba(245,158,11,0.15);  color: #f59e0b; }

.toast-success { border-left: 3px solid #10b981; }
.toast-error   { border-left: 3px solid #ef4444; }
.toast-info    { border-left: 3px solid var(--glow-blue); }
.toast-warning { border-left: 3px solid #f59e0b; }

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: currentColor;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Back Button ─────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-spring);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  min-height: 44px;
}

@media (hover: hover) {
  .back-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
    transform: translateX(-3px);
  }
  .back-btn:hover svg {
    transform: translateX(-2px);
    transition: transform 0.2s var(--ease-spring);
  }
}

.back-btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Sidebar Overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

/* ── Utility Classes ─────────────────────────────────────── */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: 'Courier New', monospace; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

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

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

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmerSweep {
  from { left: -100%; }
  to   { left: 100%; }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.02); }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes drainBar {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,0.2); }
  50%       { box-shadow: 0 0 40px rgba(99,102,241,0.4); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

/* ── Page Load Stagger ──────────────────────────────────── */
.main-content > * {
  animation: fadeInUp 0.5s var(--ease-out-expo) both;
}
.main-content > *:nth-child(1) { animation-delay: 0s; }
.main-content > *:nth-child(2) { animation-delay: 0.05s; }
.main-content > *:nth-child(3) { animation-delay: 0.1s; }
.main-content > *:nth-child(4) { animation-delay: 0.15s; }
.main-content > *:nth-child(5) { animation-delay: 0.2s; }
.main-content > *:nth-child(6) { animation-delay: 0.25s; }
.main-content > *:nth-child(7) { animation-delay: 0.3s; }
.main-content > *:nth-child(8) { animation-delay: 0.35s; }
.main-content > *:nth-child(9) { animation-delay: 0.4s; }
.main-content > *:nth-child(10) { animation-delay: 0.45s; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }

  .sidebar-overlay {
    display: block;
  }

  .mobile-header { display: flex; }

  .main-content {
    margin-left: 0;
    padding: 80px 16px 24px;
  }

  .page-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
  }

  .page-title { font-size: 22px; }

  .header-actions { flex-wrap: wrap; }

  .modal { padding: 20px; }
}

@media (max-width: 480px) {
  .main-content { padding: 76px 12px 20px; }
  .btn-primary, .btn-secondary { padding: 9px 14px; font-size: 13px; }
}

/* ── Enrollment Lock Gate ─────────────────────────────────── */

/* Locked nav item — gold yellow with lock badge replacing the tab icon */
.nav-item.nav-locked {
  opacity: 0.65;
  cursor: pointer;
  position: relative;
  transition: all 0.25s var(--ease-spring);
}

/* Hide original tab icon to swap with lock */
.nav-item.nav-locked svg {
  visibility: hidden;
}

.nav-item.nav-locked::after {
  content: '';
  position: absolute;
  left: 13px; /* align exactly where the tab icon is on the left */
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c9a84c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.95;
  animation: lockBreathe 2s ease-in-out infinite;
  will-change: transform, filter, opacity;
}

@media (hover: hover) {
  .nav-item.nav-locked:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-secondary) !important;
    transform: none !important; /* disable default sidebar slide-right hover */
  }
  
  .nav-item.nav-locked:hover::after {
    animation: lockShakeHover 0.4s ease;
  }
}

.nav-item.nav-locked.lock-pressed {
  animation: lockPressedShake 0.4s var(--ease-spring) !important;
}

@keyframes lockBreathe {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 2px rgba(201, 168, 76, 0.4));
    transform: translateY(-50%) scale(1);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(201, 168, 76, 0.95));
    transform: translateY(-50%) scale(1.15);
  }
}

@keyframes lockShakeHover {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  25% { transform: translateY(-50%) rotate(-12deg); }
  75% { transform: translateY(-50%) rotate(12deg); }
}

@keyframes lockPressedShake {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(0.96) translateX(-4px); }
  40% { transform: scale(0.96) translateX(4px); }
  60% { transform: scale(0.98) translateX(-2px); }
  80% { transform: scale(0.98) translateX(2px); }
}

/* Full-page lock screen for restricted pages */
.enrollment-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeIn 0.3s ease;
}

.enrollment-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.4s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

/* Gold top accent line */
.enrollment-gate-card::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.6), transparent);
  border-radius: 0 0 4px 4px;
}

.enrollment-gate-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: breathe 3s ease-in-out infinite;
}

.enrollment-gate-icon svg {
  stroke: var(--gold);
}

.enrollment-gate-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.enrollment-gate-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 28px;
}

.enrollment-gate-desc strong {
  color: var(--gold);
}

.enrollment-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.enrollment-gate-actions .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 13px;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.enrollment-gate-actions .btn-ghost {
  width: 100%;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 36px;
}

@media (max-width: 480px) {
  .enrollment-gate-card { padding: 32px 20px; }
  .enrollment-gate-title { font-size: 19px; }
}

/* ── Pagination ────────────────────────────────────────── */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding: 10px 0;
}

.pagination-btn {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  user-select: none;
}

.pagination-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.pagination-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-page-btn {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.pagination-page-btn:hover:not(.active) {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.pagination-page-btn:active:not(.active) {
  transform: scale(0.97);
}

.pagination-page-btn.active {
  background: rgba(201, 168, 76, 0.1);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.15);
}

.pagination-dots {
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  user-select: none;
}

/* ── Floating Translate Button ── */
.translate-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 10px rgba(201, 168, 76, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease-spring);
  will-change: transform, box-shadow;
  user-select: none;
}

@media (hover: hover) {
  .translate-toggle-btn:hover {
    transform: translateY(-4px) scale(1.08) translateZ(0);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), 0 0 20px rgba(201, 168, 76, 0.3);
    border-color: var(--gold);
    color: var(--gold-light);
  }
}

.translate-toggle-btn:active {
  transform: translateY(0) scale(0.95) translateZ(0);
  box-shadow: var(--shadow-sm);
  transition-duration: 0.1s;
}

/* Sidebar Bottom specific styles for the translate button */
.sidebar-bottom .translate-toggle-btn {
  position: static;
  width: 100%;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 14px;
  gap: 10px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: all 0.2s ease;
  will-change: auto;
}

@media (hover: hover) {
  .sidebar-bottom .translate-toggle-btn:hover {
    transform: translateY(-1px);
    background: rgba(201, 168, 76, 0.08);
    border-color: var(--gold-border);
    color: var(--gold);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 10px rgba(201, 168, 76, 0.1);
  }
}

.sidebar-bottom .translate-toggle-btn:active {
  transform: translateY(0);
  background: rgba(201, 168, 76, 0.12);
}

/* ── RTL Overrides ── */
html[dir="rtl"] {
  font-family: 'Cairo', 'Inter', sans-serif;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] .modal-title,
html[dir="rtl"] .page-title,
html[dir="rtl"] .auth-form-title {
  font-family: 'Cairo', 'Outfit', sans-serif;
}

/* Sidebar layout swap */
html[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border);
}

html[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

/* Active sidebar nav indicator */
html[dir="rtl"] .nav-item.active::before {
  left: auto;
  right: 0;
  border-radius: 3px 0 0 3px;
}

/* Sidebar hover interaction */
@media (hover: hover) {
  html[dir="rtl"] .nav-item:hover {
    transform: translateX(-4px) translateZ(0);
  }
}

/* Adjust icons inside nav items and buttons */
html[dir="rtl"] .nav-item svg,
html[dir="rtl"] .btn-primary svg,
html[dir="rtl"] .btn-secondary svg,
html[dir="rtl"] .btn-ghost svg,
html[dir="rtl"] .btn-danger svg {
  margin-left: 0;
}

/* Mirror floating position of button so it doesn't block right-side content in RTL */
html[dir="rtl"] .translate-toggle-btn {
  right: auto;
  left: 24px;
}

/* Toast container positioning */
html[dir="rtl"] .toast-container {
  left: 24px;
  right: auto;
}

/* Text alignments */
html[dir="rtl"] .auth-switch,
html[dir="rtl"] .forgot-link-wrap {
  text-align: right;
}

/* Forms layout fixes in RTL */
html[dir="rtl"] .input-wrapper .form-input {
  padding-left: 14px;
  padding-right: 40px;
}

html[dir="rtl"] .input-wrapper .form-input.has-toggle {
  padding-left: 44px;
  padding-right: 40px;
}

html[dir="rtl"] .input-icon {
  left: auto;
  right: 13px;
}

html[dir="rtl"] .toggle-password {
  right: auto;
  left: 12px;
}

/* Mirror chevrons/icons where needed */
html[dir="rtl"] .teacher-hw-chevron {
  margin-left: 0;
  margin-right: 4px;
}
html[dir="rtl"] .teacher-hw-card.card-open .teacher-hw-chevron {
  transform: rotate(-90deg);
}

/* Mirror stats cards left borders or borders that were left-aligned */
html[dir="rtl"] .teacher-hw-card {
  transition: all 0.3s var(--ease-out-expo), border-right-color 0.2s ease;
}
@media (hover: hover) {
  html[dir="rtl"] .teacher-hw-card:hover {
    border-left-color: var(--border);
    border-right: 3px solid var(--gold) !important;
    transform: translateX(-4px) translateZ(0) !important;
  }
}

/* Specific styling for mobile header button placement */
@media (max-width: 768px) {
  html[dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  html[dir="rtl"] .sidebar.sidebar-open {
    transform: translateX(0);
  }
  html[dir="rtl"] .main-content {
    margin-right: 0;
  }
}

/* Ensure codes, numbers, and scores always render left-to-right to avoid layout inversion */
.exam-code-pill,
.grade-score,
.hw-grade-chip,
.user-email,
.trans-code,
.trans-subject-code,
.trans-component-code,
.trans-session-code,
.trans-year-code,
.trans-combined-code {
  direction: ltr !important;
  unicode-bidi: embed;
  display: inline-block;
  text-align: left !important;
}

/* ── Shared Premium Interactive Loader ── */
.interactive-loader {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* Concentric rings rotating in opposite directions */
.loader-ring-outer {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--gold);
  border-bottom-color: var(--gold);
  border-radius: 50%;
  animation: spinClockwise 2s linear infinite;
}

.loader-ring-inner {
  position: absolute;
  width: 76%;
  height: 76%;
  border: 3px solid transparent;
  border-left-color: var(--glow-blue);
  border-right-color: var(--glow-blue);
  border-radius: 50%;
  animation: spinCounterClockwise 1.5s linear infinite;
}

.loader-symbol {
  position: absolute;
  width: 44px;
  height: 44px;
  object-fit: contain;
  animation: loaderSymbolBreathe 2s ease-in-out infinite;
}

/* Keyframes for loader */
@keyframes spinClockwise {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinCounterClockwise {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes loaderSymbolBreathe {
  0%, 100% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 10px rgba(201, 168, 76, 0.6)); }
}


