/* Sticky Header - All 3 Bars Fixed Together */

/* Wrapper for entire sticky header section */
.sticky-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Ensure content doesn't get hidden behind sticky header */
body {
    padding-top: 0 !important;
}

/* Push page banners and content down to avoid overlap */
.page-banner,
.page,
#bootstrap-touch-slider,
.product-infinite-scroll {
    position: relative;
    z-index: 1;
    margin-top: 0;
}

/* Compact topbar styling */
.header {
    background: var(--gradient-header);
    margin: 0;
    padding: 0;
}

.topbar-wrapper {
    background: transparent;
    width: 100%;
    display: flex;
    justify-content: center;
}

.topbar {
    padding: 6px 0;
    margin: 0;
    width: 80%;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar .left-menu,
.topbar .right-menu {
    font-size: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar .left-menu a,
.topbar .right-menu a {
    color: #fff;
    padding: 5px 10px;
    transition: all 0.3s ease;
    display: inline-block;
}

.topbar .left-menu a:hover,
.topbar .right-menu a:hover {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.topbar .right-menu > i,
.topbar .left-menu > i {
    margin-right: 4px;
    color: #fff;
}

/* Compact logo and search bar */
.row2-wrapper {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 8px 0;
}

.row2 {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    padding: 0 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-area {
    flex: 0 0 160px;
}

.logo-area img {
    max-height: 40px;
    width: auto;
}

.search-area {
    flex: 1;
    margin: 0 18px;
    max-width: 600px;
}

.search-area form {
    display: flex;
    border: 2px solid var(--qpick-pink);
    border-radius: 22px;
    overflow: hidden;
    background: #fff;
}

.search-area input[type="text"] {
    flex: 1;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    outline: none;
}

.search-area button {
    background: var(--gradient-button);
    color: #fff;
    border: none;
    padding: 8px 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.search-area button:hover {
    background: var(--gradient-button-hover);
}

/* Compact navigation menu */
.nav {
    background: #f8f9fa !important;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    position: relative;
    z-index: 900;
}

.nav .menu-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative; /* For mega menu positioning */
    background: #f8f9fa !important;
}

.nav .menu ul {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    background: #f8f9fa !important;
}

.nav .menu > ul > li {
    position: relative;
    background: #f8f9fa !important;
}

.nav .menu > ul > li > a {
    display: block;
    padding: 10px 15px;
    color: #333 !important;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
    background: transparent !important;
}

.nav .menu > ul > li > a:hover,
.nav .menu > ul > li.menu-active > a {
    background: var(--gradient-header) !important;
    color: #fff !important;
}

/* Mega Menu Dropdown - Multiple Columns (Compact) */
.nav .menu > ul > li {
    position: relative;
}

/* First level dropdown (mega menu container) - Fixed positioning */
.nav .menu > ul > li > ul {
    position: fixed;
    z-index: 1002;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-radius: 4px;
    padding: 15px 20px;
    width: 1170px;
    max-width: calc(100vw - 60px);
    left: 50%;
    transform: translateX(-50%);
    margin-left: auto;
    margin-right: auto;

    /* Multi-column layout */
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-start;
    column-gap: 20px;
    row-gap: 5px;

    /* Smooth transition - always rendered but invisible */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    pointer-events: none;
}

/* Show mega menu on hover */
.nav .menu > ul > li.menu-active > ul {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

/* Create invisible bridge to prevent gaps */
.nav .menu > ul > li.menu-active > ul::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
}

/* Mid-category items in mega menu - Compact */
.nav .menu > ul > li > ul > li {
    flex: 0 0 calc(25% - 15px);
    min-width: 160px;
    position: relative;
    margin-bottom: 8px;
}

/* Mid-category link (bold header) - Compact */
.nav .menu > ul > li > ul > li > a {
    display: block;
    padding: 3px 7px;
    color: var(--qpick-violet);
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 1px;
    transition: all 0.3s ease;
    white-space: normal;
    line-height: 1.3;
}

.nav .menu > ul > li > ul > li > a:hover {
    background: #f8f9fa;
    color: var(--qpick-pink);
    border-bottom-color: var(--qpick-pink);
    border-radius: 3px;
}

/* End-category submenu (nested under mid-category) - Very Compact */
.nav .menu > ul > li > ul > li > ul {
    position: static !important;
    display: block !important;
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    min-width: auto;
    margin-top: -1px;
}

/* End-category items - Very Compact */
.nav .menu > ul > li > ul > li > ul > li {
    margin: 0;
    padding: 0;
}

/* End-category links - Minimal Spacing */
.nav .menu > ul > li > ul > li > ul > li > a {
    display: block;
    padding: 2px 7px;
    color: #555;
    font-weight: 400;
    font-size: 11px;
    transition: all 0.3s ease;
    white-space: normal;
    line-height: 1.1;
    border: none;
    margin: 0;
}

.nav .menu > ul > li > ul > li > ul > li > a:hover {
    background: #f0f0f0;
    color: var(--qpick-pink);
    padding-left: 12px;
    border-radius: 3px;
}

/* Tablet and Mobile - Use Hamburger Menu */
@media (max-width: 991px) {
    /* Hide desktop menu, show hamburger */
    .nav .menu {
        display: none !important;
    }

    .mobile-hamburger {
        display: inline-block !important;
    }
}

/* Tablet specific adjustments (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .topbar {
        width: 90%;
    }

    .topbar .left-menu,
    .topbar .right-menu {
        font-size: 12px;
    }

    .topbar .left-menu a,
    .topbar .right-menu a {
        padding: 5px 10px;
        font-size: 12px;
    }

    .row2 {
        padding: 0 15px;
        gap: 12px;
    }

    .logo-area {
        flex: 0 0 140px;
    }

    .logo-area img {
        max-height: 40px;
    }

    .search-area {
        flex: 1;
        max-width: 500px;
    }

    .search-area input[type="text"] {
        padding: 9px 16px;
        font-size: 13px;
    }

    .search-area button {
        padding: 9px 22px;
        font-size: 13px;
    }

    /* Tablet hamburger */
    .mobile-hamburger {
        display: flex !important;
        padding: 10px 16px;
        font-size: 22px;
    }

    /* Tablet sidepanel - wider */
    #mobileSidepanel {
        width: 350px !important;
        display: block !important;
    }

    #mobileSidepanel.active {
        left: 0 !important;
        display: block !important;
    }
}

/* Mobile adjustments - Improved sizes */
@media (max-width: 767px) {
    .sticky-header-wrapper {
        box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    }

    .topbar {
        padding: 6px 0;
        width: 95%;
        flex-wrap: wrap;
    }

    .topbar .left-menu,
    .topbar .right-menu {
        font-size: 10px;
        flex-wrap: wrap;
        gap: 2px;
    }

    .topbar .left-menu a,
    .topbar .right-menu a {
        padding: 3px 6px;
        font-size: 10px;
    }

    .topbar .right-menu > i,
    .topbar .left-menu > i {
        font-size: 10px;
        margin-right: 2px;
    }

    .row2-wrapper {
        padding: 12px 0;
    }

    .row2 {
        padding: 0 5px;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
    }

    /* Compact logo for mobile - maximizing search space */
    .logo-area {
        flex: 0 0 75px;
    }

    .logo-area img {
        max-height: 36px;
        width: auto;
    }

    /* Maximum width search box for mobile */
    .search-area {
        flex: 1;
        margin: 0;
        min-width: 0;
        max-width: none;
    }

    .search-area form {
        border-radius: 20px;
        border-width: 2px;
    }

    .search-area input[type="text"] {
        padding: 10px 12px;
        font-size: 13px;
    }

    .search-area button {
        padding: 10px 14px;
        font-size: 12px;
    }

    .search-area button i {
        font-size: 14px;
    }

    .nav {
        padding: 0;
    }

    /* Compact hamburger for mobile - maximizing search space */
    .mobile-hamburger {
        display: flex !important;
        padding: 10px;
        font-size: 22px;
        margin-left: 0;
        flex-shrink: 0;
    }

    .mobile-hamburger i {
        font-size: 22px;
    }
}

/* Extra small mobile - Improved sizes */
@media (max-width: 375px) {
    .topbar .left-menu,
    .topbar .right-menu {
        font-size: 9px;
    }

    .topbar .left-menu a,
    .topbar .right-menu a {
        padding: 3px 5px;
        font-size: 9px;
    }

    .row2 {
        padding: 0 4px;
        gap: 5px;
    }

    /* Extra compact logo for very small screens - maximum search space */
    .logo-area {
        flex: 0 0 70px;
    }

    .logo-area img {
        max-height: 32px;
    }

    .search-area {
        margin: 0;
        flex: 1;
    }

    .search-area input[type="text"] {
        padding: 9px 10px;
        font-size: 12px;
    }

    .search-area button {
        padding: 9px 12px;
        font-size: 11px;
    }

    /* Compact hamburger for very small screens */
    .mobile-hamburger {
        padding: 9px;
        font-size: 20px;
    }

    .mobile-hamburger i {
        font-size: 20px;
    }

    .nav .menu > ul > li > a {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Smooth transition when scrolling */
.sticky-header-wrapper.scrolled {
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* Mobile Hamburger Slide Panel */
#mobileSidepanel {
    position: fixed !important;
    z-index: 1050 !important;
    top: 0 !important;
    left: -100% !important;
    width: 280px !important;
    height: 100% !important;
    background: #f5f5f5 !important;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transition: left 0.3s ease !important;
    padding: 20px 0 !important;
    display: block !important;
}

#mobileSidepanel.active {
    left: 0 !important;
}

/* Close button */
#mobileSidepanel .closebtn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 36px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

#mobileSidepanel .closebtn:hover {
    color: var(--qpick-pink);
}

/* Mobile menu items */
.sidepanel-menu {
    list-style: none;
    padding: 0;
    margin: 25px 0 0 0;
}

.sidepanel-menu li {
    border-bottom: 1px solid #e0e0e0;
}

.sidepanel-menu li a {
    display: block;
    padding: 7px 10px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.sidepanel-menu li a:hover {
    background: #fff;
    color: var(--qpick-pink);
    padding-left: 14px;
}

/* Panel item with submenu */
.panel-item {
    position: relative;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.panel-title:hover {
    background: #fff;
    color: var(--qpick-pink);
}

.panel-title .toggle-btn {
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.panel-item.active .toggle-btn {
    transform: rotate(45deg);
}

/* Panel submenu */
.panel-submenu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
}

.panel-item.active .panel-submenu {
    display: block;
}

.panel-submenu li {
    border-bottom: 1px solid #f0f0f0;
}

.panel-submenu li a {
    padding: 5px 10px 5px 20px;
    font-size: 12px;
    color: #666;
}

.panel-submenu li a:hover {
    color: var(--qpick-pink);
    background: #f8f9fa;
    padding-left: 24px;
}

/* Mobile hamburger icon - hidden on desktop */
.mobile-hamburger {
    cursor: pointer;
    padding: 10px 15px 12px 15px;
    background: var(--gradient-button);
    color: #fff;
    font-size: 20px;
    transition: all 0.3s ease;
    border-radius: 6px;
    display: none; /* Hidden by default on desktop */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    margin-left: 10px;
    margin-bottom: 2px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    align-self: flex-end;
}

.mobile-hamburger:hover {
    background: var(--gradient-button-hover);
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.mobile-hamburger i {
    display: block;
    line-height: 1;
}

/* Overlay for mobile menu */
.sidepanel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1049;
    transition: opacity 0.3s ease;
}

.sidepanel-overlay.active {
    display: block;
}

/* Badge styling for cart/notifications */
.badge {
    display: inline-block;
    background: #ff4757;
    color: #fff;
    padding: 2px 5px;
    border-radius: 9px;
    font-size: 9px;
    font-weight: bold;
    margin-left: 3px;
    vertical-align: top;
}
