/* -------------------------------------------------------------------
 * Wellenreiten Mega-Menu – Grundgerüst
 *
 * WICHTIG: Alle Regeln sind mit #wr-main-menu präfixt. Ein ID-Selektor
 * schlägt in der CSS-Spezifität IMMER jede Anzahl von Klassen-Selektoren
 * (z.B. .templaza-header .navbar-nav .menu-item = 3 Klassen).
 * Dadurch braucht es kein !important und wir gewinnen zuverlässig gegen
 * altes Theme-CSS, ohne dessen Dateien anfassen zu müssen.
 *
 * Voraussetzung: wp_nav_menu() wird mit 'menu_id' => 'wr-main-menu'
 * aufgerufen (siehe wellenreiten-mega-menu.php).
 * ------------------------------------------------------------------- */

#wr-main-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

#wr-main-menu, #wr-main-menu * {
    box-sizing: border-box;
}

#wr-main-menu .wr-megamenu__top-item {
    list-style: none;
}

#wr-main-menu .wr-megamenu__top-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    padding: 12px 16px;
    position: relative;
}

#wr-main-menu .current-menu-item .wr-megamenu__top-link:after {
    content: '';
    position: absolute;
    bottom: 0.875rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: #0F4C81;
    color: #0F4C81;
}

.wr-megamenu__top-title {
    font-weight: 500;
    line-height: 1.5rem;
    font-size: 1rem;

    font-family: var(--font-family)
}

#wr-main-menu .wr-megamenu__top-caret {
    display: none;
}

/* Mega-Menü wird per Hover (Desktop) sichtbar.
   position:fixed + Position wird per JS (wr-mega-menu.js) exakt auf die
   linke Kante von .templaza-header gesetzt – das umgeht zuverlässig alle
   Zwischen-Container, die selbst position:relative haben könnten. */
#wr-main-menu .wr-megamenu {
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    background: #fff;
    box-shadow: 0 12px 16px -4px var(--Colors-Effects-Shadows-shadow-lg_01, rgba(0, 0, 0, 0.08)), 0 4px 6px -2px var(--Colors-Effects-Shadows-shadow-lg_02, rgba(0, 0, 0, 0.03)), 0 2px 2px -1px var(--Colors-Effects-Shadows-shadow-lg_03, rgba(0, 0, 0, 0.04));
    overflow: hidden;
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
}

@media (min-width: 901px) {
    #wr-main-menu .wr-megamenu__top-item:hover > .wr-megamenu {
        display: block;
    }
}

/* Beim Scrollen per JS zwangsgeschlossen (siehe wr-mega-menu.js) */
#wr-main-menu .wr-megamenu__top-item.wr-mega-force-closed > .wr-megamenu {
    display: none !important;
}

/* --- Akkordion-Layout ------------------------------------------------ */

#wr-main-menu .wr-megamenu__inner {
    position: relative; /* Bezugspunkt für das absolut positionierte Panel */
    display: flex;
    gap: 24px;
    width: 100%;
}

#wr-main-menu .wr-megamenu__sidebar {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 0 0 358px;
    border-right: 1px solid #eee;
    position: relative;
    z-index: 1;
    padding: 1.5rem;
}

#wr-main-menu .wr-megamenu__country {
    list-style: none;
}

#wr-main-menu .wr-megamenu__country-link {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    text-decoration: none;
    border-radius: 8px;
}

#wr-main-menu .wr-megamenu__country.is-active > .wr-megamenu__country-link,
#wr-main-menu .wr-megamenu__country-link:hover {
    background: #EBF5F5;
}

#wr-main-menu .wr-megamenu__country.is-active > .wr-megamenu__country-link .wr-megamenu__country-title,
#wr-main-menu .wr-megamenu__country-link:hover .wr-megamenu__country-title {
    font-weight: 700;
    color: #171717;
}


/* Bild-Spalte hat eine feste Breite, damit Einträge ohne Bild
   (kein Beitragsbild + kein Fallback gesetzt) nicht "hüpfen". */
