/* ==========================================================================
   Bazendehroud — base.css (loads on every page)
   Tokens, reset, typography, layout, buttons, forms, badges, product card,
   toast, drawer. Area files (header.css, catalog.css, ...) build on these
   tokens and must not redefine them.
   ========================================================================== */

@font-face {
  font-family: "IRANYekan";
  src: url("../fonts/iranyekanwebregularfanum.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekan";
  src: url("../fonts/iranyekanwebboldfanum.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --c-primary: #ef4056;          /* brand red (old theme-color): section underlines, sale, CTAs */
  --c-primary-hover: #d62f45;
  --c-primary-soft: #fef0f2;
  --c-accent: #0d9488;           /* teal: secondary links ("مشاهده همه") */
  --c-accent-soft: #f0fdfa;

  /* Neutrals */
  --c-text: #0f172a;
  --c-text-2: #475569;
  --c-muted: #94a3b8;
  --c-border: #e2e8f0;
  --c-surface: #ffffff;
  --c-bg: #f8fafc;
  --c-bg-2: #f1f5f9;

  /* States */
  --c-success: #16a34a;
  --c-warning: #d97706;
  --c-danger: #dc2626;
  --c-info: #2563eb;

  /* Type */
  --font: "IRANYekan", Tahoma, system-ui, sans-serif;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-md: .9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --lh: 1.8;

  /* Space / shape */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / .06);
  --shadow: 0 4px 16px rgb(15 23 42 / .08);
  --shadow-lg: 0 12px 32px rgb(15 23 42 / .14);

  /* Layout */
  --container: 1320px;
  --gutter: 1rem;
  --header-h: 72px;              /* header area may update at runtime */
  --z-header: 50; --z-drawer: 90; --z-modal: 100; --z-toast: 110;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--c-text);
  background: var(--c-bg);
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
img { border-style: none; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-3); line-height: 1.5; font-weight: 700; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--sp-4); }
ul, ol { padding-inline-start: 1.25rem; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--sp-5) 0; }
:focus-visible { outline: 2px solid var(--c-info); outline-offset: 2px; }
[hidden] { display: none !important; }

.screen-reader-text, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; top: 8px; right: 8px; z-index: 1000; width: auto; height: auto; clip: auto; padding: var(--sp-2) var(--sp-4); background: var(--c-surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.site-main { padding-block: var(--sp-5); min-height: 50vh; }
.box { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.stack > * + * { margin-top: var(--sp-4); }
.layout-sidebar { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) {
  .layout-sidebar { grid-template-columns: 280px minmax(0, 1fr); }
}

/* Section heading with the brand underline (matches the old site) */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.section-head__title { position: relative; margin: 0; font-size: var(--fs-lg); padding-bottom: var(--sp-2); }
.section-head__title::after { content: ""; position: absolute; inset-inline-start: 0; bottom: 0; width: 100%; height: 2px; background: var(--c-primary); border-radius: 2px; }
.section-head__more { color: var(--c-accent); font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: var(--sp-1); }

/* ---------- Icons ---------- */
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn, .button, button.button, input[type="submit"].button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-5);
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--c-primary); color: #fff; font-weight: 700; font-size: var(--fs-md); line-height: 1;
  transition: background .15s var(--ease), border-color .15s, color .15s, opacity .15s;
  text-align: center; white-space: nowrap;
}
.btn:hover, .button:hover { background: var(--c-primary-hover); color: #fff; }
.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn--ghost:hover { background: var(--c-bg-2); color: var(--c-text); }
.btn--soft { background: var(--c-primary-soft); color: var(--c-primary); }
.btn--soft:hover { background: var(--c-primary); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn--icon { min-height: 40px; width: 40px; padding: 0; border-radius: var(--radius); }
.btn[disabled], .btn.is-loading, .button.loading, .button:disabled { opacity: .6; pointer-events: none; }
.btn.is-loading::after, .button.loading::after {
  content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-inline-end-color: transparent;
  border-radius: 50%; animation: bzr-spin .7s linear infinite;
}
@keyframes bzr-spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"],
input[type="search"], input[type="url"], select, textarea, .input-text {
  width: 100%; min-height: 44px; padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-info); box-shadow: 0 0 0 3px rgb(37 99 235 / .15); }
label { display: inline-block; margin-bottom: var(--sp-1); font-size: var(--fs-sm); color: var(--c-text-2); }
.required { color: var(--c-danger); text-decoration: none; border: 0; }

/* Quantity stepper (used by catalog, product, cart) */
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.qty-stepper button { width: 36px; height: 40px; border: 0; background: none; display: grid; place-items: center; }
.qty-stepper input { width: 44px; min-height: 40px; border: 0; text-align: center; padding: 0; -moz-appearance: textfield; }
.qty-stepper input::-webkit-inner-spin-button, .qty-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Badges / price ---------- */
.badge { display: inline-flex; align-items: center; padding: 0 var(--sp-2); min-height: 22px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; }
.badge--sale { background: var(--c-primary); color: #fff; }
.price { font-weight: 700; color: var(--c-text); }
.price del { color: var(--c-muted); font-weight: 400; font-size: .85em; display: block; line-height: 1.4; }
.price ins { text-decoration: none; }
.woocommerce-Price-currencySymbol { font-size: .75em; font-weight: 400; color: var(--c-text-2); margin-inline-start: 2px; }

/* ---------- Product card ---------- */
.p-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .p-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .p-grid { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); } }

