/* ============================================================
   Beshoy LMS — Admin Panel CSS
   Vanilla CSS with CSS Variables for maximum performance
   RTL-first, Dark mode default
   ============================================================ */

:root {
  --bg: #0a0e1a;
  --bg-surface: #111827;
  --bg-card: #1a2235;
  --bg-hover: #1e293b;
  --border: #1e293b;
  --border-light: rgba(255,255,255,0.06);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-heading: #f1f5f9;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --secondary: #8b5cf6;
  --secondary-hover: #7c3aed;
  --primary-bg: rgba(99,102,241,0.1);
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: 200ms ease;
}

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

body {
  font-family: 'Cairo', 'Segoe UI', 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scrolling on mobile */
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(circle at 15% 50%, rgba(99,102,241,0.08), transparent 25%),
              radial-gradient(circle at 85% 30%, rgba(139,92,246,0.08), transparent 25%),
              var(--bg);
  background-attachment: fixed;
}
body::before {
  content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.02) 10%, transparent 20%);
  background-size: 60px 60px; pointer-events: none; z-index: 0;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

/* ==================== LAYOUT ==================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255,255,255,0.05);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-brand {
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-nav { padding: 24px 16px; flex: 1; }

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  margin-bottom: 4px;
}

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

.nav-link.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 24px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 700; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--text-muted); font-weight: 600; }

/* ==================== MAIN CONTENT ==================== */
.admin-main {
  margin-right: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent flex children from overflowing the page */
}

.admin-header {
  height: calc(var(--header-height) + 16px);
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.admin-header h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-heading);
}

.admin-content {
  flex: 1;
  padding: 40px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  min-width: 0; /* Prevent overflow inside content area */
}

/* Global width rule for standard cards inside admin content */
.admin-content > .card {
  max-width: 1450px !important;
  margin: 0 auto !important;
  width: 100% !important;
}

/* ==================== CARDS ==================== */
.card {
  background: rgba(26, 34, 53, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  position: relative;
  z-index: 1;
  min-width: 0; /* Keep card contained in parent viewport */
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 16px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: rgba(26, 34, 53, 0.5);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-bg);  color: var(--danger); }

.stat-value { font-size: 28px; font-weight: 800; color: var(--text-heading); }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* ==================== TABLE ==================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
  width: 100%;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: rgba(17, 24, 39, 0.7);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 16px 20px;
  text-align: right;
  border-bottom: 2px solid rgba(255,255,255,0.06);
  white-space: nowrap;
}

td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text);
  vertical-align: middle;
  transition: all var(--transition);
  white-space: nowrap;
}

/* Allow title column to wrap cleanly but with a minimum width to prevent squishing */
td.title-col,
td[style*="font-weight:700"] {
  white-space: normal;
  min-width: 180px;
}

tr { transition: background-color 0.2s ease; }
tr:nth-child(even) td { background: rgba(255, 255, 255, 0.01); }
tr:hover td {
  background: rgba(99, 102, 241, 0.06);
  color: var(--text-heading);
}

/* Table Partitioning Tabs Styles */
.table-tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 24px;
  padding-bottom: 2px;
  flex-wrap: wrap;
  gap: 16px;
}

.table-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  transition: all var(--transition);
  border-radius: 2px;
}

.tab-btn.active {
  color: var(--primary-hover);
  background: rgba(99, 102, 241, 0.05);
}

.tab-btn.active::after {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}

.tab-btn .badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-right: 4px;
}

