/* 
Custom Header Overrides
Styles for custom header configurations from Fuse Addons
*/

/* Mobile Menu Fixes */
@media (max-width: 1280px) {

    /* Ensure mobile menu content is properly aligned to top */
    .fs-header__content.fs-header__content_show {
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }

    /* Fix mobile menu positioning - ensure menu appears at top after close button */
    .fs-header__content .fs-header__menu {
        order: 2 !important;
        /* Ensure menu comes after close button */
        margin: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
        flex-shrink: 0 !important;
    }

    /* Ensure close button is first */
    .fs-header__content .fs-header__burger {
        order: 1 !important;
        margin-bottom: 1.5rem !important;
        flex-shrink: 0 !important;
    }

    /* Secondary menu comes after primary menu */
    .fs-header__content .fs-header__submenu {
        order: 3 !important;
        margin: 1.5rem 0 0 !important;
        flex-shrink: 0 !important;
    }

    /* SCENARIO 1: When contacts are visible - push contacts to bottom, buttons stick below them */
    .fs-header__content .fs-header__contacts {
        order: 4 !important;
        margin: auto 0 0 !important;
        /* Push contacts to bottom with auto margin */
        flex-shrink: 0 !important;
    }

    /* When contacts exist, buttons stick right below them (no gap) */
    .fs-header__content:has(.fs-header__contacts) .fs-header__actions {
        order: 5 !important;
        margin: 0 !important;
        /* No margin - stick right below contacts */
        flex-shrink: 0 !important;
        margin-top: 1.5rem !important;
    }

    /* SCENARIO 2: When contacts are hidden - push buttons to bottom */
    .fs-header__content:not(:has(.fs-header__contacts)) .fs-header__actions {
        order: 5 !important;
        margin: auto 0 0 !important;
        /* Push to bottom when no contacts */
        flex-shrink: 0 !important;
    }
}

/* Desktop Menu Alignment Styles - only apply on desktop */
@media (min-width: 1281px) {

    /* Menu Alignment Styles */
    .fs-header--menu-center .fs-header__menu {
        margin-left: auto;
        margin-right: auto;
    }

    .fs-header--menu-right .fs-header__menu {
        margin-left: auto;
        margin-right: 1rem;
        /* Small gap before buttons */
    }

    /* If no buttons are shown, align fully to the right */
    .fs-header--menu-right .fs-header__main-grid:not(:has(.fs-header__actions)) .fs-header__menu,
    .fs-header--menu-right .fs-header__main-grid:not(:has(.fs-header__callback)) .fs-header__menu {
        margin-right: 0;
    }

    /* Ensure the header main grid can accommodate different alignments */
    .fs-header--menu-center .fs-header__main-grid,
    .fs-header--menu-right .fs-header__main-grid {
        position: relative;
    }

    /* Fine-tune center alignment */
    .fs-header--menu-center .fs-header__main-grid {
        justify-content: space-between;
    }

    .fs-header--menu-center .fs-header__logo {
        flex-shrink: 0;
    }

    .fs-header--menu-center .fs-header__content {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Right alignment adjustments */
    .fs-header--menu-right .fs-header__main-grid {
        justify-content: space-between;
    }

    .fs-header--menu-right .fs-header__content {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    /* Ensure buttons still appear on the right for right-aligned menus */
    .fs-header--menu-right .fs-header__actions,
    .fs-header--menu-right .fs-header__callback {
        margin-left: 1rem;
    }
}