/* ===== Asosiy ranglar ===== */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --sidebar-bg: #111827;
  --sidebar-text: #9ca3af;
  --page-bg: #f5f7fb;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338ca;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-border-radius: .6rem;
}

body { background: var(--page-bg); }
/* Flex ichida uzun matn qisqartirilishi uchun (Bootstrap'da bu klass yo'q) */
.min-w-0 { min-width: 0; }

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.bg-primary-soft { background: var(--brand-soft); }
.form-check-input:checked, .form-check-input:indeterminate { background-color: var(--brand); border-color: var(--brand); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); --bs-nav-link-color: var(--brand); --bs-nav-link-hover-color: var(--brand-dark); }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }

/* ===== Sahifa tuzilishi ===== */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.5rem; flex: 1; }
@media (max-width: 575.98px) { .content { padding: 1rem; } }

.sidebar {
  width: 260px; color: #fff;
  /* Bootstrap offcanvas-lg katta ekranda fonni shaffof qiladi — shuning uchun !important */
  background-color: var(--sidebar-bg) !important;
  --bs-offcanvas-width: 260px;
  display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
}
.sidebar-brand a { color: #fff; text-decoration: none; display: flex; align-items: center; gap: .65rem; }
/* Logotip — favicon bilan bir xil: binafsha kvadratda oq qalpoqcha */
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-size: 1.25rem;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .6);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-text small { font-weight: 500; font-size: .72rem; opacity: .7; letter-spacing: .02em; }
.public-brand { display: flex; align-items: center; gap: .6rem; color: #111827 !important; }
.public-brand .brand-text small { color: #6b7280; opacity: 1; }
.sidebar-nav { padding: .5rem .75rem; flex: 1; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .85rem; margin-bottom: 2px; border-radius: .5rem;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-nav a i { font-size: 1.1rem; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active { background: var(--brand); color: #fff; }
.sidebar-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: #6b7280; padding: 1rem .85rem .4rem;
}
.sidebar-user {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-user small { color: var(--sidebar-text); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.topbar {
  display: flex; align-items: center; gap: .75rem;
  background: #fff; border-bottom: 1px solid #e5e7eb;
  padding: .75rem 1.5rem; position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 1.1rem; }

/* ===== Kartochkalar ===== */
.card { border: 1px solid #e8eaf1; border-radius: .9rem; }
.card-header { background: transparent; border-bottom: 1px solid #eef0f5; font-weight: 600; padding: .9rem 1.25rem; }
.card-hover { transition: transform .15s, box-shadow .15s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(17, 24, 39, .08); }

.stat-card { flex-direction: row; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; height: 100%; }
.stat-icon {
  width: 48px; height: 48px; border-radius: .75rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: #6b7280; font-size: .85rem; }
@media (max-width: 575.98px) {
  .stat-card { padding: .8rem; gap: .6rem; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.1rem; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: .75rem; }
}
.icon-indigo { background: #eef2ff; color: #4f46e5; }
.icon-green { background: #ecfdf5; color: #059669; }
.icon-amber { background: #fffbeb; color: #d97706; }
.icon-rose { background: #fff1f2; color: #e11d48; }
.icon-sky { background: #f0f9ff; color: #0284c7; }

.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #6b7280; }
.empty-state i { font-size: 3rem; color: #c7d2fe; }

.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; font-weight: 600; }

.badge-soft-success { background: #dcfce7; color: #166534; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-primary { background: #e0e7ff; color: #3730a3; }

.group-code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.4rem; font-weight: 700; letter-spacing: .15em;
  background: var(--brand-soft); color: var(--brand);
  padding: .35rem .8rem; border-radius: .5rem;
}

/* Bir nechta tanlov (fanlar, guruhlar): har bir variant — bosiladigan kartochka */
.checkbox-list > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.checkbox-list label {
  display: flex; gap: .6rem; align-items: center; width: 100%; margin: 0; cursor: pointer;
  padding: .6rem .8rem; border: 1.5px solid #e5e7eb; border-radius: .7rem; background: #fff; line-height: 1.3;
  transition: border-color .12s, background .12s;
}
.checkbox-list label:hover { border-color: #c7d2fe; }
.checkbox-list label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.checkbox-list input { margin: 0; flex-shrink: 0; float: none; }

/* ===== Test topshirish ===== */
.timer-bar {
  position: sticky; top: 64px; z-index: 1010;
  background: #fff; border: 1px solid #e5e7eb; border-radius: .75rem;
  padding: .6rem 1rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 4px 12px rgba(17, 24, 39, .05);
}
.timer { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; font-weight: 700; }
.question-card .question-text { font-size: 1.05rem; font-weight: 500; white-space: pre-line; }
.choice-option {
  display: block; border: 1.5px solid #e5e7eb; border-radius: .6rem;
  padding: .7rem 1rem .7rem 2.6rem; margin-bottom: .5rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice-option:hover { border-color: #a5b4fc; background: #fafaff; }
.choice-option .form-check-input { margin-left: -1.6rem; margin-top: .2rem; }
.choice-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.question-nav { display: flex; flex-wrap: wrap; gap: .35rem; }
.question-nav a {
  width: 34px; height: 34px; border-radius: .45rem; border: 1px solid #d1d5db;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: #374151; font-size: .85rem; font-weight: 600;
}
.question-nav a.answered { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ===== Natija ===== */
.result-circle {
  width: 150px; height: 150px; border-radius: 50%; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--ring-color) calc(var(--p) * 1%), #e5e7eb 0);
  position: relative;
}
.result-circle::before { content: ""; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.result-circle > * { position: relative; }
.result-circle .value { font-size: 2rem; font-weight: 800; }
.review-choice { padding: .5rem .8rem; border-radius: .5rem; margin-bottom: .35rem; border: 1px solid #e5e7eb; }
.review-choice.correct { background: #ecfdf5; border-color: #86efac; }
.review-choice.wrong { background: #fef2f2; border-color: #fca5a5; }

/* ===== Ochiq sahifalar ===== */
.hero {
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 60%, #f0f9ff 100%);
  padding: 5rem 0 4rem;
}
.hero h1 { font-weight: 800; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.02em; }
.feature-icon {
  width: 56px; height: 56px; border-radius: 1rem; font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.auth-card { max-width: 460px; margin: 3rem auto; }

/* ===== Jurnal jadvali ===== */
.gradebook th, .gradebook td { white-space: nowrap; text-align: center; vertical-align: middle; }
.gradebook th:first-child, .gradebook td:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }

.material-video { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: .75rem; }
.pdf-frame { width: 100%; height: 75vh; border: 1px solid #e5e7eb; border-radius: .75rem; }

.chart-box { position: relative; height: 280px; }

/* ===== Login-parol kartochkalari (chop etish) ===== */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  .content { padding: 0 !important; }
  .print-only { display: block; }
  .cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .cred-card {
    border: 1px dashed #999; padding: 5mm 6mm; break-inside: avoid;
    font-size: 11pt; min-height: 42mm;
  }
  .cred-site { font-size: 9pt; color: #555; text-transform: uppercase; letter-spacing: .05em; }
  .cred-name { font-weight: 700; font-size: 12pt; margin-top: 1mm; }
  .cred-group { color: #444; margin-bottom: 2mm; }
  .cred-card table td { padding: .3mm 2mm .3mm 0; vertical-align: top; }
  .cred-card .mono { font-family: Consolas, "Courier New", monospace; font-weight: 700; font-size: 13pt; }
}
