/* ============================================================
   ZILA SPORT — Main Stylesheet
   Dark Navy / Crimson Red — Persian RTL — Mobile First
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap");

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --navy: #0b1120;
  --navy-2: #111827;
  --navy-3: #1c2840;
  --navy-4: #243352;
  --red: #e8142a;
  --red-hover: #c8102a;
  --red-glow: rgba(232, 20, 42, 0.25);
  --gold: #ffb800;
  --silver: #c8d4e8;
  --silver-dim: #7a8ba8;
  --white: #f5f7fa;
  --border: rgba(200, 212, 232, 0.1);
  --border-2: rgba(200, 212, 232, 0.18);

  --font: "Vazirmatn", "Tahoma", sans-serif;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-red: 0 8px 32px rgba(232, 20, 42, 0.3);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--silver);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}
button,
input,
select,
textarea {
  font-family: var(--font);
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--navy-2);
}
::-webkit-scrollbar-thumb {
  background: var(--navy-4);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

/* ── Typography ───────────────────────────────────────────── */
h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
}
h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
}
h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 600;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .container {
    padding: 0 24px;
  }
}
@media (min-width: 1024px) {
  .container {
    padding: 0 40px;
  }
}

.section {
  padding: 48px 0;
}
@media (min-width: 768px) {
  .section {
    padding: 72px 0;
  }
}

/* ── Navigation ───────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition:
    background var(--transition),
    box-shadow var(--transition);
}

.navbar.scrolled {
  background: rgba(11, 17, 32, 0.98);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-logo img {
  height: 38px;
  width: auto;
}

.navbar-logo-text {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: -0.5px;
}

.navbar-logo-text span {
  color: var(--red);
}

.navbar-nav {
  display: none;
  list-style: none;
  gap: 24px;
  align-items: center;
}

@media (min-width: 768px) {
  .navbar-nav {
    display: flex;
  }
}

.navbar-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--silver-dim);
  transition: color var(--transition);
  position: relative;
  padding-bottom: 4px;
}

.navbar-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--red);
  transition: width var(--transition);
  transform: skewX(-15deg);
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--white);
}

.navbar-nav a:hover::after,
.navbar-nav a.active::after {
  width: 100%;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--navy-3);
  border: 1px solid var(--border-2);
  color: var(--silver);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Logout is redundant on mobile — the hamburger menu carries «خروج از حساب» —
   and dropping it keeps .navbar-actions from squeezing the cart label. */
@media (max-width: 767px) {
  .navbar-actions .logout-btn {
    display: none;
  }
}

.cart-btn:hover {
  border-color: var(--red);
  color: var(--white);
  box-shadow: 0 0 0 1px var(--red);
}

.cart-btn.bump {
  animation: cartBump 0.4s ease;
}

@keyframes cartBump {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.15);
  }
  60% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.cart-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transition: transform var(--transition);
}

/* ── Hamburger ────────────────────────────────────────────── */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}

@media (min-width: 768px) {
  .hamburger {
    display: none;
  }
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--silver);
  border-radius: 2px;
  transition: all var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile menu ──────────────────────────────────────────── */
.mobile-menu {
  display: none;
  background: var(--navy-2);
  border-bottom: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition:
    max-height 0.4s ease,
    padding 0.3s ease;
}

.mobile-menu.open {
  display: block;
  max-height: 400px;
  padding: 12px 0;
}

.mobile-menu a {
  display: block;
  padding: 12px 20px;
  color: var(--silver-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition:
    color var(--transition),
    background var(--transition);
}

.mobile-menu a:hover {
  color: var(--white);
  background: var(--navy-3);
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: clamp(420px, 70vh, 680px);
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--navy-2);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 60% 80% at 70% 50%,
      rgba(232, 20, 42, 0.12) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 40% 60% at 20% 80%,
      rgba(255, 184, 0, 0.05) 0%,
      transparent 60%
    ),
    linear-gradient(135deg, #0b1120 0%, #111827 50%, #0f1a2e 100%);
}

.hero-slash {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 45%;
  background: linear-gradient(
    145deg,
    transparent 0%,
    rgba(232, 20, 42, 0.06) 100%
  );
  clip-path: polygon(15% 0%, 100% 0%, 100% 100%, 0% 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 60px 0;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(232, 20, 42, 0.15);
  border: 1px solid rgba(232, 20, 42, 0.3);
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
  animation: fadeInDown 0.6s ease both;
}

.hero-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.4);
  }
}

