/* Compressed Navigation System - Innovative Space-Saving Design */

/* Navigation Container */
.compressed-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible; /* Changed from hidden to visible to allow mega menu */
  display: flex;
  flex-direction: column;
}


.compressed-nav.open {
  transform: translateX(0);
}

.compressed-nav::-webkit-scrollbar {
  width: 4px;
  display: none; /* Make it invisible */
}

.compressed-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.compressed-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  display: none; /* Make it invisible */
}

/* Navigation Header */
.nav-header {
  padding: 1.5rem 1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-brand img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.nav-brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navigation Toggle Button */
.nav-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.nav-toggle:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.nav-toggle.open {
  right: 295px;
}

.nav-toggle i {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.nav-toggle.open i {
  transform: rotate(180deg);
}

/* Navigation Menu */
.nav-menu {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: visible; /* Allow horizontal overflow for mega menu */
  position: relative; /* Ensure proper positioning context */
  /* Invisible scrollbar for webkit browsers */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.nav-menu::-webkit-scrollbar {
  display: none; /* Chrome, Safari, and Opera */
}

.nav-section-title {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* Navigation Items */
.nav-item {
  margin: 0.125rem 0.5rem;
  position: relative; /* Ensure proper positioning context for mega menus */
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.2);
  color: white;
  border-right: 3px solid #3b82f6;
}

.nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
  color: whitesmoke;
}

.nav-link .text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: whitesmoke;
}

/* Badge for notifications */
.nav-badge {
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Submenu Styles */
.nav-submenu {
  margin-left: 2rem;
  margin-top: 0.25rem;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  padding-left: 0.5rem;
}

.nav-submenu .nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

.nav-submenu .nav-link:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

/* Mega Menu */
.mega-menu {
  position: fixed;
  right: 290px; /* Position relative to viewport, accounting for nav width */
  top: auto;
  width: 400px;
  /* background: rgba(255, 255, 255, 0.95); */
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1060;
  pointer-events: none;
  max-width: calc(100vw - 320px);
  color: #f1f5f9;
  /* Add hover bridge padding */
  padding: 5px;
  margin: -5px;
}

.nav-item:hover .mega-menu,
.mega-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.nav-item:hover .mega-menu,
.mega-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mega-menu-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px 12px 0 0;
  color: #f1f5f9;
}

.mega-menu-header h6 {
  margin: 0;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.9rem;
}

.mega-menu-body {
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.mega-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #cbd5e1;
  font-size: 0.8rem;
}

.mega-menu-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  transform: translateX(2px);
}

.mega-menu-item i {
  width: 16px;
  color: #3b82f6;
}

/* Mega Menu Divider */
.mega-menu-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: 0.5rem 0;
}

/* Icon-only mode */
.compressed-nav.icon-only {
  width: 70px;
}

.compressed-nav.icon-only .nav-brand span,
.compressed-nav.icon-only .nav-link .text,
.compressed-nav.icon-only .nav-section-title {
  display: none;
}

.compressed-nav.icon-only .nav-link {
  justify-content: center;
  padding: 0.75rem;
}

.compressed-nav.icon-only .nav-submenu {
  display: none;
}

.compressed-nav.icon-only .mega-menu {
  display: none;
}

.compressed-nav.icon-only .user-info {
  justify-content: center;
}

.compressed-nav.icon-only .user-details {
  display: none;
}

.compressed-nav.icon-only .user-actions {
  flex-direction: column;
  gap: 0.25rem;
}

.compressed-nav.icon-only .user-action {
  padding: 0.75rem;
  font-size: 0.7rem;
}

/* Icon-only toggle */
.icon-toggle {
  position: absolute;
  top: 50%;
  left: -12px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  z-index: 1070;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.icon-toggle:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.icon-toggle i {
  font-size: 0.7rem;
}

/* User Menu */
.user-menu {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
  border-top: 2px solid rgba(59, 130, 246, 0.3);
  padding: 1.25rem 1rem;
  flex-shrink: 0;
  backdrop-filter: blur(15px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.user-details {
  flex: 1;
}

.user-name {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
  line-height: 1.2;
}

.user-role {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 400;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
}

.user-action {
  flex: 1;
  padding: 0.625rem 0.75rem;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.user-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.user-action:hover::before {
  left: 100%;
}

.user-action.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.user-action.primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.user-action.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.user-action.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

/* Overlay */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .compressed-nav {
    width: 100%;
    transform: translateX(100%);
  }

  .compressed-nav.open {
    transform: translateX(0);
  }

  .nav-toggle {
    right: 15px;
  }

  .nav-toggle.open {
    right: 15px;
  }

  .mega-menu {
    width: 300px;
    position: fixed;
    right: 20px;
    left: 20px;
    top: 100px;
    transform: translateY(-10px) scale(0.95);
    max-width: calc(100vw - 40px);
  }

  .mega-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  /* Hide mega menu on mobile when navigation is closed */
  .compressed-nav:not(.open) .mega-menu {
    display: none;
  }
}

/* Extra small screens - adjust mega menu positioning */
@media (max-width: 480px) {
  .mega-menu {
    width: calc(100vw - 40px);
    right: 20px;
    left: 20px;
    top: 80px;
    max-width: calc(100vw - 40px);
  }
}

/* Animation Classes */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.compressed-nav.open {
  animation: slideInRight 0.3s ease;
}

.compressed-nav.closing {
  animation: slideOutRight 0.3s ease;
}

/* Quick Actions Bar */
.quick-actions {
  position: fixed;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1030;
}

.quick-action {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  position: relative;
}

.quick-action:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.quick-action-tooltip {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.quick-action:hover .quick-action-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Hide quick actions when nav is open */
.compressed-nav.open ~ .quick-actions {
  display: none;
}

/* Search Bar */
.nav-search {
  padding: 0 1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-search input {
  width: 100%;
  padding: 0.625rem 2.5rem 0.625rem 2rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  outline: none;
}

.nav-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.nav-search input:focus {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.nav-search input:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

/* Search icons */
.nav-search .fa-search {
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.3s ease;
}

.nav-search input:focus + .fa-search {
  color: rgba(59, 130, 246, 0.8);
}

.nav-search .fa-times {
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.nav-search .fa-times:hover {
  color: rgba(255, 255, 255, 0.8);
  transform: scale(1.1);
}

/* No results message */
.no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  animation: fadeIn 0.3s ease;
}

.no-results i {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
  color: rgba(255, 255, 255, 0.4);
}

.no-results strong {
  color: rgba(255, 255, 255, 0.8);
}

/* Search animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}