/* Panel sayti — qoʻshimcha uslublar (asosiysi common.css) */

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: all .15s;
}
.tab-btn:hover { color: var(--text); background: rgba(124, 58, 237, 0.08); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--violet-2), var(--violet-1));
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
}

.panel-card { padding: 22px; max-width: 100%; }
/* Flex bola sifatida (flex-1) #content va panel-wrap min-width:auto boʻlib, keng
   jadval sahifani gorizontal toshirib yuborardi (telefonda knijniy holatda toʻliq
   koʻrinmaydi). min-width:0 — jadval oʻz .table-wrap ichida scroll boʻladi. */
.panel-wrap, #content { min-width: 0; max-width: 100%; }
.grid-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat {
  padding: 18px;
  border-radius: 16px;
  text-align: center;
}
.stat .num { font-size: 1.8rem; font-weight: 800; }
.stat .lbl2 { color: var(--muted); font-size: 0.85rem; }

/* ============================================================
   Dashboard — morph-glass diagrammalar
   ============================================================ */
:root {
  --dm1: #7c3aed;   /* qarzdor */
  --dm2: #10b981;   /* oʻzlashtirdi */
  --dm3: #f59e0b;   /* urinib koʻrdi */
  --dm4: #ef4444;   /* oʻzlashtirmadi */
}
.dash-morph { animation: dash-in .5s ease both; }
@keyframes dash-in { from { opacity: 0; transform: translateY(10px); } }

/* Talaba soni / Qarz fanlar soni — Toggle Switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(124, 58, 237, 0.25); border-radius: 99px;
  transition: background .2s ease;
}
.switch-slider::before {
  content: ''; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .switch-slider { background: var(--brand); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* Umumiy: donut + kartochkalar */
