/* ==========================================================================
   MingBirXizmat · XARITA MODULI USLUBLARI (map.css)
   Fayl: platform/platform-core/public/map.css
   Leaflet (vendor/leaflet/leaflet.css) USTIDAN yuklanadi:
     <link rel="stylesheet" href="/vendor/leaflet/leaflet.css">
     <link rel="stylesheet" href="/map.css">

   Bo'limlar:
     1. Konteyner va offline (kulrang) holat
     2. Leaflet asosini ilova tiliga moslash + attribution
     3. Boshqaruv ustuni (o'ng tomon, 48/44px tugmalar)
     4. Qatlamlar oynasi
     5. Holat yozuvi
     6. Belglar: joylashuvim, manzil, mashina, olov
     7. Harakatni kamaytirish / kuchaytirilgan kontrast / moslashuv
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. KONTEYNER
   -------------------------------------------------------------------------- */

.mbx-map {
  position: relative;
  overflow: hidden;
  /* Plitkalar yuklanmasa ham xarita "bo'sh oq" bo'lib qolmasin — kulrang fon */
  background: #E8EBF0;
  /* Boshqaruv ustuni (5 x 48px + oraliqlar ~272px) sig'ishi uchun */
  min-height: 280px;
  /* Burchak yumaloqligi chaqiruvchi konteyner tomonidan beriladi */
}

