/* Kaveh storefront — v1: simple, clean, RTL, mobile-first. One accent colour; everything else neutral.
   Self-hosted font only (design D14: Iran-hosted, no external CDN). */

@font-face {
  font-family: IRANSansX;
  src: url('fonts/iransansx.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- palette — the ONLY values a theme preset changes (see "theme presets" below) ----
     brand = the main colour, warm = the companion accent, fresh = a bright highlight used in
     gradients, paper = neutral fill. Default preset «زمرد و طلا»: deep green #114e49 + gold. */
  --brand-950: #062522;
  --brand-900: #0a332f;
  --brand-800: #0d403b;
  --brand-700: #114e49;   /* the brand colour */
  --brand-600: #176259;
  --brand-500: #1e7a6e;
  --brand-400: #3f9b8c;
  --brand-300: #7fc0b3;
  --brand-100: #d6ebe6;
  --brand-50:  #edf6f3;
  --warm-600:  #b8893a;
  --warm-500:  #d4a94f;
  --warm-300:  #ecd08e;
  --warm-50:   #fbf5e6;
  --warm-ink:  #3a2a08;
  --fresh:     #4fc3a1;
  --paper:     #f6f5f0;
  --text:      #14231f;
  --muted:     #5f6f6a;
  --line:      #e2e6e1;
  --white:     #ffffff;

  /* ---- gradients (derived from the palette) ---- */
  --grad-primary:       linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 55%, var(--brand-900) 100%);
  --grad-primary-hover: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-600) 55%, var(--brand-800) 100%);
  --grad-gold:          linear-gradient(135deg, var(--warm-300) 0%, var(--warm-500) 55%, var(--warm-600) 100%);
  --grad-danger:        linear-gradient(135deg, #e5484d 0%, #b42318 100%);
  --grad-hero:          radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--fresh) 28%, transparent) 0%, transparent 55%),
                        radial-gradient(90% 120% at 100% 100%, color-mix(in srgb, var(--warm-500) 22%, transparent) 0%, transparent 60%),
                        linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 50%, var(--brand-950) 100%);
  --grad-footer:        linear-gradient(180deg, var(--brand-800) 0%, var(--brand-950) 100%);
  --grad-soft:          linear-gradient(135deg, var(--brand-50) 0%, var(--warm-50) 100%);

  /* ---- section backdrops: very pale tint + faint circles (never a full colour) ---- */
  --tint-green:  color-mix(in srgb, var(--brand-50) 65%, var(--white));
  --tint-gold:   color-mix(in srgb, var(--warm-50) 75%, var(--white));
  --tint-mint:   color-mix(in srgb, var(--brand-50) 85%, var(--white));
  --blob-green:  color-mix(in srgb, var(--fresh) 20%, transparent);
  --blob-gold:   color-mix(in srgb, var(--warm-500) 20%, transparent);
  --blob-teal:   color-mix(in srgb, var(--brand-500) 14%, transparent);
  --ring-green:  color-mix(in srgb, var(--brand-700) 10%, transparent);
  --ring-gold:   color-mix(in srgb, var(--warm-600) 16%, transparent);
  --dot-green:   color-mix(in srgb, var(--fresh) 12%, transparent);
  --dot-gold:    color-mix(in srgb, var(--warm-500) 14%, transparent);

  /* ---- semantic tokens (every rule below uses these) ---- */
  --page-bg: var(--white);
  --bg: var(--paper);            /* neutral fill inside components (thumbs, tags, inputs) */
  --surface: var(--white);
  --accent: var(--brand-700);
  --accent-hover: var(--brand-600);
  --accent-ink: var(--white);
  --accent-soft: var(--brand-50);
  --accent-ring: var(--brand-100);
  --highlight: var(--warm-500);
  --highlight-ink: var(--warm-ink);
  --on-dark: var(--brand-100);
  --on-dark-muted: var(--brand-300);
  --on-dark-line: rgba(255, 255, 255, .12);
  --danger: #b42318;
  --danger-ink: var(--white);
  --danger-soft: #fef3f2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --shadow-accent: 0 4px 14px color-mix(in srgb, var(--brand-700) 28%, transparent);
  --shadow-accent-hover: 0 6px 20px color-mix(in srgb, var(--brand-700) 36%, transparent);
  --dur: .4s;
  --ease: cubic-bezier(.25, .8, .25, 1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px color-mix(in srgb, var(--brand-900) 6%, transparent), 0 1px 3px color-mix(in srgb, var(--brand-900) 5%, transparent);
  --shadow-lift: 0 6px 20px color-mix(in srgb, var(--brand-900) 10%, transparent);
  --max: 1200px;
  --font: IRANSansX, Tahoma, sans-serif;
}

