/* Hide mobile sidebar elements on desktop */
.sidebar-mobile-header,
.sidebar-quick-nav {
  display: none !important;
}

.mobile-menu-btn {
  display: none !important;
}

.mobile-overlay {
  display: none !important;
}

/* Show them on mobile */
@media screen and (max-width: 900px) {
  .mobile-menu-btn {
    display: flex !important;
  }
  
  .sidebar-mobile-header {
    display: flex !important;
  }
  
  .sidebar-quick-nav {
    display: flex !important;
  }
  
  .mobile-overlay {
    display: block !important;
  }
}
/* Mobile Sidebar & Responsive Fixes - AutoHub */
/* Hamburger button + slide-out sidebar + mobile polish */

/* ========== HAMBURGER BUTTON ========== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865f2, #4752c4);
  border: none;
  color: white;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(88, 101, 242, 0.4);
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* ========== OVERLAY ========== */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ========== MOBILE NAV BUTTON (top) ========== */
.mobile-nav-btn {
  display: none;
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b5bac1;
  cursor: pointer;
  z-index: 1001;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* ========== MOBILE STYLES ========== */
@media screen and (max-width: 900px) {
  
  /* Show hamburger */
  .mobile-menu-btn {
    display: flex !important;
  }
  
  /* FORCE compact header */
  nav.autohub-nav,
  .autohub-nav {
    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    overflow: hidden !important;
  }
  
  .autohub-nav .autohub-nav-inner,
  .autohub-nav-inner {
    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    padding: 0 1rem !important;
    flex-wrap: nowrap !important;
  }
  
  /* FORCE hide nav links on mobile */
  .autohub-nav .autohub-nav-links,
  .autohub-nav-inner .autohub-nav-links,
  .autohub-nav-links,
  div.autohub-nav-links {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
  }
  
  /* Server sidebar - hidden by default, slides from left */
  .server-sidebar,
  aside.server-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 300px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #0c0d10 !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5) !important;
    padding-top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Sidebar open state */
  .server-sidebar.mobile-open,
  aside.server-sidebar.mobile-open {
    transform: translateX(0) !important;
  }
  
  /* Sidebar header */
  .sidebar-mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #0e1014, #14171d);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
  }
  
  .sidebar-mobile-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f2f3f5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  .sidebar-mobile-close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #b5bac1;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }
  
  .sidebar-mobile-close:hover,
  .sidebar-mobile-close:active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  
  /* Quick nav links in sidebar */
  .sidebar-quick-nav {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
  }
  
  .sidebar-quick-nav a {
    flex: 1;
    min-width: calc(50% - 0.25rem);
    padding: 0.625rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #b5bac1;
    font-size: 0.8125rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
  }
  
  .sidebar-quick-nav a:hover,
  .sidebar-quick-nav a:active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
  
  /* Body scroll lock */
  body.mobile-sidebar-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
  }
  
  /* ========== TOGGLE SWITCH - SMALLER ========== */
  .toggle-switch {
    width: 36px !important;
    height: 20px !important;
  }
  
  .toggle-slider:before {
    height: 14px !important;
    width: 14px !important;
    left: 3px !important;
    bottom: 3px !important;
  }
  
  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px) !important;
  }
  
  /* ========== STATS BAR FIX ========== */
  .stats-bar,
  [class*="stats"] {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    padding: 0.75rem !important;
  }
  
  .stat-item {
    font-size: 0.75rem !important;
  }
  
  .stat-value {
    font-size: 0.875rem !important;
  }
  
  .stat-label {
    font-size: 0.625rem !important;
  }
}

/* ========== SMALLER PHONES ========== */
@media screen and (max-width: 480px) {
  .mobile-menu-btn {
    bottom: 1rem;
    left: 1rem;
    width: 48px;
    height: 48px;
  }
  
  .server-sidebar,
  aside.server-sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Even smaller toggles */
  .toggle-switch {
    width: 32px !important;
    height: 18px !important;
  }
  
  .toggle-slider:before {
    height: 12px !important;
    width: 12px !important;
    left: 3px !important;
    bottom: 3px !important;
  }
  
  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(14px) !important;
  }
  
  /* Compact module items */
  .module-item {
    padding: 0.75rem !important;
  }
  
  .module-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.875rem !important;
  }
  
  .module-name {
    font-size: 0.8125rem !important;
  }
  
  .module-desc {
    font-size: 0.6875rem !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  
  .config-btn {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.6875rem !important;
  }
  
  /* Server header compact */
  .slide-in {
    padding: 0.875rem !important;
    gap: 0.75rem !important;
  }
  
  .slide-in h1 {
    font-size: 1rem !important;
  }
  
  .slide-in img,
  .slide-in > div:first-child > div:first-child {
    width: 36px !important;
    height: 36px !important;
  }
  
  .slide-in button {
    padding: 0.375rem 0.625rem !important;
    font-size: 0.6875rem !important;
  }
  
  /* Tab buttons smaller */
  .tab-btn,
  [class*="tab"] button {
    padding: 0.5rem 0.625rem !important;
    font-size: 0.6875rem !important;
  }
  
  /* Filter badges smaller */
  .filter-badge,
  [class*="badge"] {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.625rem !important;
  }
}

/* ========== VERY SMALL PHONES ========== */
@media screen and (max-width: 360px) {
  .slide-in > div:last-child {
    flex-direction: column !important;
    width: 100% !important;
  }
  
  .slide-in > div:last-child button {
    width: 100% !important;
  }
  
  .module-actions {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  .config-btn {
    width: 100% !important;
  }
}
