/* PixelLife mobile bottom navigation */
.mobile-bottom-nav {
  display: none;
}

/* The category explorer is created by JavaScript only for mobile. Keep it
   explicitly hidden on desktop as a defensive fallback. */
@media (min-width: 769px) {
  .mobile-bottom-nav,
  .mobile-category-backdrop,
  .mobile-category-sheet {
    display: none !important;
  }
}

@media (max-width: 768px) {
  :root {
    --mobile-bottom-nav-height: 70px;
  }

  body {
    padding-bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
  }

  /* Mobile header: keep only the full-width search field. */
  .header {
    padding: 10px 16px !important;
  }

  .header-inner {
    height: auto !important;
    gap: 0 !important;
  }

  .header .logo,
  .header .header-actions,
  .navbar {
    display: none !important;
  }

  .header .search-bar {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    height: 46px;
    border-radius: 12px;
    background: #f8fafc;
  }

  .header .search-bar input {
    min-width: 0;
    font-size: 13px;
  }

  .header .search-btn {
    width: 46px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .header .search-btn i {
    margin: 0;
    font-size: 20px;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1800;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
    box-sizing: border-box;
    isolation: isolate;
    pointer-events: auto;
  }

  .mobile-bottom-nav__item {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #64748b;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    min-height: 56px;
    padding: 3px 0;
    cursor: pointer;
    border: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto;
  }

  /* متن، آیکون و بج جزئی از سطح لمس نیستند؛ کل ستون یک هدف لمس است. */
  .mobile-bottom-nav__item > * {
    pointer-events: none;
  }

  .mobile-bottom-nav__icon {
    width: 25px;
    height: 25px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: color 0.2s ease, transform 0.2s ease;
  }

  /* آیکون اختصاصی سبد خرید، مطابق تصویر ارسالی؛ فقط در ناوبری موبایل. */
  .mobile-bottom-nav__cart-image {
    width: 25px;
    height: 25px;
    display: block;
    object-fit: contain;
    opacity: .62;
    filter: invert(1);
    transition: opacity .2s ease, transform .2s ease;
  }
  .mobile-bottom-nav__cart-icon {
    object-fit: contain;
  }

  .mobile-bottom-nav__item.is-active {
    color: #2563eb;
  }

  .mobile-bottom-nav__item.is-active .mobile-bottom-nav__icon {
    transform: translateY(-1px);
    stroke-width: 2.2;
  }
  .mobile-bottom-nav__item.is-active .mobile-bottom-nav__cart-image {
    opacity: 1;
    transform: translateY(-1px) scale(1.04);
  }

  .mobile-bottom-nav__badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    display: none;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 12px;
    text-align: center;
    box-sizing: border-box;
  }

  .sticky-purchase-card {
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(24px + var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
  }

  body.mobile-category-sheet-open {
    overflow: hidden;
  }

  .mobile-category-backdrop {
    position: fixed;
    inset: 0 0 calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 1750;
    background: rgba(15, 23, 42, 0.3);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }

  .mobile-category-sheet {
    position: fixed;
    right: 0;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    left: 0;
    z-index: 1760;
    height: calc(100dvh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom));
    min-height: 440px;
    padding: 8px 0 0;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
    background: #fff;
    box-shadow: 0 -18px 48px rgba(15, 23, 42, 0.18);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, calc(100% + 24px), 0);
    will-change: transform, opacity;
    transition:
      transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 220ms ease;
  }

  .mobile-category-sheet.is-mounted,
  .mobile-category-backdrop.is-mounted {
    visibility: visible;
  }

  .mobile-category-sheet.is-open,
  .mobile-category-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-category-sheet.is-open {
    transform: translate3d(0, 0, 0);
  }

  .mobile-category-sheet.is-dragging {
    transition: none;
  }

  .mobile-category-sheet__handle {
    width: 42px;
    height: 4px;
    margin: 0 auto 8px;
    border-radius: 999px;
    background: #cbd5e1;
    touch-action: none;
  }

  .mobile-category-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid #e2e8f0;
  }

  .mobile-category-sheet__title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
  }

  .mobile-category-sheet__close {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
    font-size: 20px;
  }

  .mobile-category-sheet__tabs {
    display: flex;
    align-items: center;
    height: 52px;
    padding: 0 16px;
    border-bottom: 1px solid #e2e8f0;
  }

  .mobile-category-sheet__tab {
    position: relative;
    flex: 1;
    padding: 14px 0 12px;
    color: #2563eb;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
  }

  .mobile-category-sheet__tab::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: #2563eb;
  }

  .mobile-category-sheet__search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    margin: 9px 16px;
    padding: 0 11px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #f8fbff;
    color: #2563eb;
  }
  .mobile-category-sheet__search svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
  }
  .mobile-category-sheet__search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #0f172a;
    font: 600 13px Vazirmatn, sans-serif;
  }
  .mobile-category-sheet__search input::placeholder {
    color: #94a3b8;
  }
  .mobile-category-sheet__layout {
    display: grid;
    grid-template-columns: 126px minmax(0, 1fr);
    height: calc(100% - 172px);
    direction: rtl;
  }

  .mobile-category-sheet__rail {
    overflow-y: auto;
    border-left: 1px solid #e2e8f0;
    background: #f8fafc;
    overscroll-behavior: contain;
  }

  .mobile-category-sheet__rail-item {
    width: 100%;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 5px;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    border-right: 3px solid transparent;
    background: transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-category-sheet__rail-item svg {
    width: 31px;
    height: 31px;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* آیکون‌های تصویری دسته‌ها: هم‌اندازهٔ آیکون‌های قبلی در موبایل */
  .mobile-category-sheet__icon-image {
    width: 31px;
    height: 31px;
    display: block;
    flex: 0 0 31px;
    object-fit: contain;
  }
  .mobile-category-sheet__content-head .mobile-category-sheet__icon-image {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }
  .mobile-category-sheet__thumb .mobile-category-sheet__icon-image {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .mobile-category-sheet__rail-item.is-active {
    border-right-color: #2563eb;
    background: #fff;
    color: #2563eb;
  }
  .mobile-category-sheet__rail-badge {
    max-width: 100%;
    overflow: hidden;
    padding: 2px 6px;
    border-radius: 999px;
    background: #dbeafe;
    color: #2563eb;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .mobile-category-sheet__content {
    overflow-y: auto;
    padding: 20px 18px;
    overscroll-behavior: contain;
  }
  .mobile-category-sheet__content.is-changing > * {
    animation: mobile-category-content-in 180ms ease both;
  }
  @keyframes mobile-category-content-in {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
  }

  .mobile-category-sheet__content-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 800;
  }

  .mobile-category-sheet__content-head svg {
    width: 27px;
    height: 27px;
    stroke: #2563eb;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-category-sheet__content-desc {
    margin: -6px 0 16px;
    color: #94a3b8;
    font-size: 12px;
  }

  .mobile-category-sheet__link,
  .mobile-category-sheet__soon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 10px 2px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
  }

  .mobile-category-sheet__link-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }
  .mobile-category-sheet__thumb {
    width: 32px;
    height: 32px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    background: #eff6ff;
    color: #2563eb;
  }
  .mobile-category-sheet__thumb svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .mobile-category-sheet__link svg {
    width: 18px;
    height: 18px;
    stroke: #94a3b8;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-category-sheet__group {
    margin: 0 0 6px;
    border-bottom: 1px solid #f1f5f9;
  }

  .mobile-category-sheet__group > .mobile-category-sheet__link {
    min-height: 46px;
    border-bottom: 0;
  }

  .mobile-category-sheet__brand-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 0 42px 9px 0;
  }

  .mobile-category-sheet__brand-link {
    display: grid;
    min-width: 0;
    min-height: 31px;
    place-items: center;
    padding: 4px 3px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
    color: #2563eb;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-category-sheet__brand-link:nth-child(2) {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #334155;
  }

  .mobile-category-sheet__brand-link:nth-child(3) {
    border-color: #ffedd5;
    background: #fffaf3;
    color: #c2410c;
  }

  .mobile-category-sheet__soon {
    color: #94a3b8;
  }

  .mobile-category-sheet__soon small {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
  }

  .mobile-bottom-nav__item.is-expanded {
    color: #2563eb;
  }

  .mobile-bottom-nav__item.is-expanded .mobile-bottom-nav__icon {
    transform: translateY(-1px) scale(1.06);
    stroke-width: 2.2;
  }
  /* صفحه‌های فهرست برای کارت‌ها transition عمومی را خاموش می‌کنند. این
     استثنا باعث می‌شود پنل دسته‌بندی همیشه با حرکت کشویی طبیعی باز شود. */
  .mobile-category-backdrop {
    transition: opacity 240ms ease !important;
  }

  .mobile-category-sheet {
    transition:
      transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 220ms ease !important;
  }

  .mobile-category-sheet.is-dragging {
    transition: none !important;
  }

  .mobile-category-sheet__content.is-changing > * {
    animation: mobile-category-content-in 180ms ease both !important;
  }

}