/* ---------- theme presets ----------
   Chosen in the dashboard («تنظیمات فروشگاه» → قالب), stored as Store setting ThemePreset and put on
   <html data-preset="…"> by App.razor. A preset redefines the palette only; everything else derives.
   The ids must match StoreSettingKeys.ThemePresets (server), ThemePresets.cs (this site) and the
   dashboard panel. "emerald" is :root above. */
:root[data-preset="ocean"] {      /* اقیانوس — navy + coral */
  --brand-950: #0b1535; --brand-900: #10204d; --brand-800: #162c66; --brand-700: #1e3a8a; --brand-600: #2748a6;
  --brand-500: #3b5fc4; --brand-400: #6384d8; --brand-300: #9fb4ea; --brand-100: #dde5f8; --brand-50: #eef2fc;
  --warm-600: #d9573f; --warm-500: #f07a5f; --warm-300: #f8b4a3; --warm-50: #fef1ed; --warm-ink: #4a160a;
  --fresh: #38bdf8; --paper: #f4f6fa; --text: #141b2d; --muted: #5d6679; --line: #e1e5ee;
}
:root[data-preset="rose"] {       /* رز — plum + rose gold */
  --brand-950: #2e0a1d; --brand-900: #45102b; --brand-800: #5c173a; --brand-700: #7a2350; --brand-600: #943063;
  --brand-500: #b1467c; --brand-400: #c9709d; --brand-300: #e0a7c3; --brand-100: #f6e0ea; --brand-50: #fbf1f5;
  --warm-600: #b5795f; --warm-500: #d4a08a; --warm-300: #ebcbbd; --warm-50: #fbf3ef; --warm-ink: #3f1e10;
  --fresh: #f472b6; --paper: #faf6f7; --text: #261621; --muted: #6d5d66; --line: #eee3e8;
}
:root[data-preset="graphite"] {   /* گرافیت — charcoal + amber */
  --brand-950: #0c0c0e; --brand-900: #151518; --brand-800: #1d1d21; --brand-700: #27272a; --brand-600: #3a3a40;
  --brand-500: #52525b; --brand-400: #71717a; --brand-300: #a1a1aa; --brand-100: #e4e4e7; --brand-50: #f4f4f5;
  --warm-600: #d97706; --warm-500: #f59e0b; --warm-300: #fcd34d; --warm-50: #fffbeb; --warm-ink: #3b2503;
  --fresh: #fbbf24; --paper: #f6f6f7; --text: #18181b; --muted: #62626b; --line: #e4e4e7;
}
:root[data-preset="lavender"] {   /* یاس — violet + pink */
  --brand-950: #1d1233; --brand-900: #2a1a4a; --brand-800: #3a2566; --brand-700: #4c3285; --brand-600: #5f42a0;
  --brand-500: #7657bb; --brand-400: #9579d0; --brand-300: #bba7e3; --brand-100: #e9e2f7; --brand-50: #f5f1fc;
  --warm-600: #c9708b; --warm-500: #e290a8; --warm-300: #f2c3d1; --warm-50: #fdf2f5; --warm-ink: #4a1426;
  --fresh: #a78bfa; --paper: #f8f6fc; --text: #1f1a2e; --muted: #676078; --line: #e8e3f1;
}


*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  background: var(--page-bg);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.5; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; font-weight: 800; }
h1:focus { outline: none; } /* FocusOnNavigate moves focus here for screen readers; no visible ring */
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: embed; }

