@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,400&display=swap');

/* ============================================================
   ABACUSPRO DESIGN SYSTEM — "School Prime" Education Portal Theme
   ============================================================ */

:root {
  /* SCHOOL PRIME LIGHT CANVASES (Default) */
  --bg-primary: #f6ebd8;              /* Warm Half-White Sand/Cream Canvas */
  --bg-secondary: #ffffff;            /* Pure White Surface Cards */
  --bg-tertiary: #eee9dc;

  --sidebar-bg: #1b365d;              /* Deep Royal Navy Sidebar */
  --sidebar-text: #e2e8f0;
  --sidebar-active-bg: #ffffff;       /* Active Tab White Notch */
  --sidebar-active-color: #1b365d;

  --accent-primary: #1d4ed8;          /* Royal Blue */
  --accent-primary-rgb: 29, 78, 216;
  --accent-secondary: #f59e0b;        /* Warm Gold / Amber */
  --accent-secondary-rgb: 245, 158, 11;
  --accent-gold: #fbbf24;
  --accent-success: #10b981;          /* Emerald Green */
  --accent-warning: #f59e0b;          /* Amber */
  --accent-danger: #ef4444;           /* Crimson Red */
  --accent-info: #0284c7;             /* Sky Blue */

  --text-primary: #0f172a;            /* Deep Slate Navy */
  --text-secondary: #475569;          /* Slate Secondary */
  --text-muted: #64748b;

  --glass-bg: #ffffff;
  --glass-border: #e2e8f0;
  --glass-border-hover: rgba(29, 78, 216, 0.35);
  --glass-shadow: 0 10px 25px -5px rgba(27, 54, 93, 0.07), 0 4px 10px rgba(0, 0, 0, 0.03);
  --glass-glow: 0 0 22px rgba(29, 78, 216, 0.12);

  --topbar-bg: #ffffff;
  --input-bg: #f8fafc;
  --input-bg-focus: #ffffff;
  --hover-bg: rgba(29, 78, 216, 0.04);
  --table-header-bg: #f8fafc;
  --row-hover-bg: rgba(29, 78, 216, 0.03);
  --overlay-bg: rgba(15, 23, 42, 0.6);
  --scrollbar-thumb: rgba(27, 54, 93, 0.2);
  --scrollbar-thumb-hover: rgba(29, 78, 216, 0.5);
  --filter-dropdown-bg: #ffffff;
  --btn-secondary-bg: #eff6ff;
  --btn-secondary-hover-bg: #dbeafe;
  --leaderboard-row-bg: #f8fafc;
  --leaderboard-row-hover: rgba(29, 78, 216, 0.05);

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;
  --font-serif: 'Playfair Display', Georgia, serif;

  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --theme-transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* ============================================================
   DARK MODE OVERRIDES — Premium Deep Space Theme
   ============================================================ */

html.dark-theme {
  --bg-primary:    #080e1a;              /* Very deep space navy */
  --bg-secondary:  #111827;             /* Card surfaces — rich dark */
  --bg-tertiary:   #060b14;             /* Deepest background */

  --sidebar-bg:        #060b14;
  --sidebar-text:      #cbd5e1;
  --sidebar-active-bg: #1a2540;
  --sidebar-active-color: #60a5fa;

  --accent-primary:    #3b82f6;          /* Vivid electric blue */
  --accent-primary-rgb: 59, 130, 246;
  --accent-secondary:  #f59e0b;
  --accent-success:    #10b981;
  --accent-danger:     #ef4444;
  --accent-info:       #38bdf8;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --glass-bg:           rgba(17, 24, 39, 0.92);
  --glass-border:       rgba(59, 130, 246, 0.18);
  --glass-border-hover: rgba(59, 130, 246, 0.55);
  --glass-shadow:       0 4px 6px -1px rgba(0,0,0,0.4), 0 10px 30px -5px rgba(0,0,0,0.6);
  --glass-glow:         0 0 28px rgba(59,130,246,0.15);

  --topbar-bg:          rgba(8, 14, 26, 0.95);
  --input-bg:           rgba(255, 255, 255, 0.05);
  --input-bg-focus:     rgba(59, 130, 246, 0.08);
  --hover-bg:           rgba(59, 130, 246, 0.07);
  --table-header-bg:    rgba(59, 130, 246, 0.06);
  --row-hover-bg:       rgba(59, 130, 246, 0.08);
  --overlay-bg:         rgba(0, 0, 0, 0.88);
  --scrollbar-thumb:    rgba(59, 130, 246, 0.25);
  --scrollbar-thumb-hover: rgba(59, 130, 246, 0.5);
  --filter-dropdown-bg: #111827;
  --btn-secondary-bg:   rgba(59, 130, 246, 0.1);
  --btn-secondary-hover-bg: rgba(59, 130, 246, 0.2);
  --leaderboard-row-bg:    rgba(255, 255, 255, 0.03);
  --leaderboard-row-hover: rgba(59, 130, 246, 0.08);
}

html.dark-theme body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(59, 130, 246, 0.14) 0px, transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(245, 158, 11, 0.09) 0px, transparent 55%),
    radial-gradient(ellipse at 50% 0%,  rgba(59, 130, 246, 0.07) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
}

