/* Header Base Styles */
.header {
    min-height: 48px;
    background-color: white;
    position: relative;
    z-index: 1000;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    margin: 0 80px 0 125px;
    height: 48px;
}

/* Logo Container */
#logo-container {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    flex-direction: column;
}


#logo-container img {
    height: 54px;
}

#logo-container .host {
    line-height: 14px;
    font-size: 11px;
    background-color: #f0f8ff;
    color: #006666;
    padding: 0 6px;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
    font-family: monospace;
    border-left: 2px solid #20B2AA;
    margin-left: 4px;
    margin-top: 0;
}
#logo-container img {
    height: auto;
    max-height: 40px;
}

.host {
    margin-left: 10px;
    font-size: 14px;
    color: #666;
}

/* Desktop Navigation */
.desktop-navigation {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.desktop-navigation li {
    margin: 0 10px;
}

.desktop-navigation a {
    display: flex;
    align-items: center;
    padding: 0 15px;
    height: 50px;
    text-decoration: none;
    color: rgba(0, 0, 0, 0.92);
    border-radius: 8px;
    transition: color 0.2s, transform 0.15s;
    position: relative;
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
}

.desktop-navigation a:hover {
    color: #20B2AA;
}

/* Lift effect ONLY on non-dropdown items to prevent hover jitter at mega-menu boundary */
.desktop-navigation a:hover:not(.mega-menu-trigger):not(.provider-dropdown-trigger) {
    transform: translateY(-1px);
}

.desktop-navigation a.selected-nav-item {
    color: #20B2AA;
    font-weight: 600;
}

/* Underline: scaleX from center */
.desktop-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    background: #20B2AA;
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.desktop-navigation a:hover::after {
    transform: scaleX(1);
}

.desktop-navigation a.selected-nav-item::after {
    transform: scaleX(1);
}

.nav-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* Phone CTA Button (Desktop) — needs .desktop-navigation prefix for specificity */
.desktop-navigation .nav-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #20B2AA;
    font-weight: 600;
    padding: 8px 14px;
    border: 1.5px solid #20B2AA;
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
    margin-left: auto;
    height: auto;
}

.desktop-navigation .nav-phone:hover {
    background: rgba(32, 178, 170, 0.08);
    color: #178a84;
    border-color: #178a84;
}

/* Override ::after underline for phone CTA */
.desktop-navigation .nav-phone::after {
    display: none;
}

/* Override ::after underline leaking into provider dropdown items */
.provider-dropdown .provider-dropdown-item::after {
    display: none;
    content: none;
}

/* Mobile phone — no border, just teal text */
.mobile-navigation .nav-phone-mobile {
    color: #20B2AA;
    font-weight: 600;
    border: none;
    padding: 14px 20px;
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    position: relative;
    width: 35px;
    height: 35px;
    justify-content: center;
    align-items: center;
}

.hamburger-line {
    width: 22px;
    height: 3px;
    background-color: #333;
    margin: 2px 0;
    transition: 0.3s;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.hamburger-line:nth-child(1) {
    top: 8px;
}

.hamburger-line:nth-child(2) {
    top: 16px;
}

.hamburger-line:nth-child(3) {
    top: 24px;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateX(-50%) rotate(-45deg);
    top: 16px;
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateX(-50%) rotate(45deg);
    top: 16px;
}

/* Mobile Navigation */
.mobile-navigation {
    display: none;
    position: fixed;
    top: 85px;
    left: 0;
    width: 100%;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 20px 0;
    max-height: calc(100vh - 85px);
    overflow-y: auto;
}

.mobile-navigation.active {
    display: block;
}

.mobile-navigation li {
    margin: 0;
}

.mobile-navigation a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: rgba(0, 0, 0, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
    font-size: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
}

.mobile-navigation a:hover {
    background: #f0faf9;
    color: #20B2AA;
}

.mobile-navigation a.selected-nav-item {
    background-color: rgba(32, 178, 170, 0.06);
    font-weight: 600;
    color: #20B2AA;
}

body.mobile-menu-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        min-height: 54px;
    }

    .nav-wrapper {
        margin: 0 20px;
        padding: 0;
        height: 54px;
    }

    .desktop-navigation {
        display: none;
    }

    .hamburger-menu {
        display: flex;
    }

    #logo-container img {
        max-height: 42px;
    }

    .mobile-navigation {
        top: 26px;
        max-height: calc(100vh - 26px);
    }
}