/* ---------- header ---------- */
.notice { background: var(--brand-900); color: var(--warm-300); text-align: center; font-size: .85rem; padding: 6px 16px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.brand { font-weight: 800; font-size: 1.15rem; white-space: nowrap; color: var(--accent); display: inline-flex; align-items: center; gap: 8px; }
/* the logo keeps its own proportions: fixed height, width from the image, capped so a very wide logo cannot push the search box away */
.brand-logo { height: 48px; width: auto; max-width: 180px; object-fit: contain; flex: none; }
@media (max-width: 640px) { .brand-logo { height: 38px; max-width: 120px; } }
.search { flex: 1; display: flex; min-width: 0; }
.search input {
  flex: 1; min-width: 0; font: inherit; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-left: 0; background: var(--bg);
}
.search button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 0 12px; cursor: pointer; font: inherit; }
.search input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 1px solid var(--line); }
.search button { border-right: 0; }
.header-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: .9rem; white-space: nowrap; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn { transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease); font-weight: 600; }
.icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { flex: none; }
/* sign-in / account: soft green, icon in a gradient circle */
.header-actions .icon-btn:not([href="/cart"]) { background: var(--grad-soft); border-color: var(--brand-100); color: var(--accent); padding-block: 4px; padding-inline: 4px 12px; }
.header-actions .icon-btn:not([href="/cart"]) svg { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--grad-primary); color: var(--accent-ink); }
.header-actions .icon-btn:not([href="/cart"]):hover { color: var(--accent); border-color: var(--brand-300); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
/* cart: full green gradient, icon in a gold circle */
.header-actions .icon-btn[href="/cart"] { background: var(--grad-primary); border-color: transparent; color: var(--accent-ink); padding-block: 4px; padding-inline: 4px 12px; box-shadow: var(--shadow-accent); }
.header-actions .icon-btn[href="/cart"] svg { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--grad-gold); color: var(--highlight-ink); }
.header-actions .icon-btn[href="/cart"]:hover { background: var(--grad-primary-hover); border-color: transparent; color: var(--accent-ink); box-shadow: var(--shadow-accent-hover); transform: translateY(-1px); }
.header-actions .icon-btn[href="/cart"] .cart-count { box-shadow: 0 0 0 2px var(--brand-800); }
@media (max-width: 640px) { .header-actions .icon-btn { padding: 4px; } }
.search button { color: var(--accent); }
.search button:hover { background: var(--accent-soft); }
.cart-count { background: var(--grad-gold); color: var(--highlight-ink); font-weight: 700; border-radius: 999px; font-size: .75rem; min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; }
.cat-nav { border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 6px 0; }
.cat-nav a { display: block; padding: 4px 10px; border-radius: var(--radius-sm); white-space: nowrap; font-size: .9rem; color: var(--muted); }
.cat-nav a:hover, .cat-nav a.active { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 640px) {
  .header-row { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .icon-btn .label { display: none; }
}

/* ---------- layout ---------- */
/* main is NOT a container: every page wraps itself in .container.page, and the home page is a stack
   of full-width bands (.hero, .section[aria-labelledby]) each carrying its own .container. */
main { min-height: 60vh; }
.page { padding-block: 20px 48px; }
.page-head { margin-bottom: 16px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-left: 4px; color: var(--line); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }
.section { margin-top: 28px; }

/* Home sections: flat full-width bands, edge to edge, no radius — each with its own pale backdrop (a
   soft blurred blob, a double ring and a small dot in the theme's colours at very low opacity). Only
   sections that carry an aria-labelledby (the home page ones) are bands; card/text sections elsewhere
   stay plain. The content width comes from the .container inside each band. */
.section[aria-labelledby] {
  --sec-bg: var(--tint-green); --sec-blob: var(--blob-green); --sec-ring: var(--ring-green); --sec-dot: var(--dot-gold);
  position: relative; isolation: isolate; overflow: hidden;
  margin-top: 0; padding-block: 40px 44px;
  background:
    radial-gradient(circle at 12% 78%, var(--sec-dot) 0 34px, transparent 35px),
    radial-gradient(circle at 70% 8%, var(--sec-dot) 0 10px, transparent 11px),
    var(--sec-bg);
}
.section[aria-labelledby]::before {           /* blurred blob, top start corner */
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 380px; aspect-ratio: 1; border-radius: 50%;
  top: -150px; inset-inline-start: -110px;
  background: var(--sec-blob); filter: blur(50px);
}
.section[aria-labelledby]::after {            /* double ring, bottom end corner */
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 220px; aspect-ratio: 1; border-radius: 50%;
  bottom: -100px; inset-inline-end: -70px;
  border: 1.5px solid var(--sec-ring);
  outline: 1px solid var(--sec-ring); outline-offset: 26px;
}
.section[aria-labelledby="featured"] { --sec-bg: var(--tint-gold); --sec-blob: var(--blob-gold); --sec-ring: var(--ring-gold); --sec-dot: var(--dot-green); }
.section[aria-labelledby="featured"]::before { inset-inline-start: auto; inset-inline-end: -110px; }
.section[aria-labelledby="featured"]::after  { inset-inline-end: auto; inset-inline-start: -70px; }
.section[aria-labelledby="newest"]   { --sec-bg: var(--tint-mint); --sec-blob: var(--blob-teal); --sec-dot: var(--dot-green); }
@media (max-width: 640px) {
  .section[aria-labelledby] { padding-block: 28px 32px; }
  .section[aria-labelledby]::before { width: 260px; }
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-head a { color: var(--accent); font-size: .9rem; }
/* home band titles: centred, with a short accent bar under them; the optional link sits below */
.section[aria-labelledby] .section-head { flex-direction: column; align-items: center; text-align: center; gap: 4px; margin-bottom: 22px; }
.section[aria-labelledby] .section-head h2 { font-size: 1.25rem; margin: 0; }
.section[aria-labelledby] .section-head h2::after { content: ""; display: block; width: 44px; height: 3px; margin: 8px auto 0; border-radius: 3px; background: var(--grad-gold); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  padding: 9px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; text-align: center;
}
.btn { transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.btn:hover { border-color: var(--accent); color: var(--accent); background-color: var(--accent-soft); }
.btn-primary { background: var(--grad-primary); border-color: transparent; color: var(--accent-ink); box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--grad-primary-hover); border-color: transparent; color: var(--accent-ink); box-shadow: var(--shadow-accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-accent); }
.btn-gold { background: var(--grad-gold); border-color: transparent; color: var(--highlight-ink); }
.btn-gold:hover { background: var(--grad-gold); border-color: transparent; color: var(--highlight-ink); filter: brightness(1.05); transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }

.field { display: block; margin-bottom: 14px; }
.field > span, .field > label { display: block; font-size: .9rem; margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea, .input {
  width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .search input:focus { outline: 3px solid var(--accent-ring); border-color: var(--accent); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.validation-message, .field-error { color: var(--danger); font-size: .82rem; margin-top: 4px; }
.validation-errors { color: var(--danger); padding-right: 18px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .92rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--accent-soft); color: var(--accent); }

/* ---------- product grid ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.p-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.p-card:hover { box-shadow: var(--shadow-lift); border-color: var(--brand-100); }
.p-card .thumb { aspect-ratio: 1 / 1; background: var(--bg); display: block; position: relative; }
.p-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.p-card .title { font-size: .92rem; font-weight: 600; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.2em; }
.p-card .meta { font-size: .78rem; color: var(--muted); }
.p-card .price { margin-top: auto; display: flex; flex-direction: column; align-items: flex-end; }
.p-card .price s { color: var(--muted); font-size: .8rem; }
.p-card .price strong { font-size: 1rem; }
.p-card .price .unit { font-size: .75rem; color: var(--muted); font-weight: 400; }
.p-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; }
.p-card .foot > form, .p-card .foot > .btn { flex: 1 1 auto; min-width: 88px; }
.p-card .foot > form .btn { width: 100%; }
.p-card .foot .btn-sm { padding-block: 7px; }
.tag { display: inline-block; white-space: nowrap; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.tag-off { background: var(--grad-danger); color: var(--danger-ink); position: absolute; top: 8px; right: 8px; }
.tag-live { background: var(--warn-soft); color: var(--warn); }
.tag-out { background: var(--bg); color: var(--muted); }

/* ---------- category page ---------- */
.shop-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shop-layout { grid-template-columns: 260px 1fr; align-items: start; } .shop-layout aside { position: sticky; top: 120px; } }
.filter-toggle { display: none; }
@media (max-width: 899px) {
  .filter-box { padding: 10px; }
  .filter-toggle { display: flex; }
  .filter-body { display: none; margin-top: 12px; }
  #filter-toggle:checked ~ .filter-body { display: block; }
}
.filters .f-row { display: block; margin-bottom: 12px; }
.filters .f-row > span, .filters legend { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.filters select, .filters input[type=number] { width: 100%; font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.filters fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.filters .f-price { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters .f-price legend { grid-column: 1 / -1; }
.filters .f-check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-size: .9rem; }
.filters .f-actions { display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips a { border: 1px solid var(--line); background: var(--surface); padding: 3px 12px; border-radius: 999px; font-size: .85rem; }
.result-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 10px; }
.pager a:hover { border-color: var(--accent); background: var(--accent-soft); }
.pager .current { background: var(--grad-primary); color: var(--accent-ink); border-color: transparent; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.rich { line-height: 2; }
.rich h2, .rich h3 { margin-top: 1rem; }
.rich ul { padding-right: 20px; }

/* ---------- product page ---------- */
.pdp { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .pdp { grid-template-columns: 1fr 1fr; align-items: start; } }
.gallery .main { aspect-ratio: 1 / 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery .thumbs a { width: 72px; flex: 0 0 72px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.gallery .thumbs a.active { border-color: var(--accent); }
.buy-box .producer { color: var(--muted); font-size: .9rem; }
.variants { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.variants a { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; background: var(--surface); font-size: .9rem; }
.variants a.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.variants a.out { color: var(--muted); text-decoration: line-through; }
.price-box { margin: 12px 0; }
.price-was { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.badge-off { background: var(--grad-danger); color: var(--danger-ink); border-radius: 999px; padding: 0 8px; font-size: .8rem; }
.price-now strong { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.price-now .unit { color: var(--muted); margin-right: 4px; }
.price-live { font-size: .82rem; color: var(--warn); display: flex; align-items: center; gap: 6px; }
.price-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.price-live .dot.stale { background: var(--warn); }
.price-out { color: var(--danger); font-weight: 600; margin-top: 4px; }
.buy-row { display: flex; gap: 8px; align-items: stretch; }
.qty { width: 80px; text-align: center; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.specs { width: 100%; border-collapse: collapse; }
.specs th, .specs td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; font-size: .92rem; }
.specs th { color: var(--muted); font-weight: 400; width: 40%; }
.info-list { list-style: none; padding: 0; margin: 12px 0 0; font-size: .88rem; color: var(--muted); }
.info-list li { padding: 2px 0; }

/* ---------- cart & checkout ---------- */
.cart-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cart-layout { grid-template-columns: 1fr 340px; align-items: start; } .cart-layout > aside { position: sticky; top: 120px; } }
.cart-line { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg); }
.cart-line .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.cart-line .ops { display: flex; gap: 6px; align-items: center; }
.cart-line s { margin-right: 6px; color: var(--muted); }
.cart-line .ops input { width: 64px; text-align: center; padding: 4px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.summary dl { margin: 0; }
.summary .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: .92rem; }
.summary .row dt { color: var(--muted); }
.summary .row dd { margin: 0; }
.summary .total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; font-weight: 800; font-size: 1.05rem; }
.summary .discount dd { color: var(--danger); }
.inline-form { display: flex; gap: 6px; }
.inline-form input { flex: 1; min-width: 0; font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* ---------- auth & account ---------- */
.auth-wrap { max-width: 420px; margin: 16px auto; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.tabs a { flex: 1; text-align: center; padding: 6px; border-radius: 6px; font-size: .9rem; color: var(--muted); }
.tabs a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.auth-links { display: flex; justify-content: space-between; font-size: .88rem; margin-top: 12px; }
.auth-links a { color: var(--accent); }
.account-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .account-layout { grid-template-columns: 240px 1fr; align-items: start; } }
.account-nav { list-style: none; margin: 0; padding: 8px; }
.account-nav a, .account-nav button { display: block; width: 100%; text-align: right; padding: 8px 10px; border-radius: var(--radius-sm); font: inherit; background: none; border: 0; cursor: pointer; color: var(--text); }
.account-nav a.active, .account-nav a:hover, .account-nav button:hover { background: var(--accent-soft); color: var(--accent); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.table th { color: var(--muted); font-weight: 400; }
.status { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; background: var(--bg); }
.status-1 { background: var(--warn-soft); color: var(--warn); }
.status-2, .status-3 { background: var(--accent-soft); color: var(--accent); }
.status-4 { background: var(--ok-soft); color: var(--ok); }
.status-5 { background: var(--danger-soft); color: var(--danger); }
.ladder { display: flex; gap: 4px; list-style: none; padding: 0; margin: 12px 0; flex-wrap: wrap; }
.ladder li { flex: 1; min-width: 90px; text-align: center; font-size: .8rem; padding: 6px 4px; border-radius: var(--radius-sm); background: var(--bg); color: var(--muted); }
.ladder li.done { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ladder li.cancel { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 640px) { .table .hide-sm { display: none; } }

/* ---------- home ---------- */
.hero { background: var(--grad-hero); color: var(--white); padding-block: 44px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--grad-gold); }
.hero h1 { font-size: 1.5rem; }
.hero .muted { color: var(--on-dark); }
.cat-tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .cat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cat-tiles a { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-weight: 600; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.cat-tiles a:hover { background: var(--grad-soft); border-color: var(--brand-100); box-shadow: var(--shadow-lift); }
.cat-tiles a small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
/* name on the start (right) side, round image on the end (left) side, sized from the tile's width */
.cat-tiles a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 92px; padding-block: 12px; }
.cat-tiles .cat-text { min-width: 0; overflow-wrap: anywhere; }
.cat-tiles .cat-img {
  flex: none; width: clamp(48px, 30%, 76px); aspect-ratio: 1; height: auto; border-radius: 50%;
  object-fit: cover; background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--brand-100), var(--shadow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.cat-tiles .cat-img-empty {
  display: grid; place-items: center; background: var(--grad-primary); color: var(--accent-ink);
  font-size: 1.35rem; font-weight: 800;
}
.cat-tiles a:hover .cat-img { transform: scale(1.06); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--warm-300), var(--shadow-lift); }

/* ---------- footer ---------- */
.site-footer { background: var(--grad-footer); color: var(--on-dark); border-top: 3px solid var(--highlight); padding: 28px 0 16px; font-size: .9rem; }
.site-footer h3 { color: var(--white); }
.site-footer .muted { color: var(--on-dark-muted); }
.site-footer a:hover { color: var(--warm-300); }
.footer-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 2px 0; }
.site-footer .copy { border-top: 1px solid var(--on-dark-line); margin-top: 20px; padding-top: 12px; color: var(--on-dark-muted); font-size: .8rem; text-align: center; }


/* ---------- menu hover transitions ---------- */
a { transition: color var(--dur) var(--ease); }
/* category bar: colour/background fade + a gradient underline that grows from the centre */
.cat-nav ul { padding-bottom: 8px; }
.cat-nav a { position: relative; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.cat-nav a::after {
  content: ""; position: absolute; inset-inline: 10px; bottom: -2px; height: 2px; border-radius: 2px;
  background: var(--grad-primary); transform: scaleX(0); transition: transform var(--dur) var(--ease);
}
.cat-nav a:hover::after, .cat-nav a.active::after { transform: scaleX(1); }
/* account menu: fade + slide in, with an accent bar on the start edge */
.account-nav a, .account-nav button {
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
              padding var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.account-nav a.active, .account-nav a:hover, .account-nav button:hover {
  padding-inline-start: 16px; box-shadow: inset -3px 0 0 var(--accent);
}
/* footer links: colour fade + a small nudge */
.site-footer li a { display: inline-block; transition: color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.site-footer li a:hover { transform: translateX(-4px); }
/* sign-in tabs */
.tabs a { transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tabs a:hover:not(.active) { color: var(--accent); }

/* gradients can't be transitioned, so the hover gradient sits on a layer that fades in */
.btn-primary, .header-actions .icon-btn[href="/cart"], .pager a, .cat-tiles a { position: relative; isolation: isolate; }
.btn-primary::before, .header-actions .icon-btn[href="/cart"]::before, .cat-tiles a::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.btn-primary::before, .header-actions .icon-btn[href="/cart"]::before { background: var(--grad-primary-hover); }
.cat-tiles a::before { background: var(--grad-soft); }
.btn-primary:hover::before, .header-actions .icon-btn[href="/cart"]:hover::before, .cat-tiles a:hover::before { opacity: 1; }
/* keep the base gradient on hover; the layer above does the change */
.btn-primary:hover, .header-actions .icon-btn[href="/cart"]:hover { background: var(--grad-primary); }
.cat-tiles a:hover { background: var(--surface); transform: translateY(-2px); }
.p-card { transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.p-card:hover { transform: translateY(-3px); }
.pager a { transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
/* Blazor */
#blazor-error-ui { display: none; }
.blazor-error-boundary { background: var(--danger-soft); color: var(--danger); padding: 1rem; border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "خطایی رخ داد."; }