#wr-main-menu .wr-megamenu__country-image {
    flex: 0 0 3.5rem;
    width: 3.5rem;
    height: 2.5rem;
    display: block;
}

#wr-main-menu .wr-megamenu__country-image--empty {
    background: #eee;
    border-radius: 8px;
}

#wr-main-menu .wr-megamenu__country-image img,
#wr-main-menu .wr-mm-image {
    width: 3.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    object-fit: cover;
    display: block;
}

#wr-main-menu .wr-megamenu__country-title {
    font-weight: 600;
    text-transform: none;
    font-size: 1rem;
    flex: 1;
    line-height: 1.5rem;
    font-family: var(--font-family);
    color: #282828;
}

#wr-main-menu .wr-megamenu__country-caret {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    opacity: 0.6;
}

#wr-main-menu .wr-megamenu__panel {
    display: none;
    position: absolute;
    top: 0;
    left: 382px; /* Sidebar-Breite (358px) + Abstand (24px) */
    padding: 1.5rem 1.5rem 2rem 0.25rem;
    justify-content: space-between;
    height: 100%;
}

#wr-main-menu .wr-megamenu__panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#wr-main-menu .wr-megamenu__groups {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

#wr-main-menu .wr-megamenu__group {
    min-width: 0;
    width: auto;
    list-style: none;
}

#wr-main-menu .wr-megamenu__group-image {
    display: block;
    margin-bottom: 1.25rem;
    border-radius: 10px;
    aspect-ratio: 3 / 2;
    overflow: hidden;
}

#wr-main-menu .wr-megamenu__group-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#wr-main-menu .wr-megamenu__group-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.25rem;
    color: #737373 !important;
    margin: 0 0 1rem;
    font-family: var(--font-family);
}

#wr-main-menu .wr-megamenu__group-title a {
    color: inherit;
    text-decoration: none;
}

#wr-main-menu .wr-megamenu__group-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#wr-main-menu .wr-megamenu__group-links li {
    list-style: none;
}

#wr-main-menu .wr-megamenu__group-links a {
    text-decoration: none;
    color: #171717;
    padding: 0;
    text-transform: none;
    line-height: 1.5rem;
    font-weight: 500;
    font-size: 1rem;
    font-family: var(--font-family);
}

#wr-main-menu .wr-megamenu__group-links a:hover {
    text-decoration: none;
    color: #0A355B;
    font-weight: 700;
}

#wr-main-menu .wr-megamenu__view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    color: #0F4C81;
    font-weight: 600;
    font-size: 1rem;
    padding: 0;
    height: 3rem;
    font-family: var(--font-family);
    text-transform: none;
}

#wr-main-menu .wr-megamenu__view-all:hover {
    text-decoration: underline;
}

#wr-main-menu .wr-megamenu__view-all-arrow {
    font-size: 16px;
}

/* --- Grid-Layout ------------------------------------------------------ */

#wr-main-menu .wr-megamenu--grid {
    padding: 20px;
}

#wr-main-menu .wr-megamenu__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

#wr-main-menu .wr-megamenu__grid-item {
    list-style: none;
}

#wr-main-menu .wr-megamenu__grid-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
}

#wr-main-menu .wr-megamenu__grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 3/2;
    border-radius: 0;
}

#wr-main-menu .wr-megamenu__grid-title {
    display: block;
    padding: 1rem;
    font-weight: 700;
    font-size: 1rem;
    font-family: var(--font-family);
    line-height: 1.5rem;
    text-transform: none;
}

/* --- Mobile: Desktop-Menü ausblenden ------------------------------------
 * Das komplette mobile Erlebnis übernimmt ab hier wr-mobile-menu.js mit
 * eigenem Off-Canvas-Menü. #wr-main-menu (Desktop-Hover-Version) wird
 * unterhalb von 900px einfach nicht mehr angezeigt. */

