/* ═══════════════════════════════════════════════════
   U-Pontren Al-Amin Tabanan - Main Stylesheet
   Modern Islamic CBT System
═══════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --primary: #1a4d2e;
  --primary-light: #2d7a4f;
  --primary-dark: #0d2b1a;
  --gold: #d4a017;
  --gold-light: #f0c040;
  --gold-dark: #9a7512;
  --white: #ffffff;
  --bg: #f8fafc;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* ── Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: #1e293b; overflow-x: hidden; }
.font-arabic { font-family: 'Amiri', serif; direction: rtl; text-align: right; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ═══════════════════════════════════
   SPLASH SCREEN
═══════════════════════════════════ */
#splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #052e16 0%, #1a4d2e 35%, #0d2b1a 70%, #052e16 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: splashFadeOut 0.5s ease-out 3s forwards;
}

.splash-ornament {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.splash-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(212, 160, 23, 0.15);
}

.splash-circle:nth-child(1) { width: 300px; height: 300px; top: -100px; right: -100px; }
.splash-circle:nth-child(2) { width: 500px; height: 500px; top: -200px; right: -200px; }
.splash-circle:nth-child(3) { width: 200px; height: 200px; bottom: -50px; left: -50px; }
.splash-circle:nth-child(4) { width: 400px; height: 400px; bottom: -150px; left: -150px; }

