/* ===== APP-STYLE NAVIGATION ===== */

:root {
  --app-bottom-nav-h: 88px;
  --app-nav-gold: #ffd700;
  --app-nav-gold-dark: #d4a017;
  --app-nav-bg: rgba(8, 14, 26, 0.94);
  --app-nav-bar-radius: 22px;
}

/* Alte Nav sofort ausblenden – verhindert Flash beim Reload */
.nav-actions,
.mobile-login-section,
.hamburger-btn {
  display: none !important;
}

body.has-app-nav {
  padding-top: calc(56px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--app-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

/* Top Bar */
.app-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10060;
  height: 56px;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(13, 27, 42, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

.app-top-nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white, #fff);
}

.app-top-nav__logo img {
  height: 36px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.25));
}

.app-top-nav__brand {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  color: var(--gold, #ffd700);
  display: none;
}

.app-top-nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-top-nav__login {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  color: var(--gold, #ffd700);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  text-transform: uppercase;
}

.app-top-nav__login:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.25);
}

.app-top-nav__user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-top-nav__greeting {
  color: var(--gold, #ffd700);
  font-size: 0.8rem;
  font-weight: 600;
  display: none;
}

.app-top-nav__dashboard {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: #fff;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
}

.app-top-nav__dashboard:hover {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold, #ffd700);
}

/* Bottom Bar – Floating Pill Design */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10060;
  padding: 0 max(10px, env(safe-area-inset-left, 0px))
    calc(10px + env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-right, 0px));
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  display: block !important;
}

.app-bottom-nav__inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  max-width: 560px;
  margin: 0 auto;
  padding: 7px 8px;
  background: linear-gradient(
    165deg,
    rgba(24, 34, 54, 0.97) 0%,
    rgba(8, 14, 26, 0.98) 100%
  );
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--app-nav-bar-radius);
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 215, 0, 0.1) inset;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

.app-bottom-nav__item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.48);
  cursor: pointer;
  text-decoration: none;
  transition:
    color 0.25s ease,
    transform 0.2s ease;
  border-radius: 16px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.app-bottom-nav__pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  padding: 7px 4px 6px;
  border-radius: 16px;
  transition:
    background 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s ease;
}

.app-bottom-nav__item:hover {
  color: rgba(255, 255, 255, 0.82);
}

.app-bottom-nav__item:hover .app-bottom-nav__pill {
  background: rgba(255, 255, 255, 0.05);
}

.app-bottom-nav__item.active {
  color: #0a1424;
}

.app-bottom-nav__item.active .app-bottom-nav__pill {
  background: linear-gradient(
    145deg,
    var(--app-nav-gold) 0%,
    #f5b800 48%,
    var(--app-nav-gold-dark) 100%
  );
  box-shadow:
    0 6px 20px rgba(255, 215, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transform: translateY(-1px);
}

.app-bottom-nav__item.active .app-bottom-nav__icon {
  color: #0a1424;
  filter: none;
}

.app-bottom-nav__item.active .app-bottom-nav__label {
  color: #0a1424;
  font-weight: 800;
}

.app-bottom-nav__item:active .app-bottom-nav__pill {
  transform: scale(0.96);
}

.app-bottom-nav__item.active:active .app-bottom-nav__pill {
  transform: translateY(0) scale(0.96);
}

.app-bottom-nav__icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition:
    color 0.25s ease,
    transform 0.2s ease;
}

.app-bottom-nav__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.app-bottom-nav__label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
  color: inherit;
  transition: color 0.25s ease;
}

.app-bottom-nav__badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid rgba(8, 14, 26, 0.95);
  animation: navPulse 2s infinite;
  z-index: 2;
}

@keyframes navPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.25);
  }
}

/* Social Popup */
.social-nav-modal {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.social-nav-modal.show {
  opacity: 1;
  visibility: visible;
}

.social-nav-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.social-nav-modal__content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(165deg, #1a1f35 0%, #0d1b2a 40%, #1b263b 100%);
  border-radius: 24px 24px 0 0;
  border-top: 2px solid rgba(255, 215, 0, 0.35);
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  margin-bottom: var(--app-bottom-nav-h);
  transform: translateY(calc(100% + var(--app-bottom-nav-h)));
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}

.social-nav-modal.show .social-nav-modal__content {
  transform: translateY(0);
}

.social-nav-modal__handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  margin: 0 auto 1.25rem;
}

.social-nav-modal__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 48px 1.25rem;
  margin-bottom: 0;
}

.social-nav-modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold, #ffd700);
  margin: 0;
  text-align: center;
}

.social-nav-modal__close {
  position: absolute;
  top: 0;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
}

.social-nav-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.social-nav-modal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 12px 10px;
  padding: 0.5rem 0.25rem 0.75rem;
  justify-items: center;
}

.social-nav-modal__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  border: none;
  text-decoration: none;
  transition: transform 0.25s ease;
  box-shadow: none;
  overflow: visible;
  flex-shrink: 0;
}

.social-nav-modal__icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 215, 0, 0.28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.social-nav-modal__link:active .social-nav-modal__icon-wrap {
  transform: scale(0.94);
}

.social-nav-modal__link:hover .social-nav-modal__icon-wrap {
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(255, 215, 0, 0.55);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.2);
}

.social-nav-modal__name {
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-nav-modal__link img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.social-nav-modal__fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

/* Bottom-Bar ausblenden wenn Sheet offen */
body.menu-sheet-open .app-bottom-nav,
body.social-sheet-open .app-bottom-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateY(110%);
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Hide legacy nav when app nav active */
body.has-app-nav .nav-actions,
body.has-app-nav .mobile-login-section {
  display: none !important;
}

/* Unterseiten: eigene Header ausblenden, App-Top-Bar übernimmt */
body.has-app-nav .dashboard-header,
body.has-app-nav .slotpicker-header {
  display: none !important;
}

@media (max-width: 768px) {
  .social-nav-modal__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .social-nav-modal__icon-wrap {
    width: 54px;
    height: 54px;
  }
}

@media (min-width: 769px) {
  .social-nav-modal__content {
    min-height: auto;
    max-width: 560px;
    margin-bottom: 0;
    transform: translateY(100%);
  }

  .social-nav-modal.show .social-nav-modal__content {
    transform: translateY(0);
  }

  .social-nav-modal__grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 14px 12px;
    padding: 0.75rem 0.5rem 1rem;
  }

  .social-nav-modal__icon-wrap {
    width: 64px;
    height: 64px;
  }
}

@media (min-width: 1025px) {
  :root {
    --app-bottom-nav-h: 84px;
  }

  .app-bottom-nav__inner {
    max-width: 640px;
    padding: 8px 10px;
  }

  .app-bottom-nav__label {
    font-size: 0.62rem;
  }

  .app-top-nav__brand {
    display: block;
  }

  .app-top-nav__greeting {
    display: block;
  }
}

@media (max-width: 380px) {
  .app-bottom-nav__inner {
    padding: 6px 5px;
    gap: 2px;
  }

  .app-bottom-nav__label {
    font-size: 0.52rem;
  }

  .app-bottom-nav__icon {
    width: 20px;
    height: 20px;
  }

  .app-bottom-nav__pill {
    padding: 6px 2px 5px;
  }
}