/* ============================================================
   GLOBAL BASE RESET
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 90% 10%, rgba(245, 158, 11, 0.04) 0px, transparent 50%),
    radial-gradient(at 10% 90%, rgba(245, 158, 11, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  transition: var(--theme-transition);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ============================================================
   BUTTONS — School Prime Dual-Tone Blue & Gold
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.modal-footer .btn,
.modal-content form div > .btn {
  width: auto;
}

.btn-primary {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(29, 78, 216, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(29, 78, 216, 0.45);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  border: 1px solid rgba(29, 78, 216, 0.2);
  color: var(--accent-primary);
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover-bg);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  width: auto;
}


.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--btn-secondary-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: var(--hover-bg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 90;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   AUTH / LOGIN PAGE
   ============================================================ */

.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 40px -10px rgba(27, 54, 93, 0.12);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 450px;
  padding: 44px 36px;
  text-align: center;
  animation: fadeIn 0.5s ease-out;
  position: relative;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1d4ed8, #f59e0b, #1e40af);
  border-radius: 4px 4px 0 0;
}

.auth-logo {
  font-size: 2.4rem;
  font-weight: 800;
  color: #1b365d;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

html.dark-theme .auth-logo {
  color: #f8fafc;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.15);
}

/* ============================================================
   APP SHELL LAYOUT — "School Prime" Curved Notch Sidebar
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-shell:has(.sidebar:hover) {
  grid-template-columns: 240px 1fr;
}

/* SIDEBAR NAVIGATION */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 72px;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 50;
}

.sidebar:hover {
  width: 240px;
  box-shadow: 12px 0 35px rgba(27, 54, 93, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  margin-bottom: 32px;
  white-space: nowrap;
  overflow: hidden;
}

.brand-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.25s ease 0.05s, transform 0.25s ease 0.05s;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.sidebar:hover .brand-text {
  opacity: 1;
  transform: translateX(0);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 0 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  border: none;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* Curved Notch Pill for Active Item */
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  font-weight: 800;
  border-radius: 30px 0 0 30px;
  box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.15);
}

html.dark-theme .nav-item.active {
  color: #38bdf8;
  background: #1e293b;
}

.nav-item-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  color: inherit;
}

.nav-item.active .nav-item-icon {
  color: var(--accent-primary);
}

.nav-item-text {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease 0.08s, transform 0.2s ease 0.08s;
}

.sidebar:hover .nav-item-text {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
  overflow: hidden;
  white-space: nowrap;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8 0%, #f59e0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin: 0 auto;
  transition: margin 0.25s ease;
}

