/* ═══════════════════════════════════════════════════════════
   EduPlatform — Custom CSS (Bootstrap 5 ustida)
   ═══════════════════════════════════════════════════════════ */

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

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
  --edu-accent: #3dd68c;
  --edu-accent-dark: #2bc47a;
  --edu-sidebar-w: 260px;
  --edu-topbar-h: 56px;
  --edu-font-display: 'Syne', sans-serif;
  --edu-font-body: 'Inter', sans-serif;
  --edu-radius: 10px;
  --edu-radius-lg: 14px;
  --edu-shadow: 0 2px 12px rgba(0,0,0,.08);
  --edu-shadow-md: 0 4px 20px rgba(0,0,0,.12);
}

[data-bs-theme="dark"] {
  --edu-sidebar-bg: #0e1117;
  --edu-sidebar-border: #1c2230;
  --edu-sidebar-text: #7e8fa8;
  --edu-sidebar-active: rgba(61,214,140,.1);
  --edu-topbar-bg: #111418;
  --edu-body-bg: #07090f;
  --edu-card-bg: #0e1117;
}

[data-bs-theme="light"] {
  --edu-sidebar-bg: #ffffff;
  --edu-sidebar-border: #e8ecf0;
  --edu-sidebar-text: #6b7280;
  --edu-sidebar-active: rgba(61,214,140,.08);
  --edu-topbar-bg: #ffffff;
  --edu-body-bg: #f0f4fa;
  --edu-card-bg: #ffffff;
}

/* ─── Base ──────────────────────────────────────────────── */
body {
  font-family: var(--edu-font-body);
  background: var(--edu-body-bg, #f0f4fa);
  min-height: 100vh;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6,.fw-display {
  font-family: var(--edu-font-display);
  font-weight: 700;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--edu-sidebar-w);
  background: var(--edu-sidebar-bg, #fff);
  border-right: 1px solid var(--edu-sidebar-border, #e8ecf0);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--edu-sidebar-border, #e8ecf0);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 34px; height: 34px;
  background: var(--edu-accent);
  color: #000;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--edu-font-display);
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--edu-font-display);
  font-weight: 800;
  font-size: 17px;
  color: var(--bs-body-color);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--edu-sidebar-border, #e8ecf0);
}

.user-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(61,214,140,.15);
  color: var(--edu-accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--edu-font-display);
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.user-name-sm { font-size: 13px; font-weight: 600; line-height: 1.3; }
.user-role-sm { margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--edu-sidebar-text, #6b7280);
  padding: 10px 8px 5px;
  font-weight: 600;
}

.nav-link-sidebar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--edu-sidebar-text, #374151);
  text-decoration: none;
  transition: all .15s;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.nav-link-sidebar:hover {
  background: var(--edu-sidebar-active);
  color: var(--bs-body-color);
  border-color: transparent;
}

.nav-link-sidebar.active {
  background: var(--edu-sidebar-active);
  color: var(--edu-accent);
  border-color: rgba(61,214,140,.2);
}

.nav-link-sidebar i { font-size: 15px; flex-shrink: 0; }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--edu-sidebar-border, #e8ecf0);
}

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1039;
  display: none;
}
.sidebar-overlay.show { display: block; }

/* ─── Main Content ─────────────────────────────────────── */
.main-content {
  margin-left: var(--edu-sidebar-w);
  min-height: 100vh;
  transition: margin-left .25s;
}

