/* ============================================================
   YaqinJoy — qayta ishlatiladigan komponentlar.
   Har komponent mustaqil: birini o'zgartirish boshqasini buzmaydi.
   ============================================================ */

/* ── Tugmalar ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px;
  border-radius: var(--r-md);
  font-size: 15.5px; font-weight: 700;
  transition: transform 0.12s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--blue-grad); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; }

/* ════ v76 — ISHLAYAPTI HOLATI ════
   Tugma bosilgach matn o'rniga aylanma chiqadi. Foydalanuvchi ish
   ketayotganini KO'RADI va qayta bosmaydi. */
.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.is-busy > * { opacity: 0; }
.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2.2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; opacity: .9;
  animation: yj-spin .7s linear infinite;
}
.btn-primary.is-busy::after, .prof-biz.is-busy::after { border-color: #fff; border-top-color: transparent; }
.is-busy.btn-primary { color: transparent !important; }
@keyframes yj-spin { to { transform: rotate(360deg); } }

/* ════ v76 — RASM YUKLANISHI ════
   Rasm kelmaguncha ostida yengil "shimmer" fon turadi; kelgach yumshoq
   paydo bo'ladi. Ro'yxat sakramaydi, bo'sh oq katak ko'rinmaydi. */
img.yj-img {
  opacity: 0; transition: opacity .28s ease;
  background: linear-gradient(100deg, var(--bg-input) 30%, var(--bg-card) 50%, var(--bg-input) 70%);
  background-size: 220% 100%;
  animation: yj-shim 1.4s linear infinite;
}
img.yj-img.on { opacity: 1; animation: none; background: none; }
@keyframes yj-shim { to { background-position: -220% 0; } }

/* ════ v76 — XARITA/RO'YXAT YUKLANMOQDA QATLAMI ════ */
.yj-loading {
  position: absolute; inset: 0; z-index: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: var(--bg); 
}
.yj-loading .yj-sp {
  width: 30px; height: 30px; border: 3px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%;
  animation: yj-spin .8s linear infinite;
}
.yj-loading p { font-size: 13px; font-weight: 600; color: var(--text-2); }
.yj-loading.fade { opacity: 0; transition: opacity .28s ease; pointer-events: none; }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost { background: var(--bg-input); color: var(--text); }
.btn-sm { padding: 10px 14px; font-size: 13.5px; border-radius: var(--r-sm); width: auto; }
.btn-danger { background: rgba(239, 68, 68, 0.12); color: var(--red); }
.btn-green { background: var(--green); color: #fff; }

/* ── Inputlar (1-mockup uslubi) ── */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 7px;
}
.field label .req { color: var(--red); }
/* v36: inputlar YORUG' temada fonga singib ketmasin — oq fon + ko'rinadigan
   nozik chegara (oldin border shaffof edi, fon esa sahifa foniga juda yaqin
   bo'lgani uchun maydonlar deyarli ko'rinmasdi). Fokusда ko'k halo. */
.input, .textarea, .select {
  width: 100%; padding: 14px 15px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px; color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.input.error { border-color: var(--red); }
/* v70: o'chirilgan maydon TAHRIRLANADIGANIDEK ko'rinmasin — foydalanuvchi
   unga yozmoqchi bo'lib, "sayt ishlamayapti" degan xulosaga kelardi. */
.input:disabled, .textarea:disabled, .select:disabled {
  background: var(--bg-input);
  color: var(--text-2);
  border-style: dashed;
  cursor: not-allowed;
}
.textarea { min-height: 104px; resize: vertical; }
.select-wrap { position: relative; }
.select { appearance: none; padding-right: 40px; }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%;
  width: 8px; height: 8px; border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.char-count { text-align: right; font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.field-err { color: var(--red); font-size: 12px; margin-top: 6px; display: none; }
.field-err.show { display: block; }

/* ── Toggle (1-mockup ish vaqti) ── */
.toggle { position: relative; width: 46px; height: 27px; flex: none; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle .knob {
  position: absolute; inset: 0; background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full); transition: background 0.18s ease;
}
.toggle .knob::after {
  content: ""; position: absolute; top: 2.5px; left: 3px;
  width: 19px; height: 19px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.18s ease;
}
.toggle input:checked + .knob { background: var(--blue); border-color: var(--blue); }
.toggle input:checked + .knob::after { transform: translateX(18px); }

/* ── Chiplar ── */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r-full);
  background: var(--bg-chip); color: var(--text);
  font-size: 13.5px; font-weight: 600;
  border: 1.5px solid var(--border);
  white-space: nowrap; flex: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip.active { background: var(--blue-grad); color: #fff; border-color: var(--blue); box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* ── Status badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 700;
}
.badge-open { background: var(--green-soft); color: var(--green); }
.badge-closed { background: rgba(239, 68, 68, 0.12); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--orange); }

/* ── Reyting yulduzi ── */
/* v61: RAQAM sariq edi — oq fonda 2.15:1, o'qilmasdi. Endi matn
   kontrastli rangda, YULDUZCHA esa sariqligicha qoladi (u shakl). */
.stars { color: var(--yellow-text); display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.stars svg { color: var(--yellow); }

/* ── Karta (ro'yxat elementi, 3-mockup) ── */
.biz-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-card); border-radius: var(--r-lg);
  padding: 12px; box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  cursor: pointer; transition: transform 0.12s ease;
}
.biz-card:active { transform: scale(0.988); }
.biz-thumb {
  width: 74px; height: 74px; border-radius: var(--r-md);
  object-fit: cover; flex: none; background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.biz-thumb svg { width: 30px; height: 30px; }
/* v34: rasm QANDAY o'lchamda kelsa ham ramkadan chiqmaydi — hamma
   kartada bir xil, aniq turadi (markazidan qirqiladi) */
.biz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Gorizontal karusel kartasi (2-mockup) ── */
.pop-card {
  width: 168px; flex: none; border-radius: var(--r-lg); overflow: hidden;
  background: var(--bg-card); box-shadow: var(--shadow-card);
  border: 1px solid var(--border); cursor: pointer;
}
.pop-img { position: relative; height: 108px; background: var(--bg-input); overflow: hidden; }
/* v34: MUHIM — rasm ramkaga qat'iy sig'adi. Bu qoida bo'lmagani uchun
   rasm o'z o'lchamida chizilib, pastdagi biznes NOMI ustiga chiqib
   ketayotgan edi */
.pop-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pop-img .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pop-img .ph svg { width: 36px; height: 36px; }
.pop-logo {
  position: absolute; left: 10px; bottom: 10px;
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid #fff; overflow: hidden; background: var(--bg-navy);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800;
}
.pop-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* v34: "Ochiq/Yopiq" endi RASM USTIDA emas — karta pastida, alohida
   qatorda (rasmni to'sib qo'ymaydi, o'qish oson) */
.pop-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin-top: 6px;
}
.pop-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; }
.pop-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pop-status.on { color: var(--green); }
.pop-status.off { color: var(--red); }
.pop-hours { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.pop-heart {
  position: absolute; right: 8px; top: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.pop-heart.on { color: var(--red); }
.pop-body { padding: 10px 12px 12px; }

/* ── Kategoriya grid (3-mockup) ── */
/* v66 — IKKI QATOR, YONGA SURILADI.
   Oldin 5 ustunli to'r edi: 11 ta guruh 3 qatorga chiqib, blok butun
   ekranni egallardi va ostidagi hamma narsani pastga surib yuborardi.
   Endi balandligi QAT'IY ikki qator, ortiqchasi yon tomonga suriladi. */
.cat-grid {
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  grid-auto-columns: calc((100% - 40px) / 4.35);   /* 4 tadan ko'proq ko'rinsin */
  gap: 14px 6px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  background: var(--bg-card); border-radius: var(--r-lg);
  padding: 16px 10px; box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
.cat-grid > * { scroll-snap-align: start; }
/* Surilish chizig'i telefonda ko'rinmasin — barmoq bilan suriladi */
.cat-grid::-webkit-scrollbar { height: 0; }
.cat-grid { scrollbar-width: none; }
@media (min-width: 760px) {
  /* Katta ekranda joy yetadi — surish shart emas, hammasi ko'rinadi */
  .cat-grid { grid-auto-flow: row; grid-template-rows: none;
    grid-template-columns: repeat(6, 1fr); overflow-x: visible; }
}
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer; }
.cat-item:active .cat-ic { transform: scale(0.92); }
.cat-ic {
  width: 50px; height: 50px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.cat-ic svg { width: 24px; height: 24px; }
.cat-item span {
  font-size: 11px; font-weight: 600; color: var(--text);
  text-align: center; max-width: 64px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Pastki navigatsiya ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--page-max);
  /* v58: height + padding-bottom(safe-area) + border-box = notchli
     iPhone brauzerida ichki joy 22px ga tushib, yozuvlar qisilardi */
  min-height: var(--nav-h);
  background: var(--nav-bg); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600;
}
.bn-item.active { color: var(--blue); }
.bn-fab-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.bn-fab {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--blue-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-btn);
  margin-top: -22px;
  transition: transform 0.12s ease;
}
.bn-fab:active { transform: scale(0.93); }

/* ── Top bar (ichki sahifalar) ── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; position: sticky; top: 0; z-index: 40;
  background: var(--bg);
}
.topbar .title { flex: 1; text-align: center; font-size: 16.5px; font-weight: 700; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); box-shadow: var(--shadow-card);
  color: var(--text); flex: none;
}
.icon-btn.plain { background: transparent; box-shadow: none; }

/* ── Toast xabarlar ── */
#toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 20px); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(92vw, 480px); pointer-events: none;
}
.toast {
  background: #1e293b; color: #fff;
  padding: 12px 18px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-float);
  animation: toastIn 0.25s ease;
  max-width: 100%; text-align: center;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ── Bottom sheet ── */