.dash-hero { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; }
.dash-hero-donut { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dash-hero-cards { flex: 1 1 320px; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.mstat {
  position: relative;
  padding: 18px;
  border-radius: 16px;
  text-align: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  transition: transform .25s ease, box-shadow .25s ease;
}
.mstat:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(124, 58, 237, 0.22); }
.mstat::before {
  content: ''; position: absolute; inset: 0; opacity: .12; z-index: 0;
}
.mstat.m1::before { background: radial-gradient(circle at 30% 20%, var(--dm1), transparent 70%); }
.mstat.m2::before { background: radial-gradient(circle at 30% 20%, var(--dm2), transparent 70%); }
.mstat.m3::before { background: radial-gradient(circle at 30% 20%, var(--dm3), transparent 70%); }
.mstat.m4::before { background: radial-gradient(circle at 30% 20%, var(--dm4), transparent 70%); }
.mstat-num { position: relative; z-index: 1; font-size: 2.1rem; font-weight: 800; line-height: 1; }
.mstat.m1 .mstat-num { color: var(--dm1); }
.mstat.m2 .mstat-num { color: var(--dm2); }
.mstat.m3 .mstat-num { color: var(--dm3); }
.mstat.m4 .mstat-num { color: var(--dm4); }
.mstat-lbl { position: relative; z-index: 1; font-weight: 600; margin-top: 4px; }
/* Blok bosiladigan tugma — chiroyli hover, chap tekislangan matn markazda qoladi */
button.mstat { cursor: pointer; text-align: center; font: inherit; width: 100%; }

/* Donut */
.donut { transform: rotate(-90deg); }
.donut .dtrack { fill: none; stroke: rgba(124, 58, 237, 0.12); stroke-width: 16; }
.donut .dseg {
  fill: none; stroke-width: 16; stroke-linecap: round;
  stroke-dasharray: 0 999;                    /* boshda koʻrinmaydi */
  transition: stroke-dasharray 1s cubic-bezier(.5, 0, 0, 1);
}
.donut .dseg.grow { stroke-dasharray: var(--dash); }
.dseg.m1 { stroke: var(--dm1); } .dseg.m2 { stroke: var(--dm2); } .dseg.m3 { stroke: var(--dm3); }
.dseg.dmuted { stroke: rgba(124, 58, 237, 0.12); }   /* blok donuti: qolgan ulush */
.dlegend { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }
/* Blok donuti markazidagi foiz */
.donut-wrap { position: relative; display: inline-flex; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; }
.donut-center b { font-size: 1.4rem; line-height: 1; color: var(--dm4, #ef4444); }
.donut-center span { font-size: .62rem; color: var(--muted); }

/* Ustunli morph chart */
.mchart { display: flex; flex-direction: column; gap: 14px; }
.mlegend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .85rem; margin-bottom: 4px; }
.mdot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 5px;
  vertical-align: -1px; }
.mdot.m1 { background: var(--dm1); } .mdot.m2 { background: var(--dm2); }
.mdot.m3 { background: var(--dm3); } .mdot.m4 { background: var(--dm4); }
.mrow { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.mrow-label { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.mrow-bars { display: flex; flex-direction: column; gap: 6px; }
.mbar-track {
  background: rgba(124, 58, 237, 0.08);
  border-radius: 8px;
  overflow: hidden;
  height: 20px;
}
.mbar {
  height: 100%;
  width: 0;                                    /* morph: 0 dan --w gacha */
  border-radius: 8px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px;
  color: #fff; font-size: .72rem; font-weight: 700;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.25);
}
.mbar.grow { animation: mbar-grow .9s cubic-bezier(.4, 0, .1, 1) forwards; }
@keyframes mbar-grow { to { width: var(--w); } }
.mbar.m1 { background: linear-gradient(90deg, #8b5cf6, var(--dm1)); }
.mbar.m2 { background: linear-gradient(90deg, #34d399, var(--dm2)); }
.mbar.m3 { background: linear-gradient(90deg, #fbbf24, var(--dm3)); }
.mbar.m4 { background: linear-gradient(90deg, #f87171, var(--dm4)); }
.dseg.m4 { stroke: var(--dm4); }
.mbar-val { opacity: 0; animation: mval-in .4s ease .6s forwards; }
@keyframes mval-in { to { opacity: 1; } }

@media (max-width: 640px) {
  .mrow { grid-template-columns: 1fr; }
  .mrow-label { white-space: normal; }
}

.help-box {
  background: rgba(124, 58, 237, 0.05);
  border: 1px dashed var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}
.help-box code {
  background: rgba(124, 58, 237, 0.12);
  padding: 1px 6px;
  border-radius: 5px;
  color: #6d28d9;
}

/* ---------- Nazorat suratlari ---------- */
.proctor-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  cursor: zoom-in;
  transition: transform .15s ease, box-shadow .15s ease;
  background: rgba(124, 58, 237, 0.06);
}
.proctor-thumb:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}

/* Toʻliq surat koʻrish oynasi */
#photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(46, 16, 101, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}
#photo-viewer.show { display: flex; }
#photo-viewer img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.45);
}

/* Jadval sahifalagichi (100 qatordan oshganda chiqadi) */
.tv-pager:empty { display: none; }
.tv-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.tv-pager-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.tv-pager-btns .btn { min-width: 34px; justify-content: center; }

/* Jonli video oynasi (Nazorat -> talaba ustiga bosilganda) */
#live-viewer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(46, 16, 101, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#live-viewer.show { display: flex; }
.live-card {
  width: 100%;
  max-width: 760px;
  padding: 20px;
}
/* Kadr maydoni — kadrlar almashganda oʻlcham sakramasligi uchun nisbat qatʼiy */
.live-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.live-stage .live-note {
  position: absolute;
  color: #fff;
  font-size: 14px;
  text-align: center;
  padding: 0 16px;
}
/* "Efirda" nuqtasi — kadrlar kelib turganini bildiradi */
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse { 50% { opacity: .25; } }

/* Savol / natija / tahrirlash / import oynalari (umumiy overlay) */
#q-editor,
#result-editor,
#log-editor,
#gr-editor,
#pw-editor,
#zip-import,
#zip-done,
#imp-progress {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(46, 16, 101, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#q-editor.show,
#result-editor.show,
#log-editor.show,
#gr-editor.show,
#pw-editor.show,
#zip-import.show,
#zip-done.show,
#imp-progress.show { display: flex; }
.q-editor-card {
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: 24px;
}

/* Natija batafsil tahlili (savol-ma-savol) */
#detail-viewer {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(46, 16, 101, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#detail-viewer.show { display: flex; }
.detail-card { width: 100%; max-width: 720px; margin: auto; padding: 22px; }
.detail-list { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.detail-q {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.5);
}
.detail-q-head { font-weight: 600; margin-bottom: 8px; line-height: 1.45; }
.detail-opts { display: flex; flex-direction: column; gap: 4px; }
.detail-opt {
  display: flex; gap: 8px; align-items: baseline;
  padding: 6px 10px; border-radius: 8px; font-size: 0.9rem;
  background: rgba(124, 58, 237, 0.04);
}
.detail-opt .l {
  font-weight: 700; flex: none; width: 20px; text-align: center;
}
.detail-opt.correct { background: rgba(5, 150, 105, 0.15); color: #065f46; }
.detail-opt.wrong { background: rgba(220, 38, 38, 0.13); color: #991b1b; }
