/*
 * Yalda's design system: a calm product UI (white cards on the cream page, one strong colour,
 * soft tinted states, rounded corners, floating liquid-glass navigation) in the Yalda palette.
 * Shared by the campaign page, the club page and the panel's bottom bar.
 * The `ui-` prefix keeps these clear of Bootstrap's own .btn/.card/.badge on the campaign page.
 */

:root {
  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) - 6px);
  --radius-md: calc(var(--radius) - 3px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);

  --background: #fbf3e4;
  --foreground: #2b1a1d;
  --card: #ffffff;
  --card-foreground: #2b1a1d;
  --primary: #9b1b30;
  --primary-hover: #7e1627;
  --primary-foreground: #ffffff;
  --primary-soft: #f9e9eb;
  --secondary: #f6ecdc;
  --secondary-foreground: #2b1a1d;
  --muted: #f6ecdc;
  --muted-foreground: #6b5a5c;
  --accent: #fbeff0;
  --accent-foreground: #4a0e1c;
  --destructive: #b42318;
  --destructive-soft: #fef0ee;
  --success: #4f6b3a;
  --success-soft: #eef3e6;
  --warning: #8f6b0c; /* Yalda gold, darkened so it reads as text */
  --warning-soft: #fbf3d9;
  --gold: #c9a227;
  --wine: #4a0e1c;
  --border: #ecdfcb;
  --input: #e2d3bb;
  --ring: #e3a0ab;
  --admin-header: #4a0e1c;

  --shadow-card: 0 1px 3px rgb(43 26 29 / 0.05);
  --shadow-md: 0 10px 24px -12px rgb(43 26 29 / 0.22), 0 2px 6px -2px rgb(43 26 29 / 0.08);
  --font-sans: "Kalameh", Tahoma, system-ui, sans-serif;
}

html {
  background: var(--background);
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------- Button ---------- */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.ui-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.ui-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(227 160 171 / 0.6);
}
.ui-btn:disabled,
.ui-btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}
.ui-btn--default {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 2px rgb(155 27 48 / 0.2);
}
.ui-btn--default:hover {
  background: var(--primary-hover);
  color: var(--primary-foreground);
}
.ui-btn--outline {
  border-color: var(--input);
  background: var(--card);
  color: var(--foreground);
}
.ui-btn--outline:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.ui-btn--outline-primary {
  border-color: rgb(155 27 48 / 0.4);
  background: var(--card);
  color: var(--primary);
}
.ui-btn--outline-primary:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui-btn--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.ui-btn--secondary:hover {
  background: #efe2cd;
}
.ui-btn--ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.ui-btn--link {
  height: auto;
  padding: 4px 2px;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.ui-btn--sm {
  height: 36px;
  padding: 0 12px;
  font-size: 12px;
}
.ui-btn--lg {
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
}
.ui-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
}
.ui-btn--icon-sm {
  width: 32px;
  height: 32px;
  padding: 0;
}
.ui-btn--block {
  width: 100%;
}
.ui-btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

