:root {
  --purple: #7C3AED;
  --purple-dark: #5B21B6;
  --purple-light: #F3ECFF;
  --bg: #F6F6FA;
  --ink: #17151F;
  --ink-soft: #8B899A;
  --paper: #FFFFFF;
  --line: #ECEAF3;
  --red: #FF4747;
  --green: #1DB36A;
  --radius: 16px;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  padding-bottom: 84px;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Top bar ---------- */
.topbar {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  padding: 18px 16px 20px;
  border-radius: 0 0 22px 22px;
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}
.brand {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff;
}
.lang-btn {
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.03em;
}

/* ---------- Banners ---------- */
.banner-wrap { padding: 14px 16px 0; }
.banner-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.banner-track::-webkit-scrollbar { display: none; }
.banner-slide {
  flex: none;
  width: 100%;
  scroll-snap-align: start;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16/7;
  background: var(--purple-light);
  position: relative;
  cursor: pointer;
}
.banner-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-slide .banner-title {
  position: absolute;
  left: 12px; bottom: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 12px;
  padding: 11px 14px;
}
.search-icon { width: 18px; height: 18px; color: var(--ink-soft); flex: none; }
.search-box input {
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  width: 100%;
  color: var(--ink);
  background: transparent;
}
.search-box input::placeholder { color: var(--ink-soft); }

/* ---------- Category chips ---------- */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 16px 10px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* ---------- Product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 16px 18px;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(23, 21, 31, 0.06);
}
.card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--purple-light);
}
.card-body {
  padding: 10px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  min-height: 2.5em;
  color: var(--ink);
}
.card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.price-tag {
  font-weight: 800;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.add-btn {
  border: none;
  background: var(--purple);
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.add-btn:active { background: var(--purple-dark); }
.stock-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  z-index: 2;
}
.fav-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  color: var(--ink-soft);
}
.fav-btn svg { width: 15px; height: 15px; }
.fav-btn.active { color: var(--red); }
.fav-btn.active svg { fill: var(--red); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
  font-size: 14px;
}
.empty-state svg { color: var(--line); margin-bottom: 10px; }