@media (max-width: 900px) {
    #wr-main-menu {
        display: none !important;
    }
}

/* --- Mobile Off-Canvas-Menü ---------------------------------------------- */

.templaza-header .wr-mobile-trigger {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    background: none;
}

.wr-mobile-trigger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #111;
    border-radius: 2px;
}

.wr-mobile-trigger--fallback {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1200;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 900px) {
    .wr-mobile-trigger {
        display: inline-flex;
    }

    .templaza-header .templaza-logo {
        padding-right: 2rem;
    }
}

.wr-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1100;
}

body.wr-mobile-menu-open .wr-mobile-overlay {
    opacity: 1;
    pointer-events: auto;
}

.wr-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(360px, 88vw);
    background: #fff;
    z-index: 1101;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

body.wr-mobile-menu-open .wr-mobile-menu {
    transform: translateX(0);
}

body.wr-mobile-menu-open {
    overflow: hidden;
}

.wr-mobile-menu__header {
    display: flex;
    justify-content: flex-end;
    padding: 14px;
    border-bottom: 1px solid #eee;
    flex: 0 0 auto;
}

.wr-mobile-menu .wr-mobile-menu__close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.wr-mobile-panels {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
}

.wr-mobile-panel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding-bottom: 8px;
    box-sizing: border-box;
    background: #fff;
}

/* Root-Panel (Ebene 1) ist immer sichtbar, Overlay-Panels (Ebene 3)
   liegen standardmäßig rechts außerhalb und schieben bei .is-active herein. */
.wr-mobile-panel:not(.wr-mobile-panel--root) {
    transform: translateX(100%);
    transition: transform 0.25s ease;
    padding: 14px 18px;
}

.wr-mobile-panel:not(.wr-mobile-panel--root).is-active {
    transform: translateX(0);
}

.wr-mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wr-mobile-list--root {
    padding: 4px 18px;
}

.wr-mobile-item {
    border-bottom: 1px solid #f0f0f0;
}

.wr-mobile-item__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.wr-mobile-item__row a {
    text-decoration: none;
    color: #111;
    font-weight: 600;
    font-size: 15px;
}

.wr-mobile-menu .wr-mobile-item__toggle {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0;
}

.wr-mobile-menu .wr-mobile-item__toggle:hover {
    background: none;
}

.wr-mobile-item.is-open > .wr-mobile-item__row > .wr-mobile-item__toggle {
    transform: rotate(180deg);
}

.wr-mobile-sublist {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.wr-mobile-sublist li a:not(.wr-mobile-sublist__link) {
    display: block;
    padding: 10px 0 10px 14px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.wr-mobile-sublist__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    text-decoration: none;
    color: #111;
    font-size: 1rem;
}

.wr-mobile-sublist__image img {
    width: 100%;
    max-width: 3.5rem;
    height: 100%;
    aspect-ratio: 3/2;
    border-radius: 6px;
    object-fit: cover;
    display: block;
}

.wr-mobile-sublist__link span:nth-child(2) {
    flex: 1;
    line-height: 1rem;
}

.wr-mobile-sublist__arrow {
    opacity: 0.75;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wr-mobile-menu .wr-mobile-panel__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    padding: 0 0 16px;
    font-size: 1rem;
    color: #0F4C81;
    cursor: pointer;
    font-family: var(--font-family)
}

.wr-mobile-panel__title {
    margin: 0 0 14px;
    font-size: 18px;
}

.wr-mobile-list--overlay {
    margin-bottom: 16px;
}

.wr-mobile-list--overlay li a {
    display: block;
    padding: 0.25rem 0;
    text-decoration: none;
    color: #333;
    font-size: 1rem;
}

.wr-mobile-list__group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    margin-top: 14px;
}

.wr-mobile-list__group-title:first-child {
    margin-top: 0;
}

.wr-mobile-panel__view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #1a6b6b;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 16px;
    color: #0F4C81;
}