/* ============================================================
   Burgutali LMS/CRM — asosiy uslublar
   ============================================================ */

:root {
  --nav-w: 260px;
  --topbar-h: 66px;

  --brand: #1e3a5f;
  --brand-light: #2c5282;
  --accent: #2f855a;
  --accent-light: #38a169;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e4e8ef;
  --text: #1f2937;
  --muted: #6b7280;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ============================================================ Karkas */
.app-shell { display: flex; min-height: 100vh; }

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--nav-w);
  display: flex;
  flex-direction: column;
}

/* ============================================================ Yon panel */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav-w);
  background: var(--brand);
  color: #cbd7e6;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}

.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}

.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .12);
  border-radius: 8px;
  color: #fff;
  flex-shrink: 0;
}

.brand-mark svg { width: 20px; height: 20px; display: block; }

.btn-close-sidebar {
  background: none;
  border: 0;
  color: #cbd7e6;
  font-size: 1.1rem;
  padding: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 20px;
}

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }

.nav-section {
  padding: 16px 20px 6px;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255, 255, 255, .38);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #cbd7e6;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-item.active {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border-left-color: var(--accent-light);
  font-weight: 600;
}

.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 8px 0;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 1035;
}

.sidebar-backdrop.show { display: block; }

/* ============================================================ Yuqori panel */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.btn-toggle-sidebar {
  background: none;
  border: 0;
  font-size: 1.45rem;
  color: var(--brand);
  padding: 0;
  line-height: 1;
}

.topbar-title { flex: 1; min-width: 0; }

.topbar-title h1 {
  font-size: 1.12rem;
  font-weight: 650;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subtitle { font-size: .8rem; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  background: none;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.15rem;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.btn-icon:hover { background: var(--bg); color: var(--brand); }

.notif-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  background: #dc3545;
  color: #fff;
  font-size: .62rem;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  font-weight: 600;
}

/* Foydalanuvchi chipi */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.user-chip:hover { background: var(--bg); }

.user-chip img,
.avatar-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-initials {
  background: var(--brand-light);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 600;
}

.user-meta { text-align: left; line-height: 1.25; }
.user-name { display: block; font-size: .86rem; font-weight: 600; }
.user-role { display: block; font-size: .72rem; color: var(--muted); }

/* Bildirishnoma dropdown */
.notif-dropdown { width: 330px; padding: 0; max-width: calc(100vw - 24px); }

.notif-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.notif-item:hover { background: var(--bg); }
.notif-item i { font-size: 1.1rem; margin-top: 2px; }
.notif-title { font-size: .85rem; font-weight: 550; }
.notif-time { font-size: .74rem; color: var(--muted); }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: .86rem; }
.notif-all { display: block; padding: 11px; text-align: center; font-size: .85rem; font-weight: 600; color: var(--brand); }

/* ============================================================ Kontent */
.app-content { flex: 1; padding: 22px; max-width: 1500px; width: 100%; }

.app-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .8rem;
}

.messages { margin-bottom: 16px; }
.messages .alert { border: 0; border-radius: var(--radius-sm); box-shadow: var(--shadow); }

/* ============================================================ Kartalar */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-body { padding: 18px; }