.sidebar:hover .user-avatar {
  margin: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s ease 0.05s, transform 0.25s ease 0.05s;
}

.sidebar:hover .user-info {
  opacity: 1;
  transform: translateX(0);
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.74rem;
  color: #93c5fd;
  display: block;
}

/* LOGOUT BUTTON — Responsive Collapsed/Expanded Styling */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  white-space: nowrap;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  transform: scale(1.05);
}

.logout-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.logout-text {
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar:hover .logout-btn {
  width: 100%;
  border-radius: var(--radius-md);
  justify-content: flex-start;
  padding: 0 14px;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.sidebar:hover .logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.sidebar:hover .logout-text {
  display: inline;
  opacity: 1;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 36px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--topbar-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  gap: 16px;
  transition: var(--theme-transition);
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.role-badge-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
}

.role-switcher-select {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-weight: 700;
  outline: none;
  cursor: pointer;
  font-size: 0.88rem;
  padding-right: 4px;
}

.role-switcher-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================================
   MAIN CONTENT & DASHBOARD CARDS
   ============================================================ */

.main-content {
  padding: 36px 40px;
  overflow-y: auto;
  max-height: calc(100vh - 78px);
  background: var(--bg-primary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 36px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--glass-shadow);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #1d4ed8, #f59e0b);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 14px 30px -5px rgba(27, 54, 93, 0.12);
}

/* Square Option Card Styles for System Controls */
.square-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.square-option-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 25px rgba(29, 78, 216, 0.25);
}

.square-option-card.danger:hover {
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.25);
}

.card:hover::before {
  opacity: 1;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-value {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.card-icon {
  position: absolute;
  right: 24px;
  bottom: 24px;
  font-size: 2.8rem;
  opacity: 0.15;
  color: var(--accent-primary);
  transition: transform 0.3s ease;
}

.card:hover .card-icon {
  transform: scale(1.15) rotate(-5deg);
  opacity: 0.3;
}

/* ACTION CARDS — Dual-Tone Blue & Gold */
.action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  cursor: pointer;
}

.action-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.action-card-icon {
  font-size: 1.9rem;
  color: var(--accent-primary);
  background: #eff6ff;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(29, 78, 216, 0.2);
  transition: transform 0.3s ease, background 0.3s ease;
}

html.dark-theme .action-card-icon {
  background: rgba(29, 78, 216, 0.2);
}

.action-card:hover .action-card-icon {
  transform: scale(1.1);
  background: #fef3c7;
  color: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.action-card-body h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.action-card-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ============================================================
   BADGES & PILLS
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-primary { background: #eff6ff; color: var(--accent-primary); border: 1px solid rgba(29, 78, 216, 0.3); }
.badge-success { background: #ecfdf5; color: var(--accent-success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: #fef3c7; color: #d97706; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger  { background: #fef2f2; color: var(--accent-danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-info    { background: #f0f9ff; color: var(--accent-info); border: 1px solid rgba(2, 132, 199, 0.3); }

/* ============================================================
   TABLES & LISTS
   ============================================================ */

.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: var(--glass-shadow);
  margin-bottom: 32px;
}

.table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background: var(--table-header-bg);
  padding: 16px 24px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
}

.table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.92rem;
  vertical-align: middle;
  color: var(--text-primary);
  transition: background 0.2s ease;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--row-hover-bg);
}

/* HEADER FILTER DROPDOWN */
.filterable-header {
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.filterable-header:hover {
  color: var(--accent-primary);
}

.header-filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--filter-dropdown-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px 0;
  z-index: 100;
  min-width: 180px;
  text-align: left;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  margin-top: 6px;
}

