/* ═══════════════════════════════════════════════════════════
   Digital Academy — Test Platforma
   Dizayn tizimi — logo ranglariga moslangan (ko'k gradient)
   ═══════════════════════════════════════════════════════════ */

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

:root {
  /* ── Brend ranglari (logodan) ────────────────────────── */
  --brand-950: #021631;
  --brand-900: #03244d;
  --brand-800: #03366f;
  --brand-700: #044182;
  --brand-600: #044c98;
  --brand-500: #1060b8;
  --brand-400: #3d82d6;
  --brand-300: #7db0e8;
  --brand-100: #dceaf8;
  --brand-50:  #eef5fc;

  /* ── Neytral ─────────────────────────────────────────── */
  --ink:        #16233a;
  --ink-soft:   #4a566b;
  --ink-faint:  #7c8698;
  --paper:      #f4f6fa;
  --surface:    #ffffff;
  --surface-2:  #f8fafd;
  --rule:       #dde3ec;
  --rule-soft:  #eaeef4;

  /* ── Semantik ────────────────────────────────────────── */
  --accent:     var(--brand-600);
  --accent-bg:  var(--brand-50);
  --amber:      #b26a00;
  --amber-bg:   #fdf3e2;
  --green:      #0d7355;
  --green-bg:   #e2f5ee;
  --red:        #b02c2c;
  --red-bg:     #fbeaea;

  /* v14: F-14 — chegara ranglari. Ilgari bular modern.css da QATTIQ
     yozilgan edi (#ecd6a6, #eec4c4, #b9e0d1) va qorong'i rejimda
     almashmasdi. Endi o'zgaruvchi — theme.css ularni ham flip qiladi. */
  --amber-line: #ecd6a6;
  --red-line:   #eec4c4;
  --green-line: #b9e0d1;

  --radius:     10px;
  --radius-lg:  16px;
  --radius-sm:  7px;

  --shadow-sm:  0 1px 3px rgba(2,22,49,.06), 0 1px 2px rgba(2,22,49,.04);
  --shadow:     0 4px 16px rgba(2,22,49,.08), 0 2px 6px rgba(2,22,49,.05);
  --shadow-lg:  0 12px 34px rgba(2,22,49,.14);

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Inter", sans-serif;

  --grad-brand: linear-gradient(135deg, var(--brand-800) 0%, var(--brand-600) 100%);
  --grad-hero:  radial-gradient(circle at 50% 40%, var(--brand-600) 0%, var(--brand-900) 100%);
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Tipografiya ─────────────────────────────────────────── */
h1 { font-size: 23px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }

.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--brand-500); font-weight: 500;
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Layout ──────────────────────────────────────────────── */
.shell { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.shell--narrow { max-width: 780px; }

.topbar {
  background: var(--surface); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 40; box-shadow: var(--shadow-sm);
}
.topbar__inner {
  max-width: 1120px; margin: 0 auto; padding: 0 22px;
  height: 62px; display: flex; align-items: center; gap: 16px;
}
.topbar__brand {
  display: flex; align-items: center; gap: 11px;
  font-weight: 640; font-size: 15px; color: var(--ink);
  text-decoration: none; letter-spacing: -0.01em;
}
.topbar__logo {
  width: 34px; height: 34px; border-radius: 9px;
  object-fit: cover; box-shadow: var(--shadow-sm);
}
.topbar__spacer { flex: 1; }
.topbar__user {
  font-size: 13px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 7px;
}
.topbar__user::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
}

/* ── Kartochka ───────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm);
}
.card--flat { background: var(--surface-2); border-color: var(--rule-soft); box-shadow: none; }
.card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}

/* ── Tugmalar ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 14px; font-weight: 550;
  cursor: pointer; text-decoration: none;
  transition: all .15s cubic-bezier(.2,.8,.2,1); white-space: nowrap;
}
.btn:hover  { background: var(--surface-2); border-color: var(--brand-300); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary {
  background: var(--grad-brand); border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(4,76,152,.28);
}
.btn--primary:hover { box-shadow: 0 4px 14px rgba(4,76,152,.38); filter: brightness(1.06); }
.btn--danger { color: var(--red); border-color: #e6bcbc; background: var(--surface); }
.btn--danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--brand-50); }
.btn--sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn--lg { height: 50px; padding: 0 26px; font-size: 15px; }
.btn--block { width: 100%; }

/* ── Formalar ────────────────────────────────────────────── */
label.field, div.field { display: block; margin-bottom: 15px; }
label.field > span, div.field > span {
  display: block; font-size: 13px; font-weight: 550;
  color: var(--ink); margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="number"],
