#navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card);
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flag-icon {
  height: 20px;
  width: auto;
  display: block;
}

.flag-icon-desktop-first {
  margin-right: 3px;
}

.flag-icon-mobile {
  height: 22px;
}

/* Suche im Hamburger-Menü – standardmässig versteckt */
.nav-search-item {
  display: none !important;
}

.sn-search-trigger {
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
  width: 100%;
}

.sn-search-trigger:hover {
  color: #3b82f6;
}

.lang-item {
  display: none !important;
}

.navbar {
  display: flex;
  align-items: center;
  padding: 15px 40px;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
}


.logo img {
  height: 90px;
  width: auto;
  display: block;
  transition: filter 0.3s ease;
}

/* Logo-Icon (nur Schild, kein Text) – standardmässig versteckt */
.logo .logo-icon {
  display: none;
  height: 36px;
  width: auto;
}

.logo img:hover {
  filter: drop-shadow(0 0 20px rgba(51, 153, 255, 0.75)) drop-shadow(0 0 40px rgba(102, 217, 255, 0.4));
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
}

.nav-links li {
  position: relative;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
  transition: 0.2s;
  display: block;
  padding: 5px 0;
}

.nav-links a:hover {
  color: #3b82f6;
}

.nav-links a.active {
  color: #66d9ff;
  font-weight: 700;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-card);
  list-style: none;
  margin: 0;
  padding: 10px 0;
  min-width: 220px;
  z-index: 1000;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.dropdown-menu li {
  width: 100%;
}

.dropdown-menu a {
  padding: 10px 15px;
  white-space: nowrap;
}

.dropdown-menu a:hover {
  background: #22345c;
  color: #3b82f6;
}

.dropdown-divider-item {
  padding: 8px 15px 3px;
  pointer-events: none;
  cursor: default;
}

.dropdown-divider-item span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(51, 153, 255, 0.65);
  display: block;
  border-top: 1px solid rgba(51, 153, 255, 0.15);
  padding-top: 7px;
}

@media (min-width: 769px) {
  .dropdown:hover .dropdown-menu {
    display: block;
  }
}

/* Mittlere Bildschirme: Nav-Links kompakter machen, damit nichts abgeschnitten wird */
@media (min-width: 769px) and (max-width: 1100px) {
  .navbar {
    padding: 10px 20px;
    gap: 8px;
  }

  .logo img {
    height: 55px;
  }

  .nav-links {
    gap: 14px;
  }

  .nav-links a {
    font-size: 13px;
  }
}
@media (max-width: 768px) {
  .dropdown.open .dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .language-switcher {
    display: none;
  }

  .lang-item {
    display: flex !important;
    justify-content: center;
    gap: 12px;
    padding: 8px 0;
  }

  .navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 10px 12px;
    gap: 0;
  }

  .logo {
    flex: 0 0 auto;
    z-index: 1;
  }

  .logo img {
    height: 40px;
  }

  .menu-toggle {
    display: flex;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    flex: none;
  }

  .user-menu {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .search-btn {
    display: none !important;
  }

  .nav-search-item {
    display: flex !important;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: absolute;
    top: 56px;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.75s ease, opacity 0.7s ease, padding 0.7s ease;
  }

  .nav-links.active {
    max-height: 600px;
    opacity: 1;
    padding: 20px 0;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    padding: 8px 0;
    font-size: 15px;
  }

  .dropdown-menu {
    display: none;
    position: static;
    background: transparent;
    box-shadow: none;
    padding: 5px 0 0;
    min-width: unset;
    border-radius: 0;
  }

  .dropdown.open .dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .dropdown-menu a {
    padding: 6px 0;
    color: #cbd5e1;
    font-size: 14px;
  }

  .dropdown-menu a:hover {
    background: transparent;
    color: #3b82f6;
  }
}

/* User-Menu Icon */
.user-menu {
  position: relative;
  margin-left: 10px;
  flex-shrink: 0;
}

.user-btn {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #93c5fd;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  padding: 0;
}

.user-btn svg {
  width: 20px;
  height: 20px;
}

.user-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: white;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  list-style: none;
  margin: 0;
  padding: 8px 0;
  min-width: 170px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  z-index: 1001;
}

.user-dropdown li a {
  display: block;
  padding: 10px 18px;
  color: #dbeafe;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.user-dropdown li a:hover {
  background: #22345c;
  color: #60a5fa;
}

.user-dropdown-name {
  padding: 10px 18px 6px;
  font-size: 13px;
  font-weight: 600;
  color: #60a5fa;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  margin-bottom: 4px;
  white-space: nowrap;
  list-style: none;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(59, 130, 246, 0.15);
  margin: 4px 0;
  list-style: none;
}

.user-menu.open .user-dropdown {
  display: block;
}

@media (max-width: 768px) {
  .user-btn {
    width: 36px;
    height: 36px;
  }

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

html, body {
  overflow-x: hidden;
}

/* Avatar / Initialen im User-Button */
.user-btn .user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-btn .user-initials {
  font-size: 16px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  line-height: 1;
  pointer-events: none;
}

/* -- Such-Button ------------------------------------ */
.search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #3399ff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.2s;
  flex-shrink: 0;
}
.search-btn:hover { color: #66d9ff; }

/* ===== Sehr schmale Bildschirme (≤ 360px): Nur Schild-Icon ===== */
@media (max-width: 360px) {
  .navbar {
    padding: 6px 8px;
  }

  /* Nur Schild-Icon anzeigen, Logos mit Text ausblenden */
  .logo img.logo-dark,
  .logo img.logo-light {
    display: none !important;
  }

  .logo .logo-icon {
    display: block !important;
  }

  .user-btn {
    width: 32px;
    height: 32px;
  }
}

/* .search-btn wird bei ≤768px im 768px-Block auf display:none gesetzt */

/* -- Such-Overlay ---------------------------------- */
#search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#search-overlay.open { display: flex; }

.search-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #334155;
  color: #64748b;
}
#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #e2e8f0;
  font-size: 1rem;
  font-family: inherit;
}
#search-input::placeholder { color: #64748b; }
#search-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
#search-close:hover { color: #e2e8f0; background: #334155; }
#search-results {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 360px;
  overflow-y: auto;
}
#search-results li a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  text-decoration: none;
  transition: background 0.15s;
}
#search-results li a:hover { background: #253350; }
.search-result-title { font-size: 0.95rem; font-weight: 600; color: #e2e8f0; }
.search-result-desc  { font-size: 0.82rem; color: #64748b; }
.search-no-results   { padding: 16px; color: #64748b; font-size: 0.9rem; text-align: center; }

@media (max-width: 768px) {
  #search-overlay { padding-top: 20px; }
  .search-box { max-width: calc(100% - 24px); margin: 0 12px; }
}
