/* Az Online Store — customer storefront design system.
   Palette: warm off-white ground, near-black ink, deep rose accent (not the
   cream+terracotta combo — chosen specifically to avoid it). PT Serif
   (display/headings) + PT Sans (body) — a matched serif/sans pair from the
   same foundry (Paratype), NOT the trendier 'Unbounded' this originally
   shipped with: Unbounded's cyrillic-ext subset LOOKS like it covers
   Mongolian-specific letters (ө U+04E9, ү U+04AF) by declared unicode-range,
   but its actual glyph table is missing real outlines for them — the
   browser then silently falls back per-character to the next font in the
   stack, producing a visibly mismatched glyph mid-word (confirmed live:
   "брэндүүд" rendered with "үү" in the fallback font while every other
   letter stayed in Unbounded). PT Sans was already proven glitch-free on
   this exact deploy (all body copy, including its own ө/ү words, renders
   correctly), so PT Serif — Paratype's matching serif, built with the same
   broad Cyrillic-script engineering — is the safe choice for the display
   role instead of gambling on another unverified font. */

:root {
  --bg: #faf7f5;
  --surface: #ffffff;
  --surface-sunken: #f4efec;
  --ink: #241f1d;
  --ink-muted: #71655f;
  --ink-faint: #a89c95;
  --border: #e8ddd6;
  --accent: #a9314f;
  --accent-dark: #7f2038;
  --accent-soft: #f6e2e7;
  --accent-ink: #ffffff;
  --success: #2f7d4f;
  --success-soft: #e3f3e8;
  --warning: #a8671f;
  --warning-soft: #faedd9;
  --danger: #b6392f;
  --danger-soft: #fbe6e3;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 2px 10px rgba(36, 31, 29, 0.06), 0 1px 2px rgba(36, 31, 29, 0.05);
  --shadow-lift: 0 12px 32px rgba(36, 31, 29, 0.12);
  --font-display: 'PT Serif', Georgia, 'Segoe UI', Tahoma, serif;
  --font-body: 'PT Sans', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --container: 1180px;
}

/* On a wide desktop (1920x1080 and up), a fixed 1180px container leaves huge
   idle margins on both sides and reads as a narrow, cramped site rather than
   a real store. Widening the container progressively lets the header, hero,
   product grids and footer all use more of the actual screen — more columns
   of products per row, not just bigger empty space. */
@media (min-width: 1440px) {
  :root { --container: 1360px; }
}
@media (min-width: 1800px) {
  :root { --container: 1600px; }
}

@media (prefers-color-scheme: dark) {
  /* Deliberately single-theme (production storefront, not an artifact) —
     the ground always paints from --bg so pages never render unstyled. */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
p { margin: 0 0 1em; color: var(--ink); }
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
::selection { background: var(--accent-soft); color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.shop-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.shop-header-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  max-width: var(--container);
  margin: 0 auto;
}
.shop-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-dark);
  white-space: nowrap;
}
.shop-header-spacer { flex: 1; }
.shop-header-actions { display: flex; align-items: center; gap: 14px; }
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.icon-link:hover { background: var(--surface-sunken); color: var(--ink); }
.icon-link-plain { font-size: 1.15rem; padding: 8px; }
.cart-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.shop-search {
  display: flex;
  align-items: center;
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  flex: 1;
  max-width: 380px;
  min-width: 140px;
}
.shop-search input {
  border: none;
  background: none;
  outline: none;
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 6px 0;
  color: var(--ink);
}
.shop-search button {
  border: none;
  background: var(--accent);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.shop-search button:hover { background: var(--accent-dark); }

.chat-bubble {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c6ff, #0078ff 60%, #7a3ff0);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(0, 90, 220, 0.35);
  z-index: 40;
  transition: transform 0.15s ease;
}
.chat-bubble:hover { transform: scale(1.08); }

/* ---------- Nav drawer (hamburger menu, all screen sizes) ---------- */
.hamburger-btn {
  display: inline-flex;
  align-items: center;
  border: none;
  background: none;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px 6px 0;
  color: var(--ink);
}
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 14, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
}
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 84vw);
  background: var(--surface);
  z-index: 51;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  padding: 18px;
  overflow-y: auto;
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.15);
}
.drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.drawer-head span { font-family: var(--font-display); font-weight: 700; color: var(--accent-dark); }
.drawer-close { border: none; background: none; font-size: 1.2rem; cursor: pointer; color: var(--ink-muted); }
.drawer-search {
  display: flex;
  align-items: center;
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  margin-bottom: 18px;
}
.drawer-search input { border: none; background: none; outline: none; flex: 1; min-width: 0; font-family: var(--font-body); font-size: 0.9rem; padding: 8px 0; }
.drawer-search button { border: none; background: var(--accent); color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a { padding: 12px 10px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 700; font-size: 0.93rem; }
.drawer-nav a:hover { background: var(--surface-sunken); }
.drawer-nav a.active { color: var(--accent-dark); background: var(--accent-soft); }
.drawer-divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

/* ---------- Hero: auto-scrolling deals strip ---------- */
.hero-deals {
  background: linear-gradient(160deg, var(--accent-soft) 0%, var(--bg) 75%);
  padding: 8px 0 26px;
}
.hero-deals-head { max-width: var(--container); margin: 0 auto; padding: 26px 20px 16px; }

.hero-intro {
  text-align: center;
  padding-top: 36px;
  padding-bottom: 8px;
}
.hero-tagline { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); max-width: 56ch; margin: 0 auto; }
.hero-trust {
  list-style: none;
  margin: 18px auto 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--ink-muted);
}
.hero-trust li::marker { content: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 4px 8px; color: var(--ink-muted); font-size: 1rem; }
.btn-icon:hover { color: var(--danger); }

