/* ==========================================================================
   FirstSpirit Navigation CSS - Finale Version
   ========================================================================== */

/* ==========================================================================
   Navbar Base Styles
   ========================================================================== */

.navbar {
  position: fixed;
  top: 0; 
  left: 0; 
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  color: var(--blue);
  height: 80px;
  padding: 0 2rem;
  z-index: 1000;
  border-bottom: 1px solid #eee;
  transition: top 0.3s;
}

/* Hide/Show on scroll */
.navbar.hide-navbar { 
  top: -90px; 
}

.navbar.show-navbar { 
  top: 0; 
}

/* ==========================================================================
   Transparent Navbar (Desktop)
   ========================================================================== */

.navbar.transparent-at-top {
  background: transparent;
  color: #fff;
  border-bottom: none;
}

.navbar.transparent-at-top::after {
  content: "";
  display: block;
  position: absolute;
  left: 144px;
  right: 144px;
  bottom: 0;
  height: 1px;
  background: #fff;
  opacity: 1; 
  z-index: 1001;
}

.navbar.transparent-at-top,
.navbar.transparent-at-top a,
.navbar.transparent-at-top button,
.navbar.transparent-at-top .navbar__icons a,
.navbar.transparent-at-top .iconlink,
.navbar.transparent-at-top .navbar__menu > li > button {
  color: #fff;
}

/* Menu-Items bei Transparenz auch transparent */
.navbar.transparent-at-top .navbar__item {
  background: transparent !important;
  color: #fff !important;
}

.navbar.transparent-at-top .navbar__item a,
.navbar.transparent-at-top .navbar__item button {
  background: transparent !important;
  color: #fff !important;
}

.navbar.transparent-at-top .iconlink img,
.navbar.transparent-at-top .icon-arrow img,
.navbar.transparent-at-top .navbar__burger img {
  filter: brightness(0) invert(1);
}

.navbar.transparent-at-top .navbar__logo img {
  filter: none;
}

/* ==========================================================================
   Logo
   ========================================================================== */

.navbar__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.navbar__logo a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.navbar__logo img {
  height: 50px;
  width: auto;
  display: block;
}

/* ==========================================================================
   Desktop Navigation Menu
   ========================================================================== */

.navbar__menu {
  display: flex;
  flex: 1;
  margin: 0 3rem;
  list-style: none;
  padding: 0;
  align-items: stretch;
  height: 100%;
}

/* ==========================================================================
   Navigation Item 
   ========================================================================== */

.navbar__item {
  position: relative;
  flex: 1 1 0;
  background: var(--white);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: none;
}