.header-filter-option {
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-filter-option:hover {
  background: #eff6ff;
  color: var(--accent-primary);
}

.header-filter-option.active {
  color: var(--accent-primary);
  font-weight: 700;
}

/* ============================================================
   MODALS SYSTEM
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.25s ease-out;
  padding: 20px;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  box-shadow: 0 25px 50px -12px rgba(27, 54, 93, 0.25);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 660px;
  padding: 38px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: var(--theme-transition);
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1d4ed8, #f59e0b);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--accent-danger);
  border-color: var(--accent-danger);
  transform: rotate(90deg);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 14px;
  letter-spacing: -0.2px;
}

/* ============================================================
   TABS & GRID LAYOUTS
   ============================================================ */

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 32px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: #eff6ff;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ============================================================
   EXAM & PRACTICE MODE UI
   ============================================================ */

.exam-container {
  max-width: 840px;
  margin: 0 auto;
  padding: 30px 20px;
}

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

.timer-box {
  background: #fef2f2;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.progress-bar-container {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  height: 10px;
  margin-bottom: 36px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.progress-bar-fill {
  background: linear-gradient(90deg, #1d4ed8, #f59e0b);
  height: 100%;
  width: 0%;
  transition: width 0.35s ease;
  border-radius: 20px;
}

.question-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 50px 36px;
  text-align: center;
  box-shadow: var(--glass-shadow);
  margin-bottom: 28px;
  position: relative;
}

.question-text {
  font-size: 3.8rem;
  font-weight: 800;
  margin-bottom: 36px;
  letter-spacing: 2px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.answer-input-container {
  max-width: 320px;
  margin: 0 auto;
}

.answer-input {
  font-size: 2.4rem;
  text-align: center;
  font-weight: 800;
  letter-spacing: 2px;
  font-family: var(--font-mono);
  padding: 12px;
  border-radius: var(--radius-lg);
}

/* ============================================================
   GAMIFICATION & LEADERBOARD
   ============================================================ */

.gamification-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--leaderboard-row-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all 0.25s ease;
}

.leaderboard-row:hover {
  background: var(--leaderboard-row-hover);
  border-color: var(--glass-border-hover);
  transform: translateX(4px);
}

.leaderboard-row.rank-first {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
  color: #1a1a1a !important;  /* force dark text on light yellow */
}

.leaderboard-row.rank-first span {
  color: #1a1a1a !important;  /* ensure name text is dark on gold bg */
}

.leaderboard-rank {
  width: 36px;
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
}

.leaderboard-rank.rank-first-txt {
  color: #b45309;
}

.leaderboard-student {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.leaderboard-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.leaderboard-row.rank-first .leaderboard-avatar {
  background: rgba(245, 158, 11, 0.25);
  border: 2px solid #b45309;
  color: #b45309;
}

.leaderboard-points {
  font-weight: 800;
  font-size: 1.1rem;
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

.streak-card {
  text-align: center;
  padding: 28px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.35);
  margin: 18px 0;
}

.streak-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

/* ============================================================
   CERTIFICATE & PRINTING
   ============================================================ */

.certificate-view {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 1.414;
  margin: 0 auto;
  border: 15px double #b45309;
  padding: 40px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  font-family: var(--font-sans);
}

.cert-border-inner {
  border: 2px solid #b45309;
  height: 100%;
  width: 100%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  position: relative;
}

.cert-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12rem;
  opacity: 0.03;
  pointer-events: none;
  font-family: var(--font-sans);
  font-weight: 800;
}

.cert-header {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
}

.cert-title {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  color: #1e1b4b;
  margin-top: 10px;
  font-style: italic;
}

.cert-subtitle {
  font-size: 1rem;
  color: #475569;
  margin-top: 20px;
}

.cert-name {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1d4ed8;
  border-bottom: 2px solid #cbd5e1;
  padding-bottom: 5px;
  min-width: 300px;
  margin: 15px auto;
  display: inline-block;
}

.cert-text {
  font-size: 1.1rem;
  color: #334155;
  max-width: 550px;
  line-height: 1.6;
}

.cert-meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 30px;
}

.cert-meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cert-sig-line {
  border-top: 1px solid #94a3b8;
  width: 160px;
  margin-bottom: 6px;
}

.cert-label {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cert-value {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
}

.cert-gold-seal {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #fbbf24 0%, #d97706 100%);
  border-radius: 50%;
  border: 4px solid #b45309;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 700;
  color: #78350f;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.cert-gold-seal::after {
  content: '';
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border-radius: 50%;
}

.cert-number {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #94a3b8;
}

@media print {
  body * { visibility: hidden; }
  .certificate-view, .certificate-view * { visibility: visible; }
  .certificate-view {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    border: 15px double #b45309 !important;
    margin: 0 !important;
    padding: 20px !important;
  }
}

/* ============================================================
   TELEMETRY & REVIEW DETAILS
   ============================================================ */

.telemetry-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.telemetry-item {
  background: var(--input-bg);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.telemetry-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.telemetry-val {
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-mono);
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.answer-card-detail {
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
}

.answer-card-detail.correct {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.answer-card-detail.incorrect {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */

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

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

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

/* ============================================================
   MOBILE RESPONSIVENESS
   ============================================================ */

@media (max-width: 992px) {
  .gamification-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    width: 265px !important;
    transform: translate3d(-100%, 0, 0) !important;
    z-index: 100 !important;
    padding-bottom: 20px;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.35s ease !important;
    will-change: transform;
  }

  .sidebar .brand-text,
  .sidebar .nav-item-text,
  .sidebar .user-info {
    transition: opacity 0.3s ease 0.08s, transform 0.3s ease 0.08s !important;
  }

  .sidebar.mobile-open {
    transform: translate3d(0, 0, 0) !important;
    box-shadow: 8px 0 35px rgba(0, 0, 0, 0.45) !important;
    z-index: 100 !important;
  }

  .sidebar.mobile-open .brand-text,
  .sidebar.mobile-open .nav-item-text,
  .sidebar.mobile-open .user-info {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) !important;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 18px;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .main-content {
    padding: 20px 16px;
    max-height: calc(100vh - 64px);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .question-text {
    font-size: 2.5rem;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    padding: 28px 20px;
    animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 30px 20px;
  }

  .auth-logo {
    font-size: 1.9rem;
  }
}

/* ============================================================
   ICON-ONLY TABLE ACTION BUTTONS WITH SOLID COLOR HOVER
   ============================================================ */
.icon-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border: 1px solid var(--glass-border);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-action-btn.edit-btn {
  color: var(--accent-primary);
  border-color: rgba(29, 78, 216, 0.25);
  background: rgba(29, 78, 216, 0.08);
}

.icon-action-btn.edit-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35);
  transform: translateY(-2px);
}

.icon-action-btn.delete-btn {
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
}

.icon-action-btn.delete-btn:hover {
  background: var(--accent-danger);
  color: #ffffff;
  border-color: var(--accent-danger);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

.icon-action-btn.export-btn {
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.08);
}

.icon-action-btn.export-btn:hover {
  background: var(--accent-success);
  color: #ffffff;
  border-color: var(--accent-success);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.icon-action-btn.audit-btn {
  color: var(--accent-info);
  border-color: rgba(2, 132, 199, 0.25);
  background: rgba(2, 132, 199, 0.08);
}

.icon-action-btn.audit-btn:hover {
  background: var(--accent-info);
  color: #ffffff;
  border-color: var(--accent-info);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transform: translateY(-2px);
}

/* Session Header Circular Quit Cross Button */
.session-quit-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  color: var(--accent-danger) !important;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.1);
}

.session-quit-btn:hover {
  background: var(--accent-danger) !important;
  color: #ffffff !important;
  border-color: var(--accent-danger) !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4) !important;
  transform: translateY(-2px) scale(1.08);
}

/* Bulk Action Banner Buttons */
.bulk-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.bulk-btn-assign {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}
.bulk-btn-assign:hover {
  background: #ffffff;
  color: #1b365d;
  border-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.bulk-btn-active {
  background: rgba(16, 185, 129, 0.25);
  color: #ffffff;
  border-color: rgba(16, 185, 129, 0.4);
}
.bulk-btn-active:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.bulk-btn-inactive {
  background: rgba(245, 158, 11, 0.25);
  color: #ffffff;
  border-color: rgba(245, 158, 11, 0.4);
}
.bulk-btn-inactive:hover {
  background: #f59e0b;
  color: #ffffff;
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.bulk-btn-delete {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.4);
}
.bulk-btn-delete:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

/* Compact Custom Settings Toggle Cards */
.compact-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary, #ffffff);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.compact-setting-row:hover {
  border-color: var(--accent-primary);
  background: rgba(29, 78, 216, 0.04);
}

/* Compact Switch Slider */
.custom-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.custom-toggle-slider {
  width: 36px;
  height: 20px;
  background-color: #cbd5e1;
  border-radius: 20px;
  position: relative;
  transition: all 0.25s ease;
  flex-shrink: 0;
  display: block;
}

.custom-toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #ffffff;
  top: 3px;
  left: 3px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.custom-toggle-input:checked + .custom-toggle-slider {
  background-color: var(--accent-primary);
}

.custom-toggle-input:checked + .custom-toggle-slider::before {
  transform: translateX(16px);
}

/* ============================================================
   DARK MODE PREMIUM POLISH
   ============================================================ */

html.dark-theme .table-container {
  border-color: rgba(59, 130, 246, 0.15);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.08),
    0 8px 32px -8px rgba(0, 0, 0, 0.7);
}