/* ---------- Sections / grids ---------- */
.section { max-width: var(--container); margin: 0 auto; padding: 44px 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.section-head h2 { font-size: 1.5rem; }
.section-head .see-all { font-size: 0.88rem; font-weight: 700; color: var(--accent-dark); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
/* Some real category names are long bilingual strings (Mongolian + a
   parenthetical English gloss) — without a clamp, one long name stretches
   its whole grid ROW to match, leaving every short-named tile in that row
   mostly blank space. line-clamp caps every tile at the same 2 lines so a
   row's height is never held hostage by its longest name. */
.category-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.category-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.category-tile .cat-emoji { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.category-tile .cat-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.product-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.product-card-media {
  aspect-ratio: 1 / 1;
  background: var(--surface-sunken);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.8rem;
}
.product-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.product-card:hover .product-card-media img { transform: scale(1.06); }
.product-card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card-name { font-size: 0.92rem; font-weight: 700; line-height: 1.3; }
.product-card-cat { font-size: 0.76rem; color: var(--ink-muted); }
.product-card-price { font-family: var(--font-display); font-weight: 700; color: var(--accent-dark); margin-top: auto; font-size: 1.02rem; }

/* Featured-products horizontal carousel (home page) — bigger, portrait-ish
   cards with scroll-snap, no JS needed. */
.carousel {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 4px 4px 14px;
  scrollbar-width: thin;
}
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.carousel .product-card { scroll-snap-align: start; flex: 0 0 250px; }
.carousel .product-card-media { aspect-ratio: 4 / 5; }
@media (max-width: 600px) {
  .carousel .product-card { flex-basis: 200px; }
}

/* Hero deals strip reuses .carousel wholesale, just full-bleed padding and
   slightly narrower cards (auto-scroll reads better with more cards
   in view at once). Declared after .carousel so these actually win at
   equal selector specificity. */
.hero-deals-row { padding-left: clamp(20px, 5vw, 40px); padding-right: clamp(20px, 5vw, 40px); }
.hero-deals-row .product-card { flex: 0 0 200px; }
@media (min-width: 1440px) { .hero-deals-row .product-card { flex-basis: 230px; } }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  position: absolute;
  top: 10px;
  left: 10px;
}
.badge-cargo { background: var(--warning-soft); color: var(--warning); }
.badge-soldout { background: var(--danger-soft); color: var(--danger); }
.badge-new { background: var(--success-soft); color: var(--success); }
.badge-lowstock { background: var(--warning-soft); color: var(--warning); }
.badge-sale { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- Forms ---------- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 0.87rem; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field-hint { font-size: 0.78rem; color: var(--ink-muted); margin-top: 4px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.radio-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.alert { border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.9rem; margin-bottom: 18px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Cart / order tables ---------- */
.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.cart-line-media { width: 64px; height: 64px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-sunken); }
.cart-line-media img { width: 100%; height: 100%; object-fit: cover; }
.cart-line-name { font-weight: 700; font-size: 0.94rem; }
.cart-line-unit { color: var(--ink-muted); font-size: 0.82rem; }
.qty-stepper { display: flex; align-items: center; gap: 6px; }
.qty-stepper input { width: 52px; text-align: center; padding: 7px 4px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); }
.cart-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; position: sticky; top: 100px; }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 0.92rem; color: var(--ink-muted); }
.summary-row.total { color: var(--ink); font-weight: 700; font-size: 1.15rem; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 14px; }

.order-grid { display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
@media (max-width: 860px) { .order-grid { grid-template-columns: 1fr; } .cart-summary { position: static; } }

table.plain { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.plain th { text-align: left; color: var(--ink-muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1.5px solid var(--border); }
table.plain td { padding: 10px; border-bottom: 1px solid var(--border); }

/* ---------- Product detail ---------- */
.product-detail { display: grid; grid-template-columns: 420px 1fr; gap: 40px; }
@media (max-width: 780px) { .product-detail { grid-template-columns: 1fr; } }
@media (min-width: 1440px) { .product-detail { grid-template-columns: 520px 1fr; gap: 56px; } }
.product-detail-media { aspect-ratio: 1/1; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-sunken); }
.product-detail-media img { width: 100%; height: 100%; object-fit: cover; }
.product-detail-price { font-family: var(--font-display); font-size: 1.8rem; color: var(--accent-dark); margin: 10px 0 18px; }
.product-detail p { max-width: 68ch; }
.breadcrumb { font-size: 0.83rem; color: var(--ink-muted); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--accent-dark); }

/* ---------- Status / lookup ---------- */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; }
.status-PENDING { background: var(--warning-soft); color: var(--warning); }
.status-PAID { background: var(--success-soft); color: var(--success); }
.status-MANUAL_REVIEW { background: var(--accent-soft); color: var(--accent-dark); }
.status-DELIVERED { background: var(--success-soft); color: var(--success); }
.status-CANCELLED { background: var(--danger-soft); color: var(--danger); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty-state h3 { color: var(--ink); }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 0.88rem; font-weight: 700; }
.pagination a:hover { border-color: var(--accent); color: var(--accent-dark); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

.receipt-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  color: var(--ink-muted);
}
.receipt-drop input[type="file"] { margin-top: 12px; }

/* ---------- Footer ---------- */
.info-strip { background: var(--surface); border-top: 1px solid var(--border); margin-top: 50px; padding: 44px 20px; }
.info-strip-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  text-align: center;
}
.info-item svg { color: var(--accent); margin-bottom: 10px; }
.info-item h4 { font-size: 0.85rem; letter-spacing: 0.04em; margin: 0 0 8px; color: var(--ink); }
.info-item p { font-size: 0.85rem; color: var(--ink-muted); max-width: 36ch; margin: 0 auto; }

.shop-footer { background: var(--ink); color: #f2ebe8; margin-top: 0; }
.shop-footer-inner { max-width: var(--container); margin: 0 auto; padding: 44px 20px; display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.shop-footer h4 { color: #fff; font-size: 0.95rem; }
.shop-footer p, .shop-footer a { color: #cfc3bd; font-size: 0.86rem; line-height: 1.7; }
.shop-footer a:hover { color: #fff; }
.shop-footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); text-align: center; padding: 16px 20px; font-size: 0.78rem; color: #a99b93; }
.social-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
}
.social-icon:hover { border-color: rgba(255, 255, 255, 0.4); }

@media (max-width: 600px) {
  .shop-header-bar { flex-wrap: wrap; }
  .shop-search { order: 3; max-width: none; flex-basis: 100%; }
  .hero { padding: 40px 16px 48px; }
  .cart-line { grid-template-columns: 52px 1fr; }
  .cart-line > .btn-icon, .cart-line > .qty-stepper { grid-column: 2; }
  .chat-bubble { bottom: 16px; right: 16px; width: 52px; height: 52px; }
}