.sheet-back {
  position: fixed; inset: 0; background: rgba(4, 8, 20, 0.55);
  z-index: 150; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--page-max);
  background: var(--bg-card);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  z-index: 160; animation: sheetIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sheetIn { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet-grip { width: 42px; height: 4.5px; border-radius: 3px; background: var(--border); margin: 4px auto 14px; }
.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 6px; font-size: 15px; font-weight: 600;
  border-bottom: 1px solid var(--border); text-align: left; color: var(--text);
}
.sheet-item:last-child { border-bottom: 0; }
.si-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-align: left; }
.si-sub { font-size: 11.5px; font-weight: 500; color: var(--text-2); }

/* ── Progress bar (wizard, 1-mockup) ── */
.wiz-progress { display: flex; align-items: center; gap: 8px; padding: 4px 16px 14px; }
.wiz-track { flex: 1; height: 4px; border-radius: 3px; background: var(--bg-input); position: relative; overflow: hidden; }
.wiz-fill { position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 3px; transition: width 0.3s ease; }
.wiz-step-label { font-size: 12px; font-weight: 700; color: var(--text-2); flex: none; }

/* ── Bo'sh holat ── */
.empty-state { text-align: center; padding: 60px 30px; color: var(--text-2); }
.empty-state .ic { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--text-3); }

/* ── Verified belgisi ── */
.vcheck { color: var(--green); flex: none; }

/* ── Avatar / logo doira ── */
.logo-circle {
  border-radius: 50%; background: linear-gradient(135deg, #1e2b52, #0f1b3d);
  color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none;
}
.logo-circle img { width: 100%; height: 100%; object-fit: cover; }

/* v61: Toast HAR QANDAY qatlam ustida ko'rinsin — avval z-index 200 edi va
   menyu (350), filtr paneli (320), rasm ko'ruvchi (380) ostida qolib
   ketardi, ya'ni ochiq oyna ustida chiqqan xato xabari ko'rinmasdi. */
#toast-wrap { z-index: 500; }
