/* style.css — طراحی app-like (شبیه اپ اینستاگرام)
 * هدر بالا + نوار تب پایین + گرید immersive
 */

:root {
  /* Palette */
  --primary: #0f1e3d;
  --primary-light: #1e3a8a;
  --primary-soft: #eef2ff;
  --accent: #b8965a;
  --accent-dark: #9a7b3f;
  --accent-soft: #faf6ec;
  --bg: #fafafa;
  --bg-alt: #f1f3f6;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --success: #10b981;
  --success-soft: #d1fae5;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;

  /* Layout */
  --header-h: 56px;
  --tab-h: 60px;
  --max-w: 960px;
  --bottom-bar-h: 76px;

  /* Effects */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ─── Top Header (Instagram-like) ─────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Brand */
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.app-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 30, 61, 0.15);
  border: 1px solid var(--border);
}

.app-brand-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header actions */
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.hdr-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.18s ease;
  cursor: pointer;
}

.hdr-icon-btn svg {
  width: 22px;
  height: 22px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hdr-icon-btn:hover {
  background: var(--bg-alt);
  color: var(--primary);
}

.hdr-icon-btn:active { transform: scale(0.92); }

.hdr-icon-btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ─── Logout section (in profile page, subtle) ─── */
.logout-section {
  margin-top: 24px;
  text-align: center;
  padding: 16px 0;
}

.logout-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.15s;
}

.logout-link:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.logout-link svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Tab Bar (Bottom navigation like Instagram) ─── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--tab-h);
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.tab-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: 1px;
  background: var(--border);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 2px;
  cursor: pointer;
  transition: color 0.18s;
  position: relative;
  min-width: 0;
}

.tab-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon {
  width: 24px;
  height: 24px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s;
}

.tab-item:hover { color: var(--text); }

.tab-item:hover .tab-icon { transform: scale(1.08); }

.tab-item:active .tab-icon { transform: scale(0.92); }

.tab-item.active {
  color: var(--primary);
}

.tab-item.active .tab-icon {
  stroke-width: 2.5;
  fill: var(--primary);
  fill-opacity: 0.1;
}

.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.tab-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* ─── Main Content Area ─────────────────────────── */
.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px;
  /* padding-bottom باید به اندازه کافی بزرگ باشه تا محتوا زیر نوار tab-bar
     نره. اضافه می‌کنیم margin برای نوار bottom-actions (در صفحات سبد/checkout)
     که بالای tab-bar قرار می‌گیره. */
  padding-bottom: calc(var(--tab-h) + var(--bottom-bar-h) + 32px + env(safe-area-inset-bottom, 0px));
}

body.no-tab-bar .app-main {
  padding-bottom: 24px;
}

/* وقتی bottom-actions فعال نیست، فضای اضافی لازم نیست.
   اما برای سادگی و اطمینان از اینکه هیچوقت محتوا زیر نوار نره،
   همیشه padding-bottom کامل رو نگه می‌داریم. */

/* ─── Page Header (in-content) ──────────────────── */
.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-top: 2px;
  min-height: 40px;
}

.page-head .back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  font-size: 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
  flex-shrink: 0;
  font-weight: 700;
}

.page-head .back-btn:hover {
  background: var(--bg-alt);
  border-color: var(--border-strong);
}

.page-head .page-title {
  font-size: 22px;
  font-weight: 800;
  flex: 1;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-head .cart-count {
  background: var(--danger);
  color: white;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}

/* ─── Flash Messages ────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash-success { background: var(--success-soft); color: #065f46; border-color: #6ee7b7; }
.flash-warning { background: var(--warning-soft); color: #78350f; border-color: #fcd34d; }
.flash-danger  { background: var(--danger-soft); color: #991b1b; border-color: #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

/* ─── Home Hero + Stories-style row ─────────────── */
.home-hero {
  background: linear-gradient(135deg, #0b1526 0%, var(--primary) 55%, #24406e 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(184, 150, 90, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.home-hero .hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  background: rgba(184, 150, 90, 0.25);
  border: 1px solid rgba(184, 150, 90, 0.4);
  color: var(--accent);
  border-radius: 100px;
  margin-bottom: 12px;
}

.home-hero .hero-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  position: relative;
}

.home-hero .hero-subtitle {
  font-size: 14px;
  opacity: 0.85;
  position: relative;
  line-height: 1.6;
}

.home-hero .hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 18px;
  position: relative;
}