input[type="tel"], input[type="email"], select, textarea {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink);
  font-family: var(--sans); font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; padding: 11px 13px; min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3.5px rgba(16,96,184,.14);
  background: var(--surface);
}
input.is-error { border-color: var(--red); box-shadow: 0 0 0 3.5px rgba(176,44,44,.11); }
.field__hint { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }

/* v13: F-08 — CHECKBOX VA RADIO O'LCHAMI.
   Ilgari har bir sahifada `style="width:auto;height:auto"` yozilardi:
   responsive.css dagi `input { min-height: 44px }` katakni cho'zib
   yuborardi, `.auto-toggle input { width:15px }` esa aksincha planshetda
   barmoq bilan bosib bo'lmaydigan qilib qo'yardi. Endi qoida BITTA joyda. */
input[type="checkbox"], input[type="radio"] {
  width: 20px; height: 20px; min-height: 20px;
  flex-shrink: 0; margin: 0;
  accent-color: var(--brand-600); cursor: pointer;
}

/* v13: F-08 — klaviatura bilan yurganda fokus KO'RINSIN.
   Sichqoncha bilan bosilganda chiqmaydi (:focus-visible). */
:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible, .chip:focus-visible, .tabbar button:focus-visible,
.theme-toggle:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 2px;
}

