/* ========================================
   MOBILE BURGER MENU - RESPONSIVE DESIGN
   Only applies to mobile devices (max-width: 768px)
   Desktop navigation remains unchanged
   ======================================== */

/* ========================================
   HAMBURGER BUTTON (Mobile Only)
   ======================================== */

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  color: white;
  cursor: pointer;
  padding: 8px 15px;
  z-index: 1001;
  transition: transform 0.3s ease;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.hamburger-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

.hamburger-btn.active {
  transform: translateY(-50%) rotate(45deg);
}

/* ========================================
   MOBILE NAVIGATION MENU
   ======================================== */

.mobile-menu {
  display: none;
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, rgb(40, 40, 123), rgb(2, 2, 93));
  flex-direction: column;
  padding: 20px 0;
  z-index: 1000;
  overflow-y: auto;
  animation: slideDown 0.3s ease-out;
  pointer-events: none;
}

.mobile-menu.active {
  display: flex;
  pointer-events: auto;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-menu-item {
  padding: 20px;
  color: white;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  pointer-events: auto !important;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1001;
  box-sizing: border-box;
  width: 100%;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus,
.mobile-menu-item:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  outline: none;
}

.mobile-menu-item:active {
  transform: scale(0.95);
}

.mobile-menu-item.active {
  background: rgba(219, 84, 75, 0.2);
  border-left: 4px solid rgb(219, 84, 75);
  padding-left: 16px;
}

/* Mobile Submenu (Dropdown) */
.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.mobile-submenu.active {
  max-height: 1000px;
  overflow: auto;
  pointer-events: auto;
}

.mobile-submenu-item {
  padding: 15px 20px 15px 40px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  font-size: 16px;
  display: block;
  text-align: center;
  cursor: pointer;
  pointer-events: auto !important;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1001;
}

.mobile-submenu-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  color: white;
}

.mobile-submenu-item:active {
  transform: scale(0.95);
}

.submenu-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 12px;
  cursor: pointer;
  padding: 0 10px;
  transition: transform 0.3s ease;
}

.submenu-toggle.active {
  transform: rotate(180deg);
}

/* ========================================
   MOBILE OVERLAY (Behind Menu)
   ======================================== */

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  animation: fadeIn 0.3s ease-out;
  pointer-events: none;
}

.mobile-overlay.active {
  display: block;
  pointer-events: auto;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========================================
   DESKTOP - HIDE MOBILE ELEMENTS
   ========================================
   Mobile elements hidden by default,
   only shown on screens max 768px width
   ======================================== */

/* ========================================
   MEDIA QUERY - MOBILE DEVICES
   Apply burger menu on screens < 768px
   ======================================== */

@media (max-width: 768px) {
  /* Show mobile elements */
  .hamburger-btn {
    display: block;
  }

  /* Hide desktop navigation on mobile */
  nav.nav-links {
    display: none;
  }

  .nav-links {
    display: none !important;
  }

  .dropdown {
    display: none;
  }

  /* Adjust header for mobile */
  .main-header {
    height: 48px;
    padding: 0 10px;
    justify-content: space-between;
  }

  .header-info {
    position: static;
    flex: 1;
    margin: 0;
    padding: 0 10px;
  }

  .header-info h3 {
    margin: 0;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-info a {
    text-decoration: none;
    color: rgb(219, 84, 75);
  }

  /* Mobile menu styles - But allow active state to override */
  .mobile-menu {
    display: none;
  }

  .mobile-menu.active {
    display: flex !important;
    pointer-events: auto !important;
  }

  .mobile-overlay {
    display: none;
  }

  .mobile-overlay.active {
    display: block !important;
    pointer-events: auto !important;
  }

  /* Body padding adjustment for mobile */
  body {
    padding-top: 48px !important;
  }

  /* Product container adjustment */
  .products-container {
    padding: 15px;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
  }

  .product-category {
    padding: 15px;
  }

  .product-category img {
    width: 100%;
    height: 200px;
  }

  .product-category h3 {
    font-size: 14px;
    margin: 10px 0 0 0;
  }

  /* Adjust cart sidebar for mobile */
  #cart-sidebar {
    width: 100% !important;
    right: -100% !important;
  }

  /* Back button mobile style */
  .back-button a {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ========================================
   TABLET - MEDIUM SCREENS (768px - 1024px)
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
  /* Show desktop navigation, hide burger menu */
  .hamburger-btn {
    display: none;
  }

  .mobile-menu,
  .mobile-overlay {
    display: none !important;
  }

  nav.nav-links {
    display: flex !important;
  }

  /* Adjust spacing for tablet */
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
}

/* ========================================
   DESKTOP - LARGE SCREENS (1025px+)
   ======================================== */

@media (min-width: 1025px) {
  /* Hide all mobile elements on desktop */
  .hamburger-btn {
    display: none !important;
  }

  .mobile-menu,
  .mobile-overlay {
    display: none !important;
  }

  /* Ensure desktop navigation is visible */
  nav.nav-links {
    display: flex !important;
  }

  .dropdown {
    display: inline-block !important;
  }

  /* Desktop product grid */
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
  }

  .product-category img {
    width: 300px;
    height: 300px;
  }
}

/* ========================================
   ACCESSIBILITY & ANIMATIONS
   ======================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .hamburger-btn,
  .mobile-menu,
  .mobile-overlay,
  .mobile-menu-item,
  .mobile-submenu,
  .submenu-toggle {
    transition: none;
    animation: none;
  }
}

/* Focus styles for keyboard navigation */
.hamburger-btn:focus,
.mobile-menu-item:focus,
.mobile-submenu-item:focus {
  outline: 2px solid rgb(219, 84, 75);
  outline-offset: 2px;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

.no-scroll {
  overflow: hidden;
}
