/* ==========================================================================
   MEGA NAVIGATION — FreiesRohr24
   Leistungen (B2C) + Geschäftskunden (B2B) Dropdowns
   Keine CSS-Variable-Abhängigkeiten — alles hardcoded
   ========================================================================== */

/* ── Positioning anchor ──────────────────────────────────────────────────── */

/* site-header keeps position:sticky + z-index:1000 from style.css — do NOT override */
.site-header {
    overflow: visible; /* ensure dropdown is never clipped by the header */
    z-index: 1000;
}

.main-nav-list .has-mega-dropdown {
    position: static; /* Let absolute child reach up to .site-header */
    padding-bottom: 0;
}

/* Add invisible hover bridge via pseudo-element */
.has-mega-dropdown::before {
    content: '';
    position: absolute;
    top: calc(100% - 8px);
    left: 0;
    right: 0;
    height: 20px;
    z-index: 9998;
    display: none;
}
.has-mega-dropdown:hover::before {
    display: block;
}

/* ── Dropdown arrow on nav link ─────────────────────────────────────────── */

.main-nav-list .has-mega-dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.main-nav-list .has-mega-dropdown > a::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.main-nav-list .has-mega-dropdown:hover > a::after,
.main-nav-list .has-mega-dropdown:focus-within > a::after {
    transform: rotate(-135deg) translateY(2px);
}

/* B2B nav item — regular style */
.main-nav-list .nav-b2b > a {
    color: rgba(255,255,255,.8);
    font-weight: 600;
}
.main-nav-list .nav-b2b > a:hover {
    color: #28ABE1;
    background: rgba(255,255,255,.08);
}

/* ── Mega Dropdown Container ─────────────────────────────────────────────── */

.mega-dropdown {
    position: absolute;
    top: 100%;          /* Right below the header */
    margin-top: -4px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 3px solid #28ABE1;
    box-shadow: 0 12px 40px rgba(0, 20, 60, 0.14);
    z-index: 9999;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

/* B2B dropdown: dark top border */
.mega-dropdown--b2b {
    border-top-color: #0a1628;
}

/* Invisible bridge to prevent dropdown close on gap between header and dropdown */
.has-mega-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    display: none;
}
.has-mega-dropdown:hover::after {
    display: block;
}

/* Show on hover or keyboard focus */
.has-mega-dropdown:hover .mega-dropdown,
.has-mega-dropdown:focus-within .mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Inner Grid ─────────────────────────────────────────────────────────── */

.mega-dropdown .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.mega-dropdown__inner {
    display: grid !important;
    grid-template-columns: 1fr 260px !important;
    gap: 0 !important;
    min-height: 200px;
}

/* ── Services List (left column) ─────────────────────────────────────────── */

.mega-dropdown__services {
    padding: 32px 40px 32px 12px;
    border-right: 1px solid #e8eef4;
}

.mega-dropdown__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #9ca3af;
    margin-bottom: 14px;
    padding-left: 4px;
}

.mega-dropdown__label--b2b {
    color: #28ABE1;
}

.mega-dropdown__list {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-wrap: unset !important;
    flex-direction: unset !important;
}

/* B2B uses single column (more items) */
.mega-dropdown--b2b .mega-dropdown__list {
    grid-template-columns: 1fr !important;
}

.mega-dropdown__item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    transition: background 0.14s ease, transform 0.14s ease;
}

.mega-dropdown__item:hover {
    background: #f0f7fc;
    color: #0a1628;
    text-decoration: none;
    transform: translateX(4px);
}

.mega-dropdown__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #e8f4fb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #28ABE1;
    transition: background 0.14s ease, color 0.14s ease;
}

.mega-dropdown__item:hover .mega-dropdown__icon {
    background: #28ABE1;
    color: #ffffff;
}

.mega-dropdown__item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mega-dropdown__item-text strong {
    font-size: 14px;
    font-weight: 700;
    color: #1a2332;
    line-height: 1.3;
    display: block;
    white-space: normal;
    word-break: break-word;
}

