/* Custom Header Widget Styles */
.custom-header-container {
    width: 100%;
    background-color: #1a3a5c;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease, height 0.3s ease;
}

/* Sticky Header Styles - Always fixed at top */
.custom-header-container.sticky-header-enabled {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}


/* Placeholder to prevent content jump */
.sticky-header-placeholder {
    display: block;
}

.custom-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    box-sizing: border-box;
    height: 100%;
    position: relative;
}

/* Logo Styles */
.custom-header-logo {
    flex-shrink: 0;
}

.custom-header-logo a {
    display: block;
    line-height: 0;
}

.custom-header-logo img {
    max-height: 50px;
    width: auto;
}

/* Navigation Menu Styles */
.custom-header-menu {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.custom-header-menu ul {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
}

.custom-header-menu ul li {
    position: relative;
    margin: 0;
    padding: 0;
}

.custom-header-menu ul li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.custom-header-menu ul li a:hover {
    color: #cccccc;
}

/* Dropdown Arrow */
.custom-header-menu ul li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    margin-left: 4px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Sub-menu nested arrow: point right, black */
.custom-header-menu ul li ul.sub-menu li.menu-item-has-children > a::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

/* Submenu Styles */
.custom-header-menu ul li ul.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    flex-direction: column;
    gap: 0 !important;
    padding: 0;
}

.custom-header-menu ul li:hover > ul.sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-header-menu ul li ul.sub-menu li {
    width: 100%;
}

.custom-header-menu ul li ul.sub-menu li a {
    color: #333333;
    padding: 10px 20px;
    font-size: 13px;
    text-transform: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-header-menu ul li ul.sub-menu li a:hover {
    color: #1a3a5c;
    background-color: #f5f5f5;
}

/* Nested sub-menu: open to the right */
.custom-header-menu ul li ul.sub-menu li ul.sub-menu {
    top: 0;
    left: 100%;
    transform: translateX(-10px);
}

.custom-header-menu ul li ul.sub-menu li:hover > ul.sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Search Styles */
.custom-header-search {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10000;
}

.custom-header-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 10000;
}

.custom-header-search-form {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 44px;
    overflow: hidden;
    display: flex;
    align-items: center;
    border: none;
    border-radius: 4px;
    transition: width 1s ease, background-color 0.3s ease;
    background-color: transparent;
    z-index: 10000;
}

.custom-header-search-wrapper.active .custom-header-search-form {
    width: 280px;
    background-color: rgba(255, 255, 255, 0.15);
}

.custom-header-search-input {
    width: 280px;
    flex-shrink: 0;
    padding: 0 12px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #ffffff;
    height: 100%;
    white-space: nowrap;
}


.custom-header-search-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.custom-header-search-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10001;
    pointer-events: auto !important;
    border-radius: 0 4px 4px 0;
}

.custom-header-search-icon {
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .custom-header-wrapper {
        padding: 10px 20px;
    }
    
    .custom-header-menu ul {
        gap: 15px;
    }
    
    .custom-header-menu ul li a {
        font-size: 13px;
    }
    
    .custom-header-search-form.active .custom-header-search-input {
        width: 200px;
    }
}

/* ===== Hamburger Button ===== */
.custom-header-hamburger {
    display: none;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: 1.5px solid currentColor;
    border-radius: 6px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: inherit;
    letter-spacing: 0.5px;
    line-height: 1;
    flex-shrink: 0;
}

/* ===== Mobile Menu Overlay ===== */
.mobile-menu-overlay { display: none; }

/* ===== Mobile Menu Panel ===== */
.mobile-menu-panel {
    position: fixed;
    top: 0; /* updated by JS to header height */
    left: 0;
    right: 0;
    background: #ffffff;
    z-index: 10001;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
}
.mobile-menu-panel.active {
    max-height: 80vh;
    overflow-y: auto;
}

/* ===== Mobile Nav List ===== */
.mobile-menu-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.mobile-menu-nav-list > li {
    border-bottom: 1px solid #ebebeb;
}
.mobile-menu-nav-list > li > a {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #222;
    text-decoration: none;
    flex: 1;
}

/* Submenu accordion toggle button */
.mobile-menu-item-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ebebeb;
}
.mobile-menu-item-row > a {
    flex: 1;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #222;
    text-decoration: none;
    display: block;
}
.mobile-submenu-toggle {
    width: 52px;
    height: 52px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #333;
    transition: background 0.2s;
    user-select: none;
}
.mobile-submenu-toggle:hover { ; }
.mobile-submenu-toggle svg {
    transition: transform 0.3s ease;
    display: block;
}
.mobile-submenu-toggle.open svg { transform: rotate(180deg); }

/* Sub-menu (all levels) */
.mobile-menu-nav-list .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
}
.mobile-menu-nav-list .sub-menu.open { display: block; }
.mobile-menu-nav-list .sub-menu > li {
    border-top: 1px solid #e8e8e8;
}
.mobile-menu-nav-list .sub-menu > li:last-child {
    border-bottom: 1px solid #e8e8e8;
}
/* Level-2 item row inside sub-menu */
.mobile-menu-nav-list .sub-menu .mobile-menu-item-row {
    border-bottom: none;
}
.mobile-menu-nav-list .sub-menu .mobile-menu-item-row > a {
    flex: 1;
    padding: 10px 20px 10px 22px;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #333;
}
/* Level-3 sub-sub-menu */
.mobile-menu-nav-list .sub-menu .sub-menu > li > a {
    padding-left: 36px;
}
.mobile-menu-nav-list .sub-menu > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 10px 22px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
}
.mobile-menu-nav-list .sub-menu > li > a:hover {
    color: #1a7abf;
}
.mobile-menu-nav-list .sub-menu > li > a::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    flex-shrink: 0;
}

/* Mobile Search Bar */
.mobile-menu-search-bar {
    padding: 16px 20px 20px;
    margin-top: auto;
    border-top: 1px solid #ebebeb;
}
.mobile-menu-search-bar form {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}
.mobile-menu-search-bar input[type="text"] {
    flex: 1;
    padding: 12px 14px;
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
}
.mobile-menu-search-bar input[type="text"]::placeholder { color: #999; }

/* ===== Responsive ===== */
@media (min-width: 769px) {
    .custom-header-hamburger,
    .mobile-menu-panel,
    .mobile-menu-overlay { display: none !important; }
}

@media (max-width: 768px) {
    .custom-header-menu,
    .custom-header-search { display: none !important; }

    .custom-header-hamburger { display: flex !important; }

    .custom-header-wrapper { padding: 0 16px; }
}