.home-hero .hero-stat {
  display: flex;
  flex-direction: column;
}

.home-hero .hero-stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.home-hero .hero-stat-label {
  font-size: 11px;
  opacity: 0.75;
}

/* Quick action row (Instagram story-style circles) */
.quick-row {
  display: flex;
  gap: 16px;
  padding: 4px 4px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.quick-row::-webkit-scrollbar { display: none; }

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s;
}

.quick-item:active { transform: scale(0.95); }

.quick-item-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-soft), white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  border: 2px solid var(--primary);
  position: relative;
  box-shadow: 0 4px 12px rgba(15, 30, 61, 0.08);
}

.quick-item-icon svg {
  width: 26px;
  height: 26px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-item-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  max-width: 70px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-item .quick-badge {
  position: absolute;
  top: -2px;
  left: -2px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ─── Section Title ───────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 12px;
}

.section-title h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}

.section-title .link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
}

/* ─── Category chips (horizontal scroll like IG) ─ */
.cat-chips {
  display: flex;
  gap: 8px;
  padding: 6px 0 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 4px;
}
.cat-chips::-webkit-scrollbar { display: none; }

.cat-chip {
  padding: 8px 18px;
  scroll-snap-align: start;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Selected category banner (when a filter is active) */
.selected-cat-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.selected-cat-banner .selected-cat-name {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.selected-cat-banner .selected-cat-count {
  font-size: 12px;
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.18);
  padding: 3px 10px;
  border-radius: 100px;
}

.selected-cat-clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  transition: background 0.15s;
}

.selected-cat-clear:hover { background: rgba(255, 255, 255, 0.3); }

/* page-head for explore - allow wrapping */
.explore-page-head { flex-wrap: wrap; }

/* ─── Explore Grid (Instagram-style square grid) ── */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.explore-cell {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-alt);
  cursor: pointer;
  overflow: hidden;
  display: block;
}

.explore-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.explore-cell:hover img { transform: scale(1.05); }

.explore-cell-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.85) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  pointer-events: none;
}

.explore-cell:hover .explore-cell-overlay { opacity: 1; }

.explore-cell-code {
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* On touch devices, always show code (bottom bar) */
@media (hover: none) {
  .explore-cell-overlay { opacity: 1; background: linear-gradient(to top, rgba(15, 23, 42, 0.7) 0%, transparent 60%); }
}

/* ─── Category Grid (catalog page) ──────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.cat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}

.cat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at top right, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}

.cat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cat-card .cat-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  position: relative;
}

.cat-card .cat-count {
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
}

.cat-card .cat-arrow {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-dark);
  position: relative;
}

/* ─── Featured categories (in quick-row circles) ─── */
.quick-item-featured {
  background: linear-gradient(135deg, var(--accent-soft), #fff);
  border-color: var(--accent) !important;
  color: var(--accent-dark) !important;
}

/* ─── Category card image ─── */
.cat-card-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--bg-alt);
}

/* دسته‌ای که عکس دارد: عکس لبه‌به‌لبهٔ کارت */
.cat-card-photo {
  padding: 0;
  background: var(--card);
}
.cat-card-photo .cat-card-img {
  border-radius: 0;
  margin-bottom: 0;
  aspect-ratio: 16/11;
}
.cat-card-photo .cat-card-body {
  padding: 14px 16px 18px;
  position: relative;
}
.cat-card-photo .cat-name {
  font-size: 15px;
  margin-bottom: 2px;
}

/* ─── Subcategory chips (under parent category card) ─── */
.cat-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subcat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}

.subcat-chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(184, 150, 90, 0.25);
  transition: all 0.15s;
}