.mega-dropdown__item-text span {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.mega-dropdown__badge {
    display: inline-block;
    background: #28ABE1;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 4px;
    vertical-align: middle;
}

.mega-dropdown__item--featured {
    background: #f8fbfe;
    border: 1.5px solid #e2ecf4;
}

.mega-dropdown__item--featured:hover {
    background: #e8f4fb;
    border-color: #28ABE1;
}

/* ── Side Panel (right column) ───────────────────────────────────────────── */

.mega-dropdown__panel {
    padding: 28px 8px 28px 24px;
    background: #f5f9fc;
    border-left: 1px solid #e8eef4;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mega-dropdown__panel--b2b {
    background: #f0f7fc;
}

/* Emergency CTA box */
.mega-dropdown__emergency {
    background: #ffffff;
    border: 1.5px solid #e2ecf4;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.mega-dropdown__emergency-label {
    font-size: 12px;
    font-weight: 700;
    color: #d63638;
    margin: 0 0 8px;
}

.mega-dropdown__emergency-phone {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #0a1628;
    text-decoration: none;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 6px;
    transition: color 0.14s ease;
}

.mega-dropdown__emergency-phone:hover {
    color: #28ABE1;
}

.mega-dropdown__emergency-sub {
    font-size: 10.5px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.4;
}

/* Trust list */
.mega-dropdown__trust {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.mega-dropdown__trust-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #374151;
    line-height: 1.4;
}

.mega-dropdown__trust-item svg {
    flex-shrink: 0;
}

/* All-link */
.mega-dropdown__all-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 700;
    color: #28ABE1;
    text-decoration: none;
    margin-top: auto;
    padding: 10px 14px;
    background: #e8f4fb;
    border-radius: 8px;
    transition: background 0.14s ease;
}

.mega-dropdown__all-link:hover {
    background: #28ABE1;
    color: #fff;
    text-decoration: none;
}

/* B2B specific elements */
.mega-dropdown__audience-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mega-dropdown__audience-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #374151;
}

.mega-dropdown__b2b-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mega-dropdown__b2b-cta .btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    text-align: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    display: block;
}

.mega-dropdown__b2b-cta .btn-primary {
    background: #28ABE1;
    color: #fff;
}

.mega-dropdown__b2b-cta .btn-outline {
    background: transparent;
    border: 1.5px solid #28ABE1;
    color: #28ABE1;
}

.mega-dropdown__b2b-note {
    font-size: 10.5px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.4;
    text-align: center;
}

/* ── Responsive: Mobile hides mega, uses accordion ───────────────────────── */

@media (max-width: 1024px) {
    .mega-dropdown {
        display: none !important;
    }
}

@media (min-width: 1025px) and (max-width: 1200px) {
    .mega-dropdown__list {
        grid-template-columns: 1fr;
    }

    .mega-dropdown__inner {
        grid-template-columns: 1fr 230px;
    }
}

/* ── Mobile Accordion ────────────────────────────────────────────────────── */

.mobile-mega-accordion {
    display: none;
    padding-left: 12px;
    border-left: 3px solid #28ABE1;
    margin: 6px 0 10px;
    list-style: none;
}

.mobile-mega-accordion.is-open {
    display: block;
}

.mobile-mega-accordion a {
    display: block;
    padding: 9px 10px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
}

.mobile-mega-accordion a:hover {
    background: #e8f4fb;
    color: #0a1628;
}

.mobile-mega-accordion .section-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    padding: 8px 10px 4px;
}

.mobile-mega-accordion .b2b-divider {
    border: none;
    border-top: 1px solid #e8eef4;
    margin: 6px 0;
}

/* Accordion trigger */
.mobile-accordion-trigger {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    font-weight: 600;
}

.accordion-arrow {
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.mobile-accordion-trigger[aria-expanded="true"] .accordion-arrow {
    transform: rotate(180deg);
}

.mobile-accordion-trigger--b2b {
    color: #28ABE1;
}

/* ── Narrow desktop adjustments ──────────────────────────────────────────── */

@media (min-width: 1025px) and (max-width: 1200px) {
    .mega-dropdown__item-text strong { font-size: 13px; }
    .mega-dropdown__item-text span { font-size: 11px; }
    .mega-dropdown__emergency-phone { font-size: 18px; }
}
