/**
 * Mobile Navbar Fix
 * Ensures hamburger menu, cart, and wishlist are always visible on mobile
 * Also ensures dropdowns appear below navbar properly
 * Date: January 13, 2026
 */

/* ========================================
   FORCE MOBILE NAVBAR ELEMENTS VISIBLE
======================================== */

/* Ensure navbar has overflow visible for dropdowns */
.modern-navbar {
  overflow: visible !important;
  /* Transform creates stacking context - remove it */
  transform: none !important;
  /* Ensure proper z-index without creating new stacking context */
  isolation: auto !important;
}

/* Ensure navbar wrapper has overflow visible */
.modern-navbar .navbar-wrapper {
  overflow: visible !important;
  transform: none !important;
}

/* Ensure navbar wrapper uses flexbox properly */
.modern-navbar .navbar-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
}

/* Mobile: Ensure brand doesn't take all space */
.modern-navbar .navbar-brand {
  flex: 0 1 auto !important;
  margin-right: 0 !important;
  min-width: auto !important;
}

/* Hide desktop menu on mobile */
.modern-navbar .navbar-menu {
  display: none !important;
}

@media (min-width: 768px) {
  .modern-navbar .navbar-menu {
    display: flex !important;
    flex: 1 !important;
  }
}

/* FORCE navbar actions to be visible and aligned right */
.modern-navbar .navbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  flex: 0 0 auto !important;
  overflow: visible !important;
}

@media (min-width: 480px) {
  .modern-navbar .navbar-actions {
    gap: 8px !important;
  }
}

@media (min-width: 640px) {
  .modern-navbar .navbar-actions {
    gap: 12px !important;
  }
}

/* FORCE wishlist and cart to be visible with proper positioning context */
.modern-navbar .wishlist-dropdown-wrapper,
.modern-navbar .cart-dropdown-wrapper,
.modern-navbar .action-item {
  display: block !important;
  position: relative !important;
  overflow: visible !important;
}

/* FORCE action buttons to be visible */
.modern-navbar .action-btn,
.modern-navbar #wishlistToggle,
.modern-navbar #cartToggle {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  flex-shrink: 0 !important;
}

@media (min-width: 480px) {
  .modern-navbar .action-btn,
  .modern-navbar #wishlistToggle,
  .modern-navbar #cartToggle {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
  }
}

@media (min-width: 640px) {
  .modern-navbar .action-btn,
  .modern-navbar #wishlistToggle,
  .modern-navbar #cartToggle {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }
}

/* FORCE mobile toggle (hamburger) to be visible on mobile */
.modern-navbar .mobile-toggle,
.modern-navbar #mobileMenuToggle {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  flex-shrink: 0 !important;
  gap: 4px !important;
  padding: 6px !important;
}

@media (min-width: 480px) {
  .modern-navbar .mobile-toggle,
  .modern-navbar #mobileMenuToggle {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
  }
}

@media (min-width: 768px) {
  .modern-navbar .mobile-toggle,
  .modern-navbar #mobileMenuToggle {
    display: none !important;
  }
}

/* Hamburger lines */
.modern-navbar .toggle-line {
  display: block !important;
  width: 18px !important;
  height: 2px !important;
  background: #202023 !important;
  border-radius: 2px !important;
  transition: all 0.3s ease !important;
}

@media (min-width: 480px) {
  .modern-navbar .toggle-line {
    width: 20px !important;
  }
}

/* Action badges */
.modern-navbar .action-badge,
.modern-navbar #wishlistCount,
.modern-navbar #cartCount {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  min-width: 16px !important;
  height: 16px !important;
  background: #FCB1D8 !important;
  color: #202023 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 4px !important;
  border: 2px solid #FFD0D0 !important;
}

@media (min-width: 640px) {
  .modern-navbar .action-badge,
  .modern-navbar #wishlistCount,
  .modern-navbar #cartCount {
    min-width: 18px !important;
    height: 18px !important;
    font-size: 11px !important;
  }
}

.modern-navbar .action-badge.show,
.modern-navbar #wishlistCount.show,
.modern-navbar #cartCount.show {
  display: flex !important;
}