.navbar__item a,
.navbar__item button {
  color: inherit;
  background: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  width: 100%;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: inherit;
  line-height: 1.2;
  padding: 0 1rem;
  text-decoration: none;
  white-space: nowrap;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.navbar__item:nth-child(-n+5) a,
.navbar__item:nth-child(-n+5) button {
  font-weight: 500;
}

.navbar__item:hover,
.navbar__item:focus-within {
  background: var(--blue);
  color: var(--beige);
}

.navbar__item:hover a,
.navbar__item:focus-within a,
.navbar__item:hover button,
.navbar__item:focus-within button {
  color: var(--beige);
}

.navbar__item a:focus:not(:focus-visible),
.navbar__item button:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   Dropdown Menus
   ========================================================================== */

.dropdown {
  display: block;
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  background: var(--blue);
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  padding: 0;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.navbar__item.has-dropdown:hover .dropdown,
.navbar__item.has-dropdown:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: scaleY(1);
  overflow: visible;
}

.dropdown li {
  list-style: none;
  width: 80%;
}

.dropdown li a {
  color: var(--white) !important;
  padding: 1rem;
  display: block;
  text-decoration: none;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.dropdown li a:hover {
  color: var(--beige) !important;
}

/* ==========================================================================
   Megamenus (Desktop)
   ========================================================================== */

.megamenu {
  position: fixed;
  top: 80px;
  left: 0;
  width: 100%;
  background: var(--blue);
  color: var(--white);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.45s ease, opacity 0.45s ease, visibility 0.45s ease;
  z-index: 200;
  overflow-x: auto;
}

.navbar__item.has-megamenu:hover .megamenu,
.navbar__item.has-megamenu:focus-within .megamenu {
  opacity: 1;
  visibility: visible;
  transform: scaleY(1);
}

.megamenu__inner {
  display: flex;
  justify-content: flex-start;
  padding: 0 144px 0 144px;
  min-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1500px) {
  .megamenu__inner {
    padding: 0 72px 0 72px;
    min-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 1200px) {
  .megamenu__inner {
    padding: 0 36px 0 36px;
    min-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 1100px) {
  .megamenu__inner {
    padding: 0 4px 0 4px;
    min-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 1050px) {
  .megamenu__inner {
    padding: 0 0px 0 0px;
    min-width: 100%;
    box-sizing: border-box;
  }
}

.megamenu__col {
  flex: 1 0 220px;
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
  padding-bottom: 2rem;
  cursor: pointer;
  border-left: 2px solid rgba(255, 255, 255, 0.07);
}

.megamenu__col:last-child {
  border-right: 2px solid rgba(255, 255, 255,0.07);
}

.megamenu__col:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.megamenu__head {
  min-height: 3.5rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  display: block;
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--white);
  white-space: normal;
  hyphens: auto;
}

.megamenu__head a {
  min-height: 3.5rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  display: block;
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--white);
  white-space: normal;
  hyphens: auto;
}

.megamenu__head a:hover {
  color: var(--beige) !important;
}

.megamenu__links {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
}

.megamenu__col a {
  align-self: flex-start;
  margin: 0;
  padding: 0.6rem 0;
  min-height: auto;
  color: var(--white) !important;
  text-decoration: none;
  line-height: 1.2;
  display: block;
  width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  white-space: normal;
}

.megamenu__col a:hover {
  color: var(--beige) !important;
}

/* ==========================================================================
   Icon Arrows
   ========================================================================== */

.icon-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 28px;
  width: 28px;
  margin: 0;
  padding: 0;
}

.icon-arrow img {
  transition: transform 0.2s;
  height: 28px;
  width: 28px;
  display: block;
  margin: 0;
  padding: 0;
}

.navbar__item.has-dropdown:hover .icon-arrow img,
.navbar__item.has-dropdown:focus-within .icon-arrow img,
.navbar__item.has-megamenu:hover .icon-arrow img,
.navbar__item.has-megamenu:focus-within .icon-arrow img {
  filter: invert(82%) sepia(37%) saturate(232%) hue-rotate(360deg) brightness(92%) contrast(93%);
  transition: filter 0.2s;
  transform: rotate(180deg);
}

/* ==========================================================================
   Action Icons (Search, User, Burger)
   ========================================================================== */

.navbar__icons {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}

.iconlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, filter 0.2s ease;
  margin-left: 1rem;
  height: 100%;
  width: 28px;
  flex-shrink: 0;
}

.iconlink:first-child {
  margin-left: 0;
}

.iconlink img,
.navbar__burger img {
  width: 28px;
  height: 28px;
  display: block;
  color: var(--blue);
  margin: 0;
  padding: 0;
}

/* Hover-Effekt */
.iconlink:hover img {
  filter: invert(82%) sepia(37%) saturate(232%) hue-rotate(360deg) brightness(92%) contrast(93%);
}

.navbar__burger {
  display: none;
  background: none;
  border: none;
  outline: none;
  padding: 0;
  margin-left: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 28px;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
}

/* ==========================================================================
   Mobile Styles
   ========================================================================== */

@media (max-width: 1024px) {
  /* Hide desktop navigation elements */
  .navbar__menu,
  .dropdown {
    display: none;
  }
  
  .mobile-navbar button:focus,
  .mobile-navbar a:focus,
  .mobile-menu button:focus,
  .mobile-menu a:focus {
    outline: none !important;
    box-shadow: none !important;
  }

  /* Mobile navbar adjustments */
  .navbar,
  .navbar.transparent-at-top {
    background: var(--white);
    color: var(--blue);
    border-bottom: 1px solid #eee;
  }

  .navbar.transparent-at-top .iconlink img,
  .navbar.transparent-at-top .icon-arrow img,
  .navbar.transparent-at-top .navbar__burger img {
    filter: none;
    color: var(--blue);
  }

  .navbar__burger {
    display: flex;
  }

  /* Navbar behavior with mobile menus */
  body.mainmenu-open .navbar {
    display: flex;
    position: fixed;
    top: 0;
    z-index: 1000;
  }

  body.submenu-open .navbar {
    display: none;
  }

  /* Mobile Megamenu - Responsive Anpassung */
  .megamenu {
    position: static;
    top: auto;
    width: 100%;
    opacity: 1;
    visibility: visible;
    transform: scaleY(1) !important;
    background: var(--blue);
    overflow-x: hidden;
    max-height: none;
  }

  .megamenu__inner {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    margin: 0;
    min-width: 100%;
    box-sizing: border-box;
  }

  .megamenu__col {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.8rem;
    cursor: pointer;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    width: 100%;
    box-sizing: border-box;
  }

  .megamenu__col:last-child {
    border-right: none;
    border-bottom: none;
  }

  .megamenu__col:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .megamenu__head {
    min-height: auto;
    margin-top: 0;
    margin-bottom: 0.8rem;
    line-height: 1.2;
    display: block;
    font-weight: 500;
    color: var(--white);
  }

  .megamenu__links {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
  }

  .megamenu__col a {
    align-self: flex-start;
    margin: 0;
    padding: 0.5rem 0;
    min-height: auto;
    color: var(--white) !important;
    text-decoration: none;
    line-height: 1.2;
    display: block;
    width: 100%;
  }

  .megamenu__col a:hover {
    color: var(--beige) !important;
  }

  /* Mobile Menu */
  .mobile-menu {
    display: flex;
    flex-direction: column;
    background: var(--white);
    color: var(--blue);
    position: fixed;
    top: 0px;
    left: 0;
    height: 100vh;
    width: 100vw;
    z-index: 999;
    overflow-y: auto;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease;
    pointer-events: none;
    box-sizing: border-box;
  }

  .mobile-menu.active {
    max-height: 100vh;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Mobile Navigation Menu */
  .mobile-navbar__menu {
    background: var(--white);
    color: var(--blue);
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  .mobile-navbar__item {
    border-bottom: 1px solid #eee;
    width: 100%;
  }

  /* Einheitliche Styles für alle Mobile Menu Elemente */
  .mobile-navbar__item a,
  .mobile-navbar__item button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: var(--blue);
    font-weight: 500;
    font-size: 1.2rem;
    font-family: inherit;
    line-height: 1.2;
    padding: 1.1rem 1.8rem;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    box-sizing: border-box;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
  }

  /* Mobile Submenus */
  .mobile-submenu {
    box-sizing: border-box;
    background: var(--white);
    color: var(--blue);
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow-y: auto;
  }

  .mobile-submenu[aria-hidden="false"] {
    display: flex;
  }

  .submenu-header {
    height: 80px;
    background: var(--white);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid #eee;
    font-size: 1.2rem;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
  }

  .submenu-header button {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--blue);
    padding: 0;
    cursor: pointer;
    transition: color 0.2s, fill 0.2s;
  }

  .submenu-header img {
    width: 28px;
    height: 28px;
    color: inherit;
    display: block;
  }

  .mobile-submenu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Einheitliche Styles für Mobile Submenu */
  .mobile-submenu ul li a,
  .mobile-submenu ul li button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: var(--blue);
    font-weight: 500;
    font-size: 1.2rem;
    font-family: inherit;
    line-height: 1.2;
    padding: 1.1rem 1.8rem;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: color 0.2s, background 0.2s;
    box-sizing: border-box;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
  }

  /* Mobile Accordion Headers */
  .mobile-megasubmenu-head {
    background: rgba(0,0,0,0.07);
    color: var(--blue);
    font-weight: 500;
    font-size: 1.2rem;
    font-family: inherit;
    line-height: 1.2;
    padding: 1.1rem 1.8rem;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s, color 0.2s;
    box-sizing: border-box;
    margin: 0;
    border: none;
    background: rgba(0,0,0,0.07);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }

  .mobile-megasubmenu-head img {
    width: 28px;
    height: 28px;
    display: block;
    margin-left: 0.7em;
    transition: filter 0.2s;
  }

  .has-megasubmenu-list li {
    border-bottom: none;
    width: 100%;
  }

  /* Mobile Accordion Content */
  .mobile-megasubmenu {
    background: var(--white);
    color: var(--blue);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    padding-left: 1.5rem;
    width: 100%;
    box-sizing: border-box;
  }

  .mobile-megasubmenu[aria-hidden="false"] {
    max-height: 600px;
    opacity: 1;
    visibility: visible;
  }

  .mobile-megasubmenu li a {
    display: block;
    padding: 0.75rem 1rem;
    text-align: right;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ==========================================================================
   Desktop Only
   ========================================================================== */

@media (min-width: 1025px) {
  .navbar__burger,
  .mobile-menu,
  .mobile-navbar__menu,
  .mobile-navbar__icons,
  .mobile-submenu,
  .mobile-megasubmenu {
    display: none;
  }

  .navbar__item a:focus,
  .navbar__item button:focus {
    outline: none;
    box-shadow: none;
  }
}

/* ==========================================================================
   Body Classes for Mobile Menu States
   ========================================================================== */

body.mainmenu-open,
body.submenu-open {
  overflow: hidden;
}

/* Box sizing for all mobile elements */
.mobile-menu *,
.mobile-submenu * {
  box-sizing: border-box;
}

/* ==========================================================================
   Print-Medienabfrage
   ========================================================================== */

@media print {
  /* Hauptnavigation ausblenden */
  nav.navbar {
    display: none !important;
  }
  
  /* Mobile-Navigation ausblenden */
  div.mobile-menu {
    display: none !important;
  }

  .navbar__icons {
    display: none !important;
  }
  
  .navbar__burger {
    display: none !important;
  }
}