/**
 * Modern Navbar Styles
 * Based on FM-NEXUS design
 */

/* ============================================
   NAVBAR CONTAINER
   ============================================ */
.navbar-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.navbar-container.scrolled {
  box-shadow: var(--shadow-lg);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  gap: 2rem;
}

/* ============================================
   LOGO
   ============================================ */
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.navbar-logo:hover {
  transform: scale(1.05);
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--glow-primary);
  transition: box-shadow 0.3s ease;
}

.navbar-logo:hover .logo-icon {
  box-shadow: 0 0 30px rgba(226, 1, 205, 0.8);
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: 0.05em;
}

/* ============================================
   NAVIGATION LINKS
   ============================================ */
.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  position: relative;
  padding: 0.5rem 1rem;
  color: var(--foreground);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  font-size: 100%;
}

/* Hover state - secondary color (бирюзовый) */
.nav-link:hover {
  background: rgba(31, 158, 158, 0.1);
  color: var(--secondary);
}

/* Active state - primary color (розовый) */
.nav-link.active {
  background: rgba(226, 1, 205, 0.15);
  color: var(--primary);
}

/* Active link не меняется при hover */
.nav-link.active:hover {
  background: rgba(226, 1, 205, 0.15);
  color: var(--primary);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */
.nav-dropdown {
  position: relative;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dropdown-icon {
  transition: transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-icon,
.nav-dropdown.active .dropdown-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;  /* ← Убираем зазор! */
    left: 0;
    min-width: 200px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);  /* Сдвигаем вверх для анимации */
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

/* Добавляем "мост" между кнопкой и меню */
.nav-dropdown::before,
.user-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;  /* "Невидимый мост" высотой 10px */
    background: transparent;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.active .dropdown-menu,
.user-dropdown:hover .dropdown-menu,
.user-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* Hover state - secondary color (бирюзовый) */
.dropdown-item:hover {
  background: rgba(31, 158, 158, 0.1);
  color: var(--secondary);
  transform: translateX(4px);
}

/* Active state - primary color (розовый) */
.dropdown-item.active {
  background: rgba(226, 1, 205, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.dropdown-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

/* Active item не меняется при hover */
.dropdown-item.active:hover {
  background: rgba(226, 1, 205, 0.15);
  color: var(--primary);
  transform: translateX(0);
}

.dropdown-item svg {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.dropdown-item:hover svg {
  opacity: 1;
}

.dropdown-item.active svg {
  opacity: 1;
}

.dropdown-item-disabled {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  cursor: not-allowed;
  opacity: 0.5;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

/* ============================================
   GAME SWITCHER TOGGLE
   ============================================ */
.game-switcher-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.125rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  overflow: visible;
  min-width: 80px;
  height: 40px;
  position: relative;
}

.game-switcher-toggle:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

.game-switcher-toggle:active {
  transform: translateY(0);
}

.game-switcher-toggle.switching {
  pointer-events: none;
  opacity: 0.8;
}

.game-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  width: 100%;
  height: 100%;
  padding: 0 0.25rem;
}

.toggle-handle {
  width: 32px;
  height: 32px;
  background: var(--background);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.handle-icon {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  transition: all 0.3s ease;
}

.game-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  transition: all 0.3s ease;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

/* Specific positioning for each game mode */
[data-active-game="minecraft"] .game-display {
  justify-content: flex-start;
  padding: 0 0.25rem 0 0.125rem;
}

[data-active-game="hytale"] .game-display {
  justify-content: flex-end;
  padding: 0 0.125rem 0 0.25rem;
}

/* Color themes for different games */
[data-active-game="minecraft"] .game-switcher-toggle {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), var(--glass-bg));
  border-color: rgba(34, 197, 94, 0.2);
}

[data-active-game="minecraft"] .game-switcher-toggle:hover {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

[data-active-game="minecraft"] .toggle-handle {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), var(--background));
  border-color: rgba(34, 197, 94, 0.3);
}

[data-active-game="minecraft"] .game-label {
  color: rgba(34, 197, 94, 1);
}

[data-active-game="hytale"] .game-switcher-toggle {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.05), var(--glass-bg));
  border-color: rgba(168, 85, 247, 0.2);
}

[data-active-game="hytale"] .game-switcher-toggle:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

[data-active-game="hytale"] .toggle-handle {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), var(--background));
  border-color: rgba(168, 85, 247, 0.3);
}

[data-active-game="hytale"] .game-label {
  color: rgba(168, 85, 247, 1);
}

