/**
 * Mobile Menu Styles
 * Global styles for off-canvas sidebar navigation
 * Used across all frontend pages
 */

/* ========================================
   Hamburger Menu Button (Mobile Only)
   ======================================== */

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 25px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1200;
  transition: all 300ms ease;
}

.mobile-menu-toggle:hover span {
  background-color: rgba(255, 255, 255, 0.8);
}

.mobile-menu-toggle:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.mobile-menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 2px;
  transition: all 300ms ease;
}

/* Animated hamburger - rotate lines when open */
.mobile-menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

/* ========================================
   Off-Canvas Sidebar Menu
   ======================================== */

.mobile-sidebar {
  position: fixed;
  top: -17px;
  right: -14px;
  width: 50vw;
  height: 100vh;
  background-color: #0a3842;
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 300ms ease;
  padding: 0;
  overflow-y: auto;
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}


.mobile-sidebar.open {
  transform: translateX(0);
}

/* Sidebar Header: Logo + Close Button */
.mobile-sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.mobile-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-sidebar__logo img {
  width: 70px;
  height: auto;
  display: block;
}

/* Close Button (X) */
.menu-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 200ms ease;
  flex-shrink: 0;
}

.menu-close:hover,
.menu-close:focus {
  opacity: 0.7;
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

/* Sidebar Navigation List */
.mobile-sidebar__nav {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.mobile-sidebar__nav li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-sidebar__nav li:last-child {
  border-bottom: none;
}

.mobile-sidebar__nav-link {
  display: block;
  color: white;
  text-decoration: none;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  transition: background-color 200ms ease;
}

.mobile-sidebar__nav-link:hover,
.mobile-sidebar__nav-link:focus {
  background-color: rgba(255, 255, 255, 0.1);
  outline: none;
}

/* ========================================
   Overlay Backdrop
   ======================================== */

.menu-overlay {
  position: fixed;
  top: -18px;
  /* left: -51px; */
  right: -13px;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  display: none;
  transition: opacity 300ms ease;
  pointer-events: none;
}

.menu-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ========================================
   Body Scroll Lock
   ======================================== */

body.menu-open {
  overflow: hidden;
  height: 100vh;
}

/* ========================================
   Mobile Responsiveness
   ======================================== */

/* Show menu toggle on mobile (< 992px) */
@media (max-width: 991px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-sidebar {
    width: 50vw;
  }
}

/* Hide menu toggle on desktop (>= 992px) */
@media (min-width: 992px) {
  .mobile-menu-toggle,
  .mobile-sidebar,
  .menu-overlay {
    display: none !important;
  }
}

/* Smaller devices - make sidebar wider for better UX */
@media (max-width: 576px) {
  .mobile-sidebar {
    width: 65vw;
  }
}

/* ========================================
   Accessibility
   ======================================== */

.mobile-sidebar:focus-within {
  outline: none;
}

/* Ensure buttons are keyboard accessible */
.mobile-menu-toggle:focus,
.menu-close:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .mobile-menu-toggle span,
  .mobile-sidebar,
  .menu-overlay {
    transition: none;
  }
}
