/* =========================================================
   SMARTLINK FLORIDA - REUSABLE HEADER SYSTEM
   Reliable desktop + mobile navigation for header.php
========================================================= */

:root {
    --slf-header-height: 82px;
    --slf-header-height-compact: 82px;
    --slf-header-bg: #ffffff;
    --slf-header-text: #1f2933;
    --slf-header-muted: #5c6670;
    --slf-header-border: rgba(0, 0, 0, 0.08);
    --slf-header-shadow: 0 8px 26px rgba(0, 0, 0, 0.12);
    --slf-header-teal: #006666;
    --slf-header-teal-2: #008080;
    --slf-header-mint: #e6f7f8;
}

body.slf-header-body {
    margin-top: var(--slf-header-height);
}

body.slf-body-header-layout-compact {
    margin-top: var(--slf-header-height-compact);
}

body.slf-body-header-transparent {
    margin-top: 0;
}

body.slf-nav-open {
    overflow: hidden;
}

.slf-site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 5000;
    width: 100%;
    min-height: var(--slf-header-height);
    height: var(--slf-header-height);
    background: var(--slf-header-bg);
    color: var(--slf-header-text);
    border-bottom: 1px solid var(--slf-header-border);
    box-shadow: var(--slf-header-shadow);
}

.slf-site-header.slf-header-layout-compact {
    min-height: var(--slf-header-height-compact);
    height: var(--slf-header-height-compact);
}

.slf-header-dark,
.slf-header-transparent {
    --slf-header-bg: rgba(8, 21, 23, 0.96);
    --slf-header-text: #ffffff;
    --slf-header-muted: rgba(255, 255, 255, 0.78);
    --slf-header-border: rgba(255, 255, 255, 0.12);
    --slf-header-shadow: 0 8px 26px rgba(0, 0, 0, 0.24);
}

