/* ════════════════════════════════════════════════════════════════════════════
   shop.css — Customer-facing store styles
   Search, categories, product grid, cart, checkout, orders, profile
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Search bar ──────────────────────────────────────────────────────────────── */
.search-bar {
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.search-wrap { position: relative; }
.search-input {
  width: 100%;
  background: var(--tag-bg);
  border: 1.5px solid transparent;
  border-radius: var(--r-full);
  padding: 10px 14px 10px 40px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--fg);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.search-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}
.search-input::placeholder { color: var(--fg3); }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg3);
  pointer-events: none;
}
.search-icon svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round;
}
.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg3);
  padding: 4px;
}
.search-clear[hidden] { display: none !important; }
.search-clear svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round;
}

/* ── Category pills ──────────────────────────────────────────────────────────── */
.cat-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.cat-bar::-webkit-scrollbar { display: none; }

.cat-pill {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-head);
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--fg2);
  transition: background var(--dur-fast), border-color var(--dur-fast),
              color var(--dur-fast);
  white-space: nowrap;
}
.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cat-pill:not(.active):active { background: var(--tag-bg); }

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

.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--dur-fast), border-color var(--dur-fast);
  cursor: pointer;
}
.prod-card:active { box-shadow: var(--shadow-md); border-color: var(--accent); }

.prod-img {
  aspect-ratio: 1 / 1;
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  position: relative;
  overflow: hidden;
}
.prod-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.prod-img-emoji { z-index: 1; }
.prod-out-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.prod-out-overlay[hidden] { display: none !important; }

.prod-body {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.prod-cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--fg3);
  font-family: var(--font-head);
}
.prod-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-price-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 3px;
}
.prod-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
}
.prod-unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--fg2);
}
.prod-mrp {
  font-size: 11px;
  color: var(--fg3);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.prod-footer {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Add to cart button */
.add-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(45,106,79,.35);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
  flex-shrink: 0;
}
.add-btn:active { transform: scale(.9); box-shadow: 0 1px 4px rgba(45,106,79,.2); }
.add-btn:disabled { opacity: .4; pointer-events: none; }
.add-btn svg {
  width: 16px; height: 16px;
  stroke: #fff; fill: none;
  stroke-width: 2.5; stroke-linecap: round;
}

/* Qty control (replaces + button when qty > 0) */
.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-family: var(--font-head);
  font-weight: 600;
  transition: background var(--dur-fast), color var(--dur-fast);
  line-height: 1;
}
.qty-btn:active { background: var(--accent); color: #fff; }
.qty-num {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  text-align: center;
  color: var(--fg);
}

/* ── Cart screen ─────────────────────────────────────────────────────────────── */
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cart-item-thumb {
  width: 54px;
  height: 54px;
  border-radius: var(--r-sm);
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  overflow: hidden;
}
.cart-item-thumb img { width:100%;height:100%;object-fit:cover; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-price { font-size: 13px; color: var(--fg2); margin-top: 3px; font-variant-numeric: tabular-nums; }
.cart-item-total {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* Cart summary box */
.cart-summary {
  margin: 12px 16px;
  background: var(--tag-bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-row.total {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  background: var(--surface);
}
.summary-row .key { color: var(--fg2); }
.summary-row .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-row.total .val { color: var(--accent); font-size: 18px; }
.summary-row.khata-row .key { color: var(--warn); }
.summary-row.khata-row .val { color: var(--warn); }

/* Payment method selector */
.pay-section { padding: 0 16px 12px; }
.pay-section-label { padding: 12px 0 8px; }
.pay-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.pay-option.selected {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.pay-option-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.pay-option-info { flex: 1; min-width: 0; }
.pay-option-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.pay-option-sub { font-size: 12px; color: var(--fg2); margin-top: 1px; }
.pay-check { margin-left: auto; color: var(--accent); flex-shrink: 0; }
.pay-check[hidden] { display: none !important; }
.pay-check svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}

/* Checkout CTA */
.checkout-btn-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.checkout-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 15px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 14px rgba(45,106,79,.3);
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.checkout-btn:active { opacity: .88; transform: scale(.99); }
.checkout-btn:disabled { opacity: .5; pointer-events: none; }
.checkout-btn-total { font-size: 14px; opacity: .9; font-variant-numeric: tabular-nums; }

/* ── Order status tracker ─────────────────────────────────────────────────────── */
.order-track {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
}
.track-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
}
.track-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
}
.track-step.done:not(:last-child)::after { background: var(--accent); }
.track-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.track-dot.done   { background: var(--accent); border-color: var(--accent); }
.track-dot.active {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}
.track-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .03em;
  text-align: center;
  text-transform: uppercase;
  color: var(--fg3);
  font-family: var(--font-head);
  line-height: 1.3;
}
.track-label.active { color: var(--accent); }
.track-label.done   { color: var(--accent-mid); }

/* ── Order card (customer side) ──────────────────────────────────────────────── */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 8px 16px 0;
  box-shadow: var(--shadow-xs);
}
.order-card-head {
  padding: 11px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--tag-bg);
  border-bottom: 1px solid var(--border);
}
.order-id {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--fg2);
}
.order-card-body { padding: 12px 14px; }
.order-items-preview { font-size: 13px; color: var(--fg2); line-height: 1.5; }
.order-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.order-time { font-size: 12px; color: var(--fg3); }
.order-total {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.order-card-actions {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* ── Return request button ───────────────────────────────────────────────────── */
.return-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r-full);
  background: var(--tag-bg);
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-head);
  color: var(--fg2);
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.return-btn:active { border-color: var(--warn); color: var(--warn); }

