/* ULTIMATE HEADER STABILIZATION */

/* Force stable viewport and prevent any shifts */
html {
    overflow-x: hidden;
    width: 100%; /* avoid scrollbar width causing horizontal shift */
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    /* Remove any transitions that might affect layout */
    transition: none !important;
}

/* Lock header positioning completely */
.header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 2147483500 !important; /* ensure header is above any page widget */
    background-color: #fff !important;
    /* Prevent any transforms or transitions */
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
    /* Force into its own layer */
    contain: layout style paint !important;
    /* Prevent any flex/grid issues */
    display: block !important;
}

/* Stabilize upper header */
.upper-header {
    height: 36px !important;
    width: 100% !important;
    background-color: #000 !important;
    color: #fff !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    transition: none !important;
}

/* Lock main header */
header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    padding: 0 32px 0 25px !important;
    height: 60px !important;
    align-items: center !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
    transform: none !important;
    transition: none !important;
    width: auto !important;
}

/* Stabilize navigation */
.navigation {
    height: 37px !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    padding: 0 25px 0 25px !important;
    align-items: center !important;
    transform: none !important;
    transition: none !important;
    margin: 0 !important;
}

/* Lock search box */
.header-search {
    margin-left: 16px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    height: 40px !important;
    width: 300px !important;
    background: #fff !important;
    transform: none !important;
    transition: none !important;
    overflow: hidden !important;
}

.header-search:hover {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
}

/* Prevent modal from affecting header */
.modal {
    visibility: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9999 !important; /* Lower than header */
    /* Isolate modal from header */
    contain: layout style paint !important;
}

.modal.visible {
    visibility: visible !important;
}

.modal-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 9999 !important;
    /* Prevent interaction with header */
    pointer-events: auto !important;
}

/* Ensure modal content starts below header */
.modal-inner {
    padding: 97px 25px 0 25px !important; /* Top padding = header height */
    width: 100% !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
    height: calc(100vh - 133px) !important;
    overflow-y: auto !important;
}

/* Prevent any body style changes from affecting header */
body.modal-open,
body[style*="overflow"],
body[style*="padding-right"] {
    /* Override any dynamic styles */
    margin: 0 !important;
    transform: none !important;
    transition: none !important;
}

/* Force header elements to stay in place */
.header * {
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
}

/* Lock navigation items */
.nav-inner > ul > li {
    cursor: pointer !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    position: relative !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    transform: none !important;
    transition: none !important;
}

/* Prevent underline animations from affecting layout */
.underline {
    position: absolute !important;
    bottom: 0px !important;
    height: 2px !important;
    width: 100% !important;
    background: transparent !important;
    transform: none !important;
    transition: background-color 0.1s ease !important;
}

.underline.active {
    background: rgb(0, 0, 0) !important;
}

/* Lock header right section */
.header-right {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    transform: none !important;
    transition: none !important;
}

.header-right > div > div {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    transform: none !important;
    transition: none !important;
}

/* Prevent any JavaScript-induced layout changes */
[style*="overflow: hidden"] {
    /* Keep header stable even when body overflow is hidden */
    padding-right: 0 !important;
}

/* Mobile fixes */
@media (max-width: 768px) {
    .header {
        transform: none !important;
        transition: none !important;
    }
    
    header {
        padding: 0 15px !important;
        transform: none !important;
        transition: none !important;
    }
    
    .navigation {
        padding: 0 !important;
        transform: none !important;
        transition: none !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        /* Smooth scrolling */
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE */
    }
    
    /* Hide scrollbar but keep functionality */
    .navigation::-webkit-scrollbar {
        display: none !important;
    }
    
    .nav-inner {
        width: auto !important;
        min-width: 100% !important;
        padding: 0 15px !important;
    }
    
    .nav-inner > ul {
        display: flex !important;
        flex-direction: row !important;
        list-style: none !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        min-width: max-content !important;
        justify-content: flex-start !important;
        align-items: center !important;
    }
    
    .nav-inner > ul > li {
        cursor: pointer !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        position: relative !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        transform: none !important;
        transition: none !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    
    .inner-link-text {
        font-size: 13px !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
    }
} 