/* Hover effects */
.game-switcher-toggle:hover .toggle-handle {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

[data-active-game="minecraft"] .game-switcher-toggle:hover .toggle-handle {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

[data-active-game="hytale"] .game-switcher-toggle:hover .toggle-handle {
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* Animation for switching */
.game-switcher-toggle.switching .toggle-handle {
  animation: handleSwitch 0.6s ease-in-out;
}

.game-switcher-toggle.switching .game-label {
  animation: labelPulse 0.6s ease-in-out;
}

.game-switcher-toggle.switching .game-display {
  animation: displaySwitch 0.6s ease-in-out;
}

@keyframes handleSwitch {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.1) translateY(-2px); }
}

@keyframes labelPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes displaySwitch {
  0%, 100% { opacity: 1; transform: translateX(0); }
  50% { opacity: 0.7; transform: translateX(3px); }
}

/* Loading state */
.game-switcher-toggle.switching::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(226, 1, 205, 0.1), transparent);
  animation: switchGlow 1s ease-in-out infinite;
  border-radius: 1.5rem;
  z-index: 0;
}

@keyframes switchGlow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Accessibility states */
.game-switcher-toggle:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.game-switcher-toggle[aria-pressed="true"] {
  background: rgba(226, 1, 205, 0.1);
}

/* ============================================
   GAME SWITCHER TOOLTIP
   ============================================ */

.game-switcher-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg-darker);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease 0.5s;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.game-switcher-toggle::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--glass-border);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease 0.5s;
  z-index: 1001;
}

.game-switcher-toggle:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.game-switcher-toggle:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Tooltip color themes */
[data-active-game="minecraft"] .game-switcher-toggle::after {
  /* background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), var(--glass-bg)); */
  border-color: rgba(34, 197, 94, 0.3);
}

[data-active-game="minecraft"] .game-switcher-toggle::before {
  border-bottom-color: rgba(34, 197, 94, 0.3);
}

[data-active-game="hytale"] .game-switcher-toggle::after {
  /* background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), var(--glass-bg)); */
  border-color: rgba(168, 85, 247, 0.3);
}

[data-active-game="hytale"] .game-switcher-toggle::before {
  border-bottom-color: rgba(168, 85, 247, 0.3);
}

/* Hide tooltip during switching */
.game-switcher-toggle.switching::after,
.game-switcher-toggle.switching::before {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* ============================================
   NAVBAR ACTIONS
   ============================================ */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background: rgba(226, 1, 205, 0.1);
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.theme-toggle-btn .sun-icon {
  display: none;
}

.theme-toggle-btn .moon-icon {
  display: block;
}

.theme-toggle-btn.dark .sun-icon {
  display: block;
}

.theme-toggle-btn.dark .moon-icon {
  display: none;
}

/* Login Button */
.btn-navbar-login {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--foreground);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.btn-navbar-login:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--glow-primary);
  transform: translateY(-2px);
}

/* ============================================
   USER DROPDOWN
   ============================================ */
.user-dropdown {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-weight: 500;
}

.user-trigger:hover {
  background: rgba(226, 1, 205, 0.1);
  border-color: var(--primary);
}

.user-name {
  font-size: 0.95rem;
}

.user-dropdown .dropdown-menu {
  right: 0;
  left: auto;
}

.text-destructive {
  color: var(--destructive) !important;
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle .close-icon {
  display: none;
}

.mobile-menu-toggle.active .menu-icon {
  display: none;
}

.mobile-menu-toggle.active .close-icon {
  display: block;
}

/* ============================================
   MOBILE MENU
   ============================================ */
.mobile-menu {
  display: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-menu.active {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.mobile-menu-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .navbar-links {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .mobile-menu {
    display: block;
  }
  
  .mobile-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
  }
  
  .mobile-actions .game-switcher-toggle {
    margin-right: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .navbar-content {
    height: 64px;
  }
  
  .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .logo-text {
    font-size: 1.5rem;
  }
  
  .game-switcher-toggle {
    min-width: 75px;
    height: 36px;
    padding: 0.125rem;
  }
  
  .game-display {
    padding: 0 0.125rem;
  }
  
  [data-active-game="minecraft"] .game-display {
    padding: 0 0.125rem 0 0.0625rem;
  }

  [data-active-game="hytale"] .game-display {
    padding: 0 0.0625rem 0 0.125rem;
  }
  
  .toggle-handle {
    width: 28px;
    height: 28px;
  }
  
  .handle-icon {
    width: 16px;
    height: 16px;
  }
  
  .game-label {
    font-size: 0.8rem;
  }
  
  /* Mobile tooltip adjustments */
  .game-switcher-toggle::after {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    max-width: 180px;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .game-switcher-toggle::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* User Avatar Styles */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid var(--glass-border);
  object-fit: cover;
  transition: all 0.3s ease;
}

.user-trigger:hover .user-avatar {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.ml-auto {
  margin-left: auto;
}