.hero h1 {
  color: var(--white);
  margin-bottom: 16px;
  animation: fadeInDown 0.7s 0.1s ease both;
}

.hero h1 .accent {
  color: var(--red);
  position: relative;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--silver-dim);
  max-width: 500px;
  margin-bottom: 32px;
  animation: fadeInDown 0.7s 0.2s ease both;
}

/* ── Hero Search ──────────────────────────────────────────── */
.hero-search {
  animation: fadeInDown 0.7s 0.3s ease both;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--navy-3);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  overflow: hidden;
  max-width: 520px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.search-box:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 18px;
  color: var(--white);
  font-size: 0.95rem;
  direction: rtl;
}

.search-box input::placeholder {
  color: var(--silver-dim);
}

.search-box button {
  background: var(--red);
  border: none;
  padding: 14px 20px;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background var(--transition);
  flex-shrink: 0;
}

.search-box button:hover {
  background: var(--red-hover);
}

/* ── Category Pills ───────────────────────────────────────── */
.category-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-row::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--navy-3);
  border: 1px solid var(--border-2);
  color: var(--silver-dim);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.cat-pill:hover,
.cat-pill.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(232, 20, 42, 0.3);
}

/* ── Section Headers ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::before {
  content: "";
  display: block;
  width: 4px;
  height: 28px;
  background: linear-gradient(180deg, var(--red), var(--gold));
  border-radius: 2px;
  transform: skewY(-8deg);
}

/* ── Product Cards ────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}
@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
  }
}

.product-card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  opacity: 0;
  transform: translateY(24px);
}

.product-card.visible {
  opacity: 1;
  transform: translateY(0);
}

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

.product-card:hover .product-img img {
  transform: scale(1.06);
}

.product-img {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--navy-3);
  position: relative;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  z-index: 1;
}

.product-badge.out-of-stock {
  background: var(--silver-dim);
}

.product-body {
  padding: 14px;
}

.product-category {
  font-size: 0.72rem;
  color: var(--red);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.product-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Colour swatches — a compact RTL row of the product's available colours,
   sitting between the name and the footer. The partial only emits it when
   there is at least one colour, so a card without colours is unchanged. */
.pc-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
  margin-bottom: 10px;
  overflow: hidden;
}

/* Names what the dots are, so they don't read as decoration. Shrinks first
   when the row is tight, but never below its own text. */
.pc-swatches-label {
  flex: 0 1 auto;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--silver-dim);
  white-space: nowrap;
  margin-inline-end: 1px;
}

/* --sw carries the option's hex; the ring keeps a black or white swatch
   readable against the dark card. Matches the .vchip-dot on product.php. */
.pc-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--sw, var(--navy-3));
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}

/* The colour exists but has no stock — dimmed and slashed, never hidden. */
.pc-swatch.is-out {
  position: relative;
  opacity: 0.4;
}

.pc-swatch.is-out:not(.pc-swatch-plain)::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: linear-gradient(
    45deg,
    transparent 44%,
    var(--silver-dim) 44%,
    var(--silver-dim) 56%,
    transparent 56%
  );
}

/* Fallback for an option with no hex: its Persian name as a tiny text chip. */
.pc-swatch-plain {
  display: inline-flex;
  align-items: center;
  width: auto;
  height: auto;
  max-width: 76px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--navy-3);
  border: 1px solid var(--border);
  box-shadow: none;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--silver-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* On a phone the grid is two columns and the row drops to ~135px, where the
   label plus four dots plus «+N» no longer fits at full size — and the row
   clips, hiding the «+N» that says there are more colours. Shrink the dots
   rather than drop them. */
@media (max-width: 480px) {
  .pc-swatches {
    gap: 4px;
  }

  .pc-swatch {
    width: 12px;
    height: 12px;
  }

  .pc-swatches-label {
    font-size: 0.6rem;
  }
}

/* «+N» for the colours that did not fit the row. */
.pc-swatch-more {
  flex-shrink: 0;
  padding-inline-start: 2px;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--silver-dim);
  white-space: nowrap;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.product-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  direction: ltr;
}

.product-price .unit {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--silver-dim);
  margin-right: 3px;
}

.btn-add-cart {
  background: var(--red);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-add-cart:hover {
  background: var(--red-hover);
  box-shadow: var(--shadow-red);
}

.btn-add-cart:disabled {
  background: var(--silver-dim);
  cursor: not-allowed;
}

/* ── Carousel arrow + brand tile ──────────────────────────────
   `.carousel-btn` is the arrow shared by every `.scroll-row` (categories,
   فروش ویژه, newest, brands).                                            */
.carousel-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--navy-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--silver);
  cursor: pointer;
  transition: all var(--transition);
}