.subcat-chip:hover {
  background: var(--accent);
  color: white;
}

/* ─── Subcategory section (on products page) ─── */
.subcat-section {
  margin-bottom: 16px;
}

.subcat-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.subcat-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subcat-chip-lg {
  background: var(--card);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.subcat-chip-lg:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ─── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  font-family: inherit;
  text-align: center;
  min-height: 44px;
  white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active { background: var(--primary-light); transform: scale(0.98); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(184, 150, 90, 0.3);
}

.btn-accent:active { transform: scale(0.98); }

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:active { transform: scale(0.98); }

.btn-danger { background: var(--danger); color: white; }

.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-ghost:active { background: var(--bg-alt); transform: scale(0.98); }

/* Rubika login button (Google-style) */
.btn-rubika-login {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  position: relative;
  font-weight: 700;
}

.btn-rubika-login:hover {
  background: #fafafa;
  border-color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.btn-rubika-login:active { transform: scale(0.98); }

.btn-rubika-login .rubika-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: white;
  flex-shrink: 0;
}

.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 16px; min-height: 52px; }

/* ─── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* ≥16px for iOS */
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: all 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

input::placeholder, textarea::placeholder { color: var(--text-soft); }

textarea { min-height: 84px; resize: vertical; }

.field-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 5px;
}

/* ─── Product Grid (catalog list) ──────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--bg-alt);
  display: block;
}

.product-info {
  padding: 10px 12px;
  text-align: center;
}

.product-code {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
}

/* نام محصول (وقتی تعریف شده باشد) */
.product-name {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

/* ویترین صفحهٔ اول — دو ستون در موبایل، سه ستون در دسکتاپ */
.product-grid-compact {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* ─── Browse page (single product) ──────────────── */
.browse-product {
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}

.browse-product .browse-img-wrap {
  position: relative;
  margin-bottom: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
  border: 1px solid var(--border);
}

.browse-product .browse-img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: var(--card);
  display: block;
}

.browse-product .browse-code {
  font-size: 20px;
  font-weight: 800;
  margin: 12px 0 4px;
  color: var(--text);
  letter-spacing: -0.2px;
}

.browse-product .browse-counter {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* prev/next side by side */
.browse-nav {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.browse-nav-btn { flex: 1; }

/* ─── Quantity selector (hidden until order clicked) ─── */
.qty-section {
  display: none;
  animation: fadeInUp 0.25s ease-out;
  margin-top: 16px;
  padding: 18px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.qty-section.show { display: block; }

.qty-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.qty-selector {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.qty-option {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--card);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--text);
}

.qty-option:hover {
  border-color: var(--primary-light);
}

.qty-option.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(15, 30, 61, 0.3);
}

.qty-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.qty-actions .btn { flex: 1; min-width: 130px; }

/* ─── Cart items ──────────────────────────────── */
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: opacity 0.25s, transform 0.25s;
}

.cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-alt);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info .code { font-weight: 700; font-size: 15px; color: var(--primary); }
.cart-item-info .qty { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.cart-item-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.cart-item-controls button {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all 0.15s;
  color: var(--text);
}

.cart-item-controls button:hover { background: var(--bg-alt); }
.cart-item-controls button:active { transform: scale(0.92); }

.cart-item-controls .del-btn {
  color: var(--danger);
  border-color: #fecaca;
  background: var(--danger-soft);
  font-size: 14px;
}

.cart-item-controls .del-btn:hover { background: var(--danger); color: white; }

/* ─── Bottom action bar (sticky) ──────────────── */
.bottom-actions {
  position: fixed;
  bottom: var(--tab-h);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 10px;
  z-index: 80;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
  max-width: var(--max-w);
  margin: 0 auto;
}

.bottom-actions .btn { flex: 1; }
.bottom-actions.row-2 { flex-wrap: wrap; }
.bottom-actions.row-2 .btn { flex: 1 1 45%; }

/* ─── Cart toast ──────────────────────────────── */
.cart-toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 12px);
  left: 16px;
  right: 16px;
  max-width: 420px;
  margin: 0 auto;
  background: var(--text);
  color: white;
  padding: 14px 16px;
  border-radius: var(--radius);
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-toast.show { display: flex; }