/* ========================================
   MOBILE DROPDOWN POSITIONING
======================================== */
.modern-navbar .action-dropdown,
.modern-navbar .cart-dropdown,
.modern-navbar .wishlist-dropdown,
.modern-navbar #cartPanel,
.modern-navbar #wishlistPanel {
  position: fixed !important;
  top: 60px !important;
  right: 8px !important;
  left: 8px !important;
  width: auto !important;
  max-width: 400px !important;
  margin-left: auto !important;
  max-height: calc(100vh - 70px) !important;
  max-height: calc(100dvh - 70px) !important;
  z-index: 10001 !important;
}

@media (min-width: 640px) {
  .modern-navbar .action-dropdown,
  .modern-navbar .cart-dropdown,
  .modern-navbar .wishlist-dropdown,
  .modern-navbar #cartPanel,
  .modern-navbar #wishlistPanel {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    width: 400px !important;
    max-height: 500px !important;
    z-index: 10001 !important;
    background: white !important;
  }
}

/* ========================================
   MOBILE MENU SIDEBAR
======================================== */
.modern-navbar .mobile-menu,
.modern-navbar #mobileMenu {
  position: fixed !important;
  top: 0 !important;
  right: -100% !important;
  width: 280px !important;
  max-width: 85vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: #FFFFFF !important;
  z-index: 10002 !important;
  transition: right 0.3s ease !important;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.modern-navbar .mobile-menu.active,
.modern-navbar #mobileMenu.active {
  right: 0 !important;
}

@media (min-width: 640px) {
  .modern-navbar .mobile-menu,
  .modern-navbar #mobileMenu {
    width: 320px !important;
  }
}

/* Mobile menu overlay */
.mobile-menu-overlay,
#mobileMenuOverlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 10001 !important;
  display: none !important;
  opacity: 0 !important;
  transition: opacity 0.3s ease !important;
}

.mobile-menu-overlay.active,
#mobileMenuOverlay.active {
  display: block !important;
  opacity: 1 !important;
}

/* ========================================
   BRAND LOGO & TEXT RESPONSIVE
======================================== */
.modern-navbar .brand-logo {
  width: 32px !important;
  height: 32px !important;
}

@media (min-width: 480px) {
  .modern-navbar .brand-logo {
    width: 36px !important;
    height: 36px !important;
  }
}

@media (min-width: 640px) {
  .modern-navbar .brand-logo {
    width: 44px !important;
    height: 44px !important;
  }
}

@media (min-width: 1024px) {
  .modern-navbar .brand-logo {
    width: 56px !important;
    height: 56px !important;
  }
}

.modern-navbar .brand-name {
  font-size: 13px !important;
  display: inline-block !important;
}

@media (max-width: 374px) {
  .modern-navbar .brand-name {
    display: none !important;
  }
}

@media (min-width: 480px) {
  .modern-navbar .brand-name {
    font-size: 15px !important;
  }
}

@media (min-width: 640px) {
  .modern-navbar .brand-name {
    font-size: 18px !important;
  }
}

@media (min-width: 1024px) {
  .modern-navbar .brand-name {
    font-size: 20px !important;
  }
}

/* ========================================
   TOUCH IMPROVEMENTS
======================================== */
@media (hover: none) and (pointer: coarse) {
  /* Touch devices */
  .modern-navbar .action-btn:active,
  .modern-navbar .mobile-toggle:active {
    transform: scale(0.92) !important;
    background: rgba(252, 177, 216, 0.3) !important;
  }
}

/* Prevent text selection on buttons */
.modern-navbar .action-btn,
.modern-navbar .mobile-toggle {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* ========================================
   ENSURE ICONS ARE VISIBLE
======================================== */
.modern-navbar .action-btn i,
.modern-navbar .mobile-toggle i {
  display: inline-block !important;
  pointer-events: none !important;
  font-size: 18px !important;
}

@media (min-width: 640px) {
  .modern-navbar .action-btn i,
  .modern-navbar .mobile-toggle i {
    font-size: 22px !important;
  }
}

/* ========================================
   Z-INDEX HIERARCHY
======================================== */
.modern-navbar {
  z-index: 1000 !important;
}

.modern-navbar .action-dropdown.active,
.modern-navbar .cart-dropdown.active,
.modern-navbar .wishlist-dropdown.active {
  z-index: 10001 !important;
}

.mobile-menu-overlay.active {
  z-index: 10001 !important;
}

.modern-navbar .mobile-menu.active {
  z-index: 10002 !important;
}
