/* ==========================================================
   PLC & CNC — Main Header + Dynamic Menu
   Single source of truth for the public main navigation.

   Scope:
   - Main header row
   - Brand/logo
   - Main navigation
   - Dynamic dropdown/submenu
   - Mobile/tablet collapse area
   - Header CTA

   The Top Bar is intentionally NOT styled here.
   It remains in style.css and is frozen.
========================================================== */

/* =========================
   Header shell
========================= */
.header-premium {
    position: fixed;
    inset: 0 0 auto;
    width: 100%;
    z-index: 1030;
    background: #fff;
}

.header-premium .navbar {
    min-height: 92px;
    padding: 0;
    background: #fff;
    border-bottom: 1px solid rgba(15, 42, 67, .08);
    box-shadow: 0 8px 24px rgba(15, 42, 67, .06);
}

.header-premium .header-main-container {
    min-height: 92px;
    position: relative;
    display: grid !important;
    grid-template-columns: 250px minmax(0, 1fr) 180px;
    align-items: center;
    column-gap: 18px;
    padding-top: 7px;
    padding-bottom: 7px;
}

/* =========================
   Brand / logo
========================= */
.header-premium .header-brand {
    grid-column: 3;
    grid-row: 1;
    width: 170px;
    min-width: 0;
    margin: 0 !important;
    padding: 0;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #102a43;
    text-decoration: none;
}

.header-premium .logo-img {
    width: 68px;
    height: 68px;
    margin: 0 !important;
    padding: 0;
    object-fit: contain;
}

