/* BAGHARAMESH storefront design system — RTL, mobile-first */
:root {
  --bg-primary: #c45c26;
  --bg-primary-dark: #9a4519;
  --bg-secondary: #1c1917;
  --bg-accent: #e8b86d;
  --bg-bg: #f7f3ee;
  --bg-surface: #ffffff;
  --bg-muted: #efe8df;
  --bg-text: #1c1917;
  --bg-text-muted: #78716c;
  --bg-border: #e7e0d6;
  --bg-danger: #b91c1c;
  --bg-success: #047857;
  --bg-warning: #b45309;
  --bg-radius: 14px;
  --bg-radius-sm: 10px;
  --bg-shadow: 0 8px 24px rgba(28, 25, 23, 0.08);
  --bg-font: "Vazirmatn", "Vazir", Tahoma, sans-serif;
  --bg-header-h: 56px;
  --bg-bottom-h: 64px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-bg);
  color: var(--bg-text);
  font-family: var(--bg-font);
  font-size: 16px;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
}

.shop-root {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bg-bottom-h) + env(safe-area-inset-bottom, 0px));
  background: var(--bg-bg);
}

.shop-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--bg-header-h);
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top, 0px));
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
}

.shop-logo {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--bg-text);
  text-decoration: none;
  white-space: nowrap;
}
.shop-logo img { height: 36px; width: auto; display: block; }

.shop-search {
  flex: 1;
  min-width: 0;
}
.shop-search input,
.shop-input, .shop-select, .shop-textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--bg-border);
  border-radius: var(--bg-radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-bg);
  color: var(--bg-text);
}
.shop-textarea { min-height: 88px; resize: vertical; }

.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.shop-icon-btn {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  border-radius: 12px;
  color: var(--bg-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}
.shop-icon-btn:focus-visible { outline: 2px solid var(--bg-primary); outline-offset: 2px; }
.shop-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bg-primary);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.shop-main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px;
}

.shop-footer {
  margin-top: auto;
  padding: 24px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-secondary);
  color: #f5f5f4;
  font-size: 0.9rem;
}
.shop-footer a { color: var(--bg-accent); }
.shop-footer-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
.shop-footer h2, .shop-footer h3 { font-size: 1rem; margin: 0 0 8px; }

.shop-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.shop-bottom-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: var(--bg-bottom-h);
}
.shop-bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  text-decoration: none;
  color: var(--bg-text-muted);
  font-size: 0.7rem;
  background: none;
  border: none;
  font-family: inherit;
}
.shop-bottom-item.active { color: var(--bg-primary); font-weight: 700; }

.shop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--bg-radius-sm);
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.shop-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.shop-btn-primary { background: var(--bg-primary); color: #fff; }
.shop-btn-secondary { background: var(--bg-muted); color: var(--bg-text); }
.shop-btn-ghost { background: transparent; border: 1px solid var(--bg-border); color: var(--bg-text); }
.shop-btn-block { width: 100%; }

.shop-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--bg-radius);
  box-shadow: var(--bg-shadow);
  overflow: hidden;
}
.shop-product-card { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.shop-product-card img, .shop-product-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-muted);
  display: block;
}
.shop-product-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.shop-product-name { font-size: 0.95rem; font-weight: 700; margin: 0; }
.shop-price { font-weight: 800; direction: ltr; unicode-bidi: isolate; }
.shop-price-old { color: var(--bg-text-muted); text-decoration: line-through; font-weight: 500; margin-inline-start: 6px; }
.shop-discount { display: inline-block; background: #fef2f2; color: var(--bg-danger); font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; }
.shop-chip { font-size: 0.75rem; color: var(--bg-text-muted); }

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

.shop-hero {
  background: linear-gradient(135deg, #2b211c 0%, #c45c26 100%);
  color: #fff;
  border-radius: var(--bg-radius);
  padding: 28px 18px;
  margin-bottom: 16px;
}
.shop-hero h1 { margin: 0 0 8px; font-size: 1.45rem; }
.shop-section { margin-bottom: 20px; }
.shop-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  gap: 8px;
}
.shop-section-head h2 { margin: 0; font-size: 1.1rem; }

.shop-empty, .shop-error, .shop-loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--bg-text-muted);
}
.shop-alert {
  padding: 12px 14px;
  border-radius: var(--bg-radius-sm);
  margin-bottom: 12px;
}
.shop-alert-ok { background: #ecfdf5; color: #065f46; }
.shop-alert-err { background: #fef2f2; color: #991b1b; }
.shop-alert-warn { background: #fffbeb; color: #92400e; }

.shop-skeleton {
  background: linear-gradient(90deg, #efe8df 25%, #f7f3ee 50%, #efe8df 75%);
  background-size: 200% 100%;
  animation: shop-shimmer 1.2s infinite;
  border-radius: 8px;
  min-height: 16px;
}
@keyframes shop-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.shop-crumb { font-size: 0.85rem; color: var(--bg-text-muted); margin-bottom: 12px; }
.shop-crumb a { color: inherit; }

.shop-gallery img { width: 100%; border-radius: var(--bg-radius); aspect-ratio: 1; object-fit: cover; }
.shop-thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; }
.shop-thumbs button { border: 2px solid transparent; padding: 0; background: none; border-radius: 8px; min-width: 56px; }
.shop-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }
.shop-thumbs .is-on { border-color: var(--bg-primary); }

.shop-sticky-buy {
  position: sticky;
  bottom: calc(var(--bg-bottom-h) + env(safe-area-inset-bottom, 0px));
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.shop-cart-line {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-border);
}
.shop-cart-line img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--bg-muted); }
.shop-summary { background: var(--bg-surface); border-radius: var(--bg-radius); padding: 16px; border: 1px solid var(--bg-border); }
.shop-summary-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.shop-steps { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; }
.shop-step {
  flex: 1;
  min-width: 72px;
  text-align: center;
  font-size: 0.75rem;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--bg-muted);
  color: var(--bg-text-muted);
}
.shop-step.is-on { background: var(--bg-primary); color: #fff; }

.shop-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: flex-end;
}
.shop-sheet-panel {
  width: 100%;
  max-height: 80vh;
  overflow: auto;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.shop-filters { display: none; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

@media (min-width: 768px) {
  .shop-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .shop-footer-grid { grid-template-columns: repeat(3, 1fr); }
  .shop-pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .shop-bottom-nav { display: none; }
  .shop-root { padding-bottom: 0; }
  .shop-sticky-buy { bottom: 0; }
  .shop-listing { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
  .shop-filters { display: block; }
  .shop-filter-mobile { display: none !important; }
}

@media (min-width: 1024px) {
  .shop-grid { grid-template-columns: repeat(4, 1fr); }
  .shop-main { padding: 20px; }
}

@media (min-width: 1280px) {
  .shop-main { max-width: 1280px; }
}