/* ---------- Card ---------- */
.ui-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-card);
}
.ui-card--pad {
  padding: 20px;
}
.ui-card--hover {
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.ui-card--hover:hover {
  border-color: rgb(155 27 48 / 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.ui-card__title {
  margin: 0;
  color: var(--foreground);
  font-size: 16px;
  font-weight: 700;
}
.ui-card__desc {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 14px;
}

/* ---------- Badge ---------- */
.ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.ui-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.ui-badge--primary {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui-badge--success {
  background: var(--success-soft);
  color: var(--success);
}
.ui-badge--warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.ui-badge--destructive {
  background: var(--destructive-soft);
  color: var(--destructive);
}
.ui-badge--muted {
  background: var(--muted);
  color: var(--muted-foreground);
}

/* ---------- Heading icons and section headers ---------- */
/* the icon beside a title: the drawing alone, no circle around it, about as tall as the title */
.ui-head-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--primary);
}
/* the gold trophy over the leaderboards */
.ui-head-icon--gold {
  color: var(--gold);
}
.ui-head-icon svg,
.ui-head-icon img {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ui-section-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.ui-section-title {
  margin: 0;
  color: var(--foreground);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
}
.ui-section-desc {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.6;
}
@media (min-width: 992px) {
  .ui-section-title {
    font-size: 24px;
  }
}

/* ---------- Key–value and ranked lists ---------- */
.ui-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
}
.ui-list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
}
.ui-list > li + li {
  border-top: 1px solid var(--border);
}
/* a row with a background follows the list's rounded corners */
.ui-list > li:first-child {
  border-start-start-radius: calc(var(--radius-xl) - 1px);
  border-start-end-radius: calc(var(--radius-xl) - 1px);
}
.ui-list > li:last-child {
  border-end-start-radius: calc(var(--radius-xl) - 1px);
  border-end-end-radius: calc(var(--radius-xl) - 1px);
}

/* ---------- Leaderboards (the club page's and the shop page's): the first three in gold, silver
   and bronze, from the 4th on plain. The rank sits on a shiny medal, the row takes the medal's
   tint and the score its deep colour. ---------- */
.ui-list > li.is-top-1 {
  --medal-light: #f9e08a;
  --medal: #c49b1c;
  --medal-deep: #876806;
  --medal-tint: #fcf5dc;
}
.ui-list > li.is-top-2 {
  --medal-light: #f1f3f6;
  --medal: #9ba4af;
  --medal-deep: #5b6470;
  --medal-tint: #f3f4f6;
}
.ui-list > li.is-top-3 {
  --medal-light: #f2c7a2;
  --medal: #b46f3b;
  --medal-deep: #7b441d;
  --medal-tint: #f9ede3;
}
.ui-list > li:is(.is-top-1, .is-top-2, .is-top-3) {
  background: var(--medal-tint);
}
.ui-rank {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* the first three: Hugeicons' place medals (club-client.js), a shiny disc of the metal with its
   outline and number in the metal's deep colour, and the ribbon in the metal's colour */
.ui-rank--medal {
  background: none;
}
.ui-rank--medal svg {
  display: block;
  width: 118%;
  height: 118%;
  overflow: visible;
  filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--medal-deep) 30%, transparent));
}
.ui-rank--medal .medal-ribbon {
  stroke: var(--medal);
  stroke-width: 1.7;
}
.ui-rank--medal .medal-disc {
  stroke: var(--medal-deep);
}
.ui-rank--medal .medal-number {
  stroke: var(--medal-deep);
  stroke-width: 1.6;
}
.ui-rank--medal .medal-shine-a {
  stop-color: #fff;
  stop-opacity: 0.95;
}
.ui-rank--medal .medal-shine-b {
  stop-color: var(--medal-light);
}
li:is(.is-top-1, .is-top-2, .is-top-3) .ui-rank-score {
  color: var(--medal-deep);
}

/* ---------- States ---------- */
.ui-empty {
  justify-content: center;
  color: var(--muted-foreground);
  text-align: center;
}

/* =========================================================
   Liquid-glass navigation
   ========================================================= */
.liquid-bar {
  isolation: isolate;
  box-shadow:
    0 10px 34px -10px rgb(43 26 29 / 0.3),
    0 2px 8px -3px rgb(43 26 29 / 0.12);
}
.liquid-surface {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  /* frosted enough that the bar reads clearly over banners, cards and text alike */
  background: linear-gradient(180deg, rgb(255 255 255 / 0.86), rgb(255 255 255 / 0.74));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    inset 0 10px 18px -12px rgb(255 255 255 / 0.85),
    inset 0 -8px 16px -12px rgb(43 26 29 / 0.12);
}
/* the lens under the current item: glassy, but solid enough to read on anything behind it */
.liquid-lens {
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.7), rgb(255 255 255 / 0.35)),
    rgb(249 233 235 / 0.92);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.9),
    0 1px 3px rgb(43 26 29 / 0.12);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .liquid-surface {
    background: rgb(255 255 255 / 0.94);
  }
  .liquid-lens {
    background: rgb(201 162 39 / 0.18);
  }
}