@media (max-width: 768px) {
  /* لینک‌های تصویری پلی‌استیشن و ایکس‌باکس در کشوی دسته‌بندی */
  .mobile-category-sheet__console-logo-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 8px 0 4px;
  }
  .mobile-category-sheet__console-logo-link {
    min-height: 82px;
    display: grid;
    place-items: center;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #f8fbff;
  }
  .mobile-category-sheet__console-logo-link img {
    width: 54px;
    height: 54px;
    display: block;
    object-fit: contain;
  }
  .mobile-category-sheet__console-logo-link:active {
    border-color: #2563eb;
    background: #eff6ff;
  }
}


/* نوار ثابت پایین موبایل — سبک spotlight برای مسیر فعال */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    overflow: visible;
    background: #1b1b1b;
    border-top: 1px solid #353535;
    box-shadow: 0 -8px 22px rgba(0, 0, 0, .28);
  }

  .mobile-bottom-nav__item {
    overflow: visible;
    color: rgba(255, 255, 255, .58);
    transition: color .22s ease;
  }

  .mobile-bottom-nav__item::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 50%;
    z-index: 2;
    width: 44px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 12px rgba(255, 255, 255, .95);
    transform: translateX(50%) scaleX(0);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  }

  .mobile-bottom-nav__item::after {
    content: "";
    position: absolute;
    top: -15px;
    right: 50%;
    width: 50px;
    height: 66px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,.34), rgba(255,255,255,0));
    filter: blur(11px);
    transform: translateX(50%);
    transition: opacity .28s ease;
  }

  .mobile-bottom-nav__item.is-active,
  .mobile-bottom-nav__item.is-expanded {
    color: #fff;
  }

  .mobile-bottom-nav__item.is-active::before,
  .mobile-bottom-nav__item.is-expanded::before {
    transform: translateX(50%) scaleX(1);
  }

  .mobile-bottom-nav__item.is-active::after,
  .mobile-bottom-nav__item.is-expanded::after {
    opacity: 1;
  }

  .mobile-bottom-nav__item.is-active .mobile-bottom-nav__icon,
  .mobile-bottom-nav__item.is-expanded .mobile-bottom-nav__icon {
    transform: translateY(-2px) scale(1.05);
    stroke-width: 2.35;
  }

  .mobile-bottom-nav__badge {
    border-color: #1b1b1b;
  }
}


/* پنهان/نمایان‌شدن نوار هنگام اسکرول موبایل */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    transition: transform 240ms cubic-bezier(.22, 1, .36, 1), background-color .2s ease;
    will-change: transform;
  }
  .mobile-bottom-nav.is-scroll-hidden {
    transform: translate3d(0, calc(100% + env(safe-area-inset-bottom)), 0);
    pointer-events: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-nav { transition: none !important; }
}