.partition-empty-state {
  display: none;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.partition-empty-state .empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.partition-empty-state h4 {
  color: var(--text-heading);
  font-size: 15px;
  margin-bottom: 4px;
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.form-label i[data-lucide],
.form-label svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
  display: inline-block;
  vertical-align: middle;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  direction: rtl;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-textarea { min-height: 120px; resize: vertical; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--primary-hover); color: #fff !important; transform: translateY(-1px); }
.btn-success { background: var(--success); color: #fff !important; }
.btn-success:hover, .btn-success:focus, .btn-success:active { filter: brightness(1.05); color: #fff !important; }
.btn-danger  { background: var(--danger);  color: #fff !important; }
.btn-danger:hover, .btn-danger:focus, .btn-danger:active { filter: brightness(1.1); color: #fff !important; }
.btn-ghost { background: transparent; color: var(--text-muted) !important; border: 1px solid var(--border); }
.btn-ghost:hover, .btn-ghost:focus, .btn-ghost:active { background: var(--bg-hover); color: var(--text) !important; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.pagination a:hover { background: var(--bg-hover); color: var(--text); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==================== VECTOR ICONS (LUCIDE) ==================== */
.lucide,
i[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 18px;
  height: 18px;
  stroke-width: 2px;
  margin-left: 8px; /* RTL spacing */
  flex-shrink: 0;
}

/* Icons inside buttons */
.btn i[data-lucide] {
  width: 16px;
  height: 16px;
  margin-left: 6px;
}

/* Icons inside sidebar */
.nav-link i[data-lucide] {
  width: 20px;
  height: 20px;
  margin-left: 12px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-link.active i[data-lucide] {
  color: var(--primary);
}

/* Icons inside alerts */
.alert i[data-lucide] {
  width: 20px;
  height: 20px;
  margin-left: 8px;
}

/* ==================== ALERTS ==================== */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }

/* ==================== LOGIN PAGE ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 50%, rgba(99,102,241,0.15), transparent 25%),
              radial-gradient(circle at 85% 30%, rgba(139,92,246,0.15), transparent 25%),
              var(--bg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.03) 10%, transparent 20%),
              radial-gradient(circle, rgba(139, 92, 246, 0.03) 10%, transparent 20%);
  background-size: 60px 60px;
  background-position: 0 0, 30px 30px;
  animation: moveBg 30s linear infinite;
  z-index: 0;
}

@keyframes moveBg {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(26, 34, 53, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  position: relative;
  z-index: 1;
  animation: cardEntrance 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(30px) scale(0.95); filter: blur(10px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 36px;
}

.login-card .form-group {
  position: relative;
}

.login-card .form-input { 
  height: 52px;
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0 16px;
}

.login-card .form-input:focus {
  background: rgba(17, 24, 39, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 8px 16px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

.login-card .btn { 
  width: 100%; 
  height: 52px; 
  justify-content: center; 
  font-size: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
  position: relative;
  overflow: hidden;
  border: none;
  margin-top: 12px;
}

.login-card .btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: skewX(-20deg);
  transition: all 0.6s ease;
}

.login-card .btn:hover::after {
  left: 150%;
}

.login-card .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(99, 102, 241, 0.4);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ==================== TOOLBAR ==================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 40px;
  min-width: 280px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  direction: rtl;
}

/* ==================== RESPONSIVE ==================== */
.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-hover);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Add shimmer and glass effects globally for modern feel */
.btn-primary {
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-25deg);
  transition: none;
}

.btn-primary:hover::after {
  animation: shine 0.75s ease-in-out;
}

@keyframes shine {
  100% { left: 150%; }
}

.form-input, .form-select, .form-textarea {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15), 0 0 0 3px var(--primary-bg);
}

/* Improve Table Responsiveness & Scroll Indicator */
.table-wrapper {
  position: relative;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 100%;
}

.table-wrapper::-webkit-scrollbar {
  height: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}@media (max-width: 1024px) {
  .sidebar-toggle { display: flex; }
  
  /* Cosmic Glassmorphism tablet/mobile drawer sidebar */
  .admin-sidebar {
    transform: translateX(100%);
    transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  .admin-main { margin-right: 0; }
  .admin-content { padding: 24px; }
  .card { padding: 24px; }

  /* Cosmic mobile/tablet sticky header with responsive height */
  .admin-header {
    padding: 12px 24px;
    height: auto;
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  }
  .admin-header h1 {
    font-size: 18px;
    font-weight: 800;
  }

  /* Adapting the stats grid for tablets using auto-fit */
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
  }

  /* Stack layout grids with unequal/wide ratios (e.g. 2fr 1fr) on tablets */
  div[style*="grid-template-columns:2fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns:2fr  1fr"],
  .chapter-form-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Make 3-column and 5-column grids adapt beautifully with auto-fit on tablets */
  div[style*="grid-template-columns:1fr 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr 1fr;"],
  div[style*="grid-template-columns:1fr  1fr  1fr"] {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 16px !important;
  }

  div[style*="grid-template-columns:1fr 1fr 1fr 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr 1fr 1fr 1fr"] {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 16px !important;
  }

  /* Responsive Stack for Form & Action flex containers on mobile & tablets */
  form div[style*="display:flex"],
  form div[style*="display: flex"],
  .card div[style*="display:flex"],
  .card div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  
  form div[style*="display:flex"] .btn,
  form div[style*="display: flex"] .btn,
  .card div[style*="display:flex"] .btn,
  .card div[style*="display: flex"] .btn,
  .form-actions .btn,
  .form-group .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .table-tabs-container { gap: 10px; }
  .table-tabs {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .table-tabs::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 768px) {
  .admin-content { padding: 16px; }
  .admin-header { padding: 0 16px; }
  .admin-header h1 { font-size: 16px; }
  
  /* On mobile viewports, stack ALL multi-column inline grids to a single column */
  div[style*="grid-template-columns"],
  div[style*="grid-template-columns:"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
  }
  .stat-card {
    background: linear-gradient(135deg, rgba(26, 34, 53, 0.6) 0%, rgba(17, 24, 39, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 200ms ease;
  }
  .stat-card:active {
    transform: scale(0.98);
  }
  .stat-value {
    font-size: 24px;
    background: linear-gradient(135deg, #ffffff 40%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
  }
  
  /* Beautiful glass cards on mobile */
  .card {
    padding: 20px;
    background: rgba(26, 34, 53, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
  }

  /* Luxurious sidebar link active states */
  .nav-link {
    padding: 14px 20px;
    font-size: 14px;
  }
  .nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.08));
    border-right: 4px solid var(--primary); /* RTL glow border on the right */
    color: #ffffff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.12);
  }

  /* Universal Responsive Block Tables (Card Layout) */
  .table-wrapper {
    border: none !important;
    overflow-x: visible !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .table-wrapper table,
  .table-wrapper thead,
  .table-wrapper tbody,
  .table-wrapper th,
  .table-wrapper td,
  .table-wrapper tr {
    display: block !important;
  }
  .table-wrapper thead tr {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
  }
  .table-wrapper tr {
    background: rgba(26, 34, 53, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: var(--radius) !important;
    padding: 16px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
    transition: transform 0.2s ease !important;
  }
  .table-wrapper tr:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15) !important;
  }
  .table-wrapper tr:nth-child(even) td {
    background: transparent !important;
  }
  .table-wrapper td {
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    position: relative !important;
    padding: 12px 0 !important;
    padding-right: 40% !important;
    white-space: normal !important;
    min-width: 0 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    text-align: left !important;
  }
  .table-wrapper td::before {
    content: attr(data-label);
    position: absolute !important;
    top: 50% !important;
    right: 12px !important;
    transform: translateY(-50%) !important;
    width: 35% !important;
    white-space: nowrap !important;
    text-align: right !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    font-size: 13px !important;
  }
  .table-wrapper td:last-child {
    border-bottom: none !important;
    padding-top: 16px !important;
    padding-bottom: 0 !important;
    padding-right: 0 !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
    width: 100% !important;
    display: flex !important;
  }
  .table-wrapper td:last-child::before {
    display: none !important;
  }
  .table-wrapper td:last-child a,
  .table-wrapper td:last-child button,
  .table-wrapper td:last-child form {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 110px !important;
    margin: 0 !important;
  }
  .table-wrapper td:last-child form button {
    width: 100% !important;
    justify-content: center !important;
  }
  .table-wrapper td:last-child .btn {
    justify-content: center !important;
    width: 100% !important;
    padding: 8px 12px !important;
  }
}


@media (max-width: 576px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .search-box {
    min-width: 0;
    width: 100%;
    background: rgba(17, 24, 39, 0.8);
  }
  .toolbar .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 40px 24px;
    border-radius: 20px;
    background: rgba(26, 34, 53, 0.8);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  }
  
  .admin-header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 8px;
  }
  .admin-header h1 { font-size: 14px; }
  .admin-header > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }

  /* Prevent auto-zoom on iOS by setting input font size to 16px */
  .form-input, .form-select, .form-textarea {
    font-size: 16px;
    padding: 12px 16px;
    background: rgba(17, 24, 39, 0.7);
  }
  .form-input:focus, .form-select:focus, .form-textarea:focus {
    background: rgba(17, 24, 39, 0.95);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.25), 0 0 0 3px rgba(99, 102, 241, 0.1);
  }

  /* Flex container stacking has been unified to max-width: 768px */
}

@media (max-width: 400px) {
  .admin-content { padding: 10px 8px !important; }
  .card { padding: 16px 12px !important; }
  .stat-card {
    padding: 16px !important;
    gap: 8px !important;
    flex-direction: column !important;
    text-align: center !important;
  }
  .stat-icon { margin: 0 auto !important; }
  .stat-value { font-size: 20px !important; }
  .brand-text { font-size: 13px !important; }
  .sidebar-brand { padding: 16px !important; gap: 10px !important; }

  /* Login card optimizations for extremely narrow screens */
  .login-card {
    padding: 32px 16px !important;
    border-radius: 16px !important;
  }
  .login-card h1 {
    font-size: 22px !important;
  }

  /* Table cards stacking vertical layout for perfect layout on tiny viewports */
  .table-wrapper td {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding-right: 0 !important;
    padding-top: 30px !important; /* Space for absolute header */
    justify-content: flex-start !important;
    text-align: right !important;
  }
  .table-wrapper td::before {
    top: 6px !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    text-align: right !important;
    font-size: 12px !important;
  }

  /* Full-width block action buttons on small mobile screen */
  .table-wrapper td:last-child {
    padding-top: 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .table-wrapper td:last-child a,
  .table-wrapper td:last-child button,
  .table-wrapper td:last-child form {
    flex: 1 1 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }

  /* Sticky and flex container stacking adjustments for < 400px screens */
  .toolbar {
    gap: 8px !important;
  }
  .table-tabs-container {
    margin-bottom: 16px !important;
  }
  .tab-btn {
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  /* Fluid wrapping and compact sizing for pagination buttons to prevent horizontal break */
  .pagination {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .pagination a, .pagination span {
    min-width: 30px !important;
    height: 30px !important;
    font-size: 11px !important;
    padding: 0 6px !important;
  }

  /* Compact upload dropzones for better spacing */
  .upload-dropzone {
    padding: 16px 12px !important;
    border-width: 1.5px !important;
    border-radius: var(--radius-sm) !important;
  }
  .dropzone-icon {
    font-size: 24px !important;
    margin-bottom: 8px !important;
  }
  .dropzone-icon i[data-lucide],
  .dropzone-icon svg {
    width: 28px !important;
    height: 28px !important;
  }
  .dropzone-text {
    font-size: 12px !important;
    margin-bottom: 2px !important;
  }
  .dropzone-hint {
    font-size: 10px !important;
  }

  /* Prevent horizontal overflow on non-grid details tables (e.g. user profile details) */
  .card table:not(.table-wrapper table) td {
    white-space: normal !important;
    word-break: break-word !important;
    padding: 8px 6px !important;
    font-size: 13px !important;
  }
  .card table:not(.table-wrapper table) td[style*="width:120px"],
  .card table:not(.table-wrapper table) td[style*="width: 120px"] {
    width: 90px !important;
  }

  /* Compact Quill rich text editors on small viewports */
  .ql-toolbar.ql-snow {
    padding: 4px 6px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2px !important;
  }
  .ql-toolbar.ql-snow button,
  .ql-toolbar.ql-snow .ql-picker {
    margin: 1px !important;
    padding: 2px !important;
  }
  .ql-snow .ql-picker-label {
    padding-left: 2px !important;
    padding-right: 8px !important;
  }
  .rich-editor-quill-container {
    height: 180px !important; /* More compact height on extremely narrow viewports */
  }

  /* Compact alert messages and padding */
  .alert {
    padding: 10px 14px !important;
    font-size: 13px !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }
  .alert i[data-lucide],
  .alert svg {
    width: 16px !important;
    height: 16px !important;
  }
}


/* ==================== LOADING / DISABLED ==================== */
.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary:active { transform: scale(0.97); }

/* ==================== TOAST ANIMATION ==================== */
.alert {
  animation: slideIn 300ms ease;
}

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

/* ==================== FORM SELECT ==================== */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}

/* ==================== STICKY FORM CARD ==================== */
@media (min-width: 769px) {
  .card[style*="sticky"] { max-height: calc(100vh - 120px); overflow-y: auto; }
}

/* ==================== QUESTION CARDS ==================== */
.card + .card { margin-top: 0; }

/* ============================================================
   STUDENT PROFILE PAGE
   ============================================================ */

/* ==================== STAT CARDS GRID ==================== */
.student-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.student-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(12px);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.student-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-courses { background: rgba(99,102,241,0.15); color: var(--primary); }
.stat-icon-certs { background: rgba(234,179,8,0.15); color: #eab308; }
.stat-icon-exams { background: rgba(34,197,94,0.15); color: var(--success); }
.stat-icon-avg { background: rgba(168,85,247,0.15); color: #a855f7; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text-heading); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ==================== TABS NAVIGATION ==================== */
.student-tabs-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.student-tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  font-family: inherit;
}
.student-tab-btn svg { width: 16px; height: 16px; }
.student-tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.student-tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

/* ==================== TAB CONTENT ==================== */
.student-tab-content {
  display: none;
  animation: tabFadeIn 300ms ease forwards;
}
.student-tab-content.active { display: block; }
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== PROGRESS BAR ==================== */
.progress-bar-wrapper {
  position: relative;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  height: 24px;
  min-width: 120px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.progress-bar-fill.progress-excellent { background: linear-gradient(90deg, #22c55e, #4ade80); }
.progress-bar-fill.progress-good { background: linear-gradient(90deg, #eab308, #facc15); }
.progress-bar-fill.progress-weak { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-bar-text {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ==================== REPORT STATS GRID ==================== */
.report-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.report-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  backdrop-filter: blur(12px);
}
.report-stat-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
}
.report-stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.report-stat-pass { border-color: rgba(34,197,94,0.3); }
.report-stat-pass .report-stat-value { color: var(--success); }
.report-stat-fail { border-color: rgba(239,68,68,0.3); }
.report-stat-fail .report-stat-value { color: var(--danger); }
.report-stat-avg { border-color: rgba(168,85,247,0.3); }
.report-stat-avg .report-stat-value { color: #a855f7; }
.report-stat-best { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.05); }
.report-stat-worst { border-color: rgba(234,179,8,0.3); background: rgba(234,179,8,0.05); }

/* ==================== PERFORMANCE CHART (CSS) ==================== */
.perf-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 220px;
  padding: 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.perf-chart-col {
  flex: 1;
  min-width: 50px;
  max-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.perf-chart-bar {
  width: 100%;
  border-radius: 8px 8px 0 0;
  min-height: 8px;
  transition: height 600ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  position: relative;
}
.perf-chart-val {
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.bar-excellent { background: linear-gradient(180deg, #22c55e, #16a34a); }
.bar-good { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.bar-average { background: linear-gradient(180deg, #eab308, #ca8a04); }
.bar-weak { background: linear-gradient(180deg, #ef4444, #dc2626); }
.perf-chart-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   ATTEMPT DETAILS PAGE
   ============================================================ */

/* ==================== ATTEMPT HEADER ==================== */
.attempt-header-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.attempt-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(12px);
}
.attempt-meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.attempt-meta-row span { display: flex; align-items: center; gap: 4px; }
.attempt-score-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.attempt-score-label { font-size: 12px; color: var(--text-muted); }
.attempt-score-value { font-size: 36px; font-weight: 800; color: var(--text-heading); line-height: 1.2; }
.attempt-score-status { margin-top: 6px; }
.score-pass { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.05); }
.score-pass .attempt-score-value { color: var(--success); }
.score-fail { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.05); }
.score-fail .attempt-score-value { color: var(--danger); }
.attempt-summary-card { display: flex; align-items: center; justify-content: center; }
.attempt-summary-row { display: flex; gap: 24px; }
.attempt-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.attempt-summary-item svg { width: 20px; height: 20px; }
.attempt-summary-item span { font-size: 22px; font-weight: 800; line-height: 1; }
.attempt-summary-item small { font-size: 11px; color: var(--text-muted); }
.summary-correct svg, .summary-correct span { color: var(--success); }
.summary-wrong svg, .summary-wrong span { color: var(--danger); }
.summary-total svg, .summary-total span { color: var(--primary); }

/* ==================== QUESTION CARDS ==================== */
.questions-list { display: flex; flex-direction: column; gap: 16px; }
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 200ms ease;
}
.question-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  border-radius: 0 16px 16px 0;
}
.q-correct::before { background: var(--success); }
.q-wrong::before { background: var(--danger); }
.q-pending::before { background: var(--text-muted); }
.question-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.question-number {
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 4px 12px;
  border-radius: 8px;
}
.question-type-badge {
  font-size: 11px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 6px;
}
.question-points {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: auto;
}
.q-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
}
.q-result-badge svg { width: 14px; height: 14px; }
.q-result-correct { background: rgba(34,197,94,0.15); color: var(--success); }
.q-result-wrong { background: rgba(239,68,68,0.15); color: var(--danger); }
.q-result-pending { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.question-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 16px;
}

/* ==================== OPTIONS ==================== */
.question-options { display: flex; flex-direction: column; gap: 8px; }
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: all 200ms ease;
}
.option-indicator { flex-shrink: 0; display: flex; align-items: center; }
.option-indicator svg { width: 18px; height: 18px; }
.option-text { font-size: 14px; color: var(--text); }
.option-correct {
  border-color: rgba(34,197,94,0.4);
  background: rgba(34,197,94,0.06);
}
.option-selected:not(.option-correct) {
  border-color: rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.06);
}

/* ==================== TEXT ANSWER & GRADER NOTES ==================== */
.text-answer-box, .grader-notes-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
}
.text-answer-box strong, .grader-notes-box strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.grader-notes-box {
  border-color: rgba(234,179,8,0.3);
  background: rgba(234,179,8,0.05);
}

/* ==================== RESPONSIVE: STUDENT PROFILE ==================== */
@media (max-width: 1024px) {
  .student-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .attempt-header-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .student-stats-grid { grid-template-columns: 1fr 1fr; }
  .student-tab-btn { padding: 8px 14px; font-size: 13px; }
  .student-tab-btn svg { display: none; }
  #tab-info > div { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) {
  .student-stats-grid { grid-template-columns: 1fr; }
  .student-tabs-nav { gap: 2px; padding: 3px; }
  .student-tab-btn { padding: 7px 10px; font-size: 12px; }
  .attempt-summary-row { gap: 14px; }
  .attempt-summary-item span { font-size: 18px; }
  .attempt-score-value { font-size: 28px; }
  .question-header { gap: 6px; }
  .question-number { font-size: 12px; padding: 3px 8px; }
  .report-stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ==================== PREMIUM GLASSMORPHIC QUILL OVERRIDES ==================== */
/* Overall Editor Wrapper Styling */
.rich-editor-quill-container,
#editor-container {
  background: rgba(26, 34, 53, 0.4) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border) !important;
  border-bottom-left-radius: var(--radius) !important;
  border-bottom-right-radius: var(--radius) !important;
  color: var(--text) !important;
  font-family: 'Cairo', 'Segoe UI', sans-serif !important;
  font-size: 14.5px !important;
  transition: border-color var(--transition), box-shadow var(--transition) !important;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* Focused editor */
.rich-editor-quill-container.ql-container.ql-snow:focus-within,
#editor-container.ql-container.ql-snow:focus-within {
  border-color: rgba(99, 102, 241, 0.5) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15), inset 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* Toolbar Styling */
.ql-toolbar.ql-snow {
  background: rgba(17, 24, 39, 0.6) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
  padding: 10px 14px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Editor content container */
.ql-container.ql-snow {
  border: 1px solid var(--border) !important;
  border-top: none !important;
}

/* The actual text writing area */
.ql-editor {
  direction: rtl !important;
  text-align: right !important;
  color: var(--text-heading) !important; /* Premium dynamic contrast color */
  line-height: 1.8 !important;
  padding: 18px 24px !important;
  caret-color: var(--primary) !important;
  min-height: 120px;
}

/* Custom Scrollbar for editor writing area */
.ql-editor::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.ql-editor::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
.ql-editor::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.ql-editor::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Text placeholder styling */
.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
  left: auto !important;
  right: 24px !important;
  opacity: 0.6 !important;
  font-size: 14px !important;
}

/* Toolbar button styling */
.ql-snow.ql-toolbar button {
  border-radius: var(--radius-sm) !important;
  width: 30px !important;
  height: 30px !important;
  padding: 5px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
}

/* Button strokes and fills */
.ql-snow.ql-toolbar button .ql-stroke {
  stroke: var(--text-muted) !important;
  transition: stroke 0.2s ease !important;
}
.ql-snow.ql-toolbar button .ql-fill {
  fill: var(--text-muted) !important;
  transition: fill 0.2s ease !important;
}

/* Hover / Active button styling */
.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active {
  background: rgba(99, 102, 241, 0.15) !important;
}
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--primary-hover) !important;
  filter: drop-shadow(0 0 2px rgba(129, 140, 248, 0.5)) !important;
}
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill {
  fill: var(--primary-hover) !important;
  filter: drop-shadow(0 0 2px rgba(129, 140, 248, 0.5)) !important;
}

/* Dropdown styling (e.g. Header and Color Pickers) */
.ql-snow .ql-picker {
  color: var(--text) !important;
  font-family: 'Cairo', sans-serif !important;
  font-size: 13px !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.2s ease !important;
  height: 30px !important;
  display: flex !important;
  align-items: center !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--border) !important;
  padding: 0 8px !important;
}

.ql-snow .ql-picker-label {
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  color: var(--text) !important;
  border: none !important;
}
.ql-snow .ql-picker-label svg {
  right: auto !important;
  left: 0 !important;
  margin-top: 0 !important;
  position: relative !important;
  top: 0 !important;
  stroke: var(--text-muted) !important;
}

.ql-snow .ql-picker:hover {
  border-color: rgba(99, 102, 241, 0.4) !important;
  background: rgba(99, 102, 241, 0.08) !important;
}
.ql-snow .ql-picker:hover .ql-picker-label svg {
  stroke: var(--primary) !important;
}

/* Floating Picker Options Menu */
.ql-snow .ql-picker-options {
  background: rgba(17, 24, 39, 0.96) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 6px !important;
  min-width: 120px !important;
  top: 32px !important;
  z-index: 1000 !important;
}

/* Dropdown list item styling */
.ql-snow .ql-picker.ql-header .ql-picker-item {
  color: var(--text) !important;
  font-family: 'Cairo', sans-serif !important;
  font-size: 13px !important;
  padding: 6px 12px !important;
  border-radius: 4px !important;
  transition: all 0.15s ease !important;
  text-align: right !important;
}
.ql-snow .ql-picker.ql-header .ql-picker-item:hover,
.ql-snow .ql-picker.ql-header .ql-picker-item.ql-selected {
  background: var(--primary-bg) !important;
  color: var(--primary-hover) !important;
}

/* Table actions popup modal or input elements */
.ql-snow .ql-tooltip {
  background: rgba(17, 24, 39, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--text) !important;
  padding: 10px 14px !important;
  z-index: 1000 !important;
}
.ql-snow .ql-tooltip input[type=text] {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: #fff !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  margin-left: 8px !important;
  font-family: inherit !important;
}
.ql-snow .ql-tooltip a {
  color: var(--primary-hover) !important;
  font-size: 12px !important;
  transition: all 0.2s ease !important;
}
.ql-snow .ql-tooltip a:hover {
  text-decoration: underline !important;
}

/* Styling native Quill tables inside the editor */
.ql-editor table {
  border-collapse: collapse !important;
  margin: 15px 0 !important;
  width: 100% !important;
}
.ql-editor td, .ql-editor th {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 8px 12px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--text) !important;
}
.ql-editor th {
  background: rgba(255, 255, 255, 0.05) !important;
  font-weight: 700 !important;
}

/* Beautiful color picker grids in dark mode */
.ql-snow .ql-color-picker .ql-picker-item {
  border-radius: 4px !important;
  border: 1px solid rgba(0,0,0,0.5) !important;
  margin: 2px !important;
  width: 16px !important;
  height: 16px !important;
  transition: transform 0.15s ease !important;
}

/* Lesson status icons (Free / Paid) in table view */
.lesson-status-icon {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  object-fit: contain;
  transition: transform var(--transition), filter var(--transition);
  cursor: pointer;
}
.lesson-status-icon:hover {
  transform: scale(1.2) rotate(6deg);
  filter: drop-shadow(0 0 6px var(--primary-bg));
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .admin-sidebar, .admin-header, .sidebar-toggle, .sidebar-overlay,
  .student-tabs-nav, .no-print, .btn { display: none !important; }
  .admin-layout { grid-template-columns: 1fr !important; }
  .admin-content { padding: 0 !important; }
  .print-only-header { display: block !important; text-align: center; margin-bottom: 20px; border-bottom: 2px solid #333; padding-bottom: 12px; }
  .student-tab-content { display: block !important; }
  body, .admin-content, .card, .question-card, .attempt-header-card,
  .report-stat-card, .student-stat-card { background: white !important; color: #111 !important; border-color: #ddd !important; }
  .stat-value, .report-stat-value, .attempt-score-value, .question-number { color: #111 !important; }
  .stat-label, .report-stat-label, .attempt-score-label, .question-type-badge,
  .option-text, .question-text, .perf-chart-label { color: #333 !important; }
  .progress-bar-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .q-correct::before { background: #22c55e !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .q-wrong::before { background: #ef4444 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .option-correct { background: #dcfce7 !important; border-color: #22c55e !important; }
  .option-selected:not(.option-correct) { background: #fee2e2 !important; border-color: #ef4444 !important; }
  .perf-chart-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .badge { border: 1px solid #999 !important; background: #f3f3f3 !important; color: #333 !important; }
  table, th, td { border: 1px solid #ddd !important; }
}

/* ==================== PREMIUM NUMERIC STEPPER COMPONENT ==================== */
/* Hide native spin buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

.numeric-stepper {
  display: inline-flex;
  width: 100%;
  align-items: center;
  background: rgba(17, 24, 39, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  direction: ltr; /* Force LTR layout for intuitive numeric adjustments */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  box-sizing: border-box;
}

.numeric-stepper:focus-within {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15), 0 0 0 3px var(--primary-bg);
}

.stepper-input {
  flex: 1;
  width: 100%;
  border: none !important;
  background: transparent !important;
  color: var(--text-heading) !important;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 8px;
  box-shadow: none !important;
  outline: none !important;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.stepper-btn:hover {
  background: var(--primary);
  color: #fff !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.stepper-btn:active {
  transform: scale(0.95);
}

.stepper-btn i[data-lucide] {
  width: 16px;
  height: 16px;
  margin: 0 !important; /* Reset layout margin for inside button */
}

/* Disabled and readonly state styling */
.numeric-stepper.disabled,
.numeric-stepper:has(.stepper-input:disabled),
.numeric-stepper:has(.stepper-input[readonly]) {
  opacity: 0.6;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.2);
}

/* Premium Datetime Picker UI styling */
.datetime-picker-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  background: rgba(17, 24, 39, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  box-sizing: border-box;
}

.datetime-picker-wrapper:focus-within {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15), 0 0 0 3px var(--primary-bg);
}

.datetime-picker-input {
  flex: 1;
  width: 100%;
  border: none !important;
  background: transparent !important;
  color: var(--text-heading) !important;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 16px 12px 48px; /* LTR layout: space for left calendar icon */
  outline: none !important;
  box-shadow: none !important;
  cursor: pointer;
  box-sizing: border-box;
  color-scheme: dark; /* Force Chrome/Safari native calendar picker to dark */
  direction: ltr; /* Dates look cleaner in LTR */
  text-align: right;
}

.datetime-picker-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.datetime-picker-wrapper:focus-within .datetime-picker-icon {
  color: var(--primary);
}

/* Enable clicking anywhere on the input block to trigger the calendar picker */
.datetime-picker-input::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  opacity: 0; /* Cover the entire field transparently to intercept click events */
  z-index: 3;
}/* Disabled state styling for datetime */
.datetime-picker-wrapper.disabled,
.datetime-picker-wrapper:has(.datetime-picker-input:disabled),
.datetime-picker-wrapper:has(.datetime-picker-input[readonly]) {
  opacity: 0.6;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.2);
}

/* Responsive Form Grid Utilities */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 992px) {
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .form-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Premium PWA Offline Ribbon Styles */
.pwa-offline-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(220, 38, 38, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  z-index: 10000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(-100%);
  opacity: 0;
  direction: rtl;
  pointer-events: none;
}
.pwa-offline-ribbon.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.pwa-offline-pulse {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: pwa-pulse 1.5s infinite;
}
@keyframes pwa-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

/* ==================== NAVIGATION DROPDOWN MENU ==================== */
.nav-dropdown-wrapper {
  margin-bottom: 4px;
}
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.nav-dropdown-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-dropdown-toggle.active {
  color: var(--text-heading);
}
.nav-dropdown-toggle .toggle-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-dropdown-toggle .toggle-content i[data-lucide] {
  width: 20px;
  height: 20px;
  margin-left: 12px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-dropdown-toggle.active .toggle-content i[data-lucide] {
  color: var(--primary);
}
.nav-dropdown-toggle .chevron-icon {
  width: 16px;
  height: 16px;
  margin-left: 0;
  margin-right: auto;
  transition: transform var(--transition);
}
.nav-dropdown-wrapper.open .chevron-icon {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 300ms ease, margin 300ms ease;
  border-right: 1.5px solid rgba(255, 255, 255, 0.08);
  margin-right: 24px;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-dropdown-wrapper.open .nav-dropdown-menu {
  max-height: 400px;
  opacity: 1;
  pointer-events: auto;
  margin-top: 4px;
  margin-bottom: 8px;
}
.nav-dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-dropdown-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-dropdown-link.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 700;
}
.nav-dropdown-link .sub-nav-icon {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  color: inherit;
}

/* LTR directional support override */
[dir="ltr"] .nav-dropdown-toggle .chevron-icon {
  margin-right: 0;
  margin-left: auto;
}
[dir="ltr"] .nav-dropdown-toggle .toggle-content i[data-lucide] {
  margin-left: 0;
  margin-right: 12px;
}
[dir="ltr"] .nav-dropdown-menu {
  border-right: none;
  border-left: 1.5px solid rgba(255, 255, 255, 0.08);
  margin-right: 0;
  margin-left: 24px;
  padding-right: 0;
  padding-left: 8px;
}
[dir="ltr"] .nav-dropdown-link .sub-nav-icon {
  margin-left: 0;
  margin-right: 8px;
}

/* ==================== QUILL IMAGE OVERLAY TOOLBAR & RESIZING ==================== */
.quill-image-overlay {
  position: absolute;
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.5) !important;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
  direction: ltr !important;
  user-select: none;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif !important;
  transition: opacity 0.2s ease;
}

.quill-image-overlay span {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
}

.quill-image-overlay button {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  border-radius: 6px !important;
  padding: 3px 8px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease;
  height: 24px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.quill-image-overlay button:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.quill-image-overlay button.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 8px var(--primary) !important;
}

.quill-image-overlay input {
  width: 55px !important;
  height: 24px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 6px !important;
  color: #fff !important;
  font-size: 11px !important;
  text-align: center !important;
  outline: none !important;
  font-weight: 600 !important;
}

.quill-image-overlay input:focus {
  border-color: var(--primary) !important;
}

/* Image Selection Outline in Quill */
.ql-editor img {
  cursor: pointer;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
  max-width: 100%;
}

.ql-editor img.ql-selected {
  outline: 3px solid rgba(99, 102, 241, 0.9) !important;
  outline-offset: 2px;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

/* ============================================================
   LIGHT MODE STYLING OVERRIDES
   ============================================================ */
.light-mode {
  --bg: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: rgba(0, 0, 0, 0.04);
  --text: #334155;
  --text-muted: #64748b;
  --text-heading: #0f172a;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #7c3aed;
  --secondary-hover: #6d28d9;
  --primary-bg: rgba(79, 70, 229, 0.08);
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

body.light-mode {
  background: radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.03), transparent 25%),
              radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.03), transparent 25%),
              #f8fafc;
  background-attachment: fixed;
}
body.light-mode::before {
  background: radial-gradient(circle, rgba(79, 70, 229, 0.01) 10%, transparent 20%);
  background-size: 60px 60px;
}

.light-mode .admin-sidebar {
  background: rgba(255, 255, 255, 0.85);
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}
.light-mode .sidebar-brand {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.light-mode .sidebar-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.light-mode .sidebar-user {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.light-mode .admin-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.light-mode th {
  background: rgba(241, 245, 249, 0.9);
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}
.light-mode tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.01);
}
.light-mode tr:hover td {
  background: rgba(79, 70, 229, 0.04);
}
.light-mode .table-tabs-container {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.light-mode .tab-btn:hover {
  background: rgba(0, 0, 0, 0.02);
}
.light-mode .tab-btn.active {
  background: rgba(79, 70, 229, 0.05);
}
.light-mode .partition-empty-state {
  border: 1px dashed rgba(0, 0, 0, 0.1);
}
.light-mode .card,
.light-mode .premium-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.02);
}
.light-mode .stat-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 24px rgba(0,0,0,0.02);
}
.light-mode .stat-card:hover {
  box-shadow: 0 16px 40px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.6);
}
.light-mode .login-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 24px 48px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
}
.light-mode .login-card .form-input {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.light-mode .login-card .form-input:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15), 0 8px 16px rgba(0,0,0,0.03);
}

/* Intercepting hardcoded inline styles for dark mode compatibility */
.light-mode td[style*="color:#fff"]:not(.btn *):not(.badge *),
.light-mode td[style*="color: #fff"]:not(.btn *):not(.badge *),
.light-mode strong[style*="color:#fff"]:not(.btn *):not(.badge *),
.light-mode strong[style*="color: #fff"]:not(.btn *):not(.badge *),
.light-mode span[style*="color:#fff"]:not(.btn *):not(.badge *),
.light-mode span[style*="color: #fff"]:not(.btn *):not(.badge *) {
  color: var(--text-heading) !important;
}

/* Quill Editor tweaks in Light Mode */
.light-mode .ql-toolbar,
.light-mode .ql-container {
  border-color: var(--border) !important;
  background: var(--bg-surface) !important;
  color: var(--text) !important;
}
.light-mode .ql-stroke {
  stroke: var(--text) !important;
}
.light-mode .ql-fill {
  fill: var(--text) !important;
}
.light-mode .ql-picker {
  color: var(--text) !important;
}

/* Dashboard Light Mode Overrides */
.light-mode .glass-glow-card {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.01), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}
.light-mode .glass-glow-card:hover {
  border-color: rgba(79, 70, 229, 0.2) !important;
  box-shadow: 0 15px 45px rgba(79, 70, 229, 0.04), 0 10px 30px rgba(0, 0, 0, 0.02) !important;
}
.light-mode .badge-normal {
  background: rgba(0, 0, 0, 0.03) !important;
  color: var(--text-muted) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}
.light-mode .badge-primary {
  background: rgba(79, 70, 229, 0.08) !important;
  color: #4f46e5 !important;
  border: 1px solid rgba(79, 70, 229, 0.2) !important;
}

/* Light mode overrides for high-contrast action buttons in tables */
.light-mode a[style*="color:#a78bfa"],
.light-mode a[style*="color: #a78bfa"],
.light-mode button[style*="color:#a78bfa"],
.light-mode button[style*="color: #a78bfa"] {
  color: #6d28d9 !important;
  background: rgba(109, 40, 217, 0.08) !important;
  border-color: rgba(109, 40, 217, 0.18) !important;
}

.light-mode a[style*="color:#fbbf24"],
.light-mode a[style*="color: #fbbf24"],
.light-mode button[style*="color:#fbbf24"],
.light-mode button[style*="color: #fbbf24"] {
  color: #b45309 !important;
  background: rgba(180, 83, 9, 0.08) !important;
  border-color: rgba(180, 83, 9, 0.18) !important;
}

.light-mode a[style*="color:#34d399"],
.light-mode a[style*="color: #34d399"],
.light-mode button[style*="color:#34d399"],
.light-mode button[style*="color: #34d399"],
.light-mode a[style*="color:#34D399"],
.light-mode a[style*="color: #34D399"] {
  color: #047857 !important;
  background: rgba(4, 120, 87, 0.08) !important;
  border-color: rgba(4, 120, 87, 0.18) !important;
}

.light-mode a[style*="color:#f87171"],
.light-mode a[style*="color: #f87171"],
.light-mode button[style*="color:#f87171"],
.light-mode button[style*="color: #f87171"] {
  color: #b91c1c !important;
  background: rgba(185, 28, 28, 0.08) !important;
  border-color: rgba(185, 28, 28, 0.18) !important;
}

/* Light mode overrides for high-contrast badge inline styles in tables */
.light-mode span[style*="color:#a5b4fc"],
.light-mode span[style*="color: #a5b4fc"] {
  color: #4f46e5 !important;
  background: rgba(79, 70, 229, 0.08) !important;
  border-color: rgba(79, 70, 229, 0.18) !important;
}

.light-mode span[style*="color:#93c5fd"],
.light-mode span[style*="color: #93c5fd"] {
  color: #1d4ed8 !important;
  background: rgba(29, 78, 216, 0.08) !important;
  border-color: rgba(29, 78, 216, 0.18) !important;
}

.light-mode span[style*="color:#34d399"],
.light-mode span[style*="color: #34d399"] {
  color: #047857 !important;
  background: rgba(4, 120, 87, 0.08) !important;
  border-color: rgba(4, 120, 87, 0.18) !important;
}

.light-mode span[style*="color:#f87171"],
.light-mode span[style*="color: #f87171"] {
  color: #b91c1c !important;
  background: rgba(185, 28, 28, 0.08) !important;
  border-color: rgba(185, 28, 28, 0.18) !important;
}

.light-mode span[style*="color:#fbbf24"],
.light-mode span[style*="color: #fbbf24"] {
  color: #b45309 !important;
  background: rgba(180, 83, 9, 0.08) !important;
  border-color: rgba(180, 83, 9, 0.18) !important;
}

/* General Light Mode Container Interceptors */
.light-mode [style*="background: rgba(26, 34, 53"],
.light-mode [style*="background:rgba(26, 34, 53"],
.light-mode [style*="background: rgba(26,34,53"],
.light-mode [style*="background:rgba(26,34,53"] {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
}

/* Intercept card hover enhancements */
.light-mode [style*="background: rgba(26, 34, 53"]:hover,
.light-mode [style*="background:rgba(26, 34, 53"]:hover {
  border-color: rgba(79, 70, 229, 0.2) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* Intercept dark search boxes, tab bars, and tag-like backgrounds */
.light-mode [style*="background: rgba(15, 23, 42"],
.light-mode [style*="background:rgba(15,23,42"],
.light-mode [style*="background: rgba(30, 41, 59"],
.light-mode [style*="background:rgba(30, 41, 59"],
.light-mode [style*="background: rgba(15,23,42"] {
  background: var(--bg-hover) !important;
  border-color: var(--border) !important;
}

/* Intercept inner code fields and mono blocks */
.light-mode code[style*="background: rgba(15, 23, 42"],
.light-mode code[style*="background:rgba(15,23,42"],
.light-mode code[style*="background:rgba(15, 23, 42"] {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* Intercept filter tab active styles */
.light-mode .filter-tab {
  color: var(--text-muted) !important;
}
.light-mode .filter-tab.active,
.light-mode .filter-tab[style*="background: var(--primary)"],
.light-mode .filter-tab[style*="background:var(--primary)"] {
  background: var(--primary) !important;
  color: #ffffff !important;
}

/* Intercept template gallery cards inside templates.html */
.light-mode .template-card {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
}
.light-mode .template-card:hover {
  border-color: rgba(79, 70, 229, 0.2) !important;
  box-shadow: var(--shadow-lg) !important;
}
.light-mode .template-card.is-default {
  border-color: var(--primary) !important;
  background: rgba(79, 70, 229, 0.04) !important;
}
.light-mode .template-card.is-default:hover {
  border-color: var(--primary-hover) !important;
}
.light-mode .template-card div[style*="background:rgba(255,255,255,0.03)"],
.light-mode .template-card div[style*="background: rgba(255, 255, 255, 0.03)"] {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: var(--border) !important;
}
.light-mode .template-thumbnail-container {
  background: #f1f5f9 !important;
  border-color: var(--border) !important;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04) !important;
}

/* Light Mode Input, Textarea, Select Overrides */
.light-mode input[type="text"],
.light-mode input[type="number"],
.light-mode input[type="email"],
.light-mode input[type="password"],
.light-mode input[type="datetime-local"],
.light-mode select,
.light-mode textarea,
.light-mode .form-input,
.light-mode .form-select,
.light-mode .form-control {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.light-mode input::placeholder,
.light-mode textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.7;
}

.light-mode input[type="text"]:focus,
.light-mode input[type="number"]:focus,
.light-mode input[type="email"]:focus,
.light-mode input[type="password"]:focus,
.light-mode input[type="datetime-local"]:focus,
.light-mode select:focus,
.light-mode textarea:focus,
.light-mode .form-input:focus,
.light-mode .form-select:focus,
.light-mode .form-control:focus {
  background: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1) !important;
}

/* ==========================================
   GLOBAL LIGHT MODE OVERRIDES FOR LOCAL PAGE TEMPLATE STYLES
   ========================================== */

/* 1. Reset Local Glassmorphic variables to Light versions */
.light-mode,
.light-mode :root,
.light-mode * {
  --glass-bg: rgba(255, 255, 255, 0.85) !important;
  --glass-border: rgba(0, 0, 0, 0.08) !important;
  --glass-hover-border: rgba(99, 102, 241, 0.25) !important;
  --card-bg-glass: rgba(255, 255, 255, 0.85) !important;
  --card-border-glass: rgba(0, 0, 0, 0.08) !important;
  --card-hover-border: rgba(99, 102, 241, 0.25) !important;
  --aurora-gradient: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(139, 92, 246, 0.02) 50%, rgba(16, 185, 129, 0.02) 100%) !important;
}