@media (max-width: 480px) {
    .nav-wrapper {
        margin: 0 10px;
    }

    #logo-container img {
        max-height: 40px;
    }

    .host {
        display: none;
    }
}

/* ===================================================================
   MEGA-MENÜ STYLES (Desktop Only)
   =================================================================== */

/* Mega-Menü Trigger */
.has-mega-menu {
    position: relative;
}

.mega-menu-trigger {
    display: flex !important;
    align-items: center;
    gap: 6px;
}

.mega-menu-trigger .dropdown-arrow {
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.has-mega-menu.mega-menu-open .dropdown-arrow,
.has-mega-menu:hover .dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Mega-Menü Container - größer für 4 Spalten + CTA */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 1050px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    z-index: 1001;
    padding: 0;
    margin-top: 0;
    pointer-events: none;
}

/* Transition nur nach JS-Init — verhindert Flash beim Seitennavigieren */
.mega-menu.nav-initialized {
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.mega-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* =============================================================
   MEGA-MENU CONTENT — ID-Prefix fuer Spezifitaet gegen Globals
   Gleicher Ansatz wie #logo-container im Header.
   ID schlaegt alle Klassen/Element-Selektoren aus styles.css.
   ============================================================= */

/* Basis-Reset fuer alle Elemente im Mega-Menu */
#ratgeber-mega-menu a {
    display: inline;
    height: auto;
    padding: 0;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    border-radius: 0;
    color: inherit;
    text-decoration: none;
    background: none;
    border: none;
    transition: color 0.2s ease;
    line-height: inherit;
}

#ratgeber-mega-menu a:hover {
    background-color: transparent;
}

#ratgeber-mega-menu a::before,
#ratgeber-mega-menu a::after {
    display: none;
    content: none;
}

#ratgeber-mega-menu h4 {
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    text-align: left;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.4;
}

#ratgeber-mega-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#ratgeber-mega-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Inner Container */
#ratgeber-mega-menu .mega-menu-container {
    display: flex;
    padding: 24px;
    gap: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
}

/* Kategorien-Bereich — Grid fuer spaltenuebergreifend gleiche Zeilenhoehen */
#ratgeber-mega-menu .mega-menu-categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Einzelne Spalte — Subgrid: 3 Zeilen (Header + Kategorie 1 + Kategorie 2) */
#ratgeber-mega-menu .mega-menu-column {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    gap: 0;
    min-width: 0;
}

/* Spalten-Header mit Icon */
#ratgeber-mega-menu .mega-menu-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 0;
    border-bottom: 2px solid #20B2AA;
    align-self: start;
}

#ratgeber-mega-menu .mega-menu-column-header-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #e8f7f6 0%, #d4f0ef 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#ratgeber-mega-menu .mega-menu-column-header-icon svg {
    width: 16px;
    height: 16px;
    color: #20B2AA;
    display: block;
}

#ratgeber-mega-menu .mega-menu-column-header-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #20B2AA;
    line-height: 1.3;
}

/* Kategorie-Block */
#ratgeber-mega-menu .mega-menu-category {
    display: flex;
    flex-direction: column;
    padding-top: 28px;
}

#ratgeber-mega-menu .mega-menu-column > .mega-menu-category:first-of-type {
    padding-top: 28px;
}

/* Kategorie-Titel */
#ratgeber-mega-menu .mega-menu-category-title {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

#ratgeber-mega-menu .mega-menu-category-title a {
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

#ratgeber-mega-menu .mega-menu-category-title a:hover {
    color: #20B2AA;
}

/* Artikel-Link-Liste */
#ratgeber-mega-menu .mega-menu-links {
    list-style: none;
    margin: 0;
    padding: 0 0 0 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-grow: 1;
}

#ratgeber-mega-menu .mega-menu-links li a {
    font-size: 13.5px;
    color: #555;
    text-decoration: none;
    display: block;
    line-height: 1.4;
    font-weight: 400;
    transition: color 0.2s ease;
}

#ratgeber-mega-menu .mega-menu-links li a:hover {
    color: #20B2AA;
}

/* "Alle Artikel" Link — immer am unteren Rand */
#ratgeber-mega-menu .mega-menu-show-all {
    font-size: 13px;
    color: #20B2AA;
    text-decoration: none;
    margin-top: auto;
    padding-top: 8px;
    font-weight: 500;
    display: inline-block;
    transition: opacity 0.2s ease;
}