.cart-toast #cart-toast-msg {
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.cart-toast-actions {
  display: flex;
  gap: 8px;
}

.cart-toast-actions .btn { flex: 1; }

/* ─── Tables ──────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  border: 1px solid var(--border);
}

.table th, .table td {
  padding: 11px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 13px;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-alt); }

/* ─── Badges ──────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: var(--success-soft); color: #065f46; }
.badge-warning { background: var(--warning-soft); color: #78350f; }
.badge-danger  { background: var(--danger-soft); color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* ─── Auth pages (login/register) ─────────────── */
.auth-wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 18px;
}

.auth-card-outside {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.auth-card-outside::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.auth-logo {
  text-align: center;
  margin-bottom: 22px;
}

.auth-logo-img {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  object-fit: cover;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(15, 30, 61, 0.2);
  border: 2px solid var(--border);
}

.auth-logo .auth-logo-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.auth-logo .auth-subtitle {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 13px;
}

/* ─── Empty states ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state .icon svg {
  width: 34px;
  height: 34px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state .title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.empty-state .desc {
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

/* ─── Order card ──────────────────────────────── */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: box-shadow 0.15s;
}

.order-card:hover { box-shadow: var(--shadow); }

.order-card.new-order {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.order-card .order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.order-card .order-head .order-id {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
}

.order-card .order-items { padding-top: 4px; }

.order-card .order-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text);
}

.order-card .order-item .qty { color: var(--text-muted); }