.carousel-btn:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.carousel-btn svg {
  width: 20px;
  height: 20px;
}

/* Brand logo tiles — display-only, not interactive. Width comes from the
   .sr-item track slot (the brands row is the shared .scroll-row component);
   the 2:1 ratio then fixes the height, so the tile matches the SVG's own
   160×80 viewBox at every breakpoint and its plate fills the tile. */
.brand-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: var(--navy-3);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  overflow: hidden;
}

.brand-item svg {
  width: 100%;
  height: 100%;
  border-radius: var(--r-md);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--red-hover);
  box-shadow: var(--shadow-red);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--silver);
  border: 1.5px solid var(--border-2);
}

.btn-outline:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-ghost {
  background: var(--navy-3);
  color: var(--silver);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--navy-4);
  color: var(--white);
}

.btn-lg {
  padding: 15px 32px;
  font-size: 1rem;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
}
.btn-full {
  width: 100%;
}

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--silver);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--navy-3);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--white);
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 0.9rem;
  direction: rtl;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.form-control::placeholder {
  color: var(--silver-dim);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237A8BA8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* ── Filters Sidebar ──────────────────────────────────────── */
.filter-group {
  margin-bottom: 20px;
}
.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--silver-dim);
  /* display: block; */
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--silver-dim);
  transition: color var(--transition);
}

.filter-check:hover {
  color: var(--white);
}

.filter-check input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: var(--navy-3);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.filter-check input[type="checkbox"]:checked {
  background: var(--red);
  border-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='white' d='M1 5l3.5 3.5L11 1'/%3E%3C/svg%3E");
  background-size: 10px;
  background-repeat: no-repeat;
  background-position: center;
}

/* ── Cart ─────────────────────────────────────────────────── */
.cart-product-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--navy-3);
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--navy-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.qty-control button {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--silver);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-control button:hover {
  background: var(--red);
  color: #fff;
}

.qty-control span {
  min-width: 36px;
  text-align: center;
  font-weight: 600;
  color: var(--white);
  font-size: 0.9rem;
}

/* ── Order Summary ────────────────────────────────────────── */
.order-summary {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
  position: sticky;
  top: 80px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 0.9rem;
  color: var(--silver-dim);
  border-bottom: 1px solid var(--border);
}

.summary-row:last-of-type {
  border-bottom: none;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
}

.summary-total .price {
  color: var(--red);
  font-size: 1.2rem;
}

/* ── Alert / Flash ────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease;
}

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

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}
.alert-error {
  background: rgba(232, 20, 42, 0.12);
  border: 1px solid rgba(232, 20, 42, 0.3);
  color: #fca5a5;
}
/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--silver-dim);
  flex-wrap: wrap;
  padding: 16px 0;
}

.breadcrumb a:hover {
  color: var(--red);
}
.breadcrumb .sep {
  color: var(--border-2);
}
.breadcrumb .current {
  color: var(--silver);
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 32px 0;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--silver-dim);
  font-size: 0.875rem;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  padding: 0 10px;
}

.page-btn:hover,
.page-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ── Product Detail ───────────────────────────────────────── */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 768px) {
  .product-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.product-detail-img {
  aspect-ratio: 1/1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--navy-2);
  border: 1px solid var(--border);
}

.product-detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.product-detail-img:hover img {
  transform: scale(1.04);
}

.product-detail-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-price-large {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--white);
  direction: ltr;
  display: inline-block;
}

.product-price-large .unit {
  font-size: 1rem;
  font-weight: 400;
  color: var(--silver-dim);
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}