.topbar {
  height: var(--edu-topbar-h);
  background: var(--edu-topbar-bg, #fff);
  border-bottom: 1px solid var(--edu-sidebar-border, #e8ecf0);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky; top: 0; z-index: 1030;
}

.topbar-left { flex: 1; }
.topbar-menu-btn { border: none; }

.page-content { padding: 24px 20px; }

/* ─── Kartalar ─────────────────────────────────────────── */
.edu-card {
  background: var(--edu-card-bg, #fff);
  border: 1px solid var(--edu-sidebar-border, #e8ecf0);
  border-radius: var(--edu-radius-lg);
  padding: 20px;
  box-shadow: var(--edu-shadow);
  transition: box-shadow .2s, border-color .2s;
}
.edu-card:hover { box-shadow: var(--edu-shadow-md); }

/* ─── Stat kartalar ────────────────────────────────────── */
.stat-card {
  background: var(--edu-card-bg, #fff);
  border: 1px solid var(--edu-sidebar-border, #e8ecf0);
  border-radius: var(--edu-radius-lg);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-value { font-family: var(--edu-font-display); font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--edu-sidebar-text); margin-top: 2px; }

/* ─── Test kartalar ────────────────────────────────────── */
.test-card {
  background: var(--edu-card-bg, #fff);
  border: 1px solid var(--edu-sidebar-border, #e8ecf0);
  border-radius: var(--edu-radius-lg);
  padding: 18px;
  transition: all .2s;
  height: 100%;
  display: flex; flex-direction: column;
}
.test-card:hover {
  border-color: var(--edu-accent);
  box-shadow: 0 0 0 3px rgba(61,214,140,.1);
  transform: translateY(-2px);
}
.test-card .subject-icon { font-size: 28px; margin-bottom: 10px; }
.test-card .test-title { font-family: var(--edu-font-display); font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.test-card .test-meta { font-size: 12px; color: var(--edu-sidebar-text); display: flex; gap: 10px; flex-wrap: wrap; }
.test-card .test-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--edu-sidebar-border, #e8ecf0); }

/* ─── Tugmalar ─────────────────────────────────────────── */
.btn-edu {
  background: var(--edu-accent);
  color: #000;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  transition: all .15s;
}
.btn-edu:hover { background: var(--edu-accent-dark); color: #000; transform: translateY(-1px); }
.btn-edu:active { transform: scale(.98); }

/* ─── Test topshirish interfeysi ─────────────────────────── */
.test-taking-wrap {
  max-width: 800px;
  margin: 0 auto;
}
.question-body { font-size: 17px; font-weight: 500; line-height: 1.7; margin-bottom: 20px; }
.answer-option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--edu-sidebar-border, #dee2e6);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 8px;
  background: var(--edu-card-bg, #fff);
}
.answer-option:hover { border-color: #86b7fe; background: rgba(13,110,253,.03); }
.answer-option.selected { border-color: var(--edu-accent); background: rgba(61,214,140,.07); }
.answer-option.correct  { border-color: #198754; background: rgba(25,135,84,.08); }
.answer-option.wrong    { border-color: #dc3545; background: rgba(220,53,69,.08); }
.answer-radio-circle {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex-shrink: 0; margin-top: 2px;
}

/* ─── Timer ───────────────────────────────────────────── */
.test-timer {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
}
.test-timer.warning { color: #f59e0b; }
.test-timer.danger  { color: #ef4444; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ─── Sahifalash ─────────────────────────────────────── */
.pagination .page-link { border-radius: 8px; margin: 0 2px; }
.pagination .page-item.active .page-link { background: var(--edu-accent); border-color: var(--edu-accent); color: #000; }

/* ─── Reyting jadval ─────────────────────────────────── */
.leaderboard-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--edu-sidebar-border, #e8ecf0); }
.leaderboard-row:last-child { border-bottom: none; }
.rank-badge { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.rank-1 { background: #FFD700; color: #000; }
.rank-2 { background: #C0C0C0; color: #000; }
.rank-3 { background: #CD7F32; color: #fff; }

/* ─── Progress bar ───────────────────────────────────── */
.progress { border-radius: 20px; }
.progress-bar.bg-edu { background: var(--edu-accent) !important; color: #000; }

/* ─── Badge'lar ──────────────────────────────────────── */
.badge-difficulty-easy   { background: rgba(25,135,84,.1);  color: #198754; border: 1px solid rgba(25,135,84,.2); }
.badge-difficulty-medium { background: rgba(255,193,7,.1);  color: #997404; border: 1px solid rgba(255,193,7,.2); }
.badge-difficulty-hard   { background: rgba(220,53,69,.1);  color: #dc3545; border: 1px solid rgba(220,53,69,.2); }
.badge-premium { background: rgba(255,193,7,.15); color: #b45309; border: 1px solid rgba(255,193,7,.3); }

/* ─── Auth sahifalar ─────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--edu-body-bg, #f0f4fa); padding: 24px; }
.auth-card { background: var(--edu-card-bg, #fff); border: 1px solid var(--edu-sidebar-border, #e8ecf0); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--edu-shadow-md); }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-title { font-family: var(--edu-font-display); font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.auth-sub { color: #6b7280; margin-bottom: 24px; font-size: 14px; }

/* ─── Admin ──────────────────────────────────────────── */
.admin-table { font-size: 14px; }
.admin-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-menu-btn { display: flex !important; }
}

@media (max-width: 575.98px) {
  .page-content { padding: 16px 12px; }
  .auth-card { padding: 28px 20px; }
}

/* ─── Loading spinner ───────────────────────────────── */
.edu-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(61,214,140,.2);
  border-top-color: var(--edu-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─────────────────────────────────────────── */
.edu-toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }
