/* Sirdaryo EIZ — asosiy uslublar
   Ranglar: sirdaryo-eiz-loyiha.md, 5-bo'lim.
   Eski Chromium uchun: CSS o'zgaruvchilari bor, lekin grid/gap kabi yangi imkoniyatlarga tayanilmaydi. */

/* ---------- Kun rejimi (standart) ---------- */
:root {
  --bg:            #EFF0F5;
  --card:          #FAFAFD;
  --row-active:    #EEECFE;
  --border:        #E4E4EC;
  --text:          #2B2B33;
  --text-2:        #6B6B78;
  --text-3:        #9A9AA6;
  --accent:        #7062F6;
  --accent-strong: #5A4BD4;
  --accent-soft:   #CDC5FF;
  --accent-bg:     #EDEBFF;
  --shadow:        0 20px 50px rgba(80, 70, 160, 0.12);
  --card-edge:     transparent;

  /* Shaffof-matoviy oyna (glassmorphism) */
  --glass:         rgba(255, 255, 255, 0.42);  /* katta kartochkalar */
  --glass-strong:  rgba(255, 255, 255, 0.62);  /* tugmalar, ro'yxat */
  --glass-inner:   rgba(255, 255, 255, 0.38);  /* kartochka ichidagi bloklar */
  --glass-solid:   rgba(250, 250, 253, 0.92);  /* blur ishlamasa (eski brauzer) */
  --glass-border:  rgba(255, 255, 255, 0.80);
  --glass-hi:      rgba(255, 255, 255, 0.90);  /* yuqori chetdagi yorug' chiziq */
  --glass-line:    rgba(120, 120, 170, 0.22);  /* punktir, ajratgich */
  --active-grad:   linear-gradient(135deg, #7B6CFF 0%, #5B4FE9 100%);
  --active-glow:   0 10px 24px rgba(108, 92, 246, 0.38);

  /* Fon: rangli dog'lar va mayda to'r */
  --blob-1:        rgba(124, 108, 255, 0.34);  /* binafsha */
  --blob-2:        rgba(80, 210, 235, 0.28);   /* moviy */
  --blob-3:        rgba(255, 140, 205, 0.26);  /* pushti */
  --grid:          rgba(110, 110, 160, 0.07);

  /* Xarita — vaqtinchalik (zahira) ranglar, yakuniy qaror keyin (md 5.5) */
  --map-land:      #FAFAFD;
  --map-border:    #D6D6E2;
  --map-water:     #D3E2F7;
  --map-busy:      #7062F6;  /* band yerlar */
  --map-free:      #5FA82A;  /* bo'sh yerlar */
  --map-transport: #1F5FD0;
  /* Viloyat xaritasi (tumanlar) */
  --map-region:    rgba(255, 255, 255, 0.35);
  --map-unit:      rgba(124, 108, 255, 0.10);
  --map-unit-line: rgba(255, 255, 255, 0.95);
  --map-city:      rgba(124, 108, 255, 0.32);
  --map-sel:       rgba(124, 108, 255, 0.30);

  --radius:        24px;
  --radius-sm:     14px;
  --font: "Segoe UI", Roboto, "Noto Sans", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}

/* ---------- Tun rejimi ---------- */
html[data-theme="night"] {
  --bg:            #0F1020;
  --card:          #181A2E;
  --row-active:    #24224A;
  --border:        #2C2E48;
  --text:          #ECECF5;
  --text-2:        #A6A6BC;
  --text-3:        #6F7090;
  --accent:        #8B7FFF;
  --accent-strong: #A99FFF;
  --accent-soft:   #4A4390;
  --accent-bg:     #1F1C3D;
  --shadow:        0 20px 50px rgba(0, 0, 0, 0.40);
  --card-edge:     rgba(255, 255, 255, 0.04);

  --glass:         rgba(28, 30, 58, 0.45);
  --glass-strong:  rgba(40, 42, 76, 0.62);
  --glass-inner:   rgba(255, 255, 255, 0.05);
  --glass-solid:   rgba(24, 26, 46, 0.94);
  --glass-border:  rgba(255, 255, 255, 0.10);
  --glass-hi:      rgba(255, 255, 255, 0.12);
  --glass-line:    rgba(255, 255, 255, 0.12);
  --active-grad:   linear-gradient(135deg, #8B7FFF 0%, #6455F0 100%);
  --active-glow:   0 10px 28px rgba(120, 100, 255, 0.45);

  --blob-1:        rgba(110, 90, 255, 0.38);
  --blob-2:        rgba(40, 170, 215, 0.24);
  --blob-3:        rgba(220, 80, 175, 0.24);
  --grid:          rgba(255, 255, 255, 0.035);

  --map-land:      #181A2E;
  --map-border:    #34365A;
  --map-water:     #1B2A48;
  --map-busy:      #8B7FFF;
  --map-free:      #7CC94A;
  --map-transport: #4D8BFF;
  --map-region:    rgba(255, 255, 255, 0.03);
  --map-unit:      rgba(139, 127, 255, 0.12);
  --map-unit-line: rgba(255, 255, 255, 0.22);
  --map-city:      rgba(139, 127, 255, 0.40);
  --map-sel:       rgba(139, 127, 255, 0.38);
}

/* ---------- Sahifa asosi ---------- */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;

  /* Panel: matn tanlash, tap yorug'i, uzoq bosish menyusi, pinch-zoom o'chiriladi */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -ms-touch-action: none;
  touch-action: none;
}

img { -webkit-user-drag: none; }

/* Ekranni to'liq egallaydigan qatlam; kanvas uning markazida turadi */
#stage {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  overflow: hidden;
  background-color: var(--bg);
  /* Rangli dog'lar (oynalar orqasida xiralashib ko'rinadi) + mayda to'r */
  background-image:
    radial-gradient(circle at 14% 20%, var(--blob-1) 0, transparent 36%),
    radial-gradient(circle at 86% 10%, var(--blob-2) 0, transparent 34%),
    radial-gradient(circle at 72% 90%, var(--blob-3) 0, transparent 38%),
    radial-gradient(circle at 30% 92%, var(--blob-2) 0, transparent 28%),
    radial-gradient(circle at 52% 45%, var(--blob-1) 0, transparent 30%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 64px 64px, 64px 64px;
  -webkit-transition: background-color .3s ease;
  transition: background-color .3s ease;
}

/* Qat'iy 16:9 kanvas — barcha joylashuv shu 1920x1080 ichida chiziladi */
#canvas {
  position: absolute;
  left: 0; top: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  -webkit-transform-origin: 0 0;
  transform-origin: 0 0;
  background: transparent; /* fon #stage da */
  -webkit-transition: background-color .3s ease, color .3s ease;
  transition: background-color .3s ease, color .3s ease;
}

