/* Bichak Mini App — mobilga moslashgan, Telegram mavzusiga bog'langan */

:root {
  --bg:        var(--tg-theme-bg-color, #17171a);
  --bg2:       var(--tg-theme-secondary-bg-color, #232328);
  --card:      var(--tg-theme-section-bg-color, var(--tg-theme-secondary-bg-color, #232328));
  --text:      var(--tg-theme-text-color, #ffffff);
  --sub:       var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color, #9a9aa2));
  --hint:      var(--tg-theme-hint-color, #9a9aa2);
  --link:      var(--tg-theme-link-color, #5eb0f5);
  --btn:       var(--tg-theme-button-color, #e05a2b);
  --btn-text:  var(--tg-theme-button-text-color, #ffffff);
  --separator: var(--tg-theme-section-separator-color, rgba(255, 255, 255, .08));
  --accent:    #e05a2b;
  --radius:    14px;
  --safe-b:    var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  overscroll-behavior-y: contain;
}

body { padding-bottom: calc(96px + var(--safe-b)); }

/* ─── Yuqori panel ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--separator);
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.brand-sub { font-size: 12px; color: var(--hint); margin-top: 2px; }

.cart-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: none;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

/* ─── Asosiy ko'rinish ────────────────────────────────────────── */

.view { padding: 12px 12px 0; }

.section-title {
  margin: 16px 4px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--hint);
}

/* Taom kartochkasi */

.item {
  display: flex;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--card);
  border-radius: var(--radius);
}

.item-img {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg2);
  display: block;
}

.item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.item-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-desc {
  font-size: 12.5px;
  color: var(--sub);
  margin: 0 0 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-price {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item-price small { font-size: 12px; font-weight: 500; color: var(--hint); margin-left: 2px; }

/* Miqdor tanlagich */

.stepper { display: flex; align-items: center; gap: 2px; }

.stepper button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 9px;
  background: var(--bg2);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.stepper button:active { transform: scale(.92); }
.stepper button.plus { background: var(--btn); color: var(--btn-text); }

.stepper .count {
  min-width: 30px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.add-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 9px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.add-btn:active { transform: scale(.96); }

/* ─── Savat ───────────────────────────────────────────────────── */

.cart-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--separator);
}
.cart-line:last-child { border-bottom: none; }

.cart-line-name { flex: 1 1 auto; font-size: 14.5px; }
.cart-line-sum {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 76px;
  text-align: right;
}

.summary {
  margin-top: 14px;
  padding: 14px;
  background: var(--card);
  border-radius: var(--radius);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14.5px;
  padding: 3px 0;
  color: var(--sub);
}
.summary-row.total {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--separator);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.notice {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(224, 90, 43, .13);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 500;
}

/* ─── Buyurtma formasi ────────────────────────────────────────── */

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin: 0 4px 6px;
  font-size: 13px;
  color: var(--hint);
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--separator);
  border-radius: 11px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.field input:focus,
.field textarea:focus { border-color: var(--btn); }
.field textarea { resize: none; min-height: 74px; }

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--bg2);
  border-radius: 12px;
}
.segmented button {
  flex: 1;
  padding: 11px 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.segmented button.active { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

.ghost-btn {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  border: 1px dashed var(--separator);
  border-radius: 11px;
  background: transparent;
  color: var(--link);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

/* ─── Pastki panel ────────────────────────────────────────────── */

.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--separator);
}

.bottom-total { display: flex; flex-direction: column; line-height: 1.15; }
.bottom-label { font-size: 11.5px; color: var(--hint); text-transform: uppercase; letter-spacing: .3px; }
.bottom-sum { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.primary-btn {
  flex: 1 1 auto;
  padding: 15px 18px;
  border: none;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.primary-btn:active { transform: scale(.985); }
.primary-btn[disabled] { opacity: .45; pointer-events: none; }

/* ─── Muvaffaqiyat ────────────────────────────────────────────── */

.success { padding: 44px 20px 0; text-align: center; }
.success-check {
  width: 76px; height: 76px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(46, 170, 90, .14);
  color: #2eaa5a;
  display: grid;
  place-items: center;
  font-size: 40px;
}
.success h2 { margin: 0 0 8px; font-size: 22px; }
.success p { margin: 0 0 6px; color: var(--sub); font-size: 15px; }
.success .order-no {
  margin: 18px 0 24px;
  font-size: 15px;
  color: var(--hint);
}
.success .order-no b { color: var(--text); font-size: 20px; }

/* ─── Yordamchi ───────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
}

.loader {
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.22);
  border-top-color: var(--btn);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%; bottom: calc(110px + var(--safe-b));
  transform: translateX(-50%) translateY(12px);
  z-index: 70;
  max-width: 88vw;
  padding: 11px 16px;
  border-radius: 11px;
  background: rgba(0,0,0,.86);
  color: #fff;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { padding: 40px 20px; text-align: center; color: var(--hint); font-size: 15px; }

.hidden { display: none !important; }
