/* INSTAGRAM-STYLE MOBILE NAVIGATION - 5 ITEMS (Alerts moved to top) */

/* ============================================
   MOBILE BOTTOM NAVIGATION (5 items: Home, Messages, Create, Wallet, Profile)
   ============================================ */

@media (max-width: 1023px) {
  /* Tabbar container - back to 5 items */
  .tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.3);
  }

  /* Individual tab buttons - optimized for 5 items */
  .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    min-height: 48px;
    min-width: 48px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .tab:active {
    transform: scale(0.92);
  }

  /* Tab icons */
  .tab-icon {
    color: rgba(255, 255, 255, 0.55);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tab.active .tab-icon {
    color: #ff6b1a;
    stroke-width: 2.5;
  }

  /* Tab labels */
  .tab-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.45);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: none;
  }

  .tab.active .tab-label {
    color: #ff6b1a;
    display: block;
  }

  /* CREATE BUTTON (center, special styling) */
  .tab-create {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff6b1a, #ff3a5c);
    box-shadow: 0 4px 16px rgba(255, 107, 26, 0.4);
    margin: 0 8px;
    flex: 0 0 auto;
  }

  .tab-create:active {
    transform: scale(0.88);
  }

  .tab-icon-create {
    color: #fff;
  }

  /* BADGES (notification counts) */
  .tab-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(12px);
    min-width: 18px;
    height: 18px;
    background: #ff3a5c;
    border: 2px solid rgba(10, 10, 15, 1);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    pointer-events: none;
  }

  .tab-badge.hidden {
    display: none;
  }

  /* Profile avatar in tab */
  .tab-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tab.active .tab-avatar {
    border-color: #ff6b1a;
    box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.2);
  }

  .tab-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Active indicator line */
  .tab.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: #ff6b1a;
    border-radius: 2px;
  }

  /* Wallet icon styling */
  .tab[data-tab="wallet"] .tab-icon {
    color: rgba(255, 255, 255, 0.55);
  }

  .tab[data-tab="wallet"].active .tab-icon {
    color: #ff6b1a;
    stroke-width: 2.5;
  }

  /* ============================================
     CONTENT PADDING
     ============================================ */

  .view {
    padding-bottom: calc(64px + env(safe-area-inset-bottom) + 8px) !important;
  }

  #view-feed,
  #view-messages,
  #view-alerts,
  #view-profile,
  #view-wallet {
    min-height: calc(100vh - 64px - env(safe-area-inset-bottom));
  }

  /* ============================================
     HIDE OLD FAB
     ============================================ */

  .fab {
    display: none !important;
  }
}

/* ============================================
   DESKTOP
   ============================================ */

@media (min-width: 1024px) {
  .tab-create {
    display: none;
  }
}

/* ============================================
   EXTRA SMALL SCREENS
   ============================================ */

@media (max-width: 375px) {
  .tabbar {
    height: 60px;
    padding: 0 4px;
  }

  .tab {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 2px;
  }

  .tab-icon {
    width: 24px;
    height: 24px;
  }

  .tab-create {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    margin: 0 4px;
  }

  .tab-label {
    font-size: 9px;
  }

  .tab-badge {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }
}

/* ============================================
   LANDSCAPE MODE
   ============================================ */

@media (max-width: 896px) and (orientation: landscape) {
  .tabbar {
    height: 56px;
  }

  .tab {
    gap: 2px;
    padding: 4px 2px;
  }

  .tab-label {
    display: none !important;
  }

  .tab-create {
    width: 48px;
    height: 48px;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .tab,
  .tab-icon,
  .tab-label,
  .tab-avatar {
    transition: none !important;
  }
}

/* ============================================
   HIGH DPI SCREENS
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .tabbar {
    border-top-width: 0.5px;
  }
}
