/* SmartVisitor Admin - Navigation Menu */
/* Build: 2026-01-08-v1 - Horizontal Header */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
  --nav-bg: #0e1330;
  --nav-border: #222741;
  --nav-hover: #1e293b;
  --nav-active: #2a49ff;
  --nav-text: #e9eef7;
  --nav-muted: #9aa4b2;
  --nav-height: 56px;
}

/* ============================================
   HORIZONTAL HEADER NAVIGATION
   ============================================ */

.nav-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  z-index: 500; /* High enough to be above page content, dropdowns go even higher */
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--nav-text);
  font-weight: 600;
  font-size: 16px;
  padding: 8px 12px 8px 8px;
  border-radius: 8px;
  margin-right: 8px;
  flex-shrink: 0;
}

.nav-logo:hover {
  background: var(--nav-hover);
}

.nav-logo .logo-icon {
  font-size: 22px;
}

.nav-logo .logo-text {
  white-space: nowrap;
}

/* Main Navigation Links Container */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow: visible; /* IMPORTANT: Allow dropdowns to overflow */
}

/* Navigation Link (top level) */
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  color: var(--nav-muted);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}

.nav-link:hover {
  background: var(--nav-hover);
  color: var(--nav-text);
}

.nav-link.active {
  background: var(--nav-hover);
  color: #60a5fa;
}

.nav-link.dummy {
  opacity: 0.5;
  font-style: italic;
  color: #9aa4b2;
}

.nav-link.dummy:hover {
  opacity: 0.7;
}

.nav-link .icon {
  font-size: 16px;
}

.nav-link .arrow {
  font-size: 8px;
  margin-left: 2px;
  opacity: 0.6;
}

/* ============================================
   DROPDOWN MENU
   ============================================ */

.nav-dropdown {
  position: relative;
  z-index: 150; /* Above other nav items when open */
}

.nav-dropdown:hover {
  z-index: 200; /* Highest when hovering */
}

/* Hover bridge - invisible area to maintain hover state */
.nav-dropdown > .nav-link::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 10px; /* Bridge gap between nav-link and dropdown */
  background: transparent;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px); /* Adjusted for hover bridge */
  left: 0;
  background: #1a1f35;
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  padding: 6px;
  min-width: 220px;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  z-index: 1000; /* Very high to ensure visibility */
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
  animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dropdown Section Header */
.nav-dropdown-section {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--nav-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-dropdown-section:not(:first-child) {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--nav-border);
}

/* Dropdown Item */
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s;
}

.nav-dropdown-item:hover {
  background: var(--nav-hover);
}

.nav-dropdown-item.active {
  background: var(--nav-hover);
  color: #60a5fa;
}

.nav-dropdown-item.dummy {
  opacity: 0.5;
  font-style: italic;
  color: #9aa4b2;
}

.nav-dropdown-item.dummy:hover {
  opacity: 0.7;
}

.nav-dropdown-item .icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-dropdown-item .label {
  flex: 1;
}

.nav-dropdown-item .badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--nav-active);
  border-radius: 10px;
  color: white;
}

/* ============================================
   RIGHT SIDE ACTIONS
   ============================================ */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-action-btn {
  background: transparent;
  border: 1px solid #334155;
  color: var(--nav-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-action-btn:hover {
  background: var(--nav-hover);
  border-color: #60a5fa;
  color: var(--nav-text);
}

.nav-action-btn .action-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.nav-action-btn .action-badge.warning {
  background: #f59e0b;
}

/* ============================================
   GLOBAL SEARCH BUTTON
   ============================================ */

/* The search button uses the same .nav-action-btn styles as other action buttons */
/* No additional styles needed - it integrates seamlessly with existing action buttons */

/* ============================================
   USER MENU
   ============================================ */

.nav-user-menu {
  position: relative;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid #334155;
  color: var(--nav-text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.nav-user-btn:hover {
  background: var(--nav-hover);
  border-color: #60a5fa;
}

.nav-user-icon {
  font-size: 16px;
}

.nav-user-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-arrow {
  font-size: 8px;
  color: var(--nav-muted);
}

.nav-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1a1f35;
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}

.nav-user-menu:hover .nav-user-dropdown,
.nav-user-menu.open .nav-user-dropdown {
  display: block;
  animation: dropdownFade 0.15s ease-out;
}

.nav-user-info {
  padding: 10px 12px;
  border-bottom: 1px solid var(--nav-border);
  margin-bottom: 6px;
}

.nav-user-info .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--nav-text);
}

.nav-user-info .role {
  font-size: 11px;
  color: var(--nav-muted);
  text-transform: uppercase;
}

.nav-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-user-dropdown-item:hover {
  background: var(--nav-hover);
}

.nav-user-dropdown-item.logout {
  color: #f87171;
}

.nav-user-dropdown-item.logout:hover {
  background: rgba(248, 113, 113, 0.1);
}

/* ============================================
   QUICK ACTIONS MENU
   ============================================ */

.quick-actions {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
}

.quick-actions-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a49ff, #2137c9);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(42, 73, 255, 0.4);
  transition: all 0.3s;
}

.quick-actions-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(42, 73, 255, 0.6);
}

.quick-actions-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: none;
}

.quick-actions-menu.active {
  display: block;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quick-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #e9eef7;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s;
  font-size: 14px;
}

.quick-action-item:hover {
  background: #334155;
}

.quick-action-item .icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

/* Mobile menu button (hamburger) */
.nav-mobile-btn {
  display: none;
  background: transparent;
  border: 1px solid #334155;
  color: var(--nav-text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  align-items: center;
  justify-content: center;
}

/* Mobile overlay */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.nav-mobile-overlay.active {
  display: block;
}

/* Mobile drawer */
.nav-mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  z-index: 150;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.nav-mobile-drawer.active {
  transform: translateX(0);
}

.nav-mobile-drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-mobile-drawer-close {
  background: transparent;
  border: none;
  color: var(--nav-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

.nav-mobile-menu {
  padding: 12px;
}

.nav-mobile-section {
  padding: 8px 12px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--nav-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-mobile-section:not(:first-child) {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--nav-border);
}

.nav-mobile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s;
}

.nav-mobile-item:hover {
  background: var(--nav-hover);
}

.nav-mobile-item.active {
  background: var(--nav-hover);
  color: #60a5fa;
}

.nav-mobile-item.dummy {
  opacity: 0.5;
  font-style: italic;
  color: #9aa4b2;
}

.nav-mobile-item.dummy:hover {
  opacity: 0.7;
}

.nav-mobile-item .icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

@media (max-width: 1024px) {
  .nav-links {
    display: none;
  }

  .nav-mobile-btn {
    display: flex;
  }

  .nav-mobile-drawer {
    display: block;
  }

  .nav-header {
    justify-content: space-between;
  }

  .nav-logo .logo-text {
    display: none;
  }

  .nav-user-name {
    display: none;
  }
}

@media (max-width: 480px) {
  .nav-header {
    padding: 0 12px;
  }

  .nav-action-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .nav-user-btn {
    padding: 6px 8px;
  }
}

/* ============================================
   CONTEXT MENU (Right-click)
   ============================================ */

.context-menu {
  position: fixed;
  background: #1a1f35;
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1000;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--nav-text);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.context-menu-item:hover {
  background: var(--nav-hover);
}

.context-menu-separator {
  height: 1px;
  background: var(--nav-border);
  margin: 4px 0;
}