/* ── Profile screen ──────────────────────────────────────────────────────────── */
.profile-hero {
  background: linear-gradient(135deg, var(--accent-dk) 0%, var(--accent) 100%);
  padding: 24px 16px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}
.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 3px;
}
.profile-phone { font-size: 13px; opacity: .8; }

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin: 0 16px;
  margin-top: -20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.pstat {
  padding: 14px 6px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.pstat:last-child { border-right: none; }
.pstat-num {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pstat-num.warn { color: var(--warn); }
.pstat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg3);
  font-family: var(--font-head);
  margin-top: 4px;
}

.profile-section { margin: 16px 16px 0; }
.profile-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--fg3);
  font-family: var(--font-head);
  margin-bottom: 8px;
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.profile-row:active { background: var(--tag-bg); }
.profile-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-row-icon svg {
  width: 17px; height: 17px;
  stroke: var(--fg2); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.profile-row-text { flex: 1; min-width: 0; }
.profile-row-title { font-size: 14px; font-weight: 500; color: var(--fg); }
.profile-row-sub { font-size: 12px; color: var(--fg3); margin-top: 1px; }
.profile-row-right { margin-left: auto; flex-shrink: 0; color: var(--fg3); }
.profile-row-right svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round;
}
.khata-amount {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}
.khata-amount.credit { color: var(--success); }

/* ── Auth modal ──────────────────────────────────────────────────────────────── */
.auth-modal-sheet { padding-top: 16px; }
.auth-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
}
.auth-step { display: none; }
.auth-step.active { display: block; }
.auth-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -.01em;
}
.auth-sub { font-size: 14px; color: var(--fg2); line-height: 1.5; margin-bottom: 4px; }
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-bottom: 20px;
}
.auth-back:hover { color: var(--fg); }
.auth-note { font-size: 12px; color: var(--fg3); text-align: center; margin-top: 12px; line-height: 1.6; }
.auth-link { color: var(--accent); font-weight: 600; }
.otp-timer { font-size: 13px; color: var(--fg3); text-align: center; margin-top: 14px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.otp-resend { color: var(--accent); font-weight: 600; }
.otp-resend[disabled] { color: var(--fg3); pointer-events: none; }
.error-msg {
  font-size: 13px;
  color: var(--danger);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.error-msg[hidden] { display: none !important; }