.stock-badge.in-stock {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.stock-badge.out-stock {
  background: rgba(232, 20, 42, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(232, 20, 42, 0.3);
}

/* ── Payment Result ───────────────────────────────────────── */
.result-card {
  max-width: 480px;
  margin: 60px auto;
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 48px 32px;
  text-align: center;
}

.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 24px;
  animation: resultPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes resultPop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result-icon.success {
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid rgba(16, 185, 129, 0.4);
}

.result-icon.fail {
  background: rgba(232, 20, 42, 0.15);
  border: 2px solid rgba(232, 20, 42, 0.4);
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  background: var(--navy-2);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-desc {
  font-size: 0.875rem;
  color: var(--silver-dim);
  line-height: 1.7;
}

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul a {
  font-size: 0.875rem;
  color: var(--silver-dim);
  transition: color var(--transition);
}

.footer-col ul a:hover {
  color: var(--red);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--silver-dim);
}

.footer-bottom img {
  max-height: 70px;
}

@media (max-width: 480px) {
  .footer-bottom img {
    max-height: 50px;
  }
}

/* ── Admin ────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .admin-layout {
    flex-direction: row;
  }
}

.admin-sidebar {
  width: 100%;
  background: var(--navy-2);
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

@media (min-width: 1024px) {
  .admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    border-bottom: none;
    border-left: 1px solid var(--border);
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

.admin-sidebar-logo {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--white);
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  display: none;
}

@media (min-width: 1024px) {
  .admin-sidebar-logo {
    display: block;
  }
}

.admin-sidebar-logo span {
  color: var(--red);
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--silver-dim);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  border-right: 3px solid transparent;
  white-space: nowrap;
}

.admin-nav a:hover {
  background: var(--navy-3);
  color: var(--white);
}
.admin-nav a.active {
  color: var(--red);
  border-right-color: var(--red);
  background: rgba(232, 20, 42, 0.08);
}

.admin-main {
  flex: 1;
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .admin-main {
    padding: 32px;
  }
}

.admin-page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-table-wrap {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: var(--navy-3);
  padding: 12px 16px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--silver-dim);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 13px 16px;
  font-size: 0.875rem;
  color: var(--silver);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table tr:hover td {
  background: rgba(200, 212, 232, 0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-danger {
  background: rgba(232, 20, 42, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(232, 20, 42, 0.3);
}
.badge-warn {
  background: rgba(255, 184, 0, 0.15);
  color: #fde68a;
  border: 1px solid rgba(255, 184, 0, 0.3);
}
.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.admin-card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

@media (min-width: 768px) {
  .admin-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--white);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--silver-dim);
  margin-top: 4px;
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

/* ── Responsive helpers ───────────────────────────────────── */
.overflow-scroll-x {
  overflow-x: auto;
}
.hidden-mobile {
  display: none;
}
@media (min-width: 768px) {
  .hidden-mobile {
    display: initial;
  }
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-up {
  animation: fadeInUp 0.5s ease both;
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Utility ──────────────────────────────────────────────── */
.mt-2 {
  margin-top: 16px;
}
.flex {
  display: flex;
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ============================================================
   v4 additions — sale pricing, horizontal rows, sale band
   Appended only; nothing above this line is modified.
   ============================================================ */

/* ── Price fragments emitted by renderPrice() ─────────────── */
/* Low specificity on .unit so the older .product-price .unit /
   .product-price-large .unit rules above still win where they apply. */
.unit {
  font-size: 0.7em;
  font-weight: 400;
  color: var(--silver-dim);
  margin-right: 3px;
}

.price-was {
  display: inline-block;
  margin-inline-end: 7px;
  font-size: 0.78em;
  font-weight: 500;
  color: var(--silver-dim);
  text-decoration: line-through;
  text-decoration-color: rgba(232, 20, 42, 0.75);
  text-decoration-thickness: 1.5px;
  white-space: nowrap;
  direction: ltr;
}

.price-now {
  display: inline-block;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  direction: ltr;
}

/* A struck-through original next to it means there is a live discount. */
.price-was + .price-now {
  color: var(--red);
}

/* Ranged prices (variant products) need to breathe a little smaller. */
.product-price.is-range {
  font-size: 0.82rem;
}

.product-price.is-range .price-now {
  white-space: normal;
}

/* Product-card meta row (category + serial) */
.product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-serial {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--silver-dim);
  letter-spacing: 0.04em;
  opacity: 0.75;
  white-space: nowrap;
}

/* ── Discount percentage badge ────────────────────────────── */
.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--red), var(--red-hover));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.4;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  box-shadow: 0 4px 14px rgba(232, 20, 42, 0.45);
}

/* ── Horizontal scroll rows ───────────────────────────────── */
.scroll-row {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.scroll-row-viewport {
  /* Mobile shows one card plus a sliver of the next — the peek is what tells a
     touch user the row scrolls, now that the arrows are desktop-only. */
  --sr-per-view: 1.15;
  --sr-gap: 12px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Room for the card hover lift + shadow without clipping. */
  padding: 6px 2px 12px;
  margin: -6px -2px -12px;
  /* Insets where an `end`-aligned card comes to rest, so the last one stops a
     gap short of the row's edge instead of flush against it. Only affects
     end alignment — the other cards snap by their start edge and are
     untouched. */
  scroll-padding-inline-end: var(--sr-gap);
}

.scroll-row-viewport::-webkit-scrollbar {
  display: none;
}

.scroll-row-track {
  display: flex;
  gap: var(--sr-gap);
  /* Must stay the viewport's width, NOT min-content: the items size themselves
     with a percentage flex-basis, and a min-content track makes that percentage
     resolve against the summed card widths instead — which blew one card up to
     ~600px on a 375px screen. The items simply overflow, and that overflow is
     what scrolls. */
  width: 100%;
}

.scroll-row-track > .sr-item {
  flex: 0 0
    calc((100% - (var(--sr-per-view) - 1) * var(--sr-gap)) / var(--sr-per-view));
  max-width: calc(
    (100% - (var(--sr-per-view) - 1) * var(--sr-gap)) / var(--sr-per-view)
  );
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* The LAST card snaps by its trailing edge, not its leading one.
   `scroll-snap-type: mandatory` only ever rests on a legal snap position, and
   with `start` alignment those are the cards' leading offsets — none of which
   equals the row's maximum scroll. So scrolling to the end rubber-banded back
   to the previous card and left the last one part-hidden, however far you
   dragged. Aligning the final card to `end` makes max-scroll a legal stop. */
.scroll-row-track > .sr-item:last-child {
  scroll-snap-align: end;
}

/* …and a little breathing room after it, so the card clears the row's edge
   instead of sitting flush against it. A flex spacer is used because trailing
   padding on a flex scroll container is not reliably included in scrollable
   overflow across engines. */
.scroll-row-track::after {
  content: "";
  flex: 0 0 var(--sr-gap);
}

.scroll-row-track > .sr-item > .product-card {
  flex: 1;
}

@media (min-width: 480px) {
  .scroll-row-viewport {
    --sr-per-view: 2.15;
  }
}

@media (min-width: 640px) {
  .scroll-row-viewport {
    --sr-per-view: 3;
    --sr-gap: 18px;
  }
}

@media (min-width: 1024px) {
  .scroll-row-viewport {
    --sr-per-view: 4;
    --sr-gap: 22px;
  }
}

/* Arrows are a desktop affordance; touch users just swipe. */
.scroll-row > .carousel-btn {
  align-self: center;
}

.scroll-row > .carousel-btn:disabled {
  opacity: 0.3;
  cursor: default;
  background: var(--navy-3);
  border-color: var(--border);
  color: var(--silver-dim);
}

.scroll-row.is-static > .carousel-btn {
  display: none;
}

@media (max-width: 800px) {
  .scroll-row > .carousel-btn {
    display: none;
  }
  .scroll-row {
    gap: 0;
  }
  /* Dots replace the arrows: position feedback for a row you swipe. */
  .sr-dots:not(:empty) {
    display: flex;
  }
}

/* ── Carousel position dots (mobile only, filled by index.php) ───
   Indicators, not controls — the row is swiped, so they carry no tap target
   and stay out of the accessibility tree. They are a *sibling* of `.scroll-row`,
   not a child: inside that flex container a 100%-basis item would eat the
   viewport's width instead of dropping below it.                         */
.sr-dots {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  pointer-events: none;
}

.scroll-row.is-static + .sr-dots {
  display: none;
}

.sr-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border-2);
  transition:
    width var(--transition),
    background var(--transition);
}

.sr-dot.is-on {
  width: 18px;
  background: var(--red);
}

/* ── "Show more" card that closes each row ────────────────── */
.scroll-more-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  height: 100%;
  padding: 20px 14px;
  background: var(--navy-2);
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-md);
  color: var(--silver);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.7;
  text-decoration: none;
  transition: all var(--transition);
}

