/* ============================================================
   WHIEDA Marketplace — Мобильный таббар (Premium Liquid Glass)
   5 кнопок: Каталог · Бизнес · [Корзина FAB] · Блог · Ещё
   ============================================================ */

/* Показываем только на мобильных */
.mnav { display: none; }

@media (max-width: 899px) {
  .mnav {
    display: grid;
    grid-template-columns: 1fr 1fr 90px 1fr 1fr;
    align-items: center;
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    z-index: 90;

    /* Жидкое стекло — многослойный backdrop */
    background:
      linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.55));
    backdrop-filter: blur(24px) saturate(180%) brightness(1.05);
    -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(1.05);

    border-radius: 32px;
    padding: 8px 6px;
    height: 74px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));

    /* Многослойный border + shadows для глубины */
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow:
      /* Внутренний highlight (стеклянный блик сверху) */
      inset 0 1px 0 rgba(255, 255, 255, 0.95),
      inset 0 -1px 0 rgba(255, 255, 255, 0.35),
      /* Наружные тени */
      0 10px 40px rgba(15, 93, 75, 0.18),
      0 4px 12px rgba(15, 93, 75, 0.10),
      0 2px 4px rgba(0, 0, 0, 0.06);
    /* overflow: visible — чтобы FAB выходил вверх за пределы таббара */
    overflow: visible;
    isolation: isolate;
  }

  /* Обертка для светящихся эффектов внутри — она чей-то overflow:hidden */
  .mnav::before,
  .mnav::after {
    clip-path: inset(0 round 32px);
  }

  /* Перелив: медленно движущийся conic-gradient блик */
  .mnav::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(
      from 0deg,
      transparent 0deg,
      rgba(31, 169, 131, 0.10) 60deg,
      transparent 120deg,
      rgba(1, 105, 111, 0.08) 200deg,
      transparent 260deg,
      rgba(31, 169, 131, 0.10) 320deg,
      transparent 360deg
    );
    animation: mnavShine 12s linear infinite;
    z-index: -1;
    pointer-events: none;
  }
  @keyframes mnavShine {
    to { transform: rotate(360deg); }
  }

  /* Sheen — светящаяся диагональная полоса, проходит раз в 6 сек */
  .mnav::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(
      110deg,
      transparent 30%,
      rgba(255, 255, 255, 0.4) 50%,
      transparent 70%
    );
    animation: mnavSheen 6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    z-index: -1;
    pointer-events: none;
  }
  @keyframes mnavSheen {
    0%, 100% { transform: translateX(-100%); opacity: 0; }
    45% { opacity: 1; }
    55% { opacity: 1; }
    50%, 100% { transform: translateX(200%); }
  }

  /* Обычная кнопка (4 шт по краям) */
  .mnav-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    text-decoration: none;
    color: var(--mut);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      color 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
      transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
  }

  /* Подложка активной кнопки — жидкий glass pill с glow */
  .mnav-btn::before {
    content: '';
    position: absolute;
    inset: 4px 8px;
    border-radius: 16px;
    background:
      radial-gradient(circle at 50% 40%,
        rgba(31, 169, 131, 0.22),
        rgba(31, 169, 131, 0.08) 60%,
        transparent 100%);
    opacity: 0;
    transform: scale(0.85);
    transition:
      opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
      transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: -1;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.8),
      inset 0 -1px 0 rgba(31, 169, 131, 0.15),
      0 0 20px rgba(31, 169, 131, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.6);
  }

  /* Иконка — Phosphor (fill=currentColor) */
  .mnav-btn svg {
    width: 24px; height: 24px;
    transition:
      transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
      filter 0.35s ease;
  }
  .mnav-btn span {
    font-size: 10.5px;
    letter-spacing: -0.01em;
    transition: font-weight 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* Hover — subtle lift */
  .mnav-btn:hover {
    color: var(--ink);
  }
  .mnav-btn:hover svg {
    transform: translateY(-2px) scale(1.06);
  }

  /* Active tap — параллакс сжатие */
  .mnav-btn:active {
    transform: scale(0.94);
  }
  .mnav-btn:active svg {
    transform: scale(0.88);
  }

  /* is-active: pill появляется, иконка увеличена, цвет градиент */
  .mnav-btn.is-active {
    color: var(--acc-2);
  }
  .mnav-btn.is-active::before {
    opacity: 1;
    transform: scale(1);
  }
  .mnav-btn.is-active svg {
    transform: scale(1.12);
    filter: drop-shadow(0 3px 6px rgba(1, 105, 111, 0.4));
  }
  .mnav-btn.is-active span {
    font-weight: 800;
  }

  /* Пульсирующий glow на активной кнопке */
  .mnav-btn.is-active::after {
    content: '';
    position: absolute;
    inset: 4px 8px;
    border-radius: 16px;
    background: radial-gradient(ellipse at center,
      rgba(31, 169, 131, 0.18),
      transparent 65%);
    animation: mnavPulse 2.5s ease-in-out infinite;
    z-index: -2;
    pointer-events: none;
  }
  @keyframes mnavPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
  }

  /* Центральная FAB (корзина) — премиум glass с двойным свечением */
  .mnav-fab {
    justify-self: center;
    align-self: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 30% 25%, rgba(255,255,255,0.4), transparent 55%),
      linear-gradient(135deg, var(--acc) 0%, var(--acc-2) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;

    /* Двойной border: белый + внутренний тонкий */
    border: 4px solid rgba(255,255,255,0.95);
    box-shadow:
      /* Внутренний блик */
      inset 0 2px 4px rgba(255, 255, 255, 0.4),
      inset 0 -2px 4px rgba(0, 0, 0, 0.15),
      /* Свечение вокруг */
      0 0 0 1px rgba(31, 169, 131, 0.2),
      0 8px 24px rgba(31, 169, 131, 0.45),
      0 3px 8px rgba(15, 93, 75, 0.25);
    position: relative;
    transform: translateY(-18px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: mnavFabFloat 4s ease-in-out infinite;
  }
  @keyframes mnavFabFloat {
    0%, 100% { transform: translateY(-18px); }
    50% { transform: translateY(-21px); }
  }
  .mnav-fab:hover {
    animation-play-state: paused;
    transform: translateY(-22px) scale(1.05);
  }
  .mnav-fab:active {
    animation-play-state: paused;
    transform: translateY(-16px) scale(0.94);
  }

  /* Ring pulse вокруг FAB — «дыхание» */
  .mnav-fab::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(31, 169, 131, 0.35);
    opacity: 0;
    animation: mnavFabRing 3s ease-out infinite;
    pointer-events: none;
  }
  @keyframes mnavFabRing {
    0% { opacity: 0.7; transform: scale(0.9); }
    100% { opacity: 0; transform: scale(1.25); }
  }

  .mnav-fab svg {
    width: 30px; height: 30px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  }
  .mnav-fab-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 20px; height: 20px;
    border-radius: 10px;
    padding: 0 5px;
    background: linear-gradient(135deg, #FF7A5A, #E45D3A);
    color: var(--white);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.4),
      0 2px 6px rgba(228, 93, 58, 0.5);
    border: 2px solid var(--white);
    z-index: 2;
  }
  .mnav-fab-badge[hidden] { display: none; }

  /* Даём место таббару */
  body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  /* Прячем старый бургер и sticky-bar на страницах товара */
  .burger-btn { display: none; }
  .pdp-sticky-bar { display: none; }
  body.has-sticky-bar { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* Прячем desktop-nav и hdr-cart на мобилке */
  .hdr .nav { display: none; }
  .hdr .hdr-cart { display: none; }
  .hdr-in { justify-content: center; }

  /* Прячем старое мобильное меню */
  .nav-mobile, .nav-backdrop { display: none !important; }

  /* Поднимаем cookie-баннер над таббаром */
  .cookie-banner {
    left: 12px; right: 12px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
    padding: 14px 16px !important;
    gap: 10px !important;
    max-width: none !important;
    border-radius: 18px !important;
    z-index: 95 !important;
  }
  .cookie-banner p {
    font-size: 12.5px !important;
    line-height: 1.45 !important;
    flex: 1 1 100% !important;
    margin: 0 !important;
  }
  .cookie-banner-actions {
    flex: 0 0 auto !important;
    width: 100% !important;
  }
  .cookie-banner-actions .btn {
    width: 100%;
    padding: 12px 20px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }
}

