/* SlideNavbar Component Styles */

/* CSS Variables for consistent theming */
:root {
  /* Color Palette - Professional Dark Theme */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --bg-active: #475569;

  /* Accent Colors */
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-secondary: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #1e293b;

  /* Border Colors */
  --border-primary: #334155;
  --border-secondary: #475569;
  --border-accent: #3b82f6;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
  position: fixed;
  height: 100vh;
  z-index: 1000;
  top: 0;
  left: 0;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebarHeader {
  padding: var(--spacing-lg) var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: var(--transition-normal);
  flex: 1;
  white-space: nowrap;
}

.logo svg {
  color: var(--accent-primary);
  transition: var(--transition-normal);
  flex-shrink: 0;
}

.collapsed .logo span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: var(--transition-normal);
}

.collapseBtn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  position: relative;
  z-index: 10;
  /* Ensure button is clickable */
  pointer-events: auto;
  touch-action: manipulation;
}

.collapseBtn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.sidebarNav {
  flex: 1;
  padding: var(--spacing-lg) 0;
  overflow-y: auto;
  /* Ensure nav items are interactive */
  pointer-events: auto;
}

.navItem {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  position: relative;
  /* Critical for mobile interaction */
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
  min-height: 44px; /* Ensure minimum touch target size */
  user-select: none;
  -webkit-user-select: none;
}

.navItem:hover,
.navItem:focus {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  outline: none;
}

.navItem:active {
  background-color: var(--bg-active);
  transform: scale(0.98);
}

.navItem.active {
  background-color: var(--bg-active);
  color: var(--accent-primary);
}

.navItem.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--accent-primary);
  pointer-events: none;
}

.collapsed .navItem span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebarFooter {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-primary);
}

.logoutBtn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  pointer-events: auto;
  touch-action: manipulation;
  min-height: 44px;
  user-select: none;
  -webkit-user-select: none;
}

.logoutBtn:hover,
.logoutBtn:focus {
  background-color: var(--accent-danger);
  color: var(--text-primary);
  outline: none;
}

.logoutBtn:active {
  transform: scale(0.98);
}

/* Mobile Responsive - Enhanced for manual resize */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    /* Ensure sidebar stays on top */
    z-index: 9999;
  }

  .sidebar.mobileOpen {
    transform: translateX(0);
    /* Add backdrop blur effect */
    backdrop-filter: blur(8px);
  }

  /* Ensure mobile menu buttons are always clickable */
  .sidebar.mobileOpen .navItem,
  .sidebar.mobileOpen .logoutBtn,
  .sidebar.mobileOpen .collapseBtn {
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  .desktopOnly {
    display: none !important;
  }

  .mobileOnly {
    display: flex !important;
  }

  /* Increase touch targets on mobile */
  .navItem {
    min-height: 48px;
    padding: var(--spacing-lg) var(--spacing-lg);
  }

  .logoutBtn {
    min-height: 48px;
    padding: var(--spacing-lg) var(--spacing-md);
  }
}

@media (min-width: 769px) {
  .mobileOnly {
    display: none !important;
  }

  .desktopOnly {
    display: flex !important;
  }
}

/* Fix for manual browser resize issues */
@media (max-width: 768px) and (pointer: coarse) {
  /* This targets touch devices in mobile view */
  .sidebar {
    will-change: transform;
  }

  .navItem {
    will-change: background-color, transform;
  }
}

/* Ensure clickability across all screen sizes */
.navItem,
.logoutBtn,
.collapseBtn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
