.nav-item {
  position: relative;
}

.nav-links a, .auth-controls a, .theme-toggle {
  text-decoration: none;
  color: inherit;
  font-size: 1rem;
  padding: 10px 10px;
  border-radius: 8px;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.nav-links a:hover, .auth-controls a:hover, .theme-toggle:hover {
  background: var(--color-hover);
  transform: translateY(-1px);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-item > a::after {
  content: '▾';
  display: inline-block;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.nav-item:hover > a::after {
  transform: rotate(180deg);
}

.nav-item:hover .dropdown {
  display: flex;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0;
  background: var(--color-bg);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  min-width: 220px;
  padding: 8px 0;
  z-index: 3000;
  animation: dropdownFade 0.2s ease-out;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark .dropdown {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--color-bg);
}

body.dark .dropdown::before {
  border-bottom-color: #5c5454;
}

.dropdown a {
  display: flex;
  align-items: center;
  justify-content: center; /* or flex-start with padding-left if preferred */
  height: 44px;
  padding: 0 20px;
  margin: 2px 8px;
  font-size: 1rem;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 8px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
  text-align: center;
}

.dropdown a:hover {
  background: var(--color-hover);
  color: var(--color-accent);
  transform: scale(1.02);
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}


.nav-links,
.auth-controls,
.desktop-search {
  transition: opacity 0.2s ease;
}