/* ─── Info display ────────────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 12px;
}

.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); flex-shrink: 0; }
.info-row .value { font-weight: 600; text-align: left; }

/* ─── Profile card ────────────────────────────── */
.profile-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  color: white;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.profile-header .profile-name {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.profile-header .profile-meta {
  font-size: 12px;
  opacity: 0.85;
}

/* ─── Animations ──────────────────────────────── */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Utilities ───────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ─── Responsive: Tablet & Desktop ───────────── */
@media (min-width: 768px) {
  .app-main {
    padding: 20px;
    padding-bottom: calc(var(--tab-h) + var(--bottom-bar-h) + 32px + env(safe-area-inset-bottom, 0px));
  }

  .home-hero { padding: 32px 28px; }
  .home-hero .hero-title { font-size: 28px; }

  .explore-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
  }

  /* ویترین صفحهٔ اول همیشه سه ستون (۶ محصول = دو ردیف مرتب) */
  .product-grid.product-grid-compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (min-width: 1024px) {
  .explore-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ─── Responsive: Mobile (default) ────────────── */
@media (max-width: 600px) {
  .app-header-inner { padding: 0 12px; }
  .app-brand-logo { width: 32px; height: 32px; }
  .app-brand-name { font-size: 18px; }
  .hdr-icon-btn { width: 38px; height: 38px; }
  .hdr-icon-btn svg { width: 20px; height: 20px; }

  .app-main {
    padding: 12px;
    /* padding-bottom رو دوباره تنظیم می‌کنیم چون padding:12px همه طرف رو بازنویسی می‌کنه */
    padding-bottom: calc(var(--tab-h) + var(--bottom-bar-h) + 24px + env(safe-area-inset-bottom, 0px));
  }
  body.no-tab-bar .app-main {
    padding-bottom: 24px;
  }

  .home-hero { padding: 22px 18px; }
  .home-hero .hero-title { font-size: 22px; }
  .home-hero .hero-subtitle { font-size: 13px; }
  .home-hero .hero-stats { gap: 18px; margin-top: 14px; }
  .home-hero .hero-stat-num { font-size: 18px; }

  .quick-item-icon { width: 56px; height: 56px; }
  .quick-item-icon svg { width: 22px; height: 22px; }
  .quick-item-label { font-size: 10px; }

  .explore-grid { gap: 2px; }

  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-card { padding: 18px 12px; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .page-head .page-title { font-size: 19px; }

  .qty-option { width: 60px; height: 60px; font-size: 19px; }

  .auth-card-outside { padding: 22px 18px; }
  .auth-wrap { padding: 16px 12px; }
}

/* ─── Very small screens ──────────────────────── */
@media (max-width: 360px) {
  .app-brand-name { display: none; }

  .explore-grid { grid-template-columns: repeat(2, 1fr); }

  .product-grid, .cat-grid { gap: 8px; }

  .qty-option { width: 52px; height: 52px; font-size: 17px; }

  .cart-item-img { width: 56px; height: 56px; }

  .quick-item-icon { width: 52px; height: 52px; }
}

/* ─── Desktop: hide some elements, show "desktop nav" alternative ── */
@media (min-width: 1024px) {
  .tab-bar {
    max-width: var(--max-w);
    margin: 0 auto;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    bottom: 16px;
    height: 64px;
  }
  .app-main {
    padding-bottom: calc(64px + 48px);
  }
}

/* ─── رنگ/سایز چندگانه (variant chips) ─────────────────────── */
.variant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 6px 0 10px;
}
.variant-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.variant-label {
  font-size: 12px;
  color: var(--text-muted);
}
.variant-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft, #eef1f7);
  color: var(--primary, #0f1e3d);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ══════════════════════════════════════════════════════════════
   طراحی «بوتیک آرام» — لایهٔ بازطراحی (فاز ۰ تا ۲)
   توکن‌های تازه، فونت محلی، ویترین، کارت محصول، لیست کالا و صفحهٔ محصول.
   این بلوک در انتهای فایل است تا مقادیر قبلی را override کند؛ رنگ برند
   (--primary/--accent) از تنظیمات فروشگاه می‌آید و دست‌نخورده می‌ماند.
   ══════════════════════════════════════════════════════════════ */

/* ─── فونت محلی وزیرمتن (بدون درخواست به دامنهٔ خارجی) ─── */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/vazirmatn-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/vazirmatn-600.woff2') format('woff2');
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/vazirmatn-800.woff2') format('woff2');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #FBF9F6;
  --bg-alt: #F3EFE9;
  --card: #FFFFFF;
  --text: #14161A;
  --text-muted: #6E737C;
  --text-soft: #9BA0A7;
  --border: #E8E2D9;
  --border-strong: #D8CFC2;
  --accent-soft: #F4ECDE;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, .05);
  --shadow: 0 8px 24px -16px rgba(20, 22, 26, .28);
  --shadow-md: 0 12px 32px -18px rgba(20, 22, 26, .32);
}

html, body { background: var(--bg); color: var(--text); }
body { font-weight: 400; }

/* ─── هدر ─── */
.app-header { background: rgba(251, 249, 246, .92); }
.app-brand-name { font-weight: 800; letter-spacing: -.2px; }
.hdr-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.hdr-icon-btn { position: relative; }

/* ─── تب‌بار: اندیکاتور طلایی روی تب فعال ─── */
.tab-item { gap: 4px; }
.tab-item.active { color: var(--primary); }
.tab-item.active .tab-icon { fill: none; fill-opacity: 0; }
.tab-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  right: 24%;
  left: 24%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
}
.tab-label { font-size: 10.5px; font-weight: 600; }
.tab-item.active .tab-label { font-weight: 800; }

/* ─── کمپین (اسلایدر افقی) ─── */
.campaign { margin-bottom: 14px; }
.campaign-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}
.campaign-track::-webkit-scrollbar { display: none; }
.campaign-slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--primary);
  color: #fff;
  display: block;
}
.campaign-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .92;
}
.campaign-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 17, 28, .86) 0%, rgba(11, 17, 28, .25) 48%, rgba(11, 17, 28, 0) 78%);
}
.campaign-copy {
  position: absolute;
  inset: auto 18px 16px 18px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.campaign-eyebrow {
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(176, 138, 79, .9);
  color: #14161A;
}
.campaign-title { font-size: 19px; font-weight: 800; line-height: 1.35; }
.campaign-cta { font-size: 12.5px; font-weight: 600; color: #E9DBC2; }
.campaign-dots { display: flex; justify-content: center; gap: 5px; margin-top: 9px; }
.campaign-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.campaign-dots i:first-child { background: var(--accent); width: 16px; border-radius: 3px; }

/* ─── سلام + شعار ─── */
.home-greeting {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 14px;
}
.home-hi { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.home-tagline {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -.3px;
  margin-top: 2px;
  color: var(--text);
}
.home-cart-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: #6E5327;
  white-space: nowrap;
}

/* ─── نوار اعتماد ─── */
.trust-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.5;
}
.trust-item svg { width: 20px; height: 20px; color: var(--accent); }

/* ─── دسته‌بندی‌های تصویری ۳:۴ ─── */
.cat-tiles {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.cat-tiles::-webkit-scrollbar { display: none; }
.cat-tile {
  position: relative;
  flex: 0 0 44%;
  max-width: 220px;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  scroll-snap-align: start;
  display: block;
  border: 1px solid var(--border);
}
.cat-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cat-tile-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 17, 28, .82) 0%, rgba(11, 17, 28, .12) 52%, transparent 76%);
}
.cat-tile-body {
  position: absolute;
  inset: auto 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: #fff;
}
.cat-tile-name { font-size: 14px; font-weight: 800; }
.cat-tile-count { font-size: 11px; opacity: .82; }

