/* Additional custom styles for PacketCord documentation */

/* 
 * DESKTOP NAVBAR FIX
 * Fix the sidebar scrolling issue on desktop while preserving mobile functionality
 */
 
/* Desktop only: Fix navbar scrolling by overriding the scroll synchronization */
@media screen and (min-width: 769px) {
  /* Ensure sidebar stays truly fixed on desktop */
  .wy-nav-side {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 300px !important;
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  
  /* Prevent the inner scroll container from moving */
  .wy-nav-side .wy-side-scroll {
    transform: none !important;
    position: static !important;
  }
  
  /* Ensure content doesn't hide behind fixed sidebar */
  .wy-nav-content-wrap {
    margin-left: 300px !important;
  }
}

/* Enhanced mobile navigation - Industry standard UX patterns */
@media screen and (max-width: 768px) {
  /* Mobile header bar with proper hamburger positioning */
  .wy-nav-top {
    background: var(--clay-primary) !important;
    background-image: linear-gradient(135deg, #6C6C6C 0%, #5A5A5C 100%) !important;
    color: white !important;
    padding: 0 !important;
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
    height: 56px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  
  /* Hamburger menu button - positioned on the left per industry standards */
  .wy-nav-top i {
    order: 1;
    margin: 0;
    padding: 16px;
    cursor: pointer !important;
    font-size: 20px;
    color: white !important;
    border-radius: 0;
    transition: background-color 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 56px;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation !important;
    position: relative;
    z-index: 1001;
  }
  
  /* Hamburger hover and active states */
  .wy-nav-top i:hover,
  .wy-nav-top i:active {
    background-color: rgba(255, 255, 255, 0.1);
  }
  
  .wy-nav-top i:active,
  .wy-nav-top i.pressed {
    background-color: rgba(255, 255, 255, 0.2) !important;
    transform: scale(0.95);
  }
  
  .wy-nav-top i.nav-open {
    background-color: rgba(255, 255, 255, 0.15) !important;
  }
  
  /* Remove hover effects ONLY on touch devices to prevent persistent highlighting */
  @media (hover: none) and (pointer: coarse) {
    .wy-nav-top i:hover,
    .wy-nav-top i:active {
      background-color: transparent !important;
      transform: none !important;
    }
    
    .wy-nav-top i.pressed {
      background-color: transparent !important;
      transform: none !important;
    }
  }
  
  /* Ensure nav-open state highlighting works on all devices */
  .wy-nav-top i.nav-open:hover,
  .wy-nav-top i.nav-open:active {
    background-color: rgba(255, 255, 255, 0.15) !important;
  }
  
  /* Site title centered */
  .wy-nav-top a {
    position: fixed;
    left: 50%;
    top: 0;
    height: 56px;
    transform: translateX(-50%);
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    z-index: 1001;
    pointer-events: auto;
  }
  
  /* Mobile sidebar - slide-out navigation */
  .wy-nav-side {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    top: 56px;
    left: 0;
    width: min(320px, 85vw);
    height: calc(100vh - 56px);
    z-index: 999;
    background: var(--clay-primary);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
  }
  
  .wy-nav-side.mobile-nav-open {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto;
  }
  
  /* Backdrop overlay when navigation is open */
  .wy-nav-side.mobile-nav-open::before {
    content: '';
    position: fixed;
    top: 56px;
    left: min(320px, 85vw);
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    animation: fadeIn 0.3s ease-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  /* Main content adjustments for mobile */
  .wy-nav-content-wrap {
    margin-top: 56px;
    margin-left: 0 !important;
  }
  
  .wy-nav-content {
    padding: 16px;
    max-width: 100%;
  }
  
  /* Improve navigation menu items for touch interaction */
  .wy-nav-side .wy-menu-vertical a {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .wy-nav-side .wy-menu-vertical a:hover,
  .wy-nav-side .wy-menu-vertical a:active {
    background: var(--clay-secondary);
  }

  /* Mobile expand/collapse icons spacing */
  .wy-nav-side .wy-menu-vertical .toctree-expand {
    margin-left: -2px !important;
    margin-right: 6px !important;
  }
  
  /* Improve search input in mobile nav */
  .wy-side-nav-search {
    padding: 16px;
    border-bottom: 2px solid var(--border-light);
  }
  
  .wy-side-nav-search input[type=text] {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* MkDocs search input styling - Claymorphism Theme */
#mkdocs-search-query.search_input,
.search_input.search-query {
  background: var(--clay-primary) !important;
  background-image: linear-gradient(145deg, var(--clay-secondary) 0%, var(--clay-primary) 100%) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 15px !important;
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3), inset -2px -2px 5px rgba(255, 255, 255, 0.03) !important;
  color: var(--text-color) !important;
  padding: 0.6rem 1rem !important;
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: 0.9rem !important;
  width: 100% !important;
  max-width: 300px !important;
  height: 40px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative !important;
}

#mkdocs-search-query.search_input:focus,
.search_input.search-query:focus {
  background: var(--clay-secondary) !important;
  background-image: linear-gradient(145deg, var(--clay-primary) 0%, var(--clay-secondary) 100%) !important;
  border-color: var(--accent-color) !important;
  outline: none !important;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4), -2px -2px 8px rgba(255, 255, 255, 0.02) !important;
  transform: translateY(-1px) !important;
}

#mkdocs-search-query.search_input::placeholder,
.search_input.search-query::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.8 !important;
  font-weight: 400 !important;
}