.p-card {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-2);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  padding: var(--sp-3); height: 100%;
  transition: box-shadow .2s var(--ease), border-color .2s;
}
.p-card:hover { box-shadow: var(--shadow); border-color: transparent; }
.p-card__media { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--c-surface); }
.p-card__img { width: 100%; height: 100%; object-fit: contain; }
.p-card__badge { position: absolute; top: var(--sp-2); inset-inline-start: var(--sp-2); }
.p-card__fav { position: absolute; top: var(--sp-4); inset-inline-end: var(--sp-4); }
.p-card__title { margin: 0; font-size: var(--fs-sm); font-weight: 400; line-height: 1.9; min-height: 3.8em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-card__foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-2); min-height: 44px; }
.p-card__price { font-size: var(--fs-md); }
.p-card__stock { color: var(--c-muted); font-size: var(--fs-sm); }
.p-card.is-out .p-card__img { opacity: .55; filter: grayscale(.6); }
.p-card__cart { background: var(--c-primary-soft); color: var(--c-primary); }
.p-card__cart:hover { background: var(--c-primary); color: #fff; }
.p-card__cart.added { background: var(--c-success); color: #fff; }
.p-card .added_to_cart { display: none; }

.fav-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgb(255 255 255 / .9); color: var(--c-text-2); box-shadow: var(--shadow-sm); }
.fav-btn:hover { color: var(--c-primary); }
.fav-btn[aria-pressed="true"] { color: var(--c-primary); }
.fav-btn[aria-pressed="true"] .icon { fill: currentColor; }

/* ---------- Horizontal scroller (sliders without a library) ---------- */
.scroller { position: relative; }
.scroller__track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - var(--sp-3) * (var(--per, 2) - 1)) / var(--per, 2));
  gap: var(--sp-3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
  padding-block: 2px; list-style: none; margin: 0; padding-inline: 0;
}
.scroller__track::-webkit-scrollbar { display: none; }
.scroller__track > * { scroll-snap-align: start; }
@media (min-width: 768px) { .scroller__track { --per: 3; } }
@media (min-width: 992px) { .scroller__track { --per: 4; } }
@media (min-width: 1200px) { .scroller__track { --per: var(--per-lg, 5); } }
.scroller__btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--c-border);
  background: var(--c-surface); box-shadow: var(--shadow); display: none; place-items: center;
}
@media (hover: hover) and (min-width: 768px) { .scroller__btn { display: grid; } }
.scroller__btn--prev { inset-inline-start: -12px; }
.scroller__btn--next { inset-inline-end: -12px; }
.scroller__btn[disabled] { opacity: 0; pointer-events: none; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: var(--z-toast); inset-inline: 0; bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: var(--sp-2); pointer-events: none; padding-inline: var(--sp-4); }
@media (max-width: 991px) { .toasts { bottom: calc(72px + env(safe-area-inset-bottom)); } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3);
  max-width: 480px; width: 100%; padding: var(--sp-3) var(--sp-4);
  background: var(--c-text); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: bzr-toast-in .25s var(--ease);
}
.toast a { color: #fff; text-decoration: underline; margin-inline-start: auto; white-space: nowrap; }
.toast--error { background: var(--c-danger); }
.toast--success { background: #14532d; }
@keyframes bzr-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Drawer / overlay (mobile menu, filters, mini cart) ---------- */
.overlay { position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: rgb(15 23 42 / .45); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.overlay.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; z-index: var(--z-drawer); top: 0; bottom: 0; inset-inline-start: 0;
  width: min(360px, 88vw); background: var(--c-surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s var(--ease); visibility: hidden;
}
.drawer--end { inset-inline-start: auto; inset-inline-end: 0; transform: translateX(-100%); }
.drawer.is-open { transform: none; visibility: visible; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border); }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--sp-4); overscroll-behavior: contain; }
.drawer__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--c-border); }
body.has-drawer { overflow: hidden; }

/* ---------- WooCommerce notices (shared) ---------- */
.woocommerce-notices-wrapper:empty { display: none; }
.woocommerce-message, .woocommerce-info, .woocommerce-error, .wc-block-components-notice-banner {
  list-style: none; margin: 0 0 var(--sp-4); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius); border: 1px solid var(--c-border); background: var(--c-surface);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
}
.woocommerce-message { border-color: #bbf7d0; background: #f0fdf4; }
.woocommerce-info { border-color: #bfdbfe; background: #eff6ff; }
.woocommerce-error { border-color: #fecaca; background: #fef2f2; flex-direction: column; align-items: flex-start; }
.woocommerce-message .button, .woocommerce-info .button { margin-inline-start: auto; min-height: 36px; font-size: var(--fs-sm); }

/* ---------- Pagination (shared by shop, blog, search) ---------- */
.pagination, .woocommerce-pagination { margin-top: var(--sp-6); }
.pagination ul, .woocommerce-pagination ul, .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); list-style: none; padding: 0; margin: 0; }
.page-numbers { min-width: 40px; height: 40px; padding: 0 var(--sp-2); display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--c-border); background: var(--c-surface); }
.page-numbers.current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.page-numbers.dots { border: 0; background: none; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb, .woocommerce-breadcrumb, .rank-math-breadcrumb { font-size: var(--fs-sm); color: var(--c-text-2); margin-bottom: var(--sp-4); }
.breadcrumb a:hover, .woocommerce-breadcrumb a:hover, .rank-math-breadcrumb a:hover { color: var(--c-primary); }

/* ---------- Skeleton / utility ---------- */
.muted { color: var(--c-text-2); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Height of the mobile bottom navigation (header area); other areas offset sticky bars with it. */
:root { --bnav-h: 0px; }
@media (max-width: 991px) { :root { --bnav-h: calc(64px + env(safe-area-inset-bottom)); } }
