/* =========================================
   BASIS-LAYOUT NAVBAR
========================================= */
:root {
  --safe-top: 0px;
  --nav-height: 60px;
  --offer-rail-width: 72px;
}

.navbar-collapse {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  padding-top: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;
  background: hsl(0deg 0% 100% / 74%);
  padding-inline: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 1200;
  pointer-events: auto;
}

/* Inside pages run with iOS status bar space above web content. */
body.inside-page .navbar-collapse {
  height: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}

.navbar-collapse img#bapHome {
  height: 36px;
  cursor: pointer;
}

.navbar-brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.offer-rail-toggle {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  color: var(--color-text-muted);
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.offer-rail-toggle:hover,
.offer-rail-toggle[aria-expanded="true"] {
  color: var(--color-primary);
  background: var(--color-surface-muted);
}

.offer-rail-toggle svg {
  width: 34px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.offer-rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1250;
  width: var(--offer-rail-width);
  padding: calc(var(--nav-height) + 1rem) 10px 1rem;
  color: var(--color-text-default);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-default);
  box-shadow: 5px 0 18px rgba(0, 0, 0, 0.1);
  transform: translateX(-105%);
  visibility: hidden;
  transition: width 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.offer-rail.is-open {
  transform: translateX(0);
  visibility: visible;
}

.offer-rail.is-expanded {
  --offer-rail-width: 190px;
}

.offer-rail-header {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.offer-rail-title {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  opacity: 0;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.offer-rail.is-expanded .offer-rail-title {
  opacity: 1;
}

.offer-rail-expand {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 50%;
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.offer-rail.is-expanded .offer-rail-expand span {
  display: inline-block;
  transform: rotate(180deg);
}

.offer-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.offer-rail-link {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  overflow: hidden;
  padding: 6px;
  border-radius: 10px;
  color: var(--color-text-default);
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.offer-rail-link.is-pending-icon {
  display: none;
}

.offer-rail-link:hover {
  color: var(--color-primary);
  background: var(--color-surface-muted);
}

.offer-rail-link img {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 9px;
}

.offer-rail-link span {
  opacity: 0;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.offer-rail.is-expanded .offer-rail-link span {
  opacity: 1;
}

body.offer-rail-open {
  padding-left: var(--offer-rail-width);
  transition: padding-left 0.25s ease;
}

body.offer-rail-open.offer-rail-expanded {
  --offer-rail-width: 190px;
}

body.offer-rail-open .navbar-collapse,
body.offer-rail-open #bap-ticker {
  left: var(--offer-rail-width);
  transition: left 0.25s ease;
}

/* =========================================
   MENÜ LISTE (DESKTOP)
========================================= */
.nav {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

#testimonials-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav>li {
  display: flex;
  align-items: center;
  position: relative;
  height: auto;
  cursor: pointer;
}

.nav>li>a,
.nav>li>.menu-label {
  display: flex;
  align-items: center;
  gap: 0.4em;
  text-decoration: none;
  color: var(--color-text-default);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.nav li a:hover {
  opacity: 0.8;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.language-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.language-flag:hover,
.language-flag.is-active {
  background: var(--color-surface);
  border-color: var(--color-primary);
}

.mobile-index-language-switcher {
  display: none;
}

.nav>li.selected {
  border-bottom: 2px solid var(--color-primary);
}

/* =========================================
   BUTTON-STILE
========================================= */
.nav>li.button {
  border: 2px solid var(--color-text-default);
  border-radius: 8px;
  padding-inline: 1rem;
  text-align: center;
}

.nav>li.button a {
  display: block;
  width: 100%;
  padding: 6px 0;
  text-align: center;
  text-decoration: none;
}

.nav>li.button.black {
  background-color: var(--color-text-default);
}

.nav>li.button.black a {
  color: var(--color-surface);
}

.nav>li.button.white {
  background-color: var(--color-surface);
}

.nav>li.button.white a {
  color: var(--color-text-default);
}

.nav>li.button:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.tool-dashboard-link>a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-muted);
  color: var(--color-text-default);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tool-dashboard-link>a:hover {
  background: var(--color-accent);
  border-color: var(--color-primary);
}

.tool-dashboard-link.is-hidden {
  display: none !important;
}

.nav>li.button.white:hover {
  color: var(--color-surface);
}

.nav>li.user-avatar {
  padding: 0;
  display: flex;
}

.public-user-avatar {
  cursor: default;
}

.public-user-avatar[hidden] {
  display: none !important;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  border: 1px solid var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--color-text-default);
  overflow: hidden;
  text-transform: uppercase;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar-circle.has-image img {
  display: block;
}

.avatar-circle.has-image span {
  display: none;
}

/* Dropdown-Item "Add Club" */
.dropdown-item[data-value-id="-1"] {
  color: var(--color-secondary);
  font-weight: 800;
  background-color: var(--color-accent);
  border-top: 1px solid var(--color-border-strong);
  padding-top: 0.5rem;
  text-align: center;
}

.dropdown-item[data-value-id="-1"] .dropdown-item-subtitle {
  display: none;
}

/* =========================================
   HAMBURGER / CLOSE ICONS
========================================= */
.nav-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
}

.nav-toggle .icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  font-size: 26px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.nav-toggle .icon-hamburger {
  opacity: 1;
}

.nav-toggle.active .icon-hamburger {
  opacity: 0;
}

.nav-toggle.active .icon-close {
  opacity: 1;
}

.nava {
  display: none;
}


body.index .navbar-collapse {
  top: var(--index-nav-offset, 0px);
  height: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}

body.outside-page .navbar-collapse {
  top: var(--index-nav-offset, 0px);
}

/* =========================================
   MOBILE STILE
========================================= */
@media (max-width: 1000px) {
  .offer-rail-toggle,
  .offer-rail {
    display: none;
  }


  /* Navigation zusammenklappbar */
  .nav {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    flex-direction: column;
    align-items: center;
    padding: 16px;
    gap: 10px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 14px 16px rgba(0, 0, 0, 0.2);
    z-index: 1190;
  }

  body.inside-page .nav {
    top: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
  }

  .nav.show {
    max-height: 800px;
    opacity: 1;
    transform: translateY(0);
    overflow: visible;
    /* Dropdowns sichtbar lassen */
    align-items: stretch;
    background: var(--color-surface-muted);
  }

  .nav>li.button {
    width: 100%;
    justify-content: center;
  }

  .nav>li,
  .nav>li>a,
  .nav>li>.menu-label,
  #abmelden {
    width: auto;
    justify-content: center;
    text-align: center;
  }

  #bap-tools {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  #bap-tools>a {
    width: 100%;
    max-width: 220px;
  }

  /* Dropdown unter Meine Anlagen zentrieren */
  #meine-anlagen {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  #meine-anlagen .dropdown-menu {
    display: block !important;
    position: static;
    margin: 0.5rem auto 0;
    width: 90%;
    max-width: 320px;
    text-align: left;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }

  .nava {
    display: flex;
    gap: 1rem;
    margin-inline: 1rem;
  }

  .mobile-index-language-switcher {
    display: inline-flex;
    flex-direction: column;
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 0.15rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
  }
}

/* =========================================
   DESKTOP-STILE (>1000px)
========================================= */
@media (min-width: 1001px) {
  .nav-toggle {
    display: none;
  }

  .nav {
    display: flex !important;
    opacity: 1 !important;
    max-height: none !important;
    transform: none !important;
    position: static;
    box-shadow: none;
  }

  .nava {
    display: none !important;
  }
}
