/* =====================================================================
 * BSH Navigation Widget – Styles
 * Autor: Luca Petersen | Com&Sons  |  https://comandsons.com
 *
 * States:
 *   default          → transparent / weiß, dunkler Text
 *   .is-scrolled     → blauer Hintergrund, weißer Text
 *   .is-open         → mobile Panel sichtbar
 * ===================================================================== */

.bsh-nav,
.bsh-nav *,
.bsh-nav *::before,
.bsh-nav *::after { box-sizing: border-box; }

/* Prevent FOUC: nav hidden until JS marks it ready */
.bsh-nav:not(.is-ready) {
    opacity: 0;
}

/* Submenüs erst zeigen wenn nav ready (verhindert kurzes Aufblitzen) */
.bsh-nav:not(.is-ready) .sub-menu {
    display: none !important;
}

.bsh-nav {
    --bsh-nav-bg-scroll:   #0c2344;
    --bsh-nav-text:        #1a1a1a;
    --bsh-nav-text-scroll: #ffffff;
    --bsh-nav-cta:         #e87a1e;
    --bsh-nav-h:           80px;

    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background .35s ease, box-shadow .35s ease, opacity .15s ease;
}

/* Scrolled state */
.bsh-nav.is-scrolled {
    background: var(--bsh-nav-bg-scroll);
    box-shadow: 0 2px 20px rgba(0, 0, 0, .15);
}

/* Mobile open state → dark nav bar so X is visible */
.bsh-nav.is-open {
    background: #0c2344;
}

/* ── Inner layout ────────────────────────────────────── */

.bsh-nav__inner {
    display: flex;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    height: var(--bsh-nav-h);
    padding: 0 32px;
    gap: 20px;
}

/* ── Logo ────────────────────────────────────────────── */

.bsh-nav__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    position: relative;
    height: 100%;
}

.bsh-nav__logo {
    height: 55px !important;
    max-height: 55px !important;
    width: auto !important;
    display: block;
    object-fit: contain;
    transition: opacity .3s ease;
}

/* Default logo */
.bsh-nav__logo--default {
    opacity: 1;
}

/* Scroll logo (absolutely positioned over default) */
.bsh-nav__logo--scroll {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    opacity: 0;
}

/* Scrolled → swap logos */
.bsh-nav.is-scrolled .bsh-nav__logo--default {
    opacity: 0;
}

.bsh-nav.is-scrolled .bsh-nav__logo--scroll {
    opacity: 1;
}

/* Fallback: kein Scroll-Logo — CSS invert */
.bsh-nav.is-scrolled[data-has-scroll-logo="0"] .bsh-nav__logo--default {
    opacity: 1;
    filter: invert(1) brightness(2);
}

/* ── Desktop Menu ────────────────────────────────────── */

.bsh-nav__menu {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 2px;
    flex-wrap: nowrap;
}

.bsh-nav__item,
.bsh-nav__menu > li {
    white-space: nowrap;
    list-style: none;
    position: relative;
}

.bsh-nav__link,
.bsh-nav__menu > li > a {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--bsh-nav-text);
    text-decoration: none;
    border-radius: 0;
    transition: color .25s ease, background .25s ease;
    line-height: 1.3;
}

.bsh-nav__link:hover,
.bsh-nav__menu > li > a:hover {
    background: rgba(0, 0, 0, .05);
}

/* Scrolled text color */
.bsh-nav.is-scrolled .bsh-nav__link,
.bsh-nav.is-scrolled .bsh-nav__menu > li > a {
    color: var(--bsh-nav-text-scroll);
}

.bsh-nav.is-scrolled .bsh-nav__link:hover,
.bsh-nav.is-scrolled .bsh-nav__menu > li > a:hover {
    background: rgba(255, 255, 255, .12);
}

/* ── Dropdown / Submenü (Desktop) ────────────────────── */

.bsh-nav__menu .sub-menu {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    z-index: 100;
}

/* Hover-Trigger → Dropdown zeigen */
.bsh-nav__menu > li:hover > .sub-menu,
.bsh-nav__menu > li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Unsichtbare Brücke zwischen Item und Dropdown (gegen "Hover-Gap") */
.bsh-nav__menu > li > .sub-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

/* Submenu items */
.bsh-nav__menu .sub-menu li {
    list-style: none;
    white-space: nowrap;
}

.bsh-nav__menu .sub-menu li a {
    display: block;
    padding: 9px 18px;
    font-size: 15px;
    font-weight: 400;
    color: #333;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.bsh-nav__menu .sub-menu li a:hover {
    background: #f0f4f8;
    color: var(--bsh-nav-bg-scroll);
}

/* Scrolled → Dropdown bleibt weiß */
.bsh-nav.is-scrolled .bsh-nav__menu .sub-menu {
    background: #fff;
}

.bsh-nav.is-scrolled .bsh-nav__menu .sub-menu li a {
    color: #333;
}

.bsh-nav.is-scrolled .bsh-nav__menu .sub-menu li a:hover {
    background: #f0f4f8;
    color: var(--bsh-nav-bg-scroll);
}

/* Dropdown-Pfeil-Indikator für Items mit Submenü (Chevron-SVG) */
.bsh-nav__menu > li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 4px;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M19 9L12.7071 15.2929C12.3166 15.6834 11.6834 15.6834 11.2929 15.2929L5 9' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M19 9L12.7071 15.2929C12.3166 15.6834 11.6834 15.6834 11.2929 15.2929L5 9' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    opacity: .6;
    transition: transform .2s ease;
}

.bsh-nav__menu > li.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

/* ── CTA Button ──────────────────────────────────────── */

