/* ناوبری سراسری موبایل و پنجره دسته‌بندی‌ها؛ هماهنگ با طراحی پروفایل */
.ua-bnav {
  --ua-muted: #8c7a83;
  --ua-line: #f0dde6;
  --ua-action: #C2427F;
  display: none;
}

@media (max-width: 767.98px) {
  :root { --cm-mobile-nav-height: 60px; }
  body { padding-bottom: calc(var(--cm-mobile-nav-height) + env(safe-area-inset-bottom, 0px)); }

  .ua-bnav, .ua-bnav * { box-sizing: border-box; }
  .ua-bnav {
    display: flex;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1025;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,.98);
    border-top: 1px solid var(--ua-line);
    box-shadow: 0 -3px 16px rgba(90, 45, 70, .05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    direction: rtl;
  }
  .ua-bnav > a, .ua-bnav > button {
    flex: 1 1 0;
    min-width: 0;
    min-height: var(--cm-mobile-nav-height);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 7px 2px;
    margin: 0;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--ua-muted);
    font: inherit;
    font-size: 10.5px;
    line-height: 1.3;
    font-weight: 400;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .ua-bnav > :is(a,button):is(.is-active,[aria-expanded="true"]) {
    color: var(--ua-action);
    font-weight: 700;
  }
  .ua-bnav > :is(a,button):focus-visible {
    outline: 2px solid var(--ua-action);
    outline-offset: -4px;
  }
  .ua-bnav-ico { position: relative; display: inline-flex; line-height: 1; font-size: 21px; }
  .ua-bnav-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    color: #fff;
    background: var(--ua-action);
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
  }

  /* در موبایل دکمه دسته‌بندی هدر حذف و همان منو از نوار پایین باز می‌شود. */
  .cm-hdr .cm-menu, .cm-hdr .cm-cart { display: none; }

  /* منوی کناری دسکتاپ در موبایل به یک پاپ‌آپ وسط صفحه تبدیل می‌شود. */
  .cm-overlay { z-index: 1100; }
  .cm-drawer {
    z-index: 1101;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(420px, calc(100vw - 32px));
    max-height: min(74dvh, 640px);
    padding-top: 0;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 16px 60px rgba(45,20,35,.24);
    transform: translate(-50%, -46%) scale(.97);
    transition: transform .22s ease, opacity .22s ease, visibility .22s;
    opacity: 0;
  }
  html.cm-menu-open .cm-drawer {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .cm-dh { flex: 0 0 auto; padding: 12px 16px; }
  .cm-dn { min-height: 0; overscroll-behavior: contain; padding: 8px 14px 20px; }
  .cm-dn > h2 { margin-top: 8px; }
  .cm-dn > a, .cm-dn > details { border-bottom: 1px solid var(--cm-line); }
  .cm-dn > details:last-of-type { border-bottom: 0; }
  .cm-extra { display: none; }

  /* نوارهای خرید/پرداخت مستقل باید بالای ناوبری سراسری بمانند. */
  body .lux-product-page .cm-fixed-buybar {
    bottom: calc(var(--cm-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: 9px;
  }
  body .ck-bar {
    bottom: calc(var(--cm-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: 12px;
  }
  body .cart-mobile-actions {
    bottom: calc(var(--cm-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ua-bnav *, .cm-drawer { transition: none !important; }
}
