/* ============================================================
   کافه لرد — استایل اصلی
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  background: var(--color-bg);
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  font-size: var(--font-size-base);
  line-height: 1.7;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(78px + var(--safe-bottom));
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
input, textarea, select { font-family: inherit; }

h1, h2, h3, h4 {
  color: var(--color-title);
  margin: 0;
  font-weight: var(--font-weight-bold);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- اسکرول‌بار ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-pill); }

/* ============================================================
   اسپلش اسکرین
   ============================================================ */
#splash {
  position: fixed;
  inset: 0;
  z-index: var(--z-splash);
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  transition: opacity var(--duration-slow) var(--ease), visibility var(--duration-slow) var(--ease);
}

#splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#splash .splash-logo {
  width: 92px;
  height: 92px;
  border-radius: var(--radius-lg);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splash-pop 700ms var(--ease) both;
}

#splash .splash-logo svg {
  width: 52px;
  height: 52px;
  color: var(--color-primary);
}

#splash .splash-title {
  color: #fff;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  animation: splash-fade 700ms var(--ease) 150ms both;
}

#splash .splash-tagline {
  color: rgba(255,255,255,0.85);
  font-size: var(--font-size-sm);
  animation: splash-fade 700ms var(--ease) 250ms both;
}

#splash .splash-dots {
  display: flex;
  gap: 6px;
  margin-top: var(--space-sm);
}

#splash .splash-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  animation: splash-bounce 1000ms ease-in-out infinite;
}
#splash .splash-dots span:nth-child(2) { animation-delay: 120ms; }
#splash .splash-dots span:nth-child(3) { animation-delay: 240ms; }

@keyframes splash-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes splash-fade {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes splash-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   هدر
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding-top: var(--safe-top);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo svg { width: 22px; height: 22px; color: #fff; }

.brand-text h1 {
  font-size: var(--font-size-md);
  line-height: 1.2;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- جستجو ---------- */
.search-wrap {
  padding: 0 var(--space-md) var(--space-md);
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  right: var(--space-md);
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 46px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-md) 0 40px;
  padding-right: 44px;
  font-size: var(--font-size-base);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.search-clear {
  position: absolute;
  left: var(--space-sm);
  width: 28px;
  height: 28px;
  border: none;
  background: var(--color-border);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
}
.search-clear svg { width: 14px; height: 14px; }
.search-clear.is-visible { display: flex; }

/* ---------- فیلتر دسته‌ها ---------- */
.category-scroll {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: 0 var(--space-md) var(--space-md);
  scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip svg { width: 16px; height: 16px; flex-shrink: 0; }
.chip:active { transform: scale(0.95); }
.chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ============================================================
   محتوای اصلی
   ============================================================ */
.main {
  padding: var(--space-md);
  max-width: 720px;
  margin: 0 auto;
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  margin: var(--space-lg) 0 var(--space-md);
  scroll-margin-top: 150px;
}
.section-title:first-child { margin-top: 0; }
.section-title .count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-normal);
  background: var(--color-surface-alt);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

@media (min-width: 480px) {
  .item-grid { gap: var(--space-md); }
}

.item-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  animation: card-in var(--duration-slow) var(--ease) both;
  transition: transform var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.item-card:active { transform: scale(0.97); }

@media (hover: hover) {
  .item-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-light);
  }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.item-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--color-surface-alt);
  overflow: hidden;
}
.item-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item-card-media .media-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-border);
}
.item-card-media .media-fallback svg { width: 34%; height: 34%; }

.badge-discount {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.badge-unavailable {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
}

.item-card-body {
  padding: var(--space-sm) var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.item-card-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-title);
}
.item-card-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.6em;
}
.item-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}
.item-price {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.item-price .unit {
  font-size: 10px;
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
}
.item-price .old-price {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-decoration: line-through;
  margin-inline-start: 4px;
}
.item-card-arrow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}
.item-card-arrow svg { width: 14px; height: 14px; }

/* ---------- خالی/بدون نتیجه ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  color: var(--color-text-muted);
}
.empty-state svg { width: 56px; height: 56px; color: var(--color-border); }
.empty-state.is-hidden { display: none; }

/* ============================================================
   باتم‌شیت
   ============================================================ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: var(--z-sheet);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease), visibility var(--duration-base) var(--ease);
}
.sheet-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: calc(var(--z-sheet) + 1);
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease);
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-lg);
}
.bottom-sheet.is-open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-close {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.sheet-close svg { width: 16px; height: 16px; }

.sheet-media {
  width: 100%;
  aspect-ratio: 16 / 11;
  background: var(--color-surface-alt);
  position: relative;
  flex-shrink: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.sheet-media img { width: 100%; height: 100%; object-fit: cover; }
.sheet-media .media-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-border);
}
.sheet-media .media-fallback svg { width: 25%; height: 25%; }

.sheet-body {
  padding: var(--space-lg) var(--space-lg) calc(var(--space-xl) + var(--space-md));
  overflow-y: auto;
}

.sheet-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-xs);
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
}
.sheet-category svg { width: 13px; height: 13px; }

.sheet-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-xs);
}

.sheet-desc {
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
  line-height: 1.9;
  margin: var(--space-sm) 0 var(--space-lg);
}

.sheet-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  border-top: 1px dashed var(--color-border);
}
.sheet-price-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.sheet-price-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.sheet-price-value .unit {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
}
.sheet-price-value .old-price {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  text-decoration: line-through;
  margin-inline-start: 6px;
}

.sheet-unavailable-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}
.sheet-unavailable-note svg { width: 18px; height: 18px; flex-shrink: 0; }

.sheet-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-lg);
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
.sheet-share svg { width: 18px; height: 18px; }
.sheet-share:active { background: var(--color-surface-alt); }

body.sheet-locked {
  overflow: hidden;
  height: 100vh;
}

/* ============================================================
   اسکلتون لودینگ
   ============================================================ */
.skeleton-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.skeleton-media {
  aspect-ratio: 1/1;
  background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border) 50%, var(--color-surface-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.4s ease-in-out infinite;
}
.skeleton-lines { padding: var(--space-sm); display: flex; flex-direction: column; gap: 8px; }
.skeleton-line {
  height: 10px;
  border-radius: 5px;
  background: var(--color-surface-alt);
}
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   فوتر / نوار پایین (اسکرول به بالا)
   ============================================================ */
.scroll-top-btn {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--duration-base) var(--ease);
  z-index: 30;
}
.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top-btn svg { width: 20px; height: 20px; }

.site-footer {
  text-align: center;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-title);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.toast svg { width: 16px; height: 16px; color: #6fd48a; }
.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