/* ---------- Umumiy bloklar ---------- */
/* Shaffof-matoviy oyna: orqadagi fon xiralashib ko'rinadi */
.card {
  background: var(--glass);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  box-sizing: border-box;
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
  transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
}
/* Kichik oynalar (tugmalar, til ro'yxati) — biroz zichroq */
.ctrl.card, .lang-menu.card { background: var(--glass-strong); }

/* Blur qo'llab-quvvatlanmasa (eski panel brauzeri) — deyarli to'liq rangli fon */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card, .ctrl.card, .lang-menu.card { background: var(--glass-solid); }
}

/* Kichik, bosh harfli, keng oraliqli yorliq */
.label {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Katta, ingichka raqam */
.big-number {
  font-size: 96px;
  font-weight: 300;
  line-height: 1;
  color: var(--text);
}

.accent { color: var(--accent); }

/* Bosiladigan elementlar uchun minimal o'lcham (2.2-bo'lim) */
.tap {
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
}
.tap:active { opacity: .8; }

button {
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  font: inherit;
  color: inherit;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Chiziqli ikonkalar (namunadagi kabi outline) */
.ic {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.ic-sm { width: 24px; height: 24px; }
.ic-xs { width: 18px; height: 18px; }

/* 3D ikonkalar: ranglar SVG ichida (gradientlar <svg class="svg-defs"> da) */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic3d { fill: none; stroke: none; overflow: visible; }
.ctrl .ic.ic3d { width: 34px; height: 34px; }
.ctrl-lang .ic.ic3d { width: 30px; height: 30px; }
.ic-badge .ic.ic3d {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
}

/* Ikki tonli ikonka: ichi yumshoq rang bilan to'ldiriladi, ustidan kontur */
.ic .fill {
  fill: currentColor;
  stroke: none;
  opacity: .18;
}

/* =========================================================
   KARKAS — 1920x1080 kanvas ichida absolyut joylashuv
   Kenglik doim 1920; balandlik ekranga qarab 860..1200 oralig'ida (app.js, fit)
   Menyu:    x 40,  y 40,  kengligi 380, pastdan 40 gacha
   Header:   x 444, y 40,  1436 x 80   (shaffof oyna, faqat kontent ustida)
   Kontent:  x 444, y 136, kengligi 1436, pastdan 40 gacha
   ========================================================= */

/* ---------- Header ---------- */
/* Header ham shaffof oyna ichida: sarlavha + tugmalar */
#header {
  position: absolute;
  left: 444px;
  top: 40px;
  width: 1436px;
  height: 80px;
  z-index: 5; /* til ro'yxati kontent kartochkasi ustida ochilishi uchun */
}

.site-title {
  position: absolute;
  left: 32px;
  top: 0;
  margin: 0;
  line-height: 78px;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
}

.controls {
  position: absolute;
  right: 11px;
  top: 11px;
  height: 56px;
  white-space: nowrap;
  font-size: 0; /* inline-block oraliqlarini yo'qotadi */
}

.ctrl {
  display: inline-block;
  vertical-align: top;
  height: 56px;
  min-width: 56px;
  margin-left: 10px;
  border-radius: 28px; /* pill */
  color: var(--text-2);
  text-align: center;
}
.ctrl .ic { width: 26px; height: 26px; color: var(--accent); }

.ctrl-lang {
  /* ichidagilar tepa-pastga nisbatan aniq markazda */
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 0 16px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text);
}
.ctrl-lang .ic { margin-right: 14px; } /* flex bo'shliqlarni yo'qotgani uchun +6px */
.ctrl-lang .ic-sm { color: var(--text-3); }
.ctrl-lang .ic-sm { width: 18px; height: 18px; margin: 0 0 0 12px; }
#lang-code { vertical-align: middle; }

/* Kun/tun: kunda oy (tunga o'tish), tunda quyosh */
.ic-sun { display: none; }
html[data-theme="night"] .ic-sun { display: inline-block; }
html[data-theme="night"] .ic-moon { display: none; }

/* To'liq ekran ikonkasi holatga qarab */
.ic-fs-off { display: none; }
html.is-fs .ic-fs-off { display: inline-block; }
html.is-fs .ic-fs-on { display: none; }

/* Til ro'yxati */
.lang-wrap {
  position: relative;
  display: inline-block;
  vertical-align: top;
}
.lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 74px; /* header oynasidan pastda */
  width: 260px;
  padding: 8px;
  z-index: 10;
  border-radius: 20px;
  text-align: left;
}
.lang-menu.open { display: block; }