/* 2. Text contrast fixes inside card blocks (hiding white texts on light backgrounds) */
.light-mode .rubric-card-item h3,
.light-mode .difficulty-title,
.light-mode .status-title,
.light-mode .panel-title,
.light-mode .metric-info .metric-value,
.light-mode .metric-info h4,
.light-mode .form-group-premium label,
.light-mode .filter-form-group label,
.light-mode #import-panel h3,
.light-mode #import-panel h4,
.light-mode #ai-panel h3,
.light-mode #ai-panel h4,
.light-mode .ai-modal-container h3,
.light-mode .ai-modal-container h4,
.light-mode .ai-modal-container p,
.light-mode .empty-drop-zone,
.light-mode .q-text-premium,
.light-mode .empty-state p {
  color: var(--text-heading) !important;
}

/* 3. Panel and Modal Container Light Mode Styling */
.light-mode .aurora-bg-container {
  background: var(--aurora-gradient) !important;
  border-color: var(--border) !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.02) !important;
}

.light-mode .premium-card,
.light-mode .stat-card-premium,
.light-mode .rubric-card-item,
.light-mode .metric-card {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}

.light-mode .premium-card:hover,
.light-mode .stat-card-premium:hover,
.light-mode .rubric-card-item:hover,
.light-mode .metric-card:hover {
  border-color: var(--primary) !important;
  background: var(--bg-surface) !important;
}

