/* ==========================================================================
   Liquid Glass — زبان طراحی اپل
   توکن‌های شیشه + تب‌بار شناور پایین (کپسول). این فایل آخرین لایه‌ی CSS است.
   ========================================================================== */

:root {
  /* سطح شیشه: پس‌زمینه‌ی نیمه‌شفاف، لبه‌ی روشن و سایه‌ی نرم */
  --lg-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.54));
  --lg-border: rgba(255, 255, 255, 0.72);
  --lg-highlight: rgba(255, 255, 255, 0.95);
  --lg-edge: rgba(0, 0, 0, 0.05);
  --lg-shadow: 0 12px 32px rgba(20, 24, 40, 0.14), 0 2px 8px rgba(20, 24, 40, 0.08);
  --lg-blur: blur(28px) saturate(190%);
  /* «لنز» آیتم فعال: شیشه‌ی روشن‌تر روی خود شیشه */
  --lg-lens-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.7));
  --lg-lens-shadow: 0 2px 10px rgba(20, 24, 40, 0.14), inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  --lg-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --lg-bg: linear-gradient(180deg, rgba(58, 58, 62, 0.66), rgba(34, 34, 38, 0.5));
  --lg-border: rgba(255, 255, 255, 0.16);
  --lg-highlight: rgba(255, 255, 255, 0.22);
  --lg-edge: rgba(0, 0, 0, 0.4);
  --lg-shadow: 0 14px 36px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --lg-lens-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.1));
  --lg-lens-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* تب‌بار فقط روی عرض‌های کمتر از ۹۰۰ دیده می‌شود (مطابق aiqio.css) */
@media (max-width: 899px) {
  :root {
    --bottom-nav-h: 68px;
    --bottom-nav-gap: 12px;
  }

  /* فضای خالی انتهای صفحه تا محتوا زیر کپسول نرود */
  html body,
  html body[data-page] {
    padding-bottom: calc(var(--bottom-nav-h) + var(--bottom-nav-gap) + env(safe-area-inset-bottom, 0px) + 16px);
  }

  html body .bottom-nav {
    position: fixed;
    inset-inline: 14px;
    bottom: calc(var(--bottom-nav-gap) + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 2px;
    height: var(--bottom-nav-h);
    max-width: 520px;
    margin-inline: auto;
    padding: 6px;
    border: 1px solid var(--lg-border);
    border-radius: 999px;
    background: var(--lg-bg);
    -webkit-backdrop-filter: var(--lg-blur);
    backdrop-filter: var(--lg-blur);
    box-shadow: var(--lg-shadow), inset 0 1px 0 var(--lg-highlight), inset 0 -1px 0 var(--lg-edge);
  }

  html body .bottom-nav a {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.25s var(--lg-spring), background-color 0.25s var(--lg-spring), box-shadow 0.25s var(--lg-spring), transform 0.35s var(--lg-spring);
  }

  html body .bottom-nav a svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
  }

  html body .bottom-nav a:hover {
    color: var(--text-primary);
  }

  html body .bottom-nav a:active {
    transform: scale(0.92);
  }

  html body .bottom-nav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  /* آیتم فعال: لنز شیشه‌ای روشن‌تر + رنگ تأکید */
  html body .bottom-nav a[aria-current="page"] {
    color: var(--accent);
    background: var(--lg-lens-bg);
    box-shadow: var(--lg-lens-shadow);
  }

  /* نشان تعداد سبد (بالای آیکون) */
  html body .bottom-nav .bn-badge {
    position: absolute;
    top: 3px;
    inset-inline-start: calc(50% + 4px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: #ff3b30;
    border-radius: 99px;
    box-shadow: 0 0 0 2px var(--bg-base);
  }

  /* مرورگر بدون backdrop-filter یا کاربری که شفافیت کم را خواسته: سطح مات */
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html body .bottom-nav {
      background: var(--bg-elevated);
    }
  }

  @media (prefers-reduced-transparency: reduce) {
    html body .bottom-nav {
      background: var(--bg-elevated);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html body .bottom-nav a {
      transition: none;
    }
    html body .bottom-nav a:active {
      transform: none;
    }
  }
}

/* ==========================================================================
   کنترل‌های اپلی: فیلد جستجو (کپسول با پرکننده‌ی سیستمی)، دکمه‌های کشویی (pull-down)،
   تگ‌ها و صفحه‌بندی، روی کارت شیشه‌ای
   ========================================================================== */
:root {
  --lg-fill: rgba(118, 118, 128, 0.12);
  --lg-fill-hover: rgba(118, 118, 128, 0.18);
}

[data-theme="dark"] {
  --lg-fill: rgba(118, 118, 128, 0.24);
  --lg-fill-hover: rgba(118, 118, 128, 0.32);
}

html body .pf {
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--lg-border);
  border-radius: 28px;
  background: var(--lg-bg);
  -webkit-backdrop-filter: var(--lg-blur);
  backdrop-filter: var(--lg-blur);
  box-shadow: 0 8px 28px rgba(20, 24, 40, 0.08), inset 0 1px 0 var(--lg-highlight), inset 0 -1px 0 var(--lg-edge);
}