/* ─── کارت محصول ─── */
.pcard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.pcard {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.pcard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.pcard-media { position: relative; background: var(--bg-alt); }
.pcard-img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}
.pcard-img-missing { background: linear-gradient(135deg, #EFE9E0, #E1D8CB); }
.pcard-pack {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  background: rgba(255, 255, 255, .92);
  color: var(--primary);
  backdrop-filter: blur(4px);
}
.pcard-body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 6px; }
.pcard-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}
.pcard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.pcard-code {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: .3px;
}
.pcard-swatches { display: flex; align-items: center; gap: 3px; }

/* ─── سواچ رنگ ─── */
.swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(20, 22, 26, .16);
  padding: 0;
  cursor: pointer;
  background: var(--bg-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  transition: transform .15s ease, box-shadow .15s ease;
}
.swatch-xs { width: 12px; height: 12px; border-width: 1px; cursor: default; }
.swatch-letter { background: #EFE9E0; color: #5C6169; }
.swatch:hover { transform: scale(1.08); }
.swatch.is-active {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent);
}

/* ─── داستان برند ─── */
.brand-story {
  margin: 22px 0 8px;
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, #101B30 0%, #1E3358 100%);
  color: #fff;
}
.brand-story-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  color: #C9A96B;
}
.brand-story h2 { font-size: 18px; font-weight: 800; margin: 6px 0 8px; line-height: 1.4; }
.brand-story p { font-size: 13px; line-height: 1.85; color: rgba(255, 255, 255, .82); }
.brand-story-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.brand-story .btn-ghost {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
}

.quick-row { padding-top: 18px; }

/* ─── لیست کالا (PLP) ─── */
.result-count { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.plp-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.plp-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 14px;
  min-height: 44px;
}
.plp-search svg { width: 18px; height: 18px; color: var(--text-soft); flex-shrink: 0; }
.plp-search input {
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  width: 100%;
}
.plp-search input:focus { outline: none; box-shadow: none; }
.plp-filter-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.plp-filter-btn svg { width: 20px; height: 20px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: #6E5327;
  border: 1px solid rgba(176, 138, 79, .3);
}
.active-chip svg { width: 12px; height: 12px; }