.light-mode #import-panel,
.light-mode #ai-panel {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}

.light-mode #import-panel *,
.light-mode #ai-panel * {
  border-color: var(--border) !important;
}

.light-mode #import-panel form {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

/* 4. Choice Selection Cards (Difficulty, Status, etc.) */
.light-mode .difficulty-card,
.light-mode .status-card {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: rgba(0, 0, 0, 0.06) !important;
}

.light-mode .difficulty-card:hover,
.light-mode .status-card:hover {
  background: rgba(99, 102, 241, 0.04) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
}

.light-mode .difficulty-card.active,
.light-mode .status-card.active {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: var(--primary) !important;
}

/* 5. Drag & Drop list system */
.light-mode .questions-list {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--border) !important;
}

.light-mode .q-card-premium,
.light-mode .filters-card-premium {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode .q-card-premium:hover {
  border-color: var(--primary) !important;
  background: var(--bg-hover) !important;
}

.light-mode .empty-drop-zone {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

/* 6. Custom Select Dropdowns */
.light-mode .search-select-trigger {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.light-mode .search-select-dropdown {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

.light-mode .search-select-input {
  background: rgba(0, 0, 0, 0.02) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.light-mode .search-select-option {
  color: var(--text) !important;
}

.light-mode .search-select-option:hover {
  background: rgba(99, 102, 241, 0.05) !important;
  color: var(--primary) !important;
}

.light-mode .search-select-option.selected {
  background: rgba(99, 102, 241, 0.1) !important;
  color: var(--primary) !important;
}

/* 7. Action Circle Buttons in Tables */
.light-mode .action-btn-circle {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

.light-mode .action-btn-circle:hover {
  background: var(--bg-hover) !important;
  color: var(--text-heading) !important;
}

/* 8. Tab group & Filter buttons overrides */
.light-mode .filter-btn-group {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: var(--border) !important;
}

.light-mode .filter-btn-premium {
  color: var(--text-muted) !important;
}

.light-mode .filter-btn-premium.active {
  background: rgba(99, 102, 241, 0.1) !important;
  color: var(--primary) !important;
  border: 1px solid rgba(99, 102, 241, 0.2) !important;
}

.light-mode .tab-nav-btn {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

.light-mode .tab-nav-btn:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-heading) !important;
}

.light-mode .tab-nav-btn.active {
  background: rgba(99, 102, 241, 0.08) !important;
  color: var(--primary) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
}

.light-mode .wizard-btn-prev {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .wizard-btn-prev:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  color: var(--text-heading) !important;
}

/* 9. AI modal overlay & elements */
.light-mode .ai-modal-overlay {
  background: rgba(255, 255, 255, 0.85) !important;
}

.light-mode .ai-modal-container {
  background: #ffffff !important;
  border-color: var(--border) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08) !important;
}

.light-mode .ai-modal-header,
.light-mode .ai-modal-footer {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--border) !important;
}

.light-mode .ai-modal-body select.form-select,
.light-mode .ai-modal-body input.form-input,
.light-mode .ai-modal-body textarea.form-input {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.light-mode .ai-modal-body select.form-select:focus,
.light-mode .ai-mode-body input.form-input:focus,
.light-mode .ai-modal-body textarea.form-input:focus {
  background: #ffffff !important;
  border-color: var(--primary) !important;
}

.light-mode #ai-drag-drop-zone {
  border-color: rgba(99, 102, 241, 0.25) !important;
  background: rgba(99, 102, 241, 0.02) !important;
}

.light-mode #ai-drag-drop-zone:hover {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.05) !important;
}

.light-mode #drag-drop-idle p,
.light-mode #drag-drop-loading p {
  color: var(--text) !important;
}

/* 10. Visual Template Editor Page Overrides */
.light-mode .toggle-btn-group {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: var(--border) !important;
}

.light-mode .toggle-btn {
  color: var(--text-muted) !important;
}

.light-mode .toggle-btn:hover {
  color: var(--text-heading) !important;
  background: rgba(0, 0, 0, 0.03) !important;
}

.light-mode .toggle-btn.active {
  background: var(--primary) !important;
  color: #111827 !important;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.25) !important;
}

.light-mode .device-mock-frame {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.04) !important;
}

