/* Custom CSS resets & variables for styling the hamburger menu and making it fully responsive */

/* Hamburger menu button styles (visible on mobile only) */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 1010;
  border-radius: 8px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin-right: 8px;
}

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

.mobile-menu-toggle:active {
  transform: scale(0.92);
}

/* Base styles for the backdrop */
.sidebar-backdrop {
  display: none;
}

/* Responsive Rules for Mobile (max-width: 780px) */
@media (max-width: 780px) {
  /* Display hamburger button */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Reset layout constraints added by other files */
  .app-container {
    padding-top: 58px !important; /* overrides 102px/104px */
  }

  /* Backdrop filter overlay behind slide-out menu */
  .sidebar-backdrop {
    display: block !important;
    position: fixed !important;
    inset: 58px 0 0 0 !important;
    background: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 999 !important;
    animation: sidebarFadeIn 0.2s ease-out both;
  }

  /* Slide-out Sidebar Drawer Styling */
  .sidebar {
    position: fixed !important;
    top: 58px !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: calc(100vh - 58px) !important;
    background: var(--bg-sidebar, #ffffff) !important;
    border-right: 1px solid var(--border-color, #e7ebf2) !important;
    border-bottom: none !important;
    z-index: 1000 !important;
    padding: 20px 14px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.12) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Dark mode background override for sidebar */
  [data-theme="dark"] .sidebar {
    background: #172129 !important;
    border-right-color: var(--ghl-line, #293741) !important;
  }

  /* Slide out menu when active */
  .mobile-menu-open .sidebar {
    transform: translateX(0) !important;
  }

  /* Re-enable group navigation layout styles that were set to display: contents */
  .primary-nav-title {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 750;
    color: var(--text-muted, #98a2b3);
    padding: 2px 10px 10px !important;
  }

  .sidebar-toggle {
    display: none !important;
  }

  .nav-links {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    width: auto !important;
    min-width: 0 !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    gap: 4px !important;
  }

  .nav-group {
    display: block !important;
    border: none !important;
    margin-bottom: 8px;
  }

  .nav-group-label {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 10px;
    color: var(--text-secondary, #667085);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-align: left;
  }

  [data-theme="dark"] .nav-group-label {
    color: #8fa0aa !important;
  }

  .nav-group-items {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    padding-left: 8px;
  }

  /* Navigation Items styling inside the drawer */
  .nav-item {
    min-height: 38px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: var(--text-secondary, #516071) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }

  [data-theme="dark"] .nav-item {
    color: #c2ced5 !important;
  }

  .nav-item:hover {
    background: var(--accent-purple-glow, #f2f6ff) !important;
    color: var(--accent-purple, #2762c9) !important;
  }

  [data-theme="dark"] .nav-item:hover {
    background: #20364a !important;
    color: #7db8ff !important;
  }

  .nav-item.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #326fde, #275bc3) !important;
    box-shadow: 0 4px 12px rgba(47, 111, 237, 0.2) !important;
  }

  /* SVGs back on mobile! */
  .nav-item svg {
    display: block !important;
    width: 17px !important;
    height: 17px !important;
    stroke: currentColor;
    fill: none;
  }

  /* Content area adjustment */
  .main-content {
    margin-left: 0 !important;
    padding: 20px 16px 80px !important;
  }

  /* Secondary/Context panel adjustment */
  .secondary-panel {
    display: none !important;
  }
}

@keyframes sidebarFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
