/* ═══════════════════════════════════════════════════════════════
   MOBILE NAVIGATION — "More" Drawer Pattern
   v5 — aggressive SafePal fix: no transforms, no slow transitions
   ═══════════════════════════════════════════════════════════════ */

/* ─── Nav Icons (visible on both desktop & mobile) ─── */
.nav-icon {
  font-style: normal;
  font-size: 16px;
  line-height: 1;
  display: none;
}

/* ─── More button — hidden on desktop ─── */
.nav-more-btn {
  display: none !important;
}

/* ─── Drawer — hidden on desktop ─── */
.nav-drawer-overlay,
.nav-drawer {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE: ≤768px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ─── ФИКС ПУСТОТЫ: html/body фон = цвет навбара ─── */
  html {
    background: #000c1e !important;
    background-color: #000c1e !important;
  }
  body {
    min-height: 100vh !important;
    min-height: 100dvh !important;
    background-color: #000c1e !important;
    overscroll-behavior: none !important;
  }

  /* Show icons on mobile */
  .nav-icon {
    display: block;
    font-size: 20px;
    margin-bottom: 2px;
  }

  /* ─── Bottom Nav Bar ─── */
  .main-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: stretch !important;
    gap: 4px !important;
    padding: 4px 4px 4px 4px !important;
    min-height: 52px !important;
    max-height: 60px !important;
    height: 56px !important;
    background: #000c1e !important;
    border-top: 2px solid rgba(255, 215, 0, 0.6) !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
    z-index: 9990 !important;
    backdrop-filter: blur(25px) !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
    transform: none !important;
    transition: none !important;
    margin: 0 !important;
    pointer-events: auto !important;
    /* ✅ НЕТ env() — SafePal его не поддерживает корректно */
  }

  /* ✅ Убираем ::after — не нужен без env() */

  /* Убираем ::before анимации от main.css/components.css */
  .main-nav::before,
  .nav-btn::before {
    display: none !important;
    content: none !important;
  }

  /* ─── Hide secondary buttons ─── */
  .nav-btn.nav-secondary {
    display: none !important;
  }

  /* ─── Show More button ─── */
  .nav-more-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 72px !important;
    min-height: 44px !important;
    padding: 4px 2px !important;
    border: none !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.5) !important;
    cursor: pointer !important;
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
    order: 99;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  .nav-more-btn span {
    display: block !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    margin-top: 1px !important;
    white-space: nowrap !important;
    color: inherit !important;
  }

  .nav-more-btn:active {
    opacity: 0.7 !important;
    transform: none !important;
  }

  .nav-more-btn.active,
  .nav-more-btn.drawer-open {
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.12) !important;
  }

  .nav-more-btn.drawer-open .nav-icon {
    transform: rotate(90deg) !important;
  }

  .nav-more-btn .nav-icon {
    font-size: 22px !important;
    transition: none !important;
  }

  /* ─── Nav Buttons — ZERO animation, instant response ─── */
  .nav-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 72px !important;
    min-height: 44px !important;
    padding: 4px 2px !important;
    border: none !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.5) !important;
    cursor: pointer !important;
    /* КРИТИЧНО: мгновенный отклик */
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
    position: relative !important;
    overflow: visible !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    /* ✅ Принудительно принимаем клики */
    pointer-events: auto !important;
    /* ✅ Убиваем margin/width из main.css */
    margin: 0 !important;
    width: auto !important;
  }

  .nav-btn span {
    display: block !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    margin-top: 1px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 64px !important;
    color: inherit !important;
  }

  .nav-btn .nav-icon {
    color: inherit !important;
    transition: none !important;
    transform: none !important;
  }

  /* ─── Active — мгновенный ─── */
  .nav-btn.active {
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.12) !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
  }

  .nav-btn.active .nav-icon {
    transform: none !important;
  }

  /* ─── Tap feedback — только opacity ─── */
  .nav-btn:active {
    opacity: 0.7 !important;
    transform: none !important;
  }

  /* ─── Hover — полностью отключаем на тач ─── */
  .nav-btn:hover,
  .nav-btn:focus {
    background: transparent !important;
    color: rgba(255, 255, 255, 0.5) !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
  }
  .nav-btn.active:hover,
  .nav-btn.active:focus {
    background: rgba(255, 215, 0, 0.12) !important;
    color: #ffd700 !important;
  }

  /* ─── Active indicator — убрана точка ─── */
  .nav-btn.active::after {
    display: none !important;
  }

  /* ─── Content padding ─── */
  .content {
    padding-bottom: 62px !important;
  }
  #dapp {
    padding-bottom: 62px !important;
  }

  /* ═══════════════════════════════════════════════════════════
     DRAWER OVERLAY
     ═══════════════════════════════════════════════════════════ */
  .nav-drawer-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9991;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .nav-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* ═══════════════════════════════════════════════════════════
     SLIDE-UP DRAWER
     ═══════════════════════════════════════════════════════════ */
  .nav-drawer {
    display: block !important;
    position: fixed !important;
    bottom: 58px !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    z-index: 9992 !important;
    background: linear-gradient(180deg, #0a1e3d 0%, #06142b 100%) !important;
    border: 2px solid rgba(255, 215, 0, 0.5) !important;
    border-radius: 16px !important;
    padding: 10px 12px 12px !important;
    margin: 0 !important;
    transform: translateY(calc(100% + 20px)) !important;
    opacity: 0 !important;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease, visibility 0s 0.3s !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    /* ✅ FIX: невидимый drawer НЕ должен перехватывать касания */
    pointer-events: none !important;
    visibility: hidden !important;
  }

  .nav-drawer.active {
    transform: translateY(0) !important;
    opacity: 1 !important;
    /* ✅ FIX: активный drawer принимает касания */
    pointer-events: auto !important;
    visibility: visible !important;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease, visibility 0s 0s !important;
  }

  .nav-drawer-handle {
    width: 32px !important;
    height: 3px !important;
    background: rgba(255, 215, 0, 0.35) !important;
    border-radius: 2px !important;
    margin: 0 auto 8px !important;
  }

  .nav-drawer-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .nav-drawer-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 14px !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.03)) !important;
    border: 1px solid rgba(255, 215, 0, 0.15) !important;
    border-radius: 12px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: none !important;
    transform: none !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    margin: 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .nav-drawer-item:active {
    opacity: 0.7 !important;
    transform: none !important;
  }

  .nav-drawer-item.active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1)) !important;
    border-color: rgba(255, 215, 0, 0.4) !important;
    color: #ffd700 !important;
  }

  .nav-drawer-item-icon {
    font-size: 20px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
  }

  .nav-drawer-item-label {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EXTRA SMALL: ≤380px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .nav-btn {
    max-width: 62px !important;
    min-height: 40px !important;
  }
  .nav-btn .nav-icon { font-size: 18px !important; }
  .nav-btn span { font-size: 8px !important; }
  .nav-drawer-grid { gap: 8px !important; }
  .nav-drawer-item { padding: 12px 12px !important; font-size: 12px !important; }
}