.scroll-more-card:hover {
  border-color: var(--red);
  color: var(--white);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.scroll-more-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(232, 20, 42, 0.12);
  border: 1px solid rgba(232, 20, 42, 0.3);
  color: var(--red);
  transition: all var(--transition);
}

.scroll-more-card:hover .scroll-more-icon {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: var(--shadow-red);
}

.scroll-more-card--sale {
  background: rgba(11, 17, 32, 0.55);
  border-color: rgba(232, 20, 42, 0.4);
}

/* ── Home page categories row ────────────────────────────────
   ONE horizontally-scrolling row, flat: top-level categories and their
   sub-categories are equal tiles side by side, so every category is a single
   tap away and the list is never truncated. Reuses the .scroll-row component
   (snap, arrows, dots) that the فروش ویژه and newest-products rows use —
   .cat-row-viewport only re-tunes how many fit per view, because a category
   tile is far narrower than a product card.                              */
.cat-section .section-header {
  margin-bottom: 20px;
}

.cat-row-viewport {
  --sr-per-view: 2.35;
}

@media (min-width: 480px) {
  .cat-row-viewport {
    --sr-per-view: 3.4;
  }
}

@media (min-width: 640px) {
  .cat-row-viewport {
    --sr-per-view: 4.5;
  }
}

