/* Hide default Blocksy header */
.ct-header, #main-header { display: none !important; }

/* Custom Header Styles */
#custom-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    z-index: 1000;
    transition: all 0.1s ease; /* Transition for desktop */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 0px 0px 10px 0px; /* Default padding */
    height: 100px; /* Fixed height */
    box-sizing: border-box; /* Include padding in height */
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    height: 100%; /* Match parent height */
}

.logo {
    display: block;
    margin: 0 auto 10px;
    max-width: 200px; /* Initial desktop size */
    height: auto; /* Maintain aspect ratio */
}

.nav-menu {
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-top: -10px;
}

.nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

.nav-menu > ul > li {
    font-weight: bold;
    margin: 0 15px;
    position: relative;
}

.nav-menu a {
    color: #000;
    text-decoration: none;
}

.nav-menu ul ul {
    display: none !important;            
    position: absolute;
    margin-top: 0 !important;            
    top: calc(100% + 10px) !important;    /* spacing below parent */
    bottom: auto !important;
    left: 50%;                             /* align with parent */
    transform: translateX(-50%);        /* center align */
    width: 200px !important;              
    background: #fff !important;         
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    padding: 5px 0 !important;
    border-radius: 4px;
    z-index: 1001;
    font-size: 16px;
    font-weight: 500 !important;
}

.nav-menu > ul > li:hover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 20px;        /* matches your gap size */
    background: transparent;
}

/* Show submenu on hover / keyboard focus */
.nav-menu ul > li:hover > ul,
.nav-menu ul > li:focus-within > ul {
    display: block !important;
}
/* Submenu link styles */
.nav-menu ul ul a {
    display: block;
    padding: 8px 16px;
    color: #000 !important;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
    width: 100%;             /* cover full row */
    box-sizing: border-box;
}

/* Red hover effect with white text */
.nav-menu ul ul a:hover {
    background: #c00 !important;
    color: #fff !important;
}

/* Make top-level anchors positionable for the underline indicator */
.nav-menu > ul > li > a {
    position: relative;
}

/* Red indicator below hovered top-level menu item */
.nav-menu > ul > li:hover > a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;   /* tweak if you need different spacing */
    width: 100%;
    height: 3px;
    background: #c00;
}

.nav-menu > ul > li > ul {
    left: 50%;
    transform: translateX(-50%);  /* centers card */
}

.nav-menu ul ul li {
    font-size: 15px;
    width: 100%;
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 1002; /* Ensure it stays above other elements */
}

.search-icon svg {
    width: 20px;
    height: 20px;
    fill: #f00;
}

/* Scrolled State (Desktop Only) */
#custom-header.scrolled {
    padding: 10px 0px 5px 0px; /* Applies to desktop */
    height: 65px;
}

#custom-header.scrolled .header-inner {
    display: flex;
    align-items: center;
    text-align: left; /* Default for desktop */
}

#custom-header.scrolled .logo {
    margin: 0 20px 0 0;
    max-width: 180px; /* Smaller in scrolled state */
    height: auto;
}

#custom-header.scrolled .nav-menu {
    margin: 0px 0px 0px 15px;
    font-size: 15px;
    flex-grow: 1;
    justify-content: flex-start;
}

#custom-header.scrolled .nav-menu ul {
    flex-direction: row;
}

/* Invisible hover bridge ONLY when header is scrolled */
#custom-header.scrolled .nav-menu > ul > li:hover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 21px; /* must match submenu top spacing */
    background: transparent;
}

/* Submenu position & styling for scrolled header */
#custom-header.scrolled .nav-menu ul ul {
    display: none !important;
    position: absolute;
    top: calc(100% + 21px) !important;   /* spacing below parent */
    left: 50%;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    width: 200px !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    padding: 5px 0 !important;
    border-radius: 10px;
    z-index: 1001;
}

/* Center align submenu items in scrolled state */
#custom-header.scrolled .nav-menu ul ul li {
    text-align: center;
}

#custom-header.scrolled .nav-menu ul ul li a {
    display: block;
    text-align: center;
    padding: 8px 12px;
}

/* Show submenu on hover */
#custom-header.scrolled .nav-menu > ul > li:hover > ul {
    display: block !important;
}

#custom-header.scrolled .search-icon {
    position: static;
    transform: none;
    margin-left: auto;
}

/* Mobile and Tablet Styles (No Nav Menu, Fixed Layout, Ignore Scroll) */
@media (max-width: 1024px) {
    #custom-header {
        padding: 0px 0px 10px 0px !important; /* Force fixed padding */
        height: 55px !important; /* Fixed height */
        transition: none !important; /* Remove transition on mobile */
    }

    #custom-header.scrolled {
        padding: 0px 0px 10px 0px !important; /* Override scrolled padding */
        height: 55px !important; /* Maintain height */
    }

    .nav-menu ul {
        display: none !important; /* Hide menu entirely */
    }

    .hamburger {
        display: block;
        position: absolute !important;
        left: 20px !important;
        top: 50% !important;
        transform: translateY(-90%) !important; /* Consistent centering */
        cursor: pointer;
        z-index: 1003; /* Ensure it stays on top */
    }

    .hamburger svg {
        width: 25px;
        height: 25px;
        fill: #f32323;
    }

    .search-icon {
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        transform: translateY(-90%) !important; /* Consistent centering */
        z-index: 1002; /* Ensure it stays above other elements */
    }

    .search-icon svg {
        width: 20px;
        height: 20px;
        fill: #f00;
    }

    #custom-header .header-inner {
        position: relative !important;
        text-align: center; /* Center logo */
        padding: 0; /* Remove inner padding */
        height: 100%; /* Match parent height */
    }

    #custom-header.scrolled .header-inner {
        position: relative !important;
        text-align: center; /* Keep logo centered */
        padding: 0; /* Same as initial */
        height: 100%; /* Maintain height */
    }

    .logo {
        margin: 0 auto; /* Center logo */
        max-width: 165px; /* Match your specified size */
        height: auto; /* Maintain aspect ratio */
    }

    #custom-header.scrolled .logo {
        margin: 0 auto; /* Keep centered */
        max-width: 165px; /* Same as initial */
        height: auto;
    }

    #custom-header.scrolled .hamburger {
        display: block;
        position: absolute !important;
        left: 20px !important;
        top: 50% !important;
        transform: translateY(-90%) !important; /* Same as initial */
        z-index: 1003; /* Ensure it stays on top */
    }

    #custom-header.scrolled .search-icon {
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        transform: translateY(-90%) !important; /* Same as initial */
        z-index: 1002; /* Ensure it stays above other elements */
    }

    /* No dropdowns on mobile */
    .nav-menu ul ul {
        display: none !important;
    }
}

/* Hide hamburger on desktop */
@media (min-width: 1025px) {
    .hamburger {
        display: none;
    }

    .nav-menu ul {
        display: flex !important;
    }
}