/* ── Xabarlar ────────────────────────────────────────────── */
.alert {
  padding: 12px 15px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.5; border: 1px solid;
  display: flex; gap: 9px; align-items: flex-start;
}
.alert--danger  { background: var(--red-bg);   color: var(--red);   border-color: #eec4c4; }
.alert--warning { background: var(--amber-bg); color: var(--amber); border-color: #ecd6a6; }
.alert--success { background: var(--green-bg); color: var(--green); border-color: #b9e0d1; }
.alert--info    { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: var(--brand-900); color: #fff; padding: 12px 20px;
  border-radius: var(--radius); font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 100;
  max-width: 90vw; box-shadow: var(--shadow-lg);
}
.toast--show   { opacity: 1; transform: translate(-50%, 0); }
.toast--danger { background: var(--red); }
.toast--success{ background: var(--green); }

/* ── Yorliqlar ───────────────────────────────────────────── */
.tag {
  display: inline-block; padding: 2.5px 9px; border-radius: 20px;
  font-family: var(--mono); font-size: 11px; font-weight: 550; letter-spacing: .03em;
}
.tag--d1 { background: var(--green-bg);  color: var(--green); }
.tag--d2 { background: #e6f1e0;          color: #43701a; }
.tag--d3 { background: var(--brand-50);  color: var(--brand-600); }
.tag--d4 { background: var(--amber-bg);  color: var(--amber); }
.tag--d5 { background: var(--red-bg);    color: var(--red); }

.pill { display:inline-block; padding:2.5px 9px; border-radius:5px; font-size:11px;
        font-family: var(--mono); background: var(--surface-2); border:1px solid var(--rule);
        color: var(--ink-soft); }
.pill--admin   { background: var(--red-bg);    color: var(--red);    border-color:#eec4c4; }
.pill--teacher { background: var(--brand-50);  color: var(--brand-600); border-color:var(--brand-100); }
.pill--student { background: var(--surface-2); color: var(--ink-soft); }

/* ── Jadval ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; padding: 10px 11px;
  font-family: var(--mono); font-size: 11px; font-weight: 550;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint); border-bottom: 1.5px solid var(--rule);
}
td { padding: 12px 11px; border-bottom: 1px solid var(--rule-soft); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }

/* ── Yuklanmoqda ─────────────────────────────────────────── */
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.spinner--dark { border-color: rgba(4,76,152,.2); border-top-color: var(--brand-600); }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--rule-soft) 25%, #f1f4f9 50%, var(--rule-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }

/* ── Animatsiyalar ───────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .35s cubic-bezier(.2,.8,.2,1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══ v17: rasm, kod bloki, bir nechta javob ═══════════════════════════ */
.q-img {
  display: block; max-width: 100%; max-height: 320px; margin: 4px 0 14px;
  border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--surface-2); object-fit: contain; cursor: zoom-in;
}
.q-img.is-zoom { max-height: none; cursor: zoom-out; }
.q-code {
  margin: 4px 0 14px; padding: 12px 14px; border-radius: var(--radius);
  background: #0f1b2d; color: #e6edf6; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  white-space: pre; tab-size: 4;
}
.q-code code { font-family: inherit; background: none; color: inherit; }
.q-multi-hint {
  font-size: 13px; font-weight: 600; color: var(--brand-600, #0d56a6);
  margin: -4px 0 10px;
}
.opt--multi .opt__letter { border-radius: 6px; }
.opt__img {
  display: block; max-width: 100%; max-height: 140px; margin-top: 6px;
  border-radius: var(--radius-sm); border: 1px solid var(--rule);
}
/* admin: savol formasi */
.q-img-edit { display: flex; align-items: center; gap: 8px; min-height: 38px; }
.q-img-edit img { max-height: 44px; max-width: 90px; border-radius: 6px; border: 1px solid var(--rule); }
.opt-img-prev { max-height: 32px; max-width: 56px; border-radius: 5px; border: 1px solid var(--rule); }
.code-in {
  font-family: var(--mono); font-size: 12.5px; min-height: 110px;
  white-space: pre; tab-size: 4;
}

/* v17: `hidden` atributi .btn (display:inline-flex) ustidan ham ishlasin */
.btn[hidden], .opt-img-prev[hidden], .q-img-edit img[hidden] { display: none !important; }

/* ═══ v17: rejali imtihonlar ═══════════════════════════════════════════ */
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.chk input { width: 16px; height: 16px; flex-shrink: 0; }
.exam-groups {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px; padding: 10px; border: 1px solid var(--rule);
  border-radius: var(--radius); max-height: 160px; overflow: auto;
}
.exam-code {
  font-family: var(--mono); font-weight: 700; letter-spacing: .12em;
  padding: 3px 8px; border-radius: 6px; background: var(--surface-2);
  border: 1px dashed var(--rule); cursor: copy;
}
input[type="datetime-local"] {
  width: 100%; height: 42px; padding: 0 10px; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit;
}
/* talaba kabineti — imtihon kartalari */
.exam-list { display: grid; gap: 12px; margin-bottom: 22px; }
.exam-card {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 16px 18px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--rule);
  border-left: 4px solid var(--brand-500);
}
.exam-card--open { border-left-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.08); }
.exam-card--closed { opacity: .75; border-left-color: var(--rule); }
.exam-card__main { flex: 1; min-width: 200px; }
.exam-card__title { font-weight: 700; font-size: 15px; }
.exam-card__meta { font-size: 12.5px; color: var(--ink-faint, #6b7280); margin-top: 3px; }
.exam-card__time { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.code-input {
  font-family: var(--mono); font-size: 22px; letter-spacing: .3em; text-align: center;
  text-transform: uppercase;
}

/* v17: admin bo'limlari ko'paydi — keng ekranda ikkinchi qatorga o'tsin
   (yashirin gorizontal aylantirishda «Sozlamalar» ko'rinmay qolardi) */
@media (min-width: 900px) {
  #tabbar { flex-wrap: wrap; overflow-x: visible; }
}

/* v17: modal ichidagi ikki ustunli maydonlar — telefonda bitta ustun */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-code { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 8px; padding-top: 8px; }
.grid-2 > *, .grid-code > * { min-width: 0; }
@media (max-width: 520px) {
  .grid-2, .grid-code { grid-template-columns: minmax(0, 1fr); }
}

/* ═══ v17.1: email eslatmasi ═══════════════════════════════════════════ */
.email-nudge {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin: 0 0 16px; border-radius: var(--radius-lg);
  background: #fff8e6; border: 1px solid #f3d78a; color: #5b4300; font-size: 13.5px;
}
.email-nudge__icon { font-size: 22px; }
.email-nudge__main { flex: 1; min-width: 200px; }
[data-theme="dark"] .email-nudge { background: #3a2f12; border-color: #6b5720; color: #f5e3b0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-600, #0d56a6);
  font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }

/* v17.1: modal oynaning umumiy uslubi (login sahifasida ham kerak — «Parolni
   unutdingizmi?»). admin/dashboard sahifalari o'z nusxasini ustiga yozadi. */
.modal-bg {
  position: fixed; inset: 0; background: rgba(2,22,49,.55);
  display: grid; place-items: center; padding: 20px; z-index: 60; overflow-y: auto;
}
.modal {
  background: var(--surface); color: var(--ink); border-radius: var(--radius-lg);
  padding: 26px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.25));
  margin: auto; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto;
}
#emailBtn { opacity: 1; }