@media (min-width: 1024px) {
  .cat-row-viewport {
    --sr-per-view: 6.5;
  }
}

/* ── Home page brands row ────────────────────────────────────
   Same .scroll-row component again; a brand tile is wide and short (2:1), so
   it needs its own per-view ladder — fewer, wider slots than a product card,
   with a peek of the next tile on mobile. The numbers are picked so the tile
   lands near the artwork's native 160px width on a phone and on a laptop. */
.brands-row-viewport {
  --sr-per-view: 2.2;
}

@media (min-width: 480px) {
  .brands-row-viewport {
    --sr-per-view: 3.2;
  }
}

@media (min-width: 640px) {
  .brands-row-viewport {
    --sr-per-view: 4.2;
  }
}

@media (min-width: 1024px) {
  .brands-row-viewport {
    --sr-per-view: 6.5;
  }
}

.cat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  padding: 16px 10px;
  text-align: center;
  background: var(--navy-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.cat-tile:hover {
  background: var(--navy-4);
  border-color: rgba(232, 20, 42, 0.4);
  transform: translateY(-2px);
}

.cat-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(232, 20, 42, 0.1);
  color: var(--red);
  transition: background var(--transition);
}

.cat-tile:hover .cat-tile-icon {
  background: rgba(232, 20, 42, 0.2);
}

/* Quiet context line so a flattened sub-category still reads as belonging
   to its parent. Truncates rather than wrapping — it must never push the
   tile taller than its siblings. */
.cat-tile-parent {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.62rem;
  line-height: 1.2;
  color: var(--silver-dim);
  opacity: 0.8;
}

.cat-tile-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
}

.cat-tile-count {
  font-size: 0.68rem;
  color: var(--silver-dim);
}

@media (max-width: 640px) {
  .cat-tile {
    padding: 13px 8px;
    gap: 5px;
  }

  .cat-tile-icon {
    width: 36px;
    height: 36px;
  }

  .cat-tile-name {
    font-size: 0.78rem;
  }

  .cat-tile-count {
    font-size: 0.63rem;
  }
}
/* ── Sale band ───────────────────────────────────────────── */
.sale-band {
  position: relative;
  overflow: hidden;
  margin-top: 44px;
  padding: 34px 0 40px;
  background:
    linear-gradient(
      135deg,
      rgba(232, 20, 42, 0.26) 0%,
      rgba(232, 20, 42, 0.08) 42%,
      rgba(17, 24, 39, 0.9) 100%
    ),
    var(--navy-2);
  border-top: 1px solid rgba(232, 20, 42, 0.35);
  border-bottom: 1px solid rgba(232, 20, 42, 0.35);
}

/* Diagonal light streak echoing the hero slash. */
.sale-band-glow {
  position: absolute;
  top: -60%;
  left: -10%;
  width: 55%;
  height: 220%;
  background: linear-gradient(
    90deg,
    rgba(232, 20, 42, 0.22),
    rgba(232, 20, 42, 0)
  );
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 0;
}

.sale-band-header {
  margin-bottom: 24px;
}

.sale-band-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sale-band-title h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.01em;
}

.sale-band-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-red);
  flex-shrink: 0;
}

.sale-band-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
}

.sale-band .product-card {
  border-color: rgba(232, 20, 42, 0.3);
  background: rgba(11, 17, 32, 0.82);
}

.sale-band .product-card:hover {
  border-color: var(--red);
}

/* Per-product countdown under a sale card */
.sale-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: rgba(232, 20, 42, 0.14);
  border: 1px solid rgba(232, 20, 42, 0.3);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.sale-countdown svg {
  flex-shrink: 0;
  color: var(--red);
}