html.dark-theme .table th {
  background: rgba(59, 130, 246, 0.07);
  color: #60a5fa;
  border-bottom-color: rgba(59, 130, 246, 0.15);
}

html.dark-theme .table td {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

html.dark-theme .table tr:hover td {
  background: rgba(59, 130, 246, 0.07);
}

html.dark-theme .card {
  border-color: rgba(59, 130, 246, 0.15);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.06),
    0 8px 24px -6px rgba(0, 0, 0, 0.6);
}

html.dark-theme .card:hover {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.2),
    0 16px 40px -8px rgba(0, 0, 0, 0.7),
    0 0 24px rgba(59, 130, 246, 0.12);
}

html.dark-theme .topbar {
  border-bottom-color: rgba(59, 130, 246, 0.15);
  box-shadow: 0 1px 0 rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0,0,0,0.4);
}

html.dark-theme .form-control {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--text-primary);
}

html.dark-theme .form-control:focus {
  background: rgba(59, 130, 246, 0.07);
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

html.dark-theme .modal-content {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.1),
    0 30px 60px -10px rgba(0, 0, 0, 0.85);
}

html.dark-theme .sidebar {
  border-right: 1px solid rgba(59, 130, 246, 0.1);
  box-shadow: 2px 0 20px rgba(0,0,0,0.4);
}

html.dark-theme .nav-item.active {
  background: rgba(59, 130, 246, 0.15) !important;
  border-right: 3px solid #3b82f6;
}

html.dark-theme .btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

html.dark-theme .btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

/* Dark mode leaderboard #1 row — dark gold surface, white text */
html.dark-theme .leaderboard-row.rank-first {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(180, 83, 9, 0.12)) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15), 0 0 0 1px rgba(245, 158, 11, 0.2) !important;
  color: #f1f5f9 !important;
}

html.dark-theme .leaderboard-row.rank-first span {
  color: #f1f5f9 !important;
}

html.dark-theme .leaderboard-row.rank-first .leaderboard-rank {
  color: #fbbf24 !important;
}

html.dark-theme .leaderboard-row.rank-first .leaderboard-points {
  color: #fbbf24 !important;
}

html.dark-theme .leaderboard-row.rank-first .leaderboard-avatar {
  background: rgba(251, 191, 36, 0.2) !important;
  border-color: #fbbf24 !important;
  color: #fbbf24 !important;
}