/* Reduce motion — уважаем настройки пользователя */
@media (prefers-reduced-motion: reduce) {
  .mnav::before,
  .mnav::after,
  .mnav-fab,
  .mnav-fab::before,
  .mnav-btn.is-active::after {
    animation: none !important;
  }
}

/* ============================================================
   Overlay «Ещё» — bottom sheet
   ============================================================ */
.mnav-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 42, 36, 0.5);
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mnav-sheet-backdrop.is-open {
  display: block;
  opacity: 1;
}

.mnav-sheet {
  display: none;
  position: fixed;
  left: 12px; right: 12px;
  bottom: 96px;
  z-index: 101;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 -8px 40px rgba(15, 93, 75, 0.2),
    0 4px 12px rgba(15, 93, 75, 0.08);
  transform: translateY(30px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  max-height: 75vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mnav-sheet.is-open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
@media (min-width: 900px) {
  .mnav-sheet, .mnav-sheet-backdrop { display: none !important; }
}
.mnav-sheet-hdr {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mnav-sheet-hdr h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.mnav-sheet-close {
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--mut);
  line-height: 0;
}
.mnav-sheet-close svg { width: 20px; height: 20px; }

.mnav-sheet-list {
  padding: 8px 8px 20px;
}
.mnav-sheet-section {
  padding-top: 8px;
}
.mnav-sheet-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mut);
  padding: 10px 14px 6px;
}
.mnav-sheet-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.mnav-sheet-link:hover,
.mnav-sheet-link:active {
  background: var(--acc-soft);
  color: var(--acc-2);
}
.mnav-sheet-link-icon {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--acc-soft);
  color: var(--acc-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mnav-sheet-link-icon svg { width: 18px; height: 18px; }
.mnav-sheet-link-title { flex: 1; }
.mnav-sheet-link-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--mut);
  margin-top: 2px;
}
.mnav-sheet-link-arrow {
  color: var(--mut);
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}