.glass-lens {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

/* ----- GlassTabBar: phones ----- */
.glass-tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  padding: 0 12px calc(env(safe-area-inset-bottom) + 16px);
  pointer-events: none;
}
.glass-tabbar__bar {
  position: relative;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  height: 62px;
  max-width: 448px;
  margin-inline: auto;
  padding: 6px;
  border-radius: 999px;
  pointer-events: auto;
}
.glass-tabbar__item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #3d2a2d;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}
.glass-tabbar__item svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}
.glass-tabbar__item[aria-current="page"] {
  color: var(--primary);
  font-weight: 700;
}
.glass-tabbar__item[aria-current="page"] svg {
  stroke-width: 2;
}
.glass-tabbar__item:focus-visible,
.glass-topbar__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(227 160 171 / 0.6);
}
@media (min-width: 768px) {
  .glass-tabbar {
    display: none;
  }
}

/* ----- GlassTopBar: tablets and desktops ----- */
.glass-topbar {
  display: none;
}
@media (min-width: 768px) {
  .glass-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: block;
    padding: 12px 16px 0;
  }
  .glass-topbar__bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 56px;
    max-width: var(--page-max, 1024px);
    margin-inline: auto;
    padding-inline: 20px 8px;
    border-radius: 999px;
  }
}
.glass-topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
.glass-topbar__logo {
  display: block;
  border-radius: var(--radius-lg);
}
.glass-topbar__logo:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(227 160 171 / 0.6);
}
.glass-topbar__brand .y-logo {
  display: block;
  width: 136px;
  height: auto;
}
/* ---------- header on a phone: the logo alone ---------- */
.y-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 10px;
}
.y-header__logo {
  display: block;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
}
.y-header__logo:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(227 160 171 / 0.6);
}
.y-header__logo .y-logo {
  display: block;
  width: 160px;
  height: auto;
}
@media (min-width: 768px) {
  .y-header {
    display: none;
  }
}
.glass-topbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.glass-topbar__link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #3d2a2d;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.glass-topbar__link:hover {
  color: var(--foreground);
}
.glass-topbar__link svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}
.glass-topbar__link[aria-current="page"] {
  color: var(--primary);
  font-weight: 700;
}
.glass-topbar__link[aria-current="page"] svg {
  stroke-width: 2;
}
.glass-topbar__nav .ui-btn {
  position: relative;
  z-index: 1;
  height: 40px;
  margin-inline-start: 4px;
  border-radius: 999px;
}

/* No zoom on a phone when something is tapped twice quickly (a second tap on +, a button, a link):
   the page only scrolls and zooms with two fingers. */
html,
a,
button,
input,
select,
textarea,
label,
summary,
[role="button"] {
  touch-action: manipulation;
}

/* room under the page for the bar on phones: the bar (62px, 16px off the screen's foot) and 16px above it */
@media (max-width: 767.98px) {
  .has-tabbar {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-btn,
  .ui-card--hover {
    transition: none;
  }
}

/* the bottom of a page, now that no footer closes it (on a phone .has-tabbar leaves room for the bar) */
@media (min-width: 768px) {
  body.theme-yalda,
  body.club,
  body.shop {
    padding-bottom: 48px;
  }
}

/* the number of items in the cart, on «سبد خرید» (/ui/cart.js) */
.nav-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
}
/* as on Sabad: a 20px round badge at the cart's bottom right (the phone's bar; the desktop's below) */
.nav-badge {
  position: absolute;
  right: -13px;
  bottom: -7px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border: 1px solid #f0f0f0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
/* on the desktop bar: beside the cart's right edge, a little above its foot */
.glass-topbar__link .nav-badge {
  right: -11px;
  bottom: 8px;
}
