/* mobile-nav.css — оверлей мобильной навигации для pestix.ru (derat 0.8.0).
   Подключается через nginx sub_filter только на pestix.ru.
   Правила действуют ТОЛЬКО на экранах ≤767px (телефоны); десктоп не затрагивается.
   Всё в неймспейсе .mnv-* — конфликтов со стилями приложения нет. */

@media (max-width: 767px) {

  /* 1. Горизонтальная полоса вкладок в фиксированной шапке — скрываем
        (селектор строго внутри фикс-шапки; сайдбар десктопа не задет) */
  div.fixed.inset-x-0.top-0 nav[aria-label="Разделы"] {
    display: none !important;
  }

  /* 2. Спейсер под фикс-шапкой: была высота «шапка + полоса» (5.75rem+1px),
        остаётся только строка заголовка (3rem+1px) */
  .h-\[calc\(3rem\+2\.75rem\+1px\)\] {
    height: calc(3rem + 1px) !important;
  }

  /* 3. Кнопка-гамбургер в строке заголовка (вставляется скриптом первым элементом) */
  .mnv-burger {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 2px 0 -4px;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #57534e; /* stone-600 */
    cursor: pointer;
    touch-action: manipulation;
  }
  .mnv-burger:active {
    background: #e7e5e4; /* stone-200 */
  }
  .mnv-burger svg {
    width: 22px;
    height: 22px;
  }

  /* 4. Затемнение */
  .mnv-scrim {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.mnv-open .mnv-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  /* 5. Левая панель (как сайдбар десктопной версии) */
  .mnv-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483001;
    width: min(85vw, 20rem);
    background: #fff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0.25, 1);
    visibility: hidden;
    font-family: inherit;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  body.mnv-open .mnv-drawer {
    transform: translateX(0);
    visibility: visible;
  }
  body.mnv-open {
    overflow: hidden !important;
  }

  /* Шапка панели */
  .mnv-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 16px;
    border-bottom: 1px solid #e7e5e4;
    min-height: 56px;
  }
  .mnv-head-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: #292524; /* stone-800 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mnv-close {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #78716c; /* stone-500 */
    cursor: pointer;
  }
  .mnv-close:active {
    background: #e7e5e4;
  }
  .mnv-close svg {
    width: 20px;
    height: 20px;
  }

  /* Список разделов */
  .mnv-list {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  /* Заголовок группы разделов (как в десктопном сайдбаре) */
  .mnv-group {
    padding: 12px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #a8a29e; /* stone-400 */
    user-select: none;
    -webkit-user-select: none;
  }
  .mnv-group:first-child {
    padding-top: 2px;
  }
  .mnv-item {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    margin: 0;
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    color: #44403c; /* stone-700 */
    cursor: pointer;
    transition: background-color 0.15s ease;
  }
  .mnv-item:active {
    background: #f5f5f4; /* stone-100 */
  }
  .mnv-item .mnv-ico {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f5f5f4;
    color: #57534e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .mnv-item .mnv-ico svg {
    width: 18px;
    height: 18px;
  }
  .mnv-item .mnv-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mnv-item .mnv-badge {
    flex: 0 0 auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
  }
  .mnv-item .mnv-arrow {
    flex: 0 0 auto;
    color: var(--mnv-accent, #0f766e);
    display: none;
  }
  .mnv-item .mnv-arrow svg {
    width: 16px;
    height: 16px;
  }

  /* Активный раздел — как активная вкладка/сайдбар приложения (bg-primary) */
  .mnv-item.mnv-active {
    background: var(--mnv-accent, #0f766e);
    color: #fff;
  }
  .mnv-item.mnv-active .mnv-ico {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
  }
  .mnv-item.mnv-active .mnv-arrow {
    display: inline-flex;
  }

  /* Низ панели: пользователь и выход */
  .mnv-foot {
    border-top: 1px solid #e7e5e4;
    padding: 10px 10px 12px;
  }
  .mnv-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 10px;
  }
  .mnv-user .mnv-ava {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #ccfbf1; /* teal-100 */
    color: #115e59; /* teal-800 */
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .mnv-user .mnv-name {
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    color: #292524;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mnv-logout {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    margin: 0;
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #dc2626;
    cursor: pointer;
  }
  .mnv-logout:active {
    background: #fef2f2; /* red-50 */
  }
  .mnv-logout svg {
    width: 18px;
    height: 18px;
  }

  /* Уважаем настройку «меньше движения» */
  @media (prefers-reduced-motion: reduce) {
    .mnv-drawer,
    .mnv-scrim {
      transition: none;
    }
  }
}

/* На десктопе (≥768px) всё выключено на уровне CSS — панель не создать */
@media (min-width: 768px) {
  .mnv-burger,
  .mnv-scrim,
  .mnv-drawer {
    display: none !important;
  }
}