.splash-logo {
  width: 100px;
  height: 100px;
  background: rgba(212, 160, 23, 0.15);
  border: 3px solid rgba(212, 160, 23, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: splashLogoPulse 2s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(212, 160, 23, 0.3);
}

.splash-logo svg { width: 56px; height: 56px; }

.splash-title {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  color: #fcd34d;
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.splash-subtitle {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.8);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.splash-org {
  font-size: 0.75rem;
  color: rgba(212, 160, 23, 0.8);
  text-align: center;
  margin-bottom: 40px;
}

.splash-progress {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.splash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d4a017, #fcd34d);
  border-radius: 2px;
  animation: splashProgress 3s ease-in-out forwards;
}

.splash-bismillah {
  font-family: 'Amiri', serif;
  font-size: 1.5rem;
  color: rgba(212, 160, 23, 0.9);
  margin-bottom: 20px;
  text-align: center;
}

@keyframes splashFadeOut {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

@keyframes splashLogoPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(212, 160, 23, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(212, 160, 23, 0.5); }
}

@keyframes splashProgress {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ═══════════════════════════════════
   SIDEBAR
═══════════════════════════════════ */
#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #052e16 0%, #1a4d2e 100%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}

#sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.2);
  background: rgba(0,0,0,0.2);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sidebar-logo-icon {
  width: 44px; height: 44px;
  background: rgba(212, 160, 23, 0.2);
  border: 2px solid rgba(212, 160, 23, 0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text { flex: 1; overflow: hidden; }
.sidebar-logo-text h1 {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fcd34d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.sidebar-logo-text p { font-size: 0.625rem; color: rgba(255,255,255,0.6); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  margin-top: 8px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(212, 160, 23, 0.3);
  border: 2px solid rgba(212, 160, 23, 0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; color: #fcd34d; font-weight: 700; flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-info p:first-child { font-size: 0.8125rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info p:last-child { font-size: 0.6875rem; color: rgba(212,160,23,0.8); text-transform: capitalize; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section { margin-bottom: 8px; }
.nav-section-title {
  font-size: 0.625rem;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: white;
}

.nav-item.active {
  background: rgba(212, 160, 23, 0.15);
  color: #fcd34d;
  border-left-color: #fcd34d;
}

.nav-item-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.nav-item-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* ═══════════════════════════════════
   HEADER
═══════════════════════════════════ */
#main-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 99;
  gap: 16px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

#main-header.full-width { left: 0; }

.header-menu-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: var(--transition);
  flex-shrink: 0;
}
.header-menu-btn:hover { background: #f1f5f9; color: #1e293b; }

.header-title { font-size: 1rem; font-weight: 700; color: #1e293b; flex: 1; }

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px;
  width: 240px;
  transition: var(--transition);
}
.header-search:focus-within { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.1); background: white; }
.header-search input { flex: 1; border: none; outline: none; background: transparent; font-size: 0.875rem; color: #1e293b; }
.header-search i { color: #94a3b8; font-size: 0.875rem; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.header-action-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: var(--transition);
}
.header-action-btn:hover { background: #f1f5f9; color: #1e293b; }
.header-action-btn .badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
  font-size: 0.5rem;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ═══════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════ */
#main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#main-content.full-width { margin-left: 0; }

/* ═══════════════════════════════════
   CARDS
═══════════════════════════════════ */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #f1f5f9;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 24px; }

/* ═══════════════════════════════════
   STAT CARDS
═══════════════════════════════════ */
.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #f1f5f9;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.green::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.stat-card.gold::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.stat-card.blue::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.stat-card.red::before { background: linear-gradient(90deg, #dc2626, #f87171); }
.stat-card.purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.stat-card.teal::before { background: linear-gradient(90deg, #0d9488, #2dd4bf); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.stat-card.green .icon { background: #dcfce7; color: #16a34a; }
.stat-card.gold .icon { background: #fef3c7; color: #d97706; }
.stat-card.blue .icon { background: #dbeafe; color: #2563eb; }
.stat-card.red .icon { background: #fee2e2; color: #dc2626; }
.stat-card.purple .icon { background: #ede9fe; color: #7c3aed; }
.stat-card.teal .icon { background: #ccfbf1; color: #0d9488; }

.stat-card .value { font-size: 2rem; font-weight: 800; color: #1e293b; line-height: 1; margin-bottom: 4px; }
.stat-card .label { font-size: 0.8125rem; color: #64748b; font-weight: 500; }
.stat-card .change { font-size: 0.75rem; margin-top: 8px; }
.stat-card .change.up { color: #16a34a; }
.stat-card .change.down { color: #dc2626; }

/* ═══════════════════════════════════
   BUTTONS
═══════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary { background: #16a34a; color: white; }
.btn-primary:hover { background: #15803d; }

.btn-gold { background: #d97706; color: white; }
.btn-gold:hover { background: #b45309; }

.btn-outline { background: transparent; border-color: #e2e8f0; color: #64748b; }
.btn-outline:hover { background: #f8fafc; color: #1e293b; }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: #059669; color: white; }
.btn-success:hover { background: #047857; }

.btn-info { background: #2563eb; color: white; }
.btn-info:hover { background: #1d4ed8; }

.btn-warning { background: #d97706; color: white; }
.btn-warning:hover { background: #b45309; }

.btn-sm { padding: 5px 12px; font-size: 0.8125rem; }
.btn-xs { padding: 3px 8px; font-size: 0.75rem; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; min-width: 36px; justify-content: center; }

/* Line clamp utility */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

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

/* ═══════════════════════════════════
   FORMS
═══════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.875rem;
  color: #1e293b;
  background: white;
  outline: none;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.form-control:focus { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.1); }
.form-control.arabic { font-family: 'Amiri', serif; direction: rtl; text-align: right; font-size: 1.1rem; }

/* ═══════════════════════════════════
   TABLE
═══════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.table tr:hover td { background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════
   BADGES
═══════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: #dcfce7; color: #166534; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ═══════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════ */
#login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #052e16 0%, #1a4d2e 40%, #0d3a20 70%, #052e16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-ornament {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
  margin: 20px;
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo-container {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #1a4d2e, #2d7a4f);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 20px rgba(26,77,46,0.3);
}

.login-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}

.login-header .login-bismillah {
  font-family: 'Amiri', serif;
  font-size: 1rem;
  color: #d97706;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.8125rem;
  color: #64748b;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px; top: 50%; transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
}

.input-icon-right {
  position: absolute;
  right: 14px; top: 50%; transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
  cursor: pointer;
}

.input-with-icon { padding-left: 40px !important; }

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ═══════════════════════════════════
   UJIAN / EXAM ROOM
═══════════════════════════════════ */
#exam-room {
  position: fixed;
  inset: 0;
  background: #0f172a;
  z-index: 200;
  display: none;
}

#exam-room.active { display: flex; flex-direction: column; }

.exam-header {
  background: linear-gradient(135deg, #052e16 0%, #1a4d2e 100%);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  border-bottom: 2px solid rgba(212,160,23,0.3);
}

.exam-info { flex: 1; }
.exam-info h2 { font-size: 0.9375rem; font-weight: 700; color: white; margin-bottom: 2px; }
.exam-info p { font-size: 0.75rem; color: rgba(255,255,255,0.6); }

.exam-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: 12px;
  padding: 8px 16px;
  min-width: 80px;
}

.exam-timer span:first-child {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fcd34d;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.exam-timer.warning span:first-child { color: #f97316; }
.exam-timer.danger span:first-child { color: #ef4444; animation: timerPulse 1s ease-in-out infinite; }

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.exam-timer span:last-child { font-size: 0.625rem; color: rgba(255,255,255,0.5); }

.exam-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.exam-questions-nav {
  width: 200px;
  background: #1e293b;
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 1px solid #334155;
}

.exam-questions-nav h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.question-nav-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.question-nav-btn.answered { background: #166534; border-color: #16a34a; color: #4ade80; }
.question-nav-btn.current { background: #1d4ed8; border-color: #3b82f6; color: white; }
.question-nav-btn.flagged { background: #92400e; border-color: #f59e0b; color: #fcd34d; }

.exam-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #1e293b;
}

.question-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.question-number {
  width: 32px; height: 32px;
  background: #166534;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.question-text {
  flex: 1;
  font-size: 0.9375rem;
  color: #f1f5f9;
  line-height: 1.6;
}

.question-text.arabic-text {
  font-family: 'Amiri', serif;
  font-size: 1.25rem;
  direction: rtl;
  text-align: right;
}

.options-list { display: flex; flex-direction: column; gap: 10px; }

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.option-item:hover { border-color: #4ade80; background: rgba(22,163,74,0.1); }
.option-item.selected { border-color: #22c55e; background: rgba(22,163,74,0.15); }

.option-key {
  width: 28px; height: 28px;
  background: #334155;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
  text-transform: uppercase;
}

.option-item.selected .option-key { background: #16a34a; color: white; }

.option-text { flex: 1; font-size: 0.875rem; color: #cbd5e1; }
.option-item.selected .option-text { color: #f1f5f9; }

.option-text.arabic-opt { font-family: 'Amiri', serif; font-size: 1.1rem; }

.essay-textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 12px;
  color: #f1f5f9;
  font-size: 0.9375rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  resize: vertical;
  transition: var(--transition);
}
.essay-textarea:focus { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }
.essay-textarea.arabic-essay { font-family: 'Amiri', serif; direction: rtl; text-align: right; font-size: 1.2rem; }

.exam-footer {
  background: #0f172a;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid #334155;
  flex-shrink: 0;
}

.exam-progress-bar {
  flex: 1;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}

.exam-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #4ade80);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Watermark */
.exam-watermark {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 3rem;
  font-weight: 900;
  color: rgba(255,255,255,0.03);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}

/* Camera Box */
.camera-preview {
  width: 120px; height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(212,160,23,0.4);
  background: #0f172a;
  position: relative;
  flex-shrink: 0;
}

.camera-preview video { width: 100%; height: 100%; object-fit: cover; }
.camera-status {
  position: absolute;
  bottom: 4px; left: 0; right: 0;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px;
}
.camera-status.active { color: #4ade80; }
.camera-status.inactive { color: #f87171; }

/* Warning overlay */
.warning-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.warning-card {
  background: #1e293b;
  border: 2px solid #ef4444;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

.warning-icon { font-size: 4rem; margin-bottom: 16px; }
.warning-title { font-size: 1.5rem; font-weight: 800; color: #ef4444; margin-bottom: 12px; }
.warning-text { font-size: 0.9375rem; color: #94a3b8; margin-bottom: 24px; line-height: 1.6; }
.warning-count { font-size: 0.875rem; color: #f97316; font-weight: 700; margin-bottom: 20px; }

/* ═══════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════ */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-left: 4px solid;
  min-width: 280px;
  max-width: 360px;
  animation: toastSlide 0.3s ease;
}

.toast.success { border-left-color: #16a34a; }
.toast.error { border-left-color: #dc2626; }
.toast.warning { border-left-color: #d97706; }
.toast.info { border-left-color: #2563eb; }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: #16a34a; }
.toast.error .toast-icon { color: #dc2626; }
.toast.warning .toast-icon { color: #d97706; }
.toast.info .toast-icon { color: #2563eb; }

.toast-content { flex: 1; }
.toast-title { font-size: 0.875rem; font-weight: 700; color: #1e293b; margin-bottom: 2px; }
.toast-message { font-size: 0.8125rem; color: #64748b; }
.toast-close { color: #94a3b8; cursor: pointer; font-size: 1rem; line-height: 1; }

/* ═══════════════════════════════════
   MODALS
═══════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title { font-size: 1.0625rem; font-weight: 700; color: #1e293b; flex: 1; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: var(--transition);
}
.modal-close:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════
   ISLAMIC ORNAMENTS
═══════════════════════════════════ */
.islamic-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4a017' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 0px; }
  #sidebar { transform: translateX(-260px); }
  #sidebar.mobile-open { transform: translateX(0); width: 260px; }
  #main-content { margin-left: 0; }
  #main-header { left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; display: none; }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 768px) {
  #main-content { padding: 16px; }
  .header-search { display: none; }
  .exam-questions-nav { display: none; }
  .login-card { padding: 28px 24px; }
}

/* ═══════════════════════════════════
   ANIMATIONS
═══════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastSlide { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { transform: scale(1); opacity: 1; } }

.animate-fade-in { animation: fadeIn 0.5s ease; }
.animate-slide-up { animation: slideUp 0.5s ease; }
.animate-bounce-in { animation: bounceIn 0.6s ease; }

/* ═══════════════════════════════════
   DARK MODE
═══════════════════════════════════ */
body.dark-mode {
  background: #0f172a;
  color: #f1f5f9;
}

body.dark-mode .card { background: #1e293b; border-color: #334155; }
body.dark-mode .card-title { color: #f1f5f9; }
body.dark-mode .stat-card { background: #1e293b; border-color: #334155; }
body.dark-mode .stat-card .value { color: #f1f5f9; }
body.dark-mode .table th { background: #334155; color: #94a3b8; }
body.dark-mode .table td { color: #e2e8f0; border-bottom-color: #334155; }
body.dark-mode .table tr:hover td { background: #334155; }
body.dark-mode .form-control { background: #334155; border-color: #475569; color: #f1f5f9; }
body.dark-mode #main-header { background: #1e293b; border-bottom-color: #334155; }
body.dark-mode .header-title { color: #f1f5f9; }

/* ═══════════════════════════════════
   PRINT STYLES
═══════════════════════════════════ */
@media print {
  #sidebar, #main-header, .no-print { display: none !important; }
  #main-content { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
}

/* ═══════════════════════════════════
   UTILITIES
═══════════════════════════════════ */
.no-select { user-select: none; -webkit-user-select: none; }
.no-print { print-visibility: hidden; }
.text-gradient { background: linear-gradient(135deg, #1a4d2e, #d4a017); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.divider { height: 1px; background: #e2e8f0; margin: 16px 0; }
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: skeleton 1.5s infinite; }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Highlight/selected row */
.row-selected { background: #f0fdf4 !important; }

/* Online indicator */
.online-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; animation: pulse 2s ease-in-out infinite; display: inline-block; }
.offline-dot { width: 8px; height: 8px; background: #ef4444; border-radius: 50%; display: inline-block; }