/* Statistika kartalari */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .15s, box-shadow .15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #e0edff; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #15803d; }
.stat-icon.orange { background: #ffedd5; color: #c2410c; }
.stat-icon.red    { background: #fee2e2; color: #b91c1c; }
.stat-icon.purple { background: #ede9fe; color: #6d28d9; }
.stat-icon.teal   { background: #ccfbf1; color: #0f766e; }

.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-hint  { font-size: .74rem; color: var(--muted); margin-top: 2px; }

/* ============================================================ Jadvallar */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { margin: 0; font-size: .875rem; }

.table > thead > tr > th {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  white-space: nowrap;
  padding: 11px 14px;
}

.table > tbody > tr > td { padding: 11px 14px; vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: #f8fafc; }

/* ============================================================ Progress */
.progress { height: 7px; background: #eef1f6; border-radius: 4px; }
.progress-thin { height: 5px; }

/* ============================================================ Rozetkalar */
.badge-soft {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .74rem;
  font-weight: 600;
}

.badge-soft.success { background: #dcfce7; color: #15803d; }
.badge-soft.danger  { background: #fee2e2; color: #b91c1c; }
.badge-soft.warning { background: #fef3c7; color: #b45309; }
.badge-soft.info    { background: #dbeafe; color: #1d4ed8; }
.badge-soft.muted   { background: #f1f5f9; color: #64748b; }
.badge-soft.purple  { background: #ede9fe; color: #6d28d9; }

/* ============================================================ Sahifa sarlavhasi */
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.page-actions .spacer { flex: 1; }

/* ============================================================ Filtrlar */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.filter-bar .row { --bs-gutter-x: .75rem; --bs-gutter-y: .6rem; }

/* ============================================================ Kurs kartalari */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}

.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.course-cover {
  height: 140px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .85);
  font-size: 2.6rem;
  position: relative;
}

.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-title { font-size: 1rem; font-weight: 650; margin-bottom: 6px; color: var(--text); }
.course-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.course-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

/* ============================================================ Dars ro'yxati */
.module-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; background: var(--surface); }

.module-head {
  padding: 13px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.module-title { font-weight: 650; font-size: .95rem; }

.lesson-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background .12s;
}

.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover { background: #f8fafc; }

.lesson-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 650;
  flex-shrink: 0;
}

.lesson-num.done { background: #dcfce7; color: #15803d; }
.lesson-info { flex: 1; min-width: 0; }
.lesson-name { font-size: .9rem; font-weight: 550; }
.lesson-sub { font-size: .76rem; color: var(--muted); }

/* ============================================================ Video */
.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #9ca3af;
  text-align: center;
  padding: 20px;
}

/* ============================================================ Test */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.question-head { display: flex; gap: 12px; margin-bottom: 16px; }

.question-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 650;
  flex-shrink: 0;
}

.question-text { font-weight: 550; font-size: .97rem; }

.choice-label {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.choice-label:hover { border-color: #b8c4d6; background: #f8fafc; }
.choice-label input { margin-top: 3px; flex-shrink: 0; }
.choice-label.is-correct { border-color: #86efac; background: #f0fdf4; }
.choice-label.is-wrong   { border-color: #fca5a5; background: #fef2f2; }
.choice-label.is-selected { border-color: var(--brand-light); background: #eff6ff; }

.quiz-timer {
  position: sticky;
  top: calc(var(--topbar-h) + 10px);
  z-index: 1010;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.timer-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-value.warning { color: #dc2626; animation: pulse 1s infinite; }

@keyframes pulse { 50% { opacity: .55; } }

/* Natija doirasi */
.score-ring {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}

.score-ring.pass { background: linear-gradient(135deg, #22c55e, #16a34a); }
.score-ring.fail { background: linear-gradient(135deg, #f87171, #dc2626); }

/* ============================================================ Davomat jadvali */
.attendance-cell {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 700;
}

.att-present { background: #dcfce7; color: #15803d; }
.att-late    { background: #fef3c7; color: #b45309; }
.att-absent  { background: #fee2e2; color: #b91c1c; }
.att-excused { background: #dbeafe; color: #1d4ed8; }
.att-none    { background: #f1f5f9; color: #cbd5e1; }

/* ============================================================ Kirish sahifasi */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 55%, #2f855a 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .28);
  width: 100%;
  max-width: 420px;
  padding: 36px 30px;
}

.login-logo { text-align: center; margin-bottom: 26px; }
.login-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-radius: 16px;
  color: #fff;
  box-shadow: 0 6px 18px rgba(30, 58, 95, .28);
}

.login-mark svg { width: 40px; height: 40px; display: block; }
.login-logo h1 { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--brand); }
.login-logo p { font-size: .84rem; color: var(--muted); margin: 4px 0 0; }

/* ============================================================ Formalar */
.form-label { font-size: .84rem; font-weight: 600; margin-bottom: 5px; color: #374151; }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: #d9dee8; font-size: .9rem; padding: .5rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(44, 82, 130, .12); }
.form-text { font-size: .77rem; }
.invalid-feedback, .errorlist { color: #dc2626; font-size: .8rem; list-style: none; padding: 0; margin: 4px 0 0; }

.btn { border-radius: var(--radius-sm); font-size: .88rem; font-weight: 550; padding: .5rem 1rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-light); border-color: var(--brand-light); }
.btn-success { background: var(--accent); border-color: var(--accent); }
.btn-success:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-sm { font-size: .8rem; padding: .3rem .65rem; }

/* ============================================================ Bo'sh holat */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 3rem; opacity: .35; display: block; margin-bottom: 12px; }
.empty-state h5 { color: var(--text); font-size: 1rem; margin-bottom: 6px; }

/* ============================================================ Telegram kodi */
.token-box {
  background: #0f172a;
  color: #4ade80;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 1.3rem;
  letter-spacing: .12em;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  text-align: center;
  word-break: break-all;
}

/* ============================================================ Mobil moslashuv */
@media (max-width: 991.98px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .app-content { padding: 16px; }
  .topbar { padding: 0 14px; }
}

@media (max-width: 575.98px) {
  body { font-size: 14px; }
  .app-content { padding: 12px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; }
  .stat-card { padding: 13px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.05rem; }
  .stat-value { font-size: 1.22rem; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
  .topbar-title h1 { font-size: .98rem; }
  .course-grid { grid-template-columns: 1fr; }
  .question-card { padding: 15px; }
  .score-ring { width: 104px; height: 104px; font-size: 1.6rem; }
  .login-card { padding: 26px 20px; }
  .table > thead > tr > th,
  .table > tbody > tr > td { padding: 9px 10px; }
}

/* ============================================================ Chop etish */
@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .filter-bar, .btn { display: none !important; }
  .app-main { margin-left: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
