/* Trade Submenu Navigation - Desktop + Mobile */
/* BroJack Agent #7 - October 2025 */

/* =====================================================
   DESKTOP: TRADE SUBMENU DROPDOWN
   ===================================================== */

/* Trade nav item with submenu - DESKTOP ONLY */
/* Trade button styled like normal nav items */
.nav-item-with-submenu {
  /* No special styling - inherits from .nav-item */
}

/* Submenu arrow inside Trade button */
.submenu-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
  opacity: 0.6;
}

.nav-item-with-submenu.submenu-open .submenu-arrow {
  transform: rotate(180deg);
}

/* Submenu container - SEPARATE element that pushes down other nav items */
.nav-submenu {
  display: none; /* Start hidden to prevent space - Agent #7 Fix */
  flex-direction: column;
  gap: 4px;
  padding-left: 4px; /* Reduced padding - Agent #7 Fix */
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.25s ease; /* Smooth rolldown - no delay on close */
}

/* When submenu is open - expands and pushes down other buttons */
.nav-submenu.submenu-open {
  display: flex; /* Change to flex when opening */
  opacity: 1;
  max-height: 300px; /* Enough for 4 items */
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Submenu items */
.nav-submenu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
}

.nav-submenu-item:hover {
  background: rgba(85, 93, 255, 0.15);
  color: #ffffff;
}

/* ACTIVE STATE for submenu items - Agent #7 Fix */
.nav-submenu-item.active {
  background: rgba(85, 93, 255, 0.25);
  color: #ffffff;
  font-weight: 600;
}

.submenu-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.nav-submenu-item:hover .submenu-icon,
.nav-submenu-item.active .submenu-icon {
  opacity: 1;
}

/* Active state for Trade nav item when any submenu is active */
.nav-item-with-submenu.active {
  background: rgba(85, 93, 255, 0.15);
  color: #ffffff;
}

.nav-item-with-submenu.active .nav-icon {
  opacity: 1;
}

/* =====================================================
   MOBILE: TRADE BUBBLE MENU
   ===================================================== */

@media (max-width: 768px) {
  /* Hide desktop submenu on mobile - use bubble instead */
  .nav-submenu {
    display: none !important;
  }
  
  .submenu-arrow {
    display: none !important;
  }
  /* Mobile Trade bubble container */
  .mobile-trade-bubble {
    position: fixed;
    bottom: calc(80px + max(16px, env(safe-area-inset-bottom))); /* Above bottom nav + safe area - Agent #7 */
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 9999;
  }
  
  .mobile-trade-bubble.bubble-open {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
  }
  
  /* Bubble arrow (points down to Trade button) */
  .bubble-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(14, 20, 41, 0.98);
  }
  
  /* Bubble menu container - VERTICAL 4x1 layout (Agent #7 Fix) */
  .bubble-menu {
    background: rgba(14, 20, 41, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(85, 93, 255, 0.3);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 240px;
    max-width: 280px;
  }
  
  /* Bubble menu items (4x1 vertical stack) */
  .bubble-menu-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 52px;
    justify-content: flex-start;
  }
  
  .bubble-menu-item:active {
    transform: scale(0.98);
    background: rgba(85, 93, 255, 0.2);
    border-color: rgba(85, 93, 255, 0.4);
  }
  
  /* ACTIVE STATE for mobile bubble items (Agent #7 Fix) */
  .bubble-menu-item.active {
    background: rgba(85, 93, 255, 0.3);
    border-color: rgba(85, 93, 255, 0.6);
  }
  
  .bubble-menu-item .bubble-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
    flex-shrink: 0;
  }
  
  .bubble-menu-item.active .bubble-icon {
    opacity: 1;
  }
  
  .bubble-menu-item span {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
    flex: 1;
  }
  
  .bubble-menu-item.active span {
    color: #ffffff;
    font-weight: 600;
  }
  
  /* Trade button active state (when bubble is open) */
  .mobile-nav-trade.bubble-active {
    background: rgba(85, 93, 255, 0.2);
  }
  
  /* Backdrop (darkens background when bubble is open) */
  .mobile-trade-bubble::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
  }
  
  .mobile-trade-bubble.bubble-open::before {
    opacity: 1;
    pointer-events: auto;
  }
}