.light-mode .device-mock-header {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--border) !important;
}

.light-mode .mock-address-bar {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--text-muted) !important;
}

.light-mode .mock-viewport-content {
  background: #f1f5f9 !important;
}

.light-mode .preset-item-card {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode .preset-item-card:hover {
  border-color: var(--primary) !important;
}

.light-mode .preset-item-card.active {
  background: rgba(197, 160, 89, 0.04) !important;
  border-color: var(--primary) !important;
}

.light-mode .custom-form-field label {
  color: var(--text) !important;
}

.light-mode .custom-form-field input,
.light-mode .custom-form-field select {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .custom-form-field input:focus,
.light-mode .custom-form-field select:focus {
  background: #ffffff !important;
  border-color: var(--primary) !important;
}

.light-mode .var-pill-key {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .var-pill-key:hover {
  background: var(--bg-hover) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.light-mode .media-upload-area {
  border-color: var(--border) !important;
  background: rgba(0, 0, 0, 0.01) !important;
}

.light-mode .media-upload-area:hover {
  border-color: var(--primary) !important;
  background: rgba(197, 160, 89, 0.02) !important;
}

/* ════════════════════════════════════════════════════════════ */
/* 11. Rubrics Form Overrides (Light Mode)                      */
/* ════════════════════════════════════════════════════════════ */
.light-mode .criterion-card {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}

.light-mode .criterion-card:hover {
  border-color: var(--primary) !important;
}

.light-mode .level-row {
  background: rgba(0, 0, 0, 0.015) !important;
  border: 1px solid var(--border) !important;
}

.light-mode .level-row:hover {
  background: rgba(0, 0, 0, 0.03) !important;
}

.light-mode .c-num-badge {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
  color: var(--primary) !important;
}

.light-mode #criteria-empty {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

/* ════════════════════════════════════════════════════════════ */
/* 12. Question Bank Form Overrides (Light Mode)                */
/* ════════════════════════════════════════════════════════════ */
.light-mode .workspace-card {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
}

.light-mode .workspace-header {
  border-bottom-color: var(--border) !important;
}

.light-mode .workspace-title {
  color: var(--text-heading) !important;
}

.light-mode .mcq-option-card {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

.light-mode .mcq-option-card:hover {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--primary) !important;
}

.light-mode .equation-editor-group {
  background: rgba(0, 0, 0, 0.015) !important;
  border-color: var(--border) !important;
}

.light-mode .math-toolbar {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode math-field {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .tool-btn {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .tool-btn:hover {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.light-mode .tab-btn {
  color: var(--text-muted) !important;
}

.light-mode .tab-btn:hover {
  color: var(--text-heading) !important;
  background: rgba(0, 0, 0, 0.03) !important;
}

.light-mode .tab-btn.active {
  background: var(--primary) !important;
  color: #ffffff !important;
}

.light-mode .switch-btn {
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

.light-mode .switch-btn:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.light-mode .tf-card {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

.light-mode .tf-card:hover {
  border-color: var(--primary) !important;
}

.light-mode .tf-card-title {
  color: var(--text-heading) !important;
}

.light-mode .upload-dropzone {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

.light-mode .upload-dropzone:hover {
  background: rgba(99, 102, 241, 0.02) !important;
  border-color: var(--primary) !important;
}

.light-mode .dropzone-text {
  color: var(--text-heading) !important;
}

/* ════════════════════════════════════════════════════════════ */
/* 13. Exam Form & Spinner Overrides (Light Mode)              */
/* ════════════════════════════════════════════════════════════ */
.light-mode .numeric-stepper {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode .numeric-stepper:focus-within {
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.15), 0 0 0 3px var(--primary-bg) !important;
}

.light-mode .stepper-btn {
  background: rgba(0, 0, 0, 0.03) !important;
  color: var(--text) !important;
}

.light-mode .stepper-btn:hover {
  background: var(--primary) !important;
  color: #ffffff !important;
}

.light-mode .numeric-stepper.disabled,
.light-mode .numeric-stepper:has(.stepper-input:disabled),
.light-mode .numeric-stepper:has(.stepper-input[readonly]) {
  background: rgba(0, 0, 0, 0.05) !important;
}

.light-mode .difficulty-card,
.light-mode .status-card {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode .difficulty-card:hover,
.light-mode .status-card:hover {
  background: var(--bg-hover) !important;
  border-color: var(--primary) !important;
}

.light-mode .difficulty-title,
.light-mode .status-title {
  color: var(--text-heading) !important;
}

.light-mode .difficulty-card.active[data-value=""] { border-color: #9ca3af !important; background: rgba(156, 163, 175, 0.08) !important; }
.light-mode .difficulty-card.active[data-value="easy"] { border-color: #10b981 !important; background: rgba(16, 185, 129, 0.08) !important; }
.light-mode .difficulty-card.active[data-value="medium"] { border-color: #4f46e5 !important; background: rgba(79, 70, 229, 0.08) !important; }
.light-mode .difficulty-card.active[data-value="hard"] { border-color: #f43f5e !important; background: rgba(244, 63, 94, 0.08) !important; }

.light-mode .status-card.active[data-value="1"] { border-color: #10b981 !important; background: rgba(16, 185, 129, 0.08) !important; }
.light-mode .status-card.active[data-value="0"] { border-color: #ef4444 !important; background: rgba(239, 68, 68, 0.08) !important; }

.light-mode .search-select-trigger {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .search-select-trigger:hover {
  border-color: var(--primary) !important;
}

.light-mode .search-select-dropdown {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}

.light-mode .search-select-search-wrapper {
  border-bottom-color: var(--border) !important;
}

.light-mode .search-select-input {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .search-select-option {
  color: var(--text) !important;
}

.light-mode .search-select-option:hover {
  background: var(--bg-hover) !important;
  color: var(--text-heading) !important;
}

.light-mode .search-select-option.selected {
  background: rgba(79, 70, 229, 0.08) !important;
  color: var(--primary) !important;
}

.light-mode .tab-nav-btn {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

.light-mode .tab-nav-btn:hover {
  background: var(--bg-hover) !important;
  color: var(--text-heading) !important;
  border-color: var(--border) !important;
}

.light-mode .tab-nav-btn.active {
  background: rgba(79, 70, 229, 0.08) !important;
  color: var(--primary) !important;
  border-color: rgba(79, 70, 229, 0.3) !important;
}

.light-mode .questions-list {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

.light-mode .questions-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08) !important;
}

.light-mode .questions-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15) !important;
}

.light-mode .q-card-premium {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
}

.light-mode .q-card-premium:hover {
  border-color: var(--primary) !important;
  background: var(--bg-hover) !important;
}

.light-mode .filters-card-premium {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode .empty-drop-zone {
  border-color: var(--border) !important;
  background: rgba(0, 0, 0, 0.01) !important;
}

.light-mode .form-section-title {
  border-bottom-color: var(--border) !important;
}

/* ════════════════════════════════════════════════════════════ */
/* 14. Global Inline Style Override Engine (Light Mode)         */
/* ════════════════════════════════════════════════════════════ */
.light-mode [style*="background: rgba(26, 34, 53"],
.light-mode [style*="background:rgba(26, 34, 53"],
.light-mode [style*="background: rgba(30, 41, 59"],
.light-mode [style*="background:rgba(30, 41, 59"],
.light-mode [style*="background: rgba(30,41,59"],
.light-mode [style*="background:rgba(30,41,59"] {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

.light-mode [style*="background: rgba(15, 23, 42"],
.light-mode [style*="background: rgba(15,23,42"],
.light-mode [style*="background:rgba(15,23,42"],
.light-mode [style*="background:rgba(15, 23, 42"],
.light-mode [style*="background: rgba(17, 24, 39"],
.light-mode [style*="background:rgba(17, 24, 39"],
.light-mode [style*="background: rgba(0, 0, 0, 0.15)"],
.light-mode [style*="background:rgba(0,0,0,0.15)"] {
  background: rgba(0, 0, 0, 0.015) !important;
  border-color: var(--border) !important;
}

.light-mode [style*="background: rgba(255, 255, 255, 0.02)"],
.light-mode [style*="background:rgba(255,255,255,0.02)"],
.light-mode [style*="background: rgba(255, 255, 255, 0.03)"],
.light-mode [style*="background:rgba(255,255,255,0.03)"] {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--border) !important;
}

.light-mode [style*="border: 1px solid rgba(255, 255, 255"],
.light-mode [style*="border:1px solid rgba(255,255,255"],
.light-mode [style*="border: 2px solid rgba(255, 255, 255"],
.light-mode [style*="border:2px solid rgba(255,255,255"],
.light-mode [style*="border: 2px dashed rgba(255, 255, 255"],
.light-mode [style*="border:2px dashed rgba(255,255,255"],
.light-mode [style*="border-bottom: 1px solid rgba(255, 255, 255"],
.light-mode [style*="border-bottom:1px solid rgba(255,255,255"],
.light-mode [style*="border-top: 1px solid rgba(255, 255, 255"],
.light-mode [style*="border-top:1px solid rgba(255,255,255"] {
  border-color: var(--border) !important;
}

/* Force high contrast text on inline styling that sets color to white/light grey, while preserving actions/buttons */
.light-mode form [style*="color:#fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color: #fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color:#ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color: #ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color:#f8fafc"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color: #f8fafc"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color:#f1f5f9"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color: #f1f5f9"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color:#cbd5e1"]:not(button):not(.btn):not(.badge):not(a),
.light-mode form [style*="color: #cbd5e1"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color:#fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color: #fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color:#ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color: #ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color:#f8fafc"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color: #f8fafc"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color:#f1f5f9"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color: #f1f5f9"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color:#cbd5e1"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .card [style*="color: #cbd5e1"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .premium-card [style*="color:#fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .premium-card [style*="color: #fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .premium-card [style*="color:#ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .premium-card [style*="color: #ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .premium-card [style*="color:#cbd5e1"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .premium-card [style*="color: #cbd5e1"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .workspace-card [style*="color:#fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .workspace-card [style*="color: #fff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .workspace-card [style*="color:#ffffff"]:not(button):not(.btn):not(.badge):not(a),
.light-mode .workspace-card [style*="color: #ffffff"]:not(button):not(.btn):not(.badge):not(a) {
  color: var(--text-heading) !important;
}

/* Ensure buttons with inline styles of white text on light backgrounds are overridden correctly to have dark text in light mode */
.light-mode .btn[style*="color:#fff"],
.light-mode .btn[style*="color: #fff"],
.light-mode .btn[style*="color:#ffffff"],
.light-mode .btn[style*="color: #ffffff"] {
  color: var(--text-heading) !important;
}
.light-mode .btn-primary[style*="color:#fff"],
.light-mode .btn-primary[style*="color: #fff"],
.light-mode .btn-primary[style*="color:#ffffff"],
.light-mode .btn-primary[style*="color: #ffffff"] {
  color: #ffffff !important; /* Keep primary buttons text white since primary background is deep indigo */
}

/* ════════════════════════════════════════════════════════════ */
/* 15. AI Question Generator Modal Overrides (Light Mode)       */
/* ════════════════════════════════════════════════════════════ */
.light-mode .ai-modal-overlay {
  background: rgba(15, 23, 42, 0.4) !important;
}

.light-mode .ai-modal-container {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}

.light-mode .ai-modal-header {
  background: var(--bg-surface) !important;
  border-bottom-color: var(--border) !important;
}

.light-mode .ai-modal-footer {
  background: var(--bg-surface) !important;
  border-top-color: var(--border) !important;
}

.light-mode .ai-modal-body select.form-select,
.light-mode .ai-modal-body input.form-input,
.light-mode .ai-modal-body textarea.form-input {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.light-mode .ai-modal-body select.form-select:focus,
.light-mode .ai-modal-body input.form-input:focus,
.light-mode .ai-modal-body textarea.form-input:focus {
  border-color: var(--primary) !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px var(--primary-bg) !important;
}

.light-mode .ai-modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02) !important;
}

.light-mode .ai-modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08) !important;
}

.light-mode .ai-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15) !important;
}

.light-mode .ai-tab-btn.active {
  background: rgba(79, 70, 229, 0.08) !important;
  color: #4f46e5 !important;
  border-color: rgba(79, 70, 229, 0.25) !important;
}

.light-mode .ai-tab-btn:hover:not(.active) {
  color: var(--text-heading) !important;
  background: rgba(0, 0, 0, 0.03) !important;
}

.light-mode .btn[style*="color:#a5b4fc"],
.light-mode .btn[style*="color: #a5b4fc"] {
  color: #4f46e5 !important;
  background: rgba(79, 70, 229, 0.08) !important;
  border-color: rgba(79, 70, 229, 0.25) !important;
}

.light-mode .btn[style*="color:#a5b4fc"] i,
.light-mode .btn[style*="color: #a5b4fc"] i {
  color: #4f46e5 !important;
}

/* ════════════════════════════════════════════════════════════ */
/* 16. Exam Statistics Page Overrides (Light Mode)              */
/* ════════════════════════════════════════════════════════════ */
.light-mode .stat-card-premium {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

.light-mode .stat-card-premium:hover {
  border-color: var(--primary) !important;
  box-shadow: var(--shadow) !important;
}

.light-mode .panel-card-premium {
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

.light-mode .toolbar-premium {
  border-bottom-color: var(--border) !important;
}

.light-mode .tabs-container-premium {
  border-bottom-color: var(--border) !important;
}

.light-mode .tab-btn-premium:hover:not(.active) {
  color: var(--text-heading) !important;
  background: rgba(0, 0, 0, 0.03) !important;
}

.light-mode .stats-table-premium th {
  background: rgba(0, 0, 0, 0.02) !important;
  border-bottom-color: var(--border) !important;
}

.light-mode .stats-table-premium td {
  border-bottom-color: var(--border) !important;
}

.light-mode .stats-table-premium tbody tr:hover {
  background: rgba(0, 0, 0, 0.01) !important;
}

.light-mode .chart-canvas-container {
  background: rgba(0, 0, 0, 0.01) !important;
  border-color: var(--border) !important;
}

.light-mode .summary-mini-card {
  border-color: var(--border) !important;
  background: rgba(0, 0, 0, 0.01) !important;
}

.light-mode .summary-mini-card.passed {
  background: rgba(16, 185, 129, 0.05) !important;
  border-color: rgba(16, 185, 129, 0.15) !important;
}

.light-mode .summary-mini-card.failed {
  background: rgba(239, 68, 68, 0.05) !important;
  border-color: rgba(239, 68, 68, 0.15) !important;
}

.light-mode .table-wrapper {
  border-color: var(--border) !important;
}




/* =============================================================
   LIGHT MODE: EXAM FORM PREMIUM UI (form.html components)
   ============================================================= */

/* --- Aurora Container --- */
.light-mode .aurora-bg-container {
  background: linear-gradient(135deg, rgba(79,70,229,0.04) 0%, rgba(139,92,246,0.02) 50%, rgba(16,185,129,0.02) 100%) !important;
  border: 1px solid rgba(0,0,0,0.07) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.04) !important;
}
.light-mode .aurora-bg-container::before {
  background: radial-gradient(circle, rgba(79,70,229,0.05) 0%, transparent 70%) !important;
}
.light-mode .aurora-bg-container::after {
  background: radial-gradient(circle, rgba(16,185,129,0.03) 0%, transparent 70%) !important;
}

/* --- Wizard Step Navigation --- */
.light-mode .tabs-progress-track {
  background: rgba(0,0,0,0.08) !important;
}
.light-mode .tabs-progress-fill {
  box-shadow: 0 0 6px rgba(79,70,229,0.3) !important;
}
.light-mode .tab-nav-step {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(0,0,0,0.12) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}
.light-mode .tab-nav-step i {
  color: rgba(0,0,0,0.3) !important;
}
.light-mode .tab-nav-label {
  color: #64748b !important;
}
.light-mode .tab-nav-btn:hover .tab-nav-step {
  border-color: rgba(79,70,229,0.35) !important;
  background: rgba(79,70,229,0.05) !important;
}
.light-mode .tab-nav-btn:hover .tab-nav-step i { color: #4f46e5 !important; }
.light-mode .tab-nav-btn:hover .tab-nav-label { color: #4f46e5 !important; }

.light-mode .tab-nav-btn.active .tab-nav-step {
  background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(139,92,246,0.08)) !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1), 0 4px 14px rgba(79,70,229,0.2) !important;
}
.light-mode .tab-nav-btn.active .tab-nav-step i { color: #4f46e5 !important; }
.light-mode .tab-nav-btn.active .tab-nav-label { color: #4f46e5 !important; font-weight: 700; }
.light-mode .tab-nav-btn.active .tab-nav-num { background: #4f46e5 !important; color: #fff !important; border-color: #4f46e5 !important; }

.light-mode .tab-nav-btn.completed .tab-nav-step {
  background: rgba(16,185,129,0.08) !important;
  border-color: rgba(16,185,129,0.4) !important;
}
.light-mode .tab-nav-btn.completed .tab-nav-step i { color: #059669 !important; }
.light-mode .tab-nav-btn.completed .tab-nav-label { color: #059669 !important; }
.light-mode .tab-nav-btn.completed .tab-nav-num { background: #059669 !important; }

.light-mode .tab-nav-num {
  background: rgba(255,255,255,0.95) !important;
  border-color: rgba(0,0,0,0.12) !important;
  color: rgba(0,0,0,0.4) !important;
}

/* --- Step indicator pill --- */
.light-mode #step-indicator {
  background: rgba(255,255,255,0.85) !important;
  border-color: rgba(0,0,0,0.08) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
}
.light-mode #step-indicator span { color: #475569 !important; }

/* --- Form section title --- */
.light-mode .form-section-title {
  background: linear-gradient(135deg, rgba(79,70,229,0.06) 0%, transparent 100%) !important;
  border-left-color: #4f46e5 !important;
  color: #4f46e5 !important;
}

/* --- Form inputs override --- */
.light-mode .form-input-premium,
.light-mode .form-select {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
.light-mode .form-input-premium:hover,
.light-mode .form-select:hover {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
}
.light-mode .form-input-premium:focus,
.light-mode .form-select:focus {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12) !important;
  background: #ffffff !important;
}
.light-mode .form-input-premium::placeholder { color: #94a3b8 !important; }
.light-mode .form-label,
.light-mode .form-group-premium label { color: #475569 !important; }
.light-mode .form-label i,
.light-mode .form-group-premium label i { color: #4f46e5 !important; }

/* --- Stat Input Cards (Timing tab) --- */
.light-mode .stat-input-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
}
.light-mode .stat-input-card:focus-within {
  border-color: rgba(79,70,229,0.4) !important;
  box-shadow: 0 4px 16px rgba(79,70,229,0.08) !important;
}
.light-mode .stat-input-card::before {
  background: linear-gradient(90deg, #4f46e5, rgba(139,92,246,0.5)) !important;
}
.light-mode .stat-input-card-label { color: #64748b !important; }
.light-mode .stat-input-card input { color: #0f172a !important; }
.light-mode .stat-input-card-icon { background: rgba(79,70,229,0.08) !important; }

/* --- Toggle Cards --- */
.light-mode .toggle-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04) !important;
}
.light-mode .toggle-card::before {
  background: linear-gradient(135deg, rgba(79,70,229,0.04) 0%, transparent 60%) !important;
}
.light-mode .toggle-card:hover {
  border-color: rgba(79,70,229,0.2) !important;
  background: rgba(79,70,229,0.01) !important;
}
.light-mode .toggle-card-title { color: #0f172a !important; }
.light-mode .toggle-card-desc { color: #64748b !important; }
.light-mode .toggle-card-switch {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}
.light-mode .toggle-card-switch::after { background: #94a3b8 !important; }
.light-mode .toggle-card input:checked ~ .toggle-card-switch {
  background: rgba(79,70,229,0.7) !important;
  border-color: #4f46e5 !important;
}
.light-mode .toggle-card input:checked ~ .toggle-card-switch::after { background: #fff !important; }

.light-mode .toggle-card.security-card {
  background: rgba(220,38,38,0.02) !important;
  border-color: rgba(220,38,38,0.1) !important;
}
.light-mode .toggle-card.security-card:hover {
  border-color: rgba(220,38,38,0.2) !important;
  background: rgba(220,38,38,0.04) !important;
}
.light-mode .toggle-card.security-card input:checked ~ .toggle-card-switch {
  background: rgba(220,38,38,0.6) !important;
  border-color: #dc2626 !important;
}
.light-mode .toggle-card.security-card input:checked ~ .toggle-card-switch::after { background: #fff !important; }

/* --- Tab content card --- */
.light-mode .tab-content-card {
  background: rgba(255,255,255,0.85) !important;
  border-color: rgba(0,0,0,0.07) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.03) !important;
}

/* --- Wizard Footer buttons --- */
.light-mode .wizard-footer {
  border-top-color: rgba(0,0,0,0.08) !important;
}
.light-mode .wizard-footer::before {
  background: #4f46e5 !important;
}
.light-mode .wizard-btn-prev {
  background: rgba(0,0,0,0.02) !important;
  border-color: rgba(0,0,0,0.1) !important;
  color: #475569 !important;
}
.light-mode .wizard-btn-prev:hover {
  background: rgba(0,0,0,0.05) !important;
  border-color: rgba(0,0,0,0.15) !important;
  color: #0f172a !important;
}
.light-mode .wizard-btn-next {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(79,70,229,0.3) !important;
}
.light-mode .wizard-btn-next:hover {
  box-shadow: 0 8px 24px rgba(79,70,229,0.4) !important;
}
.light-mode .wizard-btn-save {
  box-shadow: 0 4px 14px rgba(16,185,129,0.25) !important;
}

/* --- Premium Card (form container) --- */
.light-mode .premium-card {
  background: rgba(255,255,255,0.88) !important;
  border-color: rgba(0,0,0,0.07) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.04) !important;
}

/* --- Question picker panels (light) --- */
.light-mode .qpick-panel {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(0,0,0,0.08) !important;
}
.light-mode .qpick-panel-header {
  background: rgba(248,250,252,0.95) !important;
  border-bottom-color: rgba(0,0,0,0.06) !important;
}
.light-mode .qpick-filters {
  background: rgba(0,0,0,0.01) !important;
  border-bottom-color: rgba(0,0,0,0.04) !important;
}
.light-mode .qpick-filters input,
.light-mode .qpick-filters select {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
.light-mode .qpick-panel-title.bank { color: #059669 !important; }
.light-mode .qpick-panel-title.assigned { color: #4f46e5 !important; }
.light-mode .qpick-panel-count.bank { background: rgba(16,185,129,0.1) !important; color: #059669 !important; }
.light-mode .qpick-panel-count.assigned { background: rgba(79,70,229,0.1) !important; color: #4f46e5 !important; }
.light-mode .questions-picker-header {
  background: linear-gradient(135deg, rgba(79,70,229,0.05) 0%, rgba(139,92,246,0.03) 100%) !important;
  border-color: rgba(79,70,229,0.12) !important;
}
.light-mode .qpick-stat-val { background: rgba(79,70,229,0.08) !important; color: #4f46e5 !important; }
.light-mode .qpick-stat-val.green { background: rgba(16,185,129,0.08) !important; color: #059669 !important; }

/* --- Alert error (light) --- */
.light-mode .alert-error {
  background: linear-gradient(135deg, rgba(220,38,38,0.05), rgba(220,38,38,0.02)) !important;
  border-color: rgba(220,38,38,0.15) !important;
  border-left-color: #dc2626 !important;
  color: #b91c1c !important;
}

/* --- Difficulty / Status cards text (light) --- */
.light-mode .difficulty-title,
.light-mode .status-title { color: #0f172a !important; }
.light-mode .difficulty-desc,
.light-mode .status-desc { color: #64748b !important; }

/* --- Section title inline style interceptors (form) --- */
.light-mode h2[style*="color:#f8fafc"],
.light-mode h2[style*="color: #f8fafc"] { color: #0f172a !important; }
.light-mode span[style*="color:rgba(148,163,184"],
.light-mode span[style*="color: rgba(148"] { color: #64748b !important; }