#ratgeber-mega-menu .mega-menu-show-all:hover {
    opacity: 0.8;
    text-decoration: underline;
}


/* ===================================================================
   MEGA-MENÜ RESPONSIVE
   =================================================================== */

@media (max-width: 1100px) {
    .mega-menu {
        width: 950px;
    }

    #ratgeber-mega-menu .mega-menu-categories {
        gap: 16px;
    }

    #ratgeber-mega-menu .mega-menu-column {
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .has-mega-menu .mega-menu {
        display: none !important;
    }

    .has-mega-menu .dropdown-arrow {
        display: none;
    }

    .has-mega-menu {
        position: static;
    }
}

/* ===================================================================
   MOBILE RATGEBER ACCORDION
   =================================================================== */

.mobile-accordion {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.mobile-accordion-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.92);
    text-align: left;
    transition: background-color 0.3s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
}

.mobile-accordion-trigger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mobile-accordion-trigger.selected-nav-item {
    background-color: rgba(32, 178, 170, 0.1);
    font-weight: bold;
    color: #20B2AA;
}

.mobile-accordion-trigger .nav-icon {
    margin-right: 8px;
    font-size: 16px;
}

.mobile-accordion-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.mobile-accordion-trigger.active .mobile-accordion-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Accordion Content */
.mobile-accordion-content {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
}

.mobile-accordion-content.active {
    display: block;
}

.mobile-accordion-content li {
    margin: 0;
}

.mobile-accordion-content li a {
    display: block;
    padding: 12px 20px 12px 48px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-accordion-content li a:hover {
    background-color: rgba(32, 178, 170, 0.08);
    color: #20B2AA;
}

/* Section Label ("Themen") - Trenner zwischen CTA und Kategorie-Liste */
.mobile-accordion-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    padding: 12px 20px 6px 48px;
    border-bottom: none;
    cursor: default;
    user-select: none;
}

/* "Alle Artikel/Anbieter ansehen" Link - hervorgehoben */
.mobile-accordion-content li.mobile-accordion-all a {
    color: #20B2AA;
    font-weight: 500;
}

.mobile-accordion-all a:hover {
    background-color: rgba(32, 178, 170, 0.12);
}

/* ===================================================================
   PROVIDER DROPDOWN (Desktop)
   =================================================================== */

.has-provider-dropdown {
    position: relative;
}

.provider-dropdown-trigger {
    display: flex !important;
    align-items: center;
    gap: 6px;
}

.provider-dropdown-trigger .dropdown-arrow {
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.has-provider-dropdown.provider-dropdown-open .dropdown-arrow,
.has-provider-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.provider-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    z-index: 1001;
    padding: 0;
    margin-top: 0;
    pointer-events: none;
}

/* Transition nur nach JS-Init — verhindert Flash beim Seitennavigieren */
.provider-dropdown.nav-initialized {
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.provider-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.provider-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Header im Dropdown */
.provider-dropdown-header {
    padding: 16px 24px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.provider-dropdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 19px 6px;
    padding: 20px 20px;
}

.provider-dropdown .provider-dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 14px 8px;
    height: 90px;
    box-sizing: border-box;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.provider-dropdown .provider-dropdown-item:hover {
    background-color: #f0faf9;
    transform: translateY(-1px);
}

.provider-dropdown .provider-dropdown-logo {
    width: 72px;
    height: 41px;
    min-height: 41px;
    max-height: 41px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.provider-dropdown .provider-dropdown-item:hover .provider-dropdown-logo {
    opacity: 1;
}

.provider-dropdown .provider-dropdown-name {
    font-size: 13px;
    font-weight: 400;
    color: #4a5568;
    text-align: center;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.provider-dropdown .provider-dropdown-item:hover .provider-dropdown-name {
    color: #1a9a93;
}

.provider-dropdown-all {
    display: block;
    text-align: center;
    padding: 14px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 13px;
    font-weight: 500;
    color: #20B2AA;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.provider-dropdown-all::after {
    display: none !important;
}

.provider-dropdown-all:hover {
    background-color: #f0faf9;
}

/* Provider Dropdown Responsive */
@media (max-width: 768px) {
    .has-provider-dropdown .provider-dropdown {
        display: none !important;
    }

    .has-provider-dropdown .dropdown-arrow {
        display: none;
    }

    .has-provider-dropdown {
        position: static;
    }
}

/* Mobile Anbieter-Liste: Logos neben den Namen */
.mobile-anbieter-list li a {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-anbieter-logo {
    width: 32px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}