/* فیلد جستجو مثل UISearchBar: کپسول، بدون خط دور، آیکون ذره‌بین خاکستری */
html body .pf-search-input {
  height: 44px;
  padding-inline: 44px 96px;
  border: 0;
  border-radius: 999px;
  background: var(--lg-fill);
  box-shadow: none;
  font-size: 1rem;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html body .pf-search-input:hover {
  background: var(--lg-fill-hover);
}

html body .pf-search-input:focus {
  background: var(--lg-fill-hover);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 35%, transparent);
}

html body .pf-search-icon {
  inset-inline-start: 15px;
  color: var(--text-muted);
}

html body .pf-search-btn {
  inset-inline-end: 5px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 0.8125rem;
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

/* عنوان گروه (caption) و دکمه‌ی کشویی با شورون بالا/پایین */
html body .pf-label {
  padding-inline: 14px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

html body .pf-select {
  height: 44px;
  padding-inline: 16px 38px;
  border: 0;
  border-radius: 999px;
  font-weight: 500;
  background-color: var(--lg-fill);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3C/svg%3E");
  background-position: left 15px center;
  box-shadow: none;
}

html body .pf-select:hover {
  background-color: var(--lg-fill-hover);
}

html body .pf-select:focus {
  background-color: var(--lg-fill-hover);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 35%, transparent);
}

/* فهرست باز select در حالت شب خوانا بماند */
[data-theme="dark"] .pf-select option {
  background: #2c2c2e;
  color: #fff;
}

html body .pf-tag {
  font-weight: 500;
  background: color-mix(in oklch, var(--accent) 13%, transparent);
}

/* صفحه‌بندی کپسولی */
html body .pager a {
  border: 0;
  border-radius: 999px;
  background: var(--lg-fill);
  transition: background-color 0.2s var(--lg-spring), transform 0.2s var(--lg-spring);
}

html body .pager a:hover {
  background: var(--lg-fill-hover);
}

html body .pager a:active {
  transform: scale(0.95);
}

html body .pager a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 8px color-mix(in oklch, var(--accent) 45%, transparent);
}