/* ─── شیت پایین (بدون جاوااسکریپت) ─── */
.sheet { position: fixed; inset: 0; z-index: 300; display: none; }
.sheet:target { display: block; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 26, .45);
  backdrop-filter: blur(2px);
}
.sheet-panel {
  position: absolute;
  inset: auto 0 0 0;
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 86vh;
  overflow-y: auto;
  max-width: 640px;
  margin: 0 auto;
  animation: sheetIn .28s cubic-bezier(.22, .61, .36, 1);
  box-shadow: 0 -12px 40px -20px rgba(20, 22, 26, .5);
}
.sheet-handle {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 0 auto 12px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 14px;
}
.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
}
.sheet-group { margin-bottom: 16px; }
.sheet-label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.choice input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.sheet-actions { display: flex; gap: 8px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }
.sheet-note { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.7; }
.size-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 14px;
}
.size-table th, .size-table td {
  padding: 9px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.size-table th { background: var(--bg-alt); font-weight: 700; font-size: 12px; color: var(--text-muted); }

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ─── صفحهٔ محصول (PDP) ─── */
.pdp-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pdp-crumb { font-size: 12.5px; font-weight: 600; color: var(--text-muted); flex: 1; }
.pdp-counter { font-size: 11.5px; font-weight: 700; color: var(--text-soft); }

.pdp-gallery {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-alt);
  margin-bottom: 14px;
}
.pdp-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.pdp-track::-webkit-scrollbar { display: none; }
.pdp-shot {
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}
.pdp-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pdp-shot { position: relative; }
.pdp-pos-top { object-position: 50% 12%; transform: scale(1.25); }
.pdp-pos-mid { object-position: 50% 50%; }
.pdp-pos-bottom { object-position: 50% 82%; transform: scale(1.25); }
.pdp-gallery-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(255, 255, 255, .94);
  color: var(--primary);
}

.pdp-head { margin-bottom: 14px; }
.pdp-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -.3px;
}
.pdp-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}
.pdp-code { letter-spacing: .5px; font-weight: 600; }
.pdp-dot { color: var(--border-strong); }

.pdp-block { margin-bottom: 16px; }
.pdp-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.pdp-label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.pdp-value { font-size: 12.5px; font-weight: 700; color: var(--text); }
.pdp-guide-link { font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: underline; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch-row .swatch { width: 26px; height: 26px; }
.size-row { display: flex; gap: 8px; flex-wrap: wrap; }
.size-chip {
  min-width: 46px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.size-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pdp-facts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  margin-bottom: 14px;
}
.pdp-fact { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.pdp-fact svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.pdp-desc { font-size: 13px; line-height: 1.9; color: var(--text-muted); margin-bottom: 18px; }

/* ─── نوار خرید چسبان ─── */
.pdp-cta {
  position: fixed;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 85;
}
.pdp-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 3px;
  background: var(--card);
}
.pdp-stepper button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
}
.pdp-stepper button:hover { background: var(--bg-alt); }
.pdp-stepper span {
  min-width: 54px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.pdp-add { flex: 1; min-height: 46px; }
.pdp-cta-note {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3px 16px 6px;
  text-align: center;
  font-size: 10px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, .97);
  z-index: 84;
  display: none;
}
body.has-pdp-cta .app-main { padding-bottom: calc(var(--tab-h) + 150px); }

/* ─── رسپانسیو ─── */
@media (min-width: 768px) {
  /* روی دسکتاپ عکس محصول تمام صفحه را نگیرد */
  .pdp-shot { max-height: 70vh; }
  .pcard-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .cat-tile { flex: 0 0 30%; }
  .campaign-title { font-size: 22px; }
  .home-tagline { font-size: 24px; }
  .pdp-gallery { border-radius: var(--radius-lg); }
  .trust-item { font-size: 11.5px; }
}

@media (max-width: 600px) {
  .app-main { padding: 14px; padding-bottom: calc(var(--tab-h) + var(--bottom-bar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
  body.has-pdp-cta .app-main { padding-bottom: calc(var(--tab-h) + 160px); }
  .campaign-slide { aspect-ratio: 4 / 3; }
  .trust-strip { grid-template-columns: repeat(2, 1fr); gap: 10px 6px; padding: 14px 10px; }
  .trust-item { flex-direction: row; text-align: right; gap: 7px; font-size: 11px; }
  .campaign-title { font-size: 17px; }
}

/* ─── حرکت کمتر برای کاربرانی که ترجیح می‌دهند ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