.sale-countdown .cd-clock {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.sale-countdown .cd-days:empty {
  display: none;
}

/* ── Phones: shorter home-page sections ──────────────────────
   A card that is now ~1.15 viewports wide would be enormous at a 1:1 image, so
   inside a scroll row the image gets a landscape crop and the body loses a few
   pixels of padding and type. Scoped to `.scroll-row-track` so the product grid
   on products.php keeps its square images.                                  */
@media (max-width: 640px) {
  .section {
    padding: 34px 0;
  }

  .section-header {
    margin-bottom: 18px;
  }

  .scroll-row-track .product-img {
    aspect-ratio: 3 / 2;
  }

  .scroll-row-track .product-body {
    padding: 10px 11px;
  }

  .scroll-row-track .product-category {
    font-size: 0.68rem;
    margin-bottom: 4px;
  }

  .scroll-row-track .product-name {
    font-size: 0.84rem;
    margin-bottom: 8px;
  }

  .scroll-row-track .product-price {
    font-size: 0.9rem;
  }

  /* Comfortable thumb target for the one real control on the card. */
  .scroll-row-track .btn-add-cart {
    min-height: 44px;
    padding: 6px 14px;
  }

  .scroll-more-card {
    min-height: 0;
    gap: 10px;
    padding: 16px 12px;
  }

  .scroll-more-icon {
    width: 40px;
    height: 40px;
  }

  .sale-band {
    margin-top: 28px;
    padding: 26px 0 28px;
  }

  .sale-band-header {
    margin-bottom: 16px;
  }

  .sale-band-title h2 {
    font-size: 1.15rem;
  }

  .sale-band-icon {
    width: 32px;
    height: 32px;
  }

  .sale-countdown {
    padding: 4px 7px;
    font-size: 0.68rem;
  }
}

/* ============================================================
   IMAGE LIGHTBOX  (assets/js/main.js — `img.zoomable`)
   ============================================================ */
img.zoomable {
  cursor: zoom-in;
}

.zila-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 16px 24px;
  background: rgba(4, 8, 18, 0.9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow: auto;
  overscroll-behavior: contain;
  direction: rtl;
}

/* The backdrop is deliberately NOT faded in. Anything that animates opacity
   from 0 leaves the overlay invisible-but-open whenever the browser freezes
   animations (backgrounded/hidden documents), and a scroll-locked invisible
   modal is far worse than an instant one. Only the image gets an entrance. */

@keyframes zila-lightbox-pop {
  from {
    transform: scale(0.96);
  }
  to {
    transform: scale(1);
  }
}

.zila-lightbox[hidden] {
  display: none;
}

.zila-lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}