.header-premium .logo-text {
    width: 170px;
    max-width: 170px;
    margin: 0;
    color: #102a43 !important;
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   Menu layout
========================= */
.header-premium .header-menu-collapse {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.header-premium .header-menu-collapse > .site-menu-shell {
    width: 100%;
    min-width: 0;
}

.header-premium .header-menu-collapse > .site-menu-shell > .site-menu-nav {
    width: auto;
    max-width: 100%;
    margin: 0 auto !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 2px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.header-premium .site-menu-item {
    position: relative;
}

.header-premium .site-menu-nav > .site-menu-item {
    flex: 0 0 auto;
}

.header-premium .site-menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin: 0;
    padding: 10px 9px;
    border-radius: 9px;
    color: #18324b !important;
    background: transparent !important;
    font-size: .87rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease;
}

.header-premium .site-menu-link::before {
    display: none !important;
}

/* Bootstrap adds a second arrow through .dropdown-toggle::after.
   The menu has its own single chevron icon. */
.header-premium .site-menu-link::after {
    display: none !important;
}

.header-premium .site-menu-nav > .site-menu-item > .site-menu-link:hover,
.header-premium .site-menu-nav > .site-menu-item > .site-menu-link:focus-visible,
.header-premium .site-menu-nav > .site-menu-item > .site-menu-link.active,
.header-premium .site-menu-nav > .site-menu-item > .site-menu-link.is-active {
    color: #087ea4 !important;
    background: rgba(8, 126, 164, .055) !important;
}

.header-premium .site-menu-title {
    display: inline-block;
}

.header-premium .site-menu-icon {
    flex: 0 0 auto;
    font-size: .9rem;
}

.header-premium .site-menu-chevron {
    flex: 0 0 auto;
    font-size: .72rem;
    transition: transform .2s ease;
}

/* =========================
   Desktop dropdowns
========================= */
.header-premium .site-menu-nav .site-menu-dropdown {
    position: absolute;
    top: calc(100% - 2px);
    right: 0;
    left: auto;
    z-index: 1040;
    display: none;
    min-width: 220px;
    margin: 0;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
}

.header-premium .site-menu-nav > .site-menu-item:hover > .site-menu-dropdown,
.header-premium .site-menu-nav > .site-menu-item > .site-menu-dropdown.show,
.header-premium .site-menu-nav .site-menu-item.show > .site-menu-dropdown {
    display: block;
}

.header-premium .site-menu-nav .site-menu-dropdown .site-menu-dropdown {
    top: -8px;
    right: 100%;
    left: auto;
}

.header-premium .site-menu-nav .site-menu-dropdown .site-menu-item:hover > .site-menu-dropdown,
.header-premium .site-menu-nav .site-menu-dropdown .site-menu-item.show > .site-menu-dropdown {
    display: block;
}

.header-premium .site-menu-nav .site-menu-dropdown .site-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 11px;
    border-radius: 9px;
    color: #263244 !important;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
}

.header-premium .site-menu-nav .site-menu-dropdown .site-menu-link:hover,
.header-premium .site-menu-nav .site-menu-dropdown .site-menu-link:focus-visible,
.header-premium .site-menu-nav .site-menu-dropdown .site-menu-link.active,
.header-premium .site-menu-nav .site-menu-dropdown .site-menu-link.is-active {
    color: #087ea4 !important;
    background: #eff6ff !important;
}

.header-premium .site-menu-nav .site-menu-dropdown .site-menu-chevron {
    transform: rotate(90deg);
}

.header-premium .site-menu-nav .site-menu-item.show > .site-menu-link .site-menu-chevron {
    transform: rotate(180deg);
}

/* =========================
   Desktop CTA
========================= */
.header-premium .header-desktop-cta {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 250px;
}

.header-premium .header-mobile-cta {
    display: none;
}

.header-premium .header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 128px;
    min-height: 46px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #087ea4, #1268d8);
    box-shadow: 0 9px 20px rgba(18, 104, 216, .16);
    color: #fff !important;
    font-size: .86rem;
    font-weight: 800;
    white-space: nowrap;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.header-premium .header-cta:hover,
.header-premium .header-cta:focus-visible {
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(18, 104, 216, .22);
    filter: brightness(1.03);
}

.header-premium .header-products-cta {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 112px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 8px;
    border: 1px solid rgba(8, 126, 164, .38);
    border-radius: 10px;
    background: #fff;
    color: #087ea4 !important;
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.header-premium .header-products-cta:hover,
.header-premium .header-products-cta:focus-visible {
    color: #087ea4 !important;
    background: #eff8fb;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(8, 126, 164, .12);
}

.header-premium .header-products-cta i {
    font-size: .95rem;
    line-height: 1;
}

.header-premium .header-desktop-cta .header-cta {
    flex: 0 0 auto;
    min-width: 128px;
    padding-left: 12px;
    padding-right: 12px;
    font-size: .82rem;
}

/* Desktop CTA balance */
@media (min-width: 1200px) {
    .header-premium .header-desktop-cta {
        width: 250px;
    }

    .header-premium .header-desktop-cta .header-products-cta {
        width: 112px;
    }

    .header-premium .header-desktop-cta .header-cta {
        width: 128px;
    }
}

/* =========================
   Mobile / tablet
========================= */
.header-premium .header-menu-toggle {
    display: none;
}

@media (max-width: 1199.98px) {
    .header-premium .header-main-container {
        min-height: 82px;
        grid-template-columns: 1fr auto;
        column-gap: 14px;
        padding: 8px 12px;
    }

    .header-premium .header-brand {
        grid-column: 2;
        grid-row: 1;
        width: auto;
        max-width: 180px;
        justify-self: end;
    }

    .header-premium .logo-img {
        width: 58px;
        height: 58px;
    }

    .header-premium .logo-text {
        width: 150px;
        max-width: 150px;
        font-size: .78rem;
    }

    .header-premium .header-menu-toggle {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        align-self: center;
        width: 44px;
        height: 44px;
        padding: 0 !important;
        margin: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #087ea4 !important;
        border-radius: 10px !important;
        background: #087ea4 !important;
        color: #fff !important;
        box-shadow: 0 7px 16px rgba(8, 126, 164, .18);
    }

    .header-premium .header-menu-toggle i {
        color: #fff !important;
        font-size: 1.65rem;
        line-height: 1;
    }

    .header-premium .header-menu-toggle:focus-visible {
        outline: 0;
        box-shadow: 0 0 0 .2rem rgba(8, 126, 164, .15), 0 7px 16px rgba(8, 126, 164, .18);
    }

    .header-premium .header-menu-collapse {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        display: none !important;
        margin: 0;
        padding: 10px 0 14px;
        border-top: 1px solid rgba(15, 42, 67, .08);
    }

    .header-premium .header-menu-collapse.show {
        display: block !important;
    }

    .header-premium .header-menu-collapse.collapsing {
        display: block !important;
        overflow: hidden;
    }

    .header-premium .header-menu-collapse > .site-menu-shell > .site-menu-nav {
        width: 100%;
        margin: 0 !important;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .header-premium .site-menu-nav > .site-menu-item > .site-menu-link {
        width: 100%;
        justify-content: flex-start;
        margin: 0;
        padding: 11px 12px;
        border-radius: 8px;
        font-size: .92rem;
    }

    .header-premium .site-menu-nav > .site-menu-item > .site-menu-link:hover,
    .header-premium .site-menu-nav > .site-menu-item > .site-menu-link:focus-visible,
    .header-premium .site-menu-nav > .site-menu-item > .site-menu-link.active,
    .header-premium .site-menu-nav > .site-menu-item > .site-menu-link.is-active {
        color: #087ea4 !important;
        background: rgba(8, 126, 164, .055) !important;
    }

    /* On touch layouts nested menus flow vertically instead of floating. */
    .header-premium .site-menu-nav .site-menu-dropdown,
    .header-premium .site-menu-nav .site-menu-dropdown .site-menu-dropdown {
        position: static;
        display: none;
        width: 100%;
        min-width: 0;
        margin: 2px 0 6px;
        padding: 5px 8px;
        border: 0;
        border-radius: 10px;
        box-shadow: none;
        background: #f8fafc;
    }

    .header-premium .site-menu-nav .site-menu-item:hover > .site-menu-dropdown {
        display: none;
    }

    .header-premium .site-menu-nav .site-menu-item.show > .site-menu-dropdown {
        display: block;
    }

    .header-premium .site-menu-nav .site-menu-dropdown .site-menu-link {
        white-space: normal;
        padding: 9px 12px;
    }

    .header-premium .header-mobile-cta {
        display: flex;
        width: 100%;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(15, 42, 67, .07);
        gap: 8px;
    }

    .header-premium .header-mobile-cta .header-products-cta,
    .header-premium .header-mobile-cta .header-cta {
        flex: 1 1 0;
        width: 100%;
    }

    .header-premium .header-desktop-cta {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .header-premium .header-main-container {
        min-height: 76px;
        padding: 7px 10px;
    }

    .header-premium .logo-img {
        width: 52px;
        height: 52px;
    }

    .header-premium .logo-text {
        width: 125px;
        max-width: 125px;
        font-size: .72rem;
    }

    .header-premium .header-menu-toggle {
        width: 42px;
        height: 42px;
        border-radius: 9px !important;
    }
}