.slf-header-transparent {
    background: rgba(8, 21, 23, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.slf-header-inner {
    width: min(92%, var(--slf-layout-container));
    min-height: var(--slf-header-height);
    height: var(--slf-header-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.slf-header-layout-compact .slf-header-inner {
    min-height: var(--slf-header-height-compact);
    height: var(--slf-header-height-compact);
}

.slf-header-logo-link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
    text-decoration: none;
}

.slf-logo {
    display: block;
    height: 50px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.slf-logo-white {
    display: none;
}

.slf-header-dark .slf-logo-default,
.slf-header-transparent .slf-logo-default {
    display: none;
}

.slf-header-dark .slf-logo-white,
.slf-header-transparent .slf-logo-white {
    display: block;
}

.slf-main-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    min-height: var(--slf-header-height);
}

.slf-main-navigation a,
.slf-nav-parent-row,
.slf-submenu-toggle {
    font-family: inherit;
}

.slf-main-navigation > a,
.slf-nav-parent-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 13px;
    border-radius: 999px;
    color: var(--slf-header-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.slf-main-navigation > a:hover,
.slf-nav-parent-link:hover,
.slf-main-navigation > a.active,
.slf-nav-parent-link.active {
    background: var(--slf-header-mint);
    color: var(--slf-header-teal);
}

.slf-header-dark .slf-main-navigation > a:hover,
.slf-header-dark .slf-nav-parent-link:hover,
.slf-header-dark .slf-main-navigation > a.active,
.slf-header-dark .slf-nav-parent-link.active,
.slf-header-transparent .slf-main-navigation > a:hover,
.slf-header-transparent .slf-nav-parent-link:hover,
.slf-header-transparent .slf-main-navigation > a.active,
.slf-header-transparent .slf-nav-parent-link.active {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.slf-nav-item {
    position: relative;
}

.slf-nav-parent-row {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.slf-caret {
    margin-left: 5px;
    font-size: 0.82em;
    line-height: 1;
}

.slf-submenu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: currentColor;
    cursor: pointer;
}

.slf-submenu {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    min-width: 250px;
    padding: 10px;
    display: grid;
    gap: 2px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.slf-nav-item:hover .slf-submenu,
.slf-nav-item:focus-within .slf-submenu,
.slf-nav-item.submenu-open .slf-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.slf-submenu a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: #1f2933;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.slf-submenu a:hover,
.slf-submenu a:focus {
    background: var(--slf-header-mint);
    color: var(--slf-header-teal);
    outline: none;
}

.slf-header-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: linear-gradient(145deg, var(--slf-header-teal), var(--slf-header-teal-2));
    color: #ffffff;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: var(--slf-weight-button);
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 102, 102, 0.24);
}

.slf-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    background: rgba(0, 102, 102, 0.10);
    color: var(--slf-header-text);
    cursor: pointer;
    position: relative;
}

.slf-header-dark .slf-menu-toggle,
.slf-header-transparent .slf-menu-toggle {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.slf-menu-toggle span {
    position: absolute;
    left: 11px;
    right: 11px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.slf-menu-toggle span:nth-child(1) { top: 13px; }
.slf-menu-toggle span:nth-child(2) { top: 21px; }
.slf-menu-toggle span:nth-child(3) { top: 29px; }

.slf-menu-toggle.is-active span:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}

.slf-menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.slf-menu-toggle.is-active span:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}

@media (max-width: 1120px) {
    .slf-header-call {
        display: none;
    }
}

@media (max-width: 980px) {
    :root {
        --slf-header-height: 78px;
        --slf-header-height-compact: 78px;
    }

    .slf-header-inner {
        width: min(92%, 760px);
    }

    .slf-logo {
        height: 42px;
        max-width: 190px;
    }

    .slf-menu-toggle {
        display: inline-flex;
    }

    .slf-main-navigation {
        position: fixed;
        top: var(--slf-header-height);
        left: 0;
        right: 0;
        bottom: 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 14px min(5vw, 28px) 28px;
        background: rgba(255, 255, 255, 0.98);
        color: #1f2933;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 24px 46px rgba(0, 0, 0, 0.18);
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    }

    .slf-header-layout-compact .slf-main-navigation {
        top: var(--slf-header-height-compact);
    }

    .slf-header-dark .slf-main-navigation,
    .slf-header-transparent .slf-main-navigation {
        background: rgba(8, 21, 23, 0.98);
        color: #ffffff;
        border-top-color: rgba(255, 255, 255, 0.12);
    }

    .slf-main-navigation.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .slf-main-navigation > a,
    .slf-nav-parent-link {
        width: 100%;
        min-height: 52px;
        justify-content: flex-start;
        padding: 0 14px;
        border-radius: 12px;
        font-size: 1rem;
        color: inherit;
    }

    .slf-nav-item {
        width: 100%;
    }

    .slf-nav-parent-row {
        display: grid;
        grid-template-columns: 1fr 48px;
        align-items: center;
        width: 100%;
    }

    .slf-submenu-toggle {
        display: inline-flex;
        width: 44px;
        height: 44px;
        justify-self: end;
        font-weight: 900;
        transform: rotate(0deg);
        transition: background 0.18s ease, transform 0.18s ease;
    }

    .slf-submenu-toggle::before {
        content: '+';
        font-size: 1.45rem;
        line-height: 1;
    }

    .slf-nav-item.submenu-open .slf-submenu-toggle::before {
        content: '–';
    }

    .slf-submenu-toggle:hover,
    .slf-submenu-toggle:focus {
        background: rgba(0, 128, 128, 0.12);
        outline: none;
    }

    .slf-header-dark .slf-submenu-toggle:hover,
    .slf-header-transparent .slf-submenu-toggle:hover,
    .slf-header-dark .slf-submenu-toggle:focus,
    .slf-header-transparent .slf-submenu-toggle:focus {
        background: rgba(255, 255, 255, 0.12);
    }

    .slf-submenu {
        position: static;
        min-width: 0;
        display: none;
        margin: 0 0 8px 14px;
        padding: 4px 0 6px 10px;
        background: transparent;
        border: 0;
        border-left: 3px solid rgba(0, 128, 128, 0.28);
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition: none;
    }

    .slf-nav-item:hover .slf-submenu,
    .slf-nav-item:focus-within .slf-submenu {
        display: none;
    }

    .slf-nav-item.submenu-open .slf-submenu {
        display: grid;
    }

    .slf-submenu a {
        color: inherit;
        white-space: normal;
        padding: 10px 12px;
        font-size: 0.93rem;
        opacity: 0.92;
    }
}

@media (max-width: 460px) {
    :root {
        --slf-header-height: 68px;
        --slf-header-height-compact: 68px;
    }

    .slf-header-inner {
        width: min(92%, 420px);
    }

    .slf-logo {
        height: 36px;
        max-width: 158px;
    }
}

/* Mobile submenu containment. */
@media (max-width: 980px) {
    .slf-site-header .slf-main-navigation {
        height: calc(100dvh - var(--slf-header-height));
        max-height: calc(100dvh - var(--slf-header-height));
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(34px, env(safe-area-inset-bottom));
    }

    .slf-site-header.slf-header-layout-compact .slf-main-navigation {
        height: calc(100dvh - var(--slf-header-height-compact));
        max-height: calc(100dvh - var(--slf-header-height-compact));
    }

    .slf-site-header .slf-nav-item.has-submenu {
        width: 100%;
        overflow: visible;
    }

    .slf-site-header .slf-nav-parent-row {
        position: relative;
        display: grid;
        grid-template-columns: 1fr 48px;
        width: 100%;
        align-items: center;
    }

    .slf-site-header .slf-nav-parent-link {
        min-width: 0;
        padding-right: 58px;
    }

    .slf-site-header .slf-submenu-toggle {
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    .slf-site-header .slf-submenu {
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 2px 0 12px 0 !important;
        padding: 8px !important;
        display: none !important;
        gap: 4px;
        background: #eefafa;
        border: 1px solid rgba(0, 128, 128, 0.14);
        border-radius: 14px;
        box-shadow: none;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        overflow: visible;
    }

    .slf-site-header .slf-nav-item:hover .slf-submenu,
    .slf-site-header .slf-nav-item:focus-within .slf-submenu {
        display: none !important;
    }

    .slf-site-header .slf-nav-item.submenu-open .slf-submenu {
        display: grid !important;
    }

    .slf-site-header .slf-submenu a {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 40px;
        padding: 9px 12px;
        border-radius: 10px;
        color: #1f2933 !important;
        background: transparent;
        font-size: 0.92rem;
        font-weight: 800;
        line-height: 1.25;
        white-space: normal;
        overflow-wrap: anywhere;
        opacity: 1;
    }

    .slf-site-header .slf-submenu a:hover,
    .slf-site-header .slf-submenu a:focus {
        background: #ffffff;
        color: #006666 !important;
    }

    .slf-site-header.slf-header-dark .slf-submenu,
    .slf-site-header.slf-header-transparent .slf-submenu {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.12);
    }

    .slf-site-header.slf-header-dark .slf-submenu a,
    .slf-site-header.slf-header-transparent .slf-submenu a {
        color: #ffffff !important;
    }

    .slf-site-header.slf-header-dark .slf-submenu a:hover,
    .slf-site-header.slf-header-dark .slf-submenu a:focus,
    .slf-site-header.slf-header-transparent .slf-submenu a:hover,
    .slf-site-header.slf-header-transparent .slf-submenu a:focus {
        background: rgba(255, 255, 255, 0.12);
        color: #ffffff !important;
    }
}

/* Desktop submenu hover bridge. */
@media (min-width: 981px) {
    .slf-site-header .slf-nav-item.has-submenu::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        height: 18px;
        background: transparent;
        pointer-events: auto;
    }

    .slf-site-header .slf-submenu {
        top: calc(100% + 4px) !important;
        z-index: 9999;
    }

}