.mbx-map__canvas {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Leaflet kutubxonasi yuklanmagan yoki umuman ishga tushmagan holat */
.mbx-map.is-failed::after {
  content: "Xarita yuklanmadi — internetsiz rejim";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  max-width: 78%;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: #5E646E;
}

/* Plitkalar (tile) xatosi: xarita o'z joyida qoladi, faqat fon kulrang */
.mbx-map.is-offline {
  background: #E8EBF0;
}

.mbx-map.is-offline .mbx-map__canvas {
  background: #E8EBF0;
}

/* --------------------------------------------------------------------------
   2. LEAFLET ASOSI + ATTRIBUTION (© OpenStreetMap — majburiy)
   -------------------------------------------------------------------------- */

.mbx-map .leaflet-container,
.mbx-map__canvas.leaflet-container {
  background: #E8EBF0;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.mbx-map .leaflet-control-attribution {
  margin: 0;
  padding: 2px 8px;
  border-radius: 10px 0 0 0;
  background: rgba(255, 255, 255, 0.88);
  color: #3A3F49;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 -1px 4px rgba(15, 23, 42, 0.08);
}

.mbx-map .leaflet-control-attribution a {
  color: #1B4FA8;
  text-decoration: none;
}

.mbx-map .leaflet-control-attribution a:hover {
  text-decoration: underline;
}

/* Boshqaruv ustuni xarita siljishidan zarar ko'rmasin */
.mbx-map .leaflet-pane,
.mbx-map .leaflet-control {
  -webkit-user-select: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   3. BOSHQARUV USTUNI (o'ng tomon)
   Tartib: qatlamlar, mening joylashuvim, +, -, mikrofon
   -------------------------------------------------------------------------- */

.mbx-controls {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Faqat tugmalar bosilsin — ustunning bo'sh joyi xaritani to'smasin */
  pointer-events: none;
}

.mbx-controls > * {
  pointer-events: auto;
}

.mbx-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: 1px solid #E7EAF0;
  border-radius: 12px;
  background: #FFFFFF;
  color: #17181C;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.mbx-btn:hover {
  background: #FFF8E1;
}

.mbx-btn:active {
  transform: scale(0.95);
}

.mbx-btn.is-on {
  background: #FFD21F;
  border-color: #F2C400;
  color: #17181C;
}

.mbx-btn:focus-visible {
  outline: 3px solid #17181C;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #FFD21F;
}

/* --------------------------------------------------------------------------
   4. QATLAMLAR OYNASI (tugmaning chap tomonida ochiladi)
   -------------------------------------------------------------------------- */

.mbx-layers {
  position: absolute;
  right: calc(100% + 8px);
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 186px;
  padding: 6px;
  border: 1px solid #E7EAF0;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.mbx-layers[hidden] {
  display: none;
}

.mbx-layer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #17181C;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mbx-layer:hover {
  background: #F6F7F9;
}

.mbx-layer:focus-visible {
  outline: 3px solid #17181C;
  outline-offset: 2px;
}

.mbx-layer__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid #C6CAD2;
  border-radius: 6px;
  background: #FFFFFF;
  color: transparent;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.mbx-layer.is-on .mbx-layer__mark {
  border-color: #F2C400;
  background: #FFD21F;
  color: #17181C;
}

.mbx-layer__text {
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   5. HOLAT YOZUVASI (pastda chapda; attribution — pastda o'ngda)
   -------------------------------------------------------------------------- */

.mbx-note {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 900;
  max-width: calc(100% - 140px);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(23, 24, 28, 0.88);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.mbx-note[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   6. BELGILAR
   -------------------------------------------------------------------------- */

/* Leaflet divIcon uchun tayyor oq kvadratni olib tashlaymiz */
.mbx-icon {
  background: none;
  border: 0;
}

.mbx-icon--me,
.mbx-icon--car,
.mbx-icon--zone {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 6.1 — MENING JOYLASHUVIM: ko'k nuqta + halo */
.mbx-dot {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
}

.mbx-dot__halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: rgba(27, 111, 240, 0.22);
  animation: mbx-pulse 2s ease-out infinite;
}

.mbx-dot__core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  background: #1B6FF0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
}

@keyframes mbx-pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.85;
  }
  70% {
    transform: scale(1.25);
    opacity: 0.18;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* 6.2 — MANZIL: qizil pin (uchi pastga qaragan) */
.mbx-icon--pin {
  display: block;
}

.mbx-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid #FFFFFF;
  border-radius: 50% 50% 50% 0;
  background: #E03131;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
  transform: rotate(-45deg);
}

.mbx-pin__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #FFFFFF;
}

/* 6.3 — MASHINA: sariq doira, `bearing` bo'yicha aylanadi */
.mbx-car {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid #17181C;
  border-radius: 50%;
  background: #FFD21F;
  color: #17181C;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.3);
  transform-origin: 50% 50%;
}

/* 6.4 — OLOV (talab): daraja qancha yuqori bo'lsa, belgi shuncha katta */
.mbx-fire {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid #F08C00;
  border-radius: 50%;
  background: #FFFFFF;
  color: #F08C00;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.28);
}

.mbx-fire--1 {
  width: 28px;
  height: 28px;
  color: #F08C00;
  border-color: #F08C00;
}

.mbx-fire--2 {
  width: 34px;
  height: 34px;
  color: #E8590C;
  border-color: #E8590C;
}

.mbx-fire--3 {
  width: 40px;
  height: 40px;
  color: #C92A2A;
  border-color: #C92A2A;
  background: #FFF4E6;
}

/* --------------------------------------------------------------------------
   7. MOSLASHUV VA FOYDALANUVCHI SOZLAMALARI
   -------------------------------------------------------------------------- */

/* Telefon: tugmalar 44x44 (barmoq uchun yetarli), oraliqlar zichroq */
@media (max-width: 599px) {
  .mbx-controls {
    right: 8px;
    gap: 7px;
  }

  .mbx-btn {
    width: 44px;
    height: 44px;
  }

  .mbx-layers {
    min-width: 172px;
  }

  .mbx-note {
    max-width: calc(100% - 120px);
    font-size: 12.5px;
  }
}

/* Harakatni kamaytirish: pulsatsiya va o'tishlar o'chadi */
@media (prefers-reduced-motion: reduce) {
  .mbx-dot__halo {
    animation: none;
    transform: scale(1);
    opacity: 0.35;
  }

  .mbx-btn {
    transition: none;
  }

  .mbx-btn:active {
    transform: none;
  }
}

/* Kuchaytirilgan kontrast */
@media (prefers-contrast: more) {
  .mbx-btn {
    border: 2px solid #101216;
  }

  .mbx-btn.is-on {
    border-color: #101216;
  }

  .mbx-layer {
    color: #000000;
  }

  .mbx-layer__mark {
    border-color: #101216;
  }

  .mbx-note {
    background: #000000;
  }

  .mbx-map.is-failed::after {
    color: #101216;
    font-weight: 800;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   189-buyruq (egasi): TAKSI EKRANI XARITA BOSHQARUVLARI — IXCHAM ✅
   ❗ HAQIQIY element: .mbx-btn (48px edi) — .navg-side-btn EMAS!
   ══════════════════════════════════════════════════════════════════════════ */
.mbx-controls {
  right: 8px !important;
  gap: 6px !important;
}
.mbx-controls .mbx-btn,
.mbx-btn {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18) !important;
  border: 1px solid #E7EAF0 !important;
}
.mbx-controls .mbx-btn svg,
.mbx-btn svg {
  width: 17px !important;
  height: 17px !important;
}
/* ◎ joylashuv va 🎤 mikrofon — doira, biroz kattaroq (ajralib tursin ✅) */
.mbx-controls .mbx-btn.is-locate,
.mbx-controls .mbx-btn[data-act="locate"],
.mbx-controls .mbx-btn[aria-label*="lashuv"],
.mbx-controls .mbx-btn[aria-label*="ikrofon"] {
  width: 36px !important; height: 36px !important;
  min-width: 36px !important; min-height: 36px !important;
  border-radius: 50% !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   190-buyruq (egasi): barcha tugmalar BIR XIL o'lchamda ✅ (34px)
   ══════════════════════════════════════════════════════════════════════════ */
.mbx-controls > * { width: 34px !important; height: 34px !important; }
.mbx-controls .mbx-btn,
.mbx-controls #tx-nav-open {
  width: 34px !important; height: 34px !important;
  min-width: 34px !important; min-height: 34px !important;
  border-radius: 10px !important;
}
.mbx-controls #tx-nav-open { border-radius: 10px !important; }
.mbx-controls .mbx-btn svg, .mbx-controls #tx-nav-open svg {
  width: 17px !important; height: 17px !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   191-buyruq (egasi): «+ va − qo'shilib qolgan, o'rtasini ochib ber» ✅
   Sabab: media query (max-width:599px) gap:7px + .mbx-btn margin:0
   Yechim: KUCHLI gap + har tugmaga margin-top ✅ (media query ni ham bosadi ✅)
   ══════════════════════════════════════════════════════════════════════════ */
.mbx-controls {
  gap: 12px !important;
  row-gap: 12px !important;
  column-gap: 12px !important;
  display: flex !important;
  flex-direction: column !important;
}
/* Har bir tugma orasida aniq bo'shliq ✅ (margin gap ni mustahkamlaydi) */
.mbx-controls > * { margin: 0 !important; }
.mbx-controls > * + * { margin-top: 12px !important; }
.mbx-controls .mbx-btn,
.mbx-controls #tx-nav-open {
  width: 34px !important; height: 34px !important;
  min-width: 34px !important; min-height: 34px !important;
}
.mbx-controls #tx-nav-open { margin-top: 12px !important; }

/* Media query ni ham qayta yozamiz ✅ (telefonda ham 12px bo'lsin) */
@media (max-width: 599px) {
  .mbx-controls { gap: 12px !important; right: 8px !important; }
  .mbx-controls > * + * { margin-top: 12px !important; }
  .mbx-controls .mbx-btn,
  .mbx-controls #tx-nav-open { width: 34px !important; height: 34px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   192-buyruq (egasi): «shularni bir-biriga yaqinroq qilib ber» ✅
   Oraliq 12px -> 4px (yaqin ✅) · tugmalar 34px (o'zgarmadi ✅)
   ══════════════════════════════════════════════════════════════════════════ */
.mbx-controls { gap: 4px !important; row-gap: 4px !important; }
.mbx-controls > * + * { margin-top: 4px !important; }
@media (max-width: 599px) {
  .mbx-controls { gap: 4px !important; }
  .mbx-controls > * + * { margin-top: 4px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   193-buyruq (egasi): «yaqinroq» — gap + margin IKKALASI qo'shilib 8px edi ✅
   Yechim: gap ni 0 qildik · faqat margin-top: 4px qoldi ✅
   ══════════════════════════════════════════════════════════════════════════ */
.mbx-controls {
  gap: 0 !important;
  row-gap: 0 !important;
  column-gap: 0 !important;
}
.mbx-controls > * { margin: 0 !important; }
.mbx-controls > * + * { margin-top: 4px !important; }
.mbx-controls #tx-nav-open { margin-top: 4px !important; }
@media (max-width: 599px) {
  .mbx-controls { gap: 0 !important; }
  .mbx-controls > * + * { margin-top: 4px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   197-buyruq (egasi): «navigator qani? joyiga qaytar» ✅
   🧭 tugma KO'RINMASLIGI tuzatildi ✅ (display/visibility majburiy ✅)
   ══════════════════════════════════════════════════════════════════════════ */
.mbx-controls #tx-nav-open {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  width: 34px !important; height: 34px !important;
  min-width: 34px !important; min-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid #E7EAF0 !important;
  border-radius: 10px !important;
  background: #FFFFFF !important;
  place-items: center !important;
  box-shadow: 0 1px 4px rgba(15,23,42,.18) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.mbx-controls > * + #tx-nav-open,
.mbx-controls #tx-nav-open { margin-top: 4px !important; }
.mbx-controls #tx-nav-open svg { width: 17px !important; height: 17px !important; }
