/*
 * BQ Top Navigation Menu Styles
 * Version: 1.3.0 (CLS Fix with proper arrow handling)
 * -------------------------------------------------- */

/* 1. Main Container - Fixed height to prevent CLS */
.bq-top-navigation {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
    position: relative;
    min-height: 52px; /* Reserve height to prevent CLS */
}

/* 2. Scrollable Wrapper - Takes up full width */
.bq-nav-scroller {
    overflow-x: auto;
    overflow-y: visible; /* Allow dropdown to show */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

.bq-nav-scroller::-webkit-scrollbar {
    display: none;
}

/* 3. The Menu List */
.bq-nav-scroll-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    white-space: nowrap;
    position: relative;
    min-height: 50px; /* Reserve space to prevent CLS */
}

.bq-nav-scroll-list li {
    flex-shrink: 0;
    position: relative;
}

.bq-nav-scroll-list li a {
    display: block;
    padding: 14px 18px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.bq-nav-scroll-list li:not(.active):not(.dropdown-open) a:hover {
    background-color: #f8f9fa;
    color: #0073aa;
}

.bq-nav-scroll-list li.active > a,
.bq-nav-scroll-list li.dropdown-open > a {
    color: #0073aa;
    border-bottom-color: #0073aa;
    font-weight: 400;
}



/* 4. The Dropdown Submenu (Hidden - JS will clone it) */
.bq-top-navigation .submenu {
    display: none !important; /* Original submenu is hidden, JS creates a clone */
}

/* Styles for the cloned dropdown (created by JS) */
body > .submenu {
    display: none;
    position: fixed;
    z-index: 9999;
    background-color: #fff;
    min-width: 220px;
    list-style: none;
    padding: 5px 0;
    margin: 0;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border: 1px solid #dee2e6;
    border-top: none;
}

body > .submenu li {
    width: 100%;
    position: static;
}

body > .submenu li a {
    display: block;
    padding: 10px 18px;
    border-bottom: none !important;
    white-space: normal;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

body > .submenu li a:hover {
    background-color: #f8f9fa;
    color: #0073aa;
}

body > .submenu li.sub-active > a {
    background-color: #e9f5ff;
    font-weight: 600;
    color: #0073aa;
}

/* Dropdown Arrow */
.bq-nav-scroll-list a.has-arrow::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
    border-top: 5px solid;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    transition: transform 0.2s ease-in-out;
}

.bq-nav-scroll-list .dropdown-open a.has-arrow::after {
    transform: rotate(180deg);
}

/* 5. The Arrows - Improved for CLS prevention */
.nav-arrow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50px;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: color 0.2s ease, opacity 0.2s ease;
    z-index: 100;
    pointer-events: auto;
    opacity: 0; /* Start invisible */
    visibility: hidden;
    display: flex; /* Always flex, controlled by visibility */
}

/* JS will add this class when arrow should be visible */
.nav-arrow.visible {
    opacity: 1;
    visibility: visible;
}

.nav-arrow:hover {
    color: #0073aa;
}

.nav-arrow:hover svg {
    transform: scale(1.15);
}

.nav-arrow.left-arrow {
    left: 0;
    background: linear-gradient(to right, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 255, 255, 0.95) 40%, 
        rgba(255, 255, 255, 0.7) 70%, 
        rgba(255, 255, 255, 0) 100%);
    border-radius: 8px 0 0 8px;
}

.nav-arrow.right-arrow {
    right: 0;
    background: linear-gradient(to left, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 255, 255, 0.95) 40%, 
        rgba(255, 255, 255, 0.7) 70%, 
        rgba(255, 255, 255, 0) 100%);
    border-radius: 0 8px 8px 0;
}

.nav-arrow svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bq-nav-scroll-list li a {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .nav-arrow {
        width: 35px;
    }
    
    .bq-top-navigation {
        min-height: 48px;
    }
    
    .bq-nav-scroll-list {
        min-height: 46px;
    }
}