.bsh-nav__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
    padding: 12px 24px;
    background: var(--bsh-nav-cta);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: all 1s ease;
    box-shadow: 0 4px 14px rgba(232, 122, 30, .25);

    /* Blattform: oben-links & unten-rechts rund, oben-rechts & unten-links eckig */
    border-top-left-radius: 50px;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 50px;
    border-bottom-left-radius: 0px;
}

.bsh-nav__cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 6px 22px rgba(232, 122, 30, .4);

    /* Hover: border-radius wechselt auf die anderen Ecken */
    border-top-left-radius: 0px;
    border-top-right-radius: 50px;
    border-bottom-right-radius: 0px;
    border-bottom-left-radius: 50px;
}

/* ── Burger (hidden on desktop) ──────────────────────── */

.bsh-nav__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    z-index: 10001;
}

.bsh-nav__burger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--bsh-nav-text);
    border-radius: 0;
    transition: transform .3s ease, opacity .2s ease, background .25s ease;
}

.bsh-nav.is-scrolled .bsh-nav__burger-line {
    background: var(--bsh-nav-text-scroll);
}

/* Burger → X animation */
.bsh-nav.is-open .bsh-nav__burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.bsh-nav.is-open .bsh-nav__burger-line:nth-child(2) {
    opacity: 0;
}
.bsh-nav.is-open .bsh-nav__burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* When mobile panel open → always show white burger/X */
.bsh-nav.is-open .bsh-nav__burger-line {
    background: #fff;
}

/* ── Mobile Panel (hidden by default) ────────────────── */

.bsh-nav__mobile {
    position: fixed;
    top: var(--bsh-nav-h);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--bsh-nav-h));
    height: calc(100dvh - var(--bsh-nav-h));
    background: #0c2344;
    display: none;                 /* Hidden on desktop — prevents flash */
    flex-direction: column;
    padding: 24px 24px 40px;
    overflow-y: auto;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1), visibility .35s ease;
    z-index: 9998;
}

.bsh-nav.is-open .bsh-nav__mobile {
    transform: translateX(0);
    visibility: visible;
}

/* ── Mobile Menu (WordPress) ─────────────────────────── */

.bsh-nav__mobile-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bsh-nav__mobile-menu > li {
    list-style: none;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

/* Parent items with submenus → flex row (link + toggle) */
.bsh-nav__mobile-menu > li.menu-item-has-children {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.bsh-nav__mobile-menu > li.menu-item-has-children > a {
    flex: 1;
}

.bsh-nav__mobile-menu > li.menu-item-has-children > .sub-menu {
    flex-basis: 100%;
}

.bsh-nav__mobile-menu > li > a,
.bsh-nav__mobile-link {
    display: block;
    padding: 14px 0;
    font-size: 18px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    transition: opacity .2s ease;
}

.bsh-nav__mobile-menu > li > a:hover,
.bsh-nav__mobile-link:hover { opacity: .75; }

/* Mobile Submenü — collapsed by default */
.bsh-nav__mobile-menu .sub-menu {
    list-style: none;
    padding: 0 0 8px 16px;
    margin: 0;
    display: none;
}

.bsh-nav__mobile-menu .sub-menu.is-sub-open {
    display: block;
}

/* Submenu toggle arrow */
.bsh-nav__sub-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: rgba(255,255,255,.1);
    border-radius: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .3s ease, background .2s ease;
}

.bsh-nav__sub-toggle::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: transform .3s ease;
}

.bsh-nav__sub-toggle.is-sub-open::after {
    transform: rotate(-135deg) translate(-1px, -1px);
}

.bsh-nav__sub-toggle.is-sub-open {
    background: rgba(255,255,255,.18);
}

.bsh-nav__mobile-menu .sub-menu li {
    list-style: none;
}

.bsh-nav__mobile-menu .sub-menu li a {
    display: block;
    padding: 8px 0;
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    transition: color .15s ease;
}

.bsh-nav__mobile-menu .sub-menu li a:hover {
    color: #fff;
}

/* Mobile CTA */
.bsh-nav__mobile-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 24px;
    padding: 14px 24px;
    background: var(--bsh-nav-cta);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
    border-top-left-radius: 50px;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 50px;
    border-bottom-left-radius: 0px;
    box-shadow: 0 4px 16px rgba(232, 122, 30, .3);
    transition: all 1s ease;
}

.bsh-nav__mobile-cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 1200px) {
    .bsh-nav__inner { padding: 0 20px; gap: 12px; }
    .bsh-nav__link,
    .bsh-nav__menu > li > a { padding: 7px 8px; font-size: 15px; }
    .bsh-nav__cta { padding: 10px 18px; font-size: 14px; }
    .bsh-nav__logo { height: 48px !important; max-height: 48px !important; }
}

@media (max-width: 1024px) {
    .bsh-nav__menu { display: none; }
    .bsh-nav__cta  { display: none; }
    .bsh-nav__burger { display: flex; margin-left: auto; }
    .bsh-nav { --bsh-nav-h: 64px; }
    .bsh-nav__logo { height: 40px !important; max-height: 40px !important; }

    /* Mobile panel aktivieren (war display:none auf Desktop) */
    .bsh-nav__mobile {
        display: flex;
    }

    /* Dropdowns brauchen wir nicht auf mobile desktop-menu */
    .bsh-nav__menu .sub-menu {
        display: none !important;
    }
}

/* ── Spacer utility ──────────────────────────────────── */
/* Damit der Content nicht unter der fixen Nav verschwindet,
   kann man im Elementor ein Spacer von --bsh-nav-h einfügen
   oder folgende Klasse auf den Body/Wrapper legen:             */
.bsh-nav-spacer {
    height: var(--bsh-nav-h, 80px);
}
