/* =====================================================
   CYBERPROBD — Mobile Bottom Navigation
   Author: MD Abu Bokkar
   Version: v12.0 — Complete New
   Build: January 2026

   🎯 PURPOSE:
   Glassmorphism-style bottom navigation bar for mobile.
   Shows only on screens ≤ 900px wide.
   Hidden on desktop and print.

   📱 ITEMS:
   Home · Trading · Search · Services · Portfolio

   🎨 STYLE:
   - Glassmorphism blur background
   - Active item = pill highlight with gradient
   - Safe-area support (iPhone notch)
   - Smooth tap animations
   - Hidden when mobile menu is open
   ===================================================== */

/* ============================================
   BOTTOM NAVIGATION — BASE
   ============================================ */
.mobile-nav {
  display: none; /* hidden by default, shown on mobile */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;

  /* Glassmorphism */
  background: rgba(15, 10, 34, 0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);

  /* Border top */
  border-top: 1px solid rgba(139, 92, 246, 0.18);

  /* Safe area for iPhone home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0px);

  /* Shadow upward */
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
}

/* Light theme */
[data-theme="light"] .mobile-nav {
  background: rgba(255, 255, 255, 0.88);
  border-top-color: rgba(124, 58, 237, 0.15);
  box-shadow: 0 -8px 32px rgba(10, 6, 24, 0.08);
}

/* ============================================
   NAV ITEMS CONTAINER
   ============================================ */
.mobile-nav-list {
  display: flex;
  align-items: center;
  justify-content: space-around;
  list-style: none;
  margin: 0;
  padding: 8px 6px;
  gap: 2px;
}

/* ============================================
   INDIVIDUAL NAV ITEM
   ============================================ */
.mobile-nav-item {
  flex: 1;
  min-width: 0;
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-3, #7a7098);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-height: 48px;
}

/* Icon */
.mobile-nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  flex-shrink: 0;
}

.mobile-nav-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2;
  transition: stroke 0.25s ease;
}

/* Label */
.mobile-nav-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1;
  transition: color 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ============================================
   ACTIVE STATE — Pill Highlight
   ============================================ */
.mobile-nav-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #ec4899 100%);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
}

.mobile-nav-link.active .mobile-nav-icon {
  transform: translateY(-1px) scale(1.05);
}

.mobile-nav-link.active .mobile-nav-label {
  color: #ffffff;
  font-weight: 700;
}

/* Light theme active */
[data-theme="light"] .mobile-nav-link.active {
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}

/* ============================================
   TAP / HOVER FEEDBACK
   ============================================ */
.mobile-nav-link:active {
  transform: scale(0.94);
}

.mobile-nav-link:not(.active):hover {
  color: var(--text, #ffffff);
  background: rgba(139, 92, 246, 0.08);
}

[data-theme="light"] .mobile-nav-link:not(.active):hover {
  color: var(--text, #0a0618);
  background: rgba(124, 58, 237, 0.06);
}

/* Focus visible (accessibility) */
.mobile-nav-link:focus-visible {
  outline: 2px solid #ec4899;
  outline-offset: 2px;
}

/* ============================================
   SEARCH ITEM — Special Treatment
   (middle button slightly different)
   ============================================ */
.mobile-nav-link.mobile-nav-search {
  position: relative;
}

.mobile-nav-link.mobile-nav-search .mobile-nav-icon {
  width: 24px;
  height: 24px;
}

/* ============================================
   SHOW ONLY ON MOBILE
   ============================================ */
@media (max-width: 900px) {
  .mobile-nav {
    display: block;
  }

  /* Add bottom padding to body so content isn't hidden behind nav */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Move float-top button above bottom nav */
  .float-btn.float-top {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Move WhatsApp widget above bottom nav */
  .wa-widget {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* WhatsApp widget box — adjust position */
  .wa-widget-box {
    bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ============================================
   HIDE WHEN MOBILE MENU IS OPEN
   ============================================ */
body.menu-open .mobile-nav {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
}

/* ============================================
   HIDE WHEN COMMAND PALETTE IS OPEN
   ============================================ */
body:has(.cmd-palette.open) .mobile-nav {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* Fallback if :has() not supported */
.cmd-palette.open ~ .mobile-nav,
body.cmd-open .mobile-nav {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   HIDE WHEN PROJECT MODAL IS OPEN
   ============================================ */
body.modal-open .mobile-nav {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   HIDE ON DESKTOP
   ============================================ */
@media (min-width: 901px) {
  .mobile-nav {
    display: none !important;
  }
  body {
    padding-bottom: 0 !important;
  }
}

/* ============================================
   HIDE ON PRINT
   ============================================ */
@media print {
  .mobile-nav {
    display: none !important;
  }
}

/* ============================================
   EXTRA SMALL SCREENS (≤ 360px)
   ============================================ */
@media (max-width: 360px) {
  .mobile-nav-list {
    padding: 6px 4px;
    gap: 1px;
  }

  .mobile-nav-link {
    padding: 6px 2px;
    gap: 2px;
    min-height: 44px;
  }

  .mobile-nav-icon {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-link.mobile-nav-search .mobile-nav-icon {
    width: 22px;
    height: 22px;
  }

  .mobile-nav-label {
    font-size: 8.5px;
    letter-spacing: 0;
  }
}

/* ============================================
   VERY SMALL SCREENS (≤ 320px)
   ============================================ */
@media (max-width: 320px) {
  .mobile-nav-label {
    font-size: 8px;
  }

  .mobile-nav-icon {
    width: 18px;
    height: 18px;
  }

  .mobile-nav-link.mobile-nav-search .mobile-nav-icon {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-link {
    min-height: 42px;
    padding: 5px 2px;
  }
}

/* ============================================
   LANDSCAPE MOBILE — Compact height
   ============================================ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .mobile-nav-list {
    padding: 5px 8px;
  }

  .mobile-nav-link {
    flex-direction: row;
    gap: 6px;
    padding: 8px 12px;
    min-height: 40px;
  }

  .mobile-nav-label {
    font-size: 10px;
  }

  body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .mobile-nav,
  .mobile-nav-link,
  .mobile-nav-icon {
    transition: none !important;
    animation: none !important;
  }

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

/* ============================================
   FALLBACK: env() not supported (very old browsers)
   ============================================ */
@supports not (padding: env(safe-area-inset-bottom)) {
  .mobile-nav {
    padding-bottom: 0;
  }
  body {
    padding-bottom: 72px !important;
  }
  .float-btn.float-top {
    bottom: 88px !important;
  }
  .wa-widget {
    bottom: 84px !important;
  }
}

/* ============================================
   ACCESSIBILITY — High contrast mode
   ============================================ */
@media (prefers-contrast: high) {
  .mobile-nav {
    background: #000000;
    border-top: 2px solid #ffffff;
  }

  [data-theme="light"] .mobile-nav {
    background: #ffffff;
    border-top: 2px solid #000000;
  }

  .mobile-nav-link {
    color: #ffffff;
  }

  [data-theme="light"] .mobile-nav-link {
    color: #000000;
  }
}

/* ============================================
   FORCED COLORS
   ============================================ */
@media (forced-colors: active) {
  .mobile-nav {
    border-top: 2px solid ButtonText;
  }

  .mobile-nav-link.active {
    border: 2px solid Highlight;
    background: Highlight;
  }
}

/* ============================================
   END — mobile-nav.css v12.0
   ============================================ */