@media (prefers-reduced-transparency: reduce) {
  html body .pf {
    background: var(--bg-card);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* ==========================================================================
   هدر: نوار ناوبری شیشه‌ای اپل (خط مویی، بلور، آیکون‌های دایره‌ای، منوی کپسولی)
   ========================================================================== */
:root {
  --lg-nav-bg: rgba(250, 250, 252, 0.72);
  --lg-nav-sep: rgba(60, 60, 67, 0.2);
}

[data-theme="dark"] {
  --lg-nav-bg: rgba(28, 28, 30, 0.72);
  --lg-nav-sep: rgba(84, 84, 88, 0.65);
}

html body .site-header {
  background: var(--lg-nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 0.5px solid var(--lg-nav-sep);
  box-shadow: none;
}

/* لوگو: آیکون اپلیکیشن با گوشه‌ی پیوسته و گرادیان */
html body .site-header .logo {
  font-weight: 700;
  letter-spacing: -0.03em;
}

html body .site-header .logo-mark {
  border-radius: 24%;
  background: linear-gradient(180deg, #5eb0ff, #0a74ff);
  box-shadow: 0 2px 6px rgba(10, 116, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* دکمه‌های آیکونی: دایره، با پرکننده‌ی سیستمی هنگام hover و فشردن */
html body .site-header .nav-actions .icon-btn {
  border-radius: 50%;
  color: var(--text-primary);
  transition: background-color 0.2s var(--lg-spring), transform 0.3s var(--lg-spring);
}

html body .site-header .nav-actions .icon-btn svg {
  stroke-width: 1.8;
}

html body .site-header .nav-actions .icon-btn:hover {
  background: var(--lg-fill);
}

html body .site-header .nav-actions .icon-btn:active {
  background: var(--lg-fill-hover);
  transform: scale(0.9);
}

html body .site-header .nav-actions .icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* موبایل/تبلت: سبد و علاقه‌مندی در تب‌بار پایین‌اند؛ تکراری در هدر نباشند */
@media (max-width: 899px) {
  html body .site-header .nav-dup {
    display: none;
  }
}

/* دسکتاپ: منوی اصلی مثل کنترل سگمنتی اپل (کپسول با لنز برای صفحه‌ی فعال) */
@media (min-width: 900px) {
  html body .site-header .nav-links {
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--lg-fill);
  }

  html body .site-header .nav-links a {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    transition: color 0.2s var(--lg-spring), background-color 0.2s var(--lg-spring), box-shadow 0.2s var(--lg-spring);
  }

  html body .site-header .nav-links a:hover {
    color: var(--text-primary);
    background: transparent;
  }

  html body .site-header .nav-links a[aria-current="page"] {
    color: var(--text-primary);
    background: var(--lg-lens-bg);
    box-shadow: var(--lg-lens-shadow);
  }
}

/* ورود / خروج: کپسول */
html body .site-header .nav-login,
html body .site-header .nav-logout {
  border-radius: 999px;
  font-weight: 600;
}

html body .site-header .nav-login {
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

/* جستجوی بازشونده‌ی هدر: کپسول با پرکننده‌ی سیستمی */
html body .site-header .search-form {
  border: 0;
  border-radius: 999px;
  background: var(--lg-fill);
  box-shadow: none;
}

html body .site-header .search-form:focus-within {
  background: var(--lg-fill-hover);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 35%, transparent);
}

html body .site-header .search-input {
  background: transparent;
  border: 0;
  box-shadow: none;
}

@media (prefers-reduced-transparency: reduce) {
  html body .site-header {
    background: var(--bg-elevated);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .site-header .nav-actions .icon-btn {
    transition: none;
  }
  html body .site-header .nav-actions .icon-btn:active {
    transform: none;
  }
}

/* ==========================================================================
   فیلدهای فرم (ورود، ثبت‌نام، پنل‌ها): پرکننده‌ی سیستمی اپل، بدون خط دور
   ========================================================================== */
html body .input,
html body .select,
html body .textarea {
  border: 0;
  border-radius: 14px;
  background-color: var(--lg-fill);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: background-color 0.2s var(--lg-spring), box-shadow 0.2s var(--lg-spring);
}

html body .input:hover,
html body .select:hover,
html body .textarea:hover {
  background-color: var(--lg-fill-hover);
}

html body .input:focus,
html body .select:focus,
html body .textarea:focus,
html body .input:focus-visible,
html body .select:focus-visible,
html body .textarea:focus-visible {
  outline: none;
  background-color: var(--lg-fill-hover);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 35%, transparent);
}

html body .field > label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}