.lang-item {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border-radius: 12px;
  text-align: left;
  font-size: 20px;
  color: var(--text-2);
}
.lang-item b {
  display: inline-block;
  width: 62px;
  font-weight: 700;
  color: var(--text);
}
.lang-item.active { background: var(--active-grad); color: #fff; box-shadow: var(--active-glow); }
.lang-item.active b { color: #fff; }

/* ---------- Chap menyu ---------- */
#sidebar {
  position: absolute;
  left: 40px;
  top: 40px;
  width: 380px;
  bottom: 40px; /* balandlik kanvasga qarab moslashadi */
  padding: 20px;
  box-sizing: border-box;
}

.nav-item {
  position: relative;
  display: block;
  width: 100%;
  height: 96px;
  margin-bottom: 12px;
  padding: 0 20px;
  box-sizing: border-box;
  border-radius: 18px;
  text-align: left;
  font-size: 28px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  -webkit-transition: background-color .25s ease, color .25s ease;
  transition: background-color .25s ease, color .25s ease;
}
.nav-item > span { vertical-align: middle; }

/* Ikonka nishoni: dumaloq shaffof oyna, ichida aksent rangli ikonka */
.ic-badge {
  display: inline-block;
  width: 58px;
  height: 58px;
  margin: 0 18px 0 -6px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 4px 12px rgba(80, 70, 160, 0.10);
  color: var(--accent);
  text-align: center;
  -webkit-transition: background-color .25s ease, color .25s ease, border-color .25s ease;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
/* Ikonka nishonning aniq markazida (tepa-past va yonlarga nisbatan) */
.ic-badge { position: relative; vertical-align: middle; }
.ic-badge .ic {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  stroke-width: 1.7;
}

/* O'ng tomondagi kichik dumaloq strelka */
.chev-dot {
  position: absolute;
  right: 18px;
  top: 30px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  text-align: center;
  color: var(--text-3);
  background: transparent;
}
.chev-dot .ic {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -9px 0 0 -9px;
  stroke-width: 2.2;
}

.nav-item.active {
  background: var(--active-grad);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--active-glow);
}
/* Faol bandda nishon oq shaffof bo'ladi */
.nav-item.active .ic-badge {
  background: rgba(255, 255, 255, 0.20);
  border-color: rgba(255, 255, 255, 0.40);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  color: #fff;
}
.nav-item.active .ic .fill { opacity: .30; }
.nav-item.active .chev-dot {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- Kontent paneli ---------- */
#content {
  position: absolute;
  left: 444px;
  top: 136px; /* header oynasi pastidan 16px */
  width: 1436px;
  bottom: 40px; /* balandlik kanvasga qarab moslashadi */
  overflow: hidden;
}

/* Bo'limlar ustma-ust turadi; faoli yumshoq paydo bo'ladi */
.panel {
  position: absolute;
  left: 48px;
  top: 44px;
  right: 48px;
  bottom: 48px;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateY(16px);
  transform: translateY(16px);
  -webkit-transition: opacity .35s ease, -webkit-transform .35s ease, visibility 0s linear .35s;
  transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
}
.panel.active {
  opacity: 1;
  visibility: visible;
  -webkit-transform: none;
  transform: none;
  -webkit-transition-delay: 0s;
  transition-delay: 0s;
}

.panel-title {
  margin: 10px 0 0;
  font-size: 56px;
  font-weight: 300;
  line-height: 1.15;
  color: var(--text);
}

/* Vaqtinchalik joy: ma'lumot kelguncha */
.placeholder {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px dashed var(--glass-line);
  border-radius: 20px;
}
.ph-full { top: 140px; }

/* Yerlar: xarita butun kontent kartochkasini egallaydi (sarlavhasiz, kichik ichki chekinish) */
.panel-map {
  left: 20px;
  top: 20px;
  right: 20px;
  bottom: 20px;
}
.ph-map { top: 0; }

/* ---------- Xarita (Yerlar) ---------- */
.map-wrap {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  border-radius: 20px;
  overflow: hidden;
}
/* Brauzer 3D ni qo'llamasa — xarita o'rnida ogohlantirish */
.map-warn {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 640px;
  margin-left: -320px;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  padding: 28px 32px;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  text-align: center;
  font-size: 24px;
  line-height: 1.45;
  color: var(--text);
}
.map-warn .ic { display: block; width: 48px; height: 48px; margin: 0 auto 12px; color: var(--accent); stroke-width: 1.8; }
.map-wrap.no-3d .map-warn { display: block; }
.map-wrap.no-3d .map-back, .map-wrap.no-3d .map-credit { display: none; }
/* Xarita legendasi: avto yo'l va temir yo'l */
.map-legend {
  position: absolute;
  left: 20px;
  bottom: 20px;
  padding: 10px 16px;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  font-size: 17px;
  color: var(--text-2);
  white-space: nowrap;
}
.map-legend .lg { display: inline-block; margin-right: 18px; vertical-align: middle; }
.map-legend .lg:last-child { margin-right: 0; }
.map-legend i { display: inline-block; width: 30px; height: 4px; margin-right: 8px; vertical-align: middle; border-radius: 2px; }
.lg-road { background: #000000; }
.lg-local { height: 2px !important; background: #555555; }
.lg-rail { height: 5px !important; background: repeating-linear-gradient(90deg, #000000 0 6px, #FFFFFF 6px 12px); border: 1px solid #000000; box-sizing: border-box; }
.map-wrap.no-3d .map-legend { display: none; }
/* "Butun viloyat" tugmasi — faqat yaqinlashganda ko'rinadi */
.map-back {
  position: absolute;
  left: 20px;
  top: 20px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  height: 56px;
  padding: 0 22px 0 14px;
  border-radius: 28px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  background: var(--glass-strong);
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity .3s ease, visibility 0s linear .3s;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.map-back .ic { margin-right: 6px; color: var(--accent); stroke-width: 2.4; }
.map-back span { vertical-align: middle; }
.map-back.show {
  opacity: 1;
  visibility: visible;
  -webkit-transition-delay: 0s;
  transition-delay: 0s;
}

/* 3D xarita: WebGL ishlasa SVG yashiriladi */
.map3d, .m3-labels {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
}
.map3d canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.m3-labels { pointer-events: none; overflow: hidden; }

.m3-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 14px rgba(40, 30, 120, 0.15);
  -webkit-transition: opacity .3s ease;
  transition: opacity .3s ease;
}
.m3-label.city { font-size: 14px; padding: 3px 9px; color: var(--accent); }
.m3-label.sel { background: var(--active-grad); color: #fff; border-color: transparent; box-shadow: var(--active-glow); }
.m3-label.dim { opacity: .35; }

.map-credit {
  position: absolute;
  right: 16px;
  bottom: 10px;
  font-size: 13px;
  color: var(--text-3);
  opacity: .8;
}
.ph-below-stats { top: 380px; }

.ph-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  margin-top: -20px;
  text-align: center;
  font-size: 28px;
  line-height: 40px;
  color: var(--text-3);
}

/* Infrastruktura: 3 ta raqam kartochkasi */
.stats {
  position: absolute;
  left: 0;
  right: 0;
  top: 140px;
  height: 216px;
  white-space: nowrap;
  font-size: 0; /* inline-block oraliqlarini yo'qotadi */
}
.stat {
  display: inline-block;
  vertical-align: top;
  width: 430px;
  height: 216px;
  margin-right: 25px;
  padding: 32px;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  white-space: normal;
}
.stat.last { margin-right: 0; }
.stat .big-number { margin-top: 28px; }