.zila-lightbox-img {
  display: block;
  max-width: 94vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: var(--r-sm, 8px);
  background: var(--navy-3, #101a2e);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  cursor: default;
}

.zila-lightbox.is-open .zila-lightbox-img {
  animation: zila-lightbox-pop 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.zila-lightbox-caption {
  max-width: min(94vw, 620px);
  text-align: center;
  color: var(--silver-dim, #9aa7bd);
  font-size: 0.84rem;
  line-height: 1.7;
  word-break: break-word;
}

.zila-lightbox-caption[hidden] {
  display: none;
}

.zila-lightbox-close {
  position: fixed;
  top: 14px;
  inset-inline-end: 14px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.14));
  border-radius: 50%;
  background: var(--navy-3, #101a2e);
  color: var(--white, #fff);
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s;
}

.zila-lightbox-close:hover,
.zila-lightbox-close:focus-visible {
  background: var(--red, #e8142a);
  border-color: var(--red, #e8142a);
  transform: rotate(90deg);
}

.zila-lightbox-close:focus-visible {
  outline: 2px solid var(--white, #fff);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .zila-lightbox {
    padding: 60px 10px 18px;
  }

  .zila-lightbox-close {
    top: 10px;
    inset-inline-end: 10px;
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zila-lightbox.is-open,
  .zila-lightbox.is-open .zila-lightbox-img {
    animation: none;
  }

  .zila-lightbox-close {
    transition: none;
  }

  .zila-lightbox-close:hover,
  .zila-lightbox-close:focus-visible {
    transform: none;
  }
}

/* ============================================================
   ORDER-ITEM → PRODUCT LINKS  (admin/orders.php, order-tracking.php,
   account.php). A deleted product renders as plain text instead.
   ============================================================ */
.ord-item-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition:
    color 0.18s,
    border-color 0.18s;
}

.ord-item-link:hover,
.ord-item-link:focus-visible {
  color: var(--red, #e8142a);
  border-bottom-color: currentColor;
}

.ord-item-link .ord-item-link-icon {
  width: 12px;
  height: 12px;
  margin-inline-start: 4px;
  vertical-align: -1px;
  opacity: 0;
  transition: opacity 0.18s;
}

.ord-item-link:hover .ord-item-link-icon,
.ord-item-link:focus-visible .ord-item-link-icon {
  opacity: 1;
}

/* ============================================================
   COLLAPSIBLE ADMIN FORM SECTIONS — .adm-fold
   Behaviour lives in assets/js/main.js (the "adm-fold" module).
   Sections are collapsed by default *by JS*; the markup ships
   OPEN so that a page still works with JavaScript disabled.

   Copy-paste markup (do NOT add `hidden` yourself):

     <section class="adm-fold" data-fold="products:main">
       <button type="button" class="adm-fold-head" aria-expanded="true">
         <svg class="adm-fold-chev" width="16" height="16" viewBox="0 0 24 24"
              fill="none" stroke="currentColor" stroke-width="2"
              stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
           <polyline points="6 9 12 15 18 9"/>
         </svg>
         <span class="adm-fold-title">اطلاعات اصلی</span>
         <span class="adm-fold-note">نام، قیمت، دسته‌بندی</span>
       </button>
       <div class="adm-fold-body">
         …form fields…
       </div>
     </section>
   ============================================================ */

.adm-fold {
  background: var(--navy-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.adm-fold:last-child {
  margin-bottom: 0;
}

/* ── The whole create/edit form behind ONE bar ──────────────────
   `.adm-fold-outer` wraps the entire form so an admin lands on the
   LIST, with a single «+ افزودن …» bar above it. The per-group folds
   still exist, nested inside — the JS scopes each fold to its own
   head/body, so nesting needs no extra wiring. Styling only: the
   outer bar reads as an action, the inner ones lose their frame so
   the open form does not look like boxes inside a box. */
.adm-fold-outer {
  background: var(--navy-2);
  border-color: var(--border);
}

.adm-fold-outer > .adm-fold-head {
  font-weight: 700;
  color: var(--white);
}

.adm-fold-outer > .adm-fold-head .adm-fold-title {
  font-size: 0.95rem;
}

/* Nested sections sit flush: no frame, just a rule between them. */
.adm-fold-outer .adm-fold-body .adm-fold {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 0;
}

.adm-fold-outer .adm-fold-body .adm-fold:first-child {
  border-top: 0;
}

/* A section holding a validation error is outlined so it is findable
   after the JS force-opens it. */
.adm-fold.has-error,
.adm-fold[data-fold-error] {
  border-color: rgba(232, 20, 42, 0.45);
}

.adm-fold-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  background: transparent;
  border: 0;
  border-radius: inherit;
  color: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: start;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}

.adm-fold-head:hover {
  background: var(--navy-4);
}

.adm-fold-head:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

/* Without JS nothing toggles, so don't promise a click target. */
html:not(.adm-fold-js) .adm-fold-head {
  cursor: default;
}

.adm-fold.is-open > .adm-fold-head {
  border-bottom: 1px solid var(--border);
  border-end-start-radius: 0;
  border-end-end-radius: 0;
}

/* Chevron: points along the reading direction when collapsed, down when
   open. RTL flips it so it always opens "inward". */
.adm-fold-chev {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--silver-dim);
  transform: rotate(-90deg);
  transition:
    transform var(--transition),
    color var(--transition);
}

[dir="rtl"] .adm-fold-chev {
  transform: rotate(90deg);
}

.adm-fold.is-open > .adm-fold-head .adm-fold-chev,
[dir="rtl"] .adm-fold.is-open > .adm-fold-head .adm-fold-chev {
  transform: rotate(0deg);
}

.adm-fold-head:hover .adm-fold-chev,
.adm-fold.is-open > .adm-fold-head .adm-fold-chev {
  color: var(--red);
}

.adm-fold-title {
  flex: 0 1 auto;
  min-width: 0;
}

.adm-fold-note {
  margin-inline-start: auto;
  max-width: 48%;
  overflow: hidden;
  color: var(--silver-dim);
  font-size: 0.74rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-fold-body {
  padding: 16px 14px 18px;
}

/* `hidden` is how the body is collapsed — keep it winning over any
   display value a page might add later. */
.adm-fold-body[hidden] {
  display: none !important;
}

/* Reveal animation, applied only to user-driven toggles (`is-anim` is
   added by the JS on click) so the page does not animate on load. */
@keyframes admFoldIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.adm-fold.is-anim.is-open > .adm-fold-body {
  animation: admFoldIn 0.18s ease both;
}

@media (max-width: 560px) {
  .adm-fold-note {
    display: none;
  }
}
