/* ==================================================
   CLEAN HEADER STYLES - URGENT REWRITE
   Version: Bulletproof Layout + Fixed Submenus + Gaps + Z-Index 100
================================================== */

/* RESET EVERYTHING inside header-clean to avoid legacy pollution */
.header-clean *,
.header-clean *::before,
.header-clean *::after {
    box-sizing: border-box;
}

/* 1. Main Container Setup */
.my-header-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    /* Bottom alignment */
    position: relative !important;
    z-index: 100 !important;
    /* REQUESTED Z-INDEX */
    padding: 10px 15px 0px 15px !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    flex-wrap: nowrap !important;
    /* PREVENT WRAPPING */
}

/* 2. Logo Area (STRICTLY LEFT) */
.my-logo-wrapper {
    flex-shrink: 0 !important;
    order: 1 !important;
    /* Force First */
    margin-right: auto !important;
    /* Push everything else right */
    padding-bottom: 5px !important;
    position: relative !important;
    z-index: 101 !important;
    left: 0 !important;
    top: 0 !important;
    float: none !important;
}

.my-logo-img {
    max-height: 55px !important;
    width: auto !important;
    display: block !important;
    border: none !important;
}

/* 3. Right Menu Area (Stack Vertical) */
.my-menu-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    /* Align children to right */
    justify-content: flex-end !important;
    flex-grow: 0 !important;
    /* Do not expand unnecessarily */
    order: 2 !important;
    /* Force Second */
    position: relative !important;
    z-index: 102 !important;
    right: 0 !important;
    top: 0 !important;
    float: none !important;
    width: auto !important;
}

/* 4. Top Secondary Links (Row 1) */
.my-top-links {
    display: flex !important;
    gap: 25px !important;
    justify-content: flex-end !important;
    margin-bottom: 25px !important;
    /* INCREASED GAP AS REQUESTED */
    width: 100% !important;
}

.my-top-links a {
    font-family: 'Mulish', sans-serif !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    color: #666 !important;
    text-decoration: none !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
}

.my-top-links a:hover {
    color: #007bff !important;
}

/* 5. Main Navigation (Row 2) */
.my-main-nav-container {
    display: block !important;
    width: 100% !important;
    text-align: right !important;
}

#main-nav {
    display: block !important;
    float: none !important;
    /* Kill legacy float */
    position: static !important;
    /* Kill legacy positioning */
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    width: auto !important;
}

#main-nav .menu {
    display: flex !important;
    gap: 25px !important;
    /* Decreased Gap as requested */
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: flex-end !important;
}

#main-nav .menu>li {
    display: block !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    /* Essential for dropdown positioning */
}

#main-nav .menu>li>a {
    font-family: 'Mulish', sans-serif !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #000 !important;
    text-decoration: none !important;
    padding: 10px 5px !important;
    /* Bigger click area */
    display: block !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

#main-nav .menu>li>a:hover {
    color: #007bff !important;
}


/* Dropdown Handling - FIXED VISIBILITY */
#main-nav .sub-menu {
    position: absolute !important;
    z-index: 99999 !important;
    /* Max z-index */
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-top: 3px solid #007bff !important;
    /* Visual indicator */
    display: none;
    left: 0 !important;
    top: 100% !important;
    /* Stick to bottom of parent */
    min-width: 220px !important;
    text-align: left !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    border-radius: 0 0 4px 4px !important;
}

#main-nav .menu>li:hover .sub-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Submenu Items */
#main-nav .sub-menu>li {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

#main-nav .sub-menu>li>a {
    display: block !important;
    padding: 8px 15px !important;
    font-size: 14px !important;
    color: #333 !important;
    border-bottom: 1px solid #eee !important;
    text-transform: capitalize !important;
    font-weight: 600 !important;
}

#main-nav .sub-menu>li:last-child>a {
    border-bottom: none !important;
}

#main-nav .sub-menu>li>a:hover {
    background: #f8f9fa !important;
    color: #007bff !important;
    padding-left: 20px !important;
    /* Hover effect */
    transition: all 0.2s ease !important;
}


/* Legacy Override: Ensure no random floats interfere */
#site-header *,
.header-box * {
    float: none !important;
}

/* ==================================================
   RESPONSIVE (Laptop + Mobile)
================================================== */

/* Laptop (Small screens < 1200px) */
@media (max-width: 1200px) {
    .my-header-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    #main-nav .menu {
        gap: 20px !important;
        /* Reduce gap on smaller screens */
    }

    #main-nav .menu>li>a {
        font-size: 14px !important;
    }

    .my-top-links {
        gap: 15px !important;
    }
}

/* Mobile / Tablet (< 992px) */
@media (max-width: 991px) {

    /* STRICTLY HIDE DESKTOP MENUS */
    .my-menu-wrapper {
        display: none !important;
    }

    /* Ensure Top Links are definitely hidden even if wrapper is toggled */
    .my-top-links {
        display: none !important;
    }

    .my-header-container {
        align-items: center !important;
        /* Center Logo Vertically */
        padding: 10px 15px !important;
        justify-content: space-between !important;
    }

    /* Force Order: Logo Left (1), Button Right (2) */
    .my-logo-wrapper {
        order: 1 !important;
        flex-grow: 1 !important;
        /* Allow it to take visible space */
        max-width: 80% !important;
    }

    .my-logo-img {
        max-height: 40px !important;
        /* Smaller Logo for mobile */
    }

    /* Mobile Button - Use Theme Default */
    .mobile-button {
        order: 2 !important;
        /* FORCE RIGHT */
        display: block !important;
        position: relative;
        cursor: pointer;
        z-index: 200 !important;
        margin-top: 5px !important;
        width: 35px !important;
        /* Ensure click area */
        height: 35px !important;
    }

    /* Ensure the internal span is visible if the theme uses it */
    .mobile-button span {
        display: block !important;
    }
}

/* Desktop: Hide Mobile Button */
@media (min-width: 992px) {
    .mobile-button {
        display: none !important;
    }
}