/* ---------- To'liq ekranli sahifalar (Sevimlilar/Savat/Buyurtmalarim/Profil) ---------- */
.page-view {
  min-height: 100vh;
  background: var(--bg);
}
.page-header {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0 0 18px 18px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.page-back {
  border: none;
  background: rgba(255,255,255,0.16);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.page-back svg { width: 18px; height: 18px; }
.page-header h2 {
  flex: 1;
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}
.page-header-icon {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: none;
}
.page-header-icon svg { width: 20px; height: 20px; }
.page-content {
  padding: 16px 16px 24px;
}
.page-subtitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.page-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
  font-size: 14px;
}

/* ---------- Ro'yxat qatorlari (Sevimlilar / Savat) ---------- */
.list-row {
  display: flex;
  gap: 10px;
  background: var(--paper);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
  position: relative;
}
.list-row img {
  width: 60px; height: 60px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--purple-light);
  flex: none;
}
.list-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.list-row-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.list-row-price { font-size: 14px; font-weight: 800; color: var(--ink); }
.list-row-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.icon-btn {
  border: none;
  background: var(--purple-light);
  color: var(--purple-dark);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.icon-btn.danger { background: #FFE5E5; color: var(--red); }
.icon-btn svg { width: 14px; height: 14px; }

.tip-card {
  display: flex;
  gap: 10px;
  background: var(--purple-light);
  border-radius: 14px;
  padding: 14px;
  margin-top: 6px;
  align-items: flex-start;
}
.tip-card svg { width: 22px; height: 22px; color: var(--purple-dark); flex: none; margin-top: 2px; }
.tip-card strong { display: block; font-size: 13.5px; color: var(--purple-dark); margin-bottom: 2px; }
.tip-card p { margin: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

/* ---------- Savat sahifasi ---------- */
.cart-page-foot {
  background: var(--paper);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
}

/* ---------- Buyurtma kartasi (Buyurtmalarim) ---------- */
.order-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.order-filter-tabs::-webkit-scrollbar { display: none; }
.order-thumb-row { display: flex; gap: 6px; margin: 8px 0; }
.order-thumb-row img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--purple-light); }
.order-thumb-more {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--line);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.order-status-pill.status-new, .order-status-pill.status-confirmed { background: #FFF1DA; color: #B4690E; }
.order-status-pill.status-processing { background: #E1EEFF; color: #1D62D6; }
.order-status-pill.status-delivered { background: #DCF7E8; color: #12824B; }
.order-status-pill.status-cancelled { background: #FFE1E1; color: #C42A2A; }
.order-detail-toggle {
  width: 100%;
  border: 1px solid var(--purple);
  background: #fff;
  color: var(--purple);
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 8px;
}
.order-detail-list { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: none; flex-direction: column; gap: 6px; }
.order-detail-list.open { display: flex; }
.order-detail-item { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- Profil sahifasi ---------- */
.profile-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
}
.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.profile-summary-info { flex: 1; min-width: 0; }
.profile-summary-name { font-size: 15.5px; font-weight: 800; color: var(--ink); }
.profile-summary-phone { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.profile-menu {
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
}
.profile-menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.profile-menu-row:last-child { border-bottom: none; }
.profile-menu-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--purple-light);
  color: var(--purple-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.profile-menu-icon svg { width: 17px; height: 17px; }
.profile-menu-label { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.profile-menu-value { font-size: 13px; color: var(--ink-soft); }
.profile-menu-chevron { color: var(--ink-soft); flex: none; }
.profile-menu-chevron svg { width: 16px; height: 16px; }
.profile-toggle {
  position: relative;
  width: 40px; height: 24px;
  border-radius: 999px;
  background: var(--line);
  border: none;
  cursor: pointer;
  flex: none;
}
.profile-toggle.on { background: var(--purple); }
.profile-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}
.profile-toggle.on::after { transform: translateX(16px); }
.profile-panel {
  background: var(--paper);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
}
.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.address-row:last-of-type { border-bottom: none; }
.address-row-text { font-size: 13.5px; color: var(--ink); flex: 1; }
.address-row-label { font-size: 11px; font-weight: 700; color: var(--purple-dark); text-transform: uppercase; }

/* ---------- Checkout: yetkazib berish / olib ketish ---------- */
.delivery-toggle {
  display: flex;
  gap: 8px;
  background: var(--purple-light);
  padding: 4px;
  border-radius: 12px;
}
.delivery-opt {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--purple-dark);
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
}
.delivery-opt.active { background: var(--purple); color: #fff; }
.pickup-info {
  display: flex;
  gap: 10px;
  background: var(--purple-light);
  border-radius: 12px;
  padding: 12px;
  align-items: flex-start;
}
.pickup-info strong { font-size: 13px; color: var(--purple-dark); }
.pickup-info p { margin: 2px 0 0; font-size: 13px; color: var(--ink); }
.saved-address-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 10px;
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
  box-shadow: 0 -4px 16px rgba(23,21,31,0.05);
}
.nav-btn {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.nav-btn svg { width: 21px; height: 21px; }
.nav-btn.active { color: var(--purple); }
.nav-icon-wrap { position: relative; display: inline-flex; }
.nav-badge {
  position: absolute;
  top: -6px; right: -10px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.nav-badge[hidden] {
  display: none !important;
}

/* ---------- Sheets / overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 21, 31, 0.5);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.overlay[hidden] {
  display: none !important;
}
.sheet {
  background: var(--bg);
  width: 100%;
  max-height: 88vh;
  border-radius: 20px 20px 0 0;
  padding: 18px;
  overflow-y: auto;
  animation: slideUp .22s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-head h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
}
.close-btn {
  border: none;
  background: var(--paper);
  border: 1px solid var(--line);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
}

.cart-items { display: flex; flex-direction: column; gap: 10px; }
.cart-item {
  display: flex;
  gap: 10px;
  background: var(--paper);
  border-radius: 14px;
  padding: 10px;
  align-items: center;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
}
.cart-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--purple-light); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; }
.cart-item-price { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.qty-control { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 27px; height: 27px;
  border-radius: 50%;
  border: none;
  background: var(--purple-light);
  color: var(--purple-dark);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}
.qty-val { font-weight: 700; min-width: 18px; text-align: center; }

.sheet-foot {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row-between { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.row-between strong { font-weight: 800; color: var(--ink); }

.btn-primary {
  border: none;
  background: var(--purple);
  color: #fff;
  padding: 15px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
}
.btn-primary:active { background: var(--purple-dark); }

.checkout-form { display: flex; flex-direction: column; gap: 12px; }
.checkout-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.checkout-form input, .checkout-form textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  resize: none;
}
.checkout-form input:focus, .checkout-form textarea:focus { outline: 2px solid var(--purple-light); border-color: var(--purple); }
.field-label { font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; }
.pay-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  background: var(--paper);
}
.pay-option input { accent-color: var(--purple); }

.coupon-row { display: flex; gap: 8px; }
.coupon-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--paper);
}
.btn-outline {
  border: 1px solid var(--purple);
  background: #fff;
  color: var(--purple);
  font-weight: 700;
  font-size: 13px;
  padding: 0 16px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.coupon-msg { font-size: 12.5px; margin: -6px 0 0; }
.coupon-msg.ok { color: var(--green); }
.coupon-msg.error { color: var(--red); }
.settings-hint { font-size: 12px; color: var(--ink-soft); margin: -4px 0 0; line-height: 1.4; }

.profile-contact-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-contact-block h3 { margin: 0; font-size: 14px; color: var(--ink-soft); }
.profile-contact-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.profile-contact-row a { color: var(--purple); text-decoration: none; font-weight: 600; }
.profile-contact-row span { color: var(--ink); }

.card-pay-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--purple-light);
  border-radius: 12px;
  padding: 14px;
  margin-top: -4px;
}
.card-pay-details { font-size: 14px; line-height: 1.5; color: var(--ink); }
.card-pay-details strong { font-family: var(--font-mono, monospace); letter-spacing: 0.03em; }
.card-pay-panel input[type="file"] {
  border: 1px dashed var(--purple);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  background: var(--paper);
}
.proof-preview { width: 100%; max-height: 180px; object-fit: contain; border-radius: 10px; background: var(--paper); }

.product-detail-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 14px;
  background: var(--purple-light);
}
.product-detail-name {
  font-size: 19px;
  font-weight: 800;
  margin: 14px 0 4px;
  color: var(--ink);
}
.product-detail-price {
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 10px;
}
.product-detail-desc { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin-bottom: 16px; }

.order-card {
  background: var(--paper);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 1px 6px rgba(23,21,31,0.05);
  margin-bottom: 10px;
}
.order-status-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--purple-light);
  color: var(--purple-dark);
}
