/**
 * Custom Header Styles for Sober Child Theme
 * Version: 2.2 (Logo in top bar, menu starts left)
 */

/* -----------------------------------------
   1. PROMO BAR STYLES (Row 1) - UPDATED with Slider
----------------------------------------- */
.promo-bar {
    background-color: #0b9070;
    color: #ffffff;
    padding: 5px 0;
    font-size: 14px;
    width: 100%;
    position: relative;
    z-index: 1002;
    transition: all 0.3s ease;
}

.promo-bar.hidden {
    display: none;
}

.promo-bar .container-wide {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.promo-slider {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 24px;
}

.promo-slide {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    width: 100%;
    text-align: center;
}

.promo-slide.active {
    display: flex;
}

/* Desktop promo slides - shown on larger screens */
.promo-desktop-slide {
    display: none;
}

/* Mobile promo slides - shown on mobile */
.promo-mobile-slide {
    display: none;
}

/* Desktop styles */
@media (min-width: 992px) {
    .promo-desktop-slide {
        display: none;
    }
    .promo-desktop-slide.active {
        display: flex;
    }
    .promo-mobile-slide {
        display: none !important;
    }
}

/* Mobile styles */
@media (max-width: 991px) {
    .promo-mobile-slide {
        display: none;
    }
    .promo-mobile-slide.active {
        display: flex;
    }
    .promo-desktop-slide {
        display: none !important;
    }
}

.promo-text {
    color: #ffffff;
    font-weight: normal;
    white-space: nowrap;
}

.promo-detail {
    color: #ffffff;
    font-weight: normal;
    white-space: nowrap;
}

.promo-dot {
    color: #ffffff;
    opacity: 0.7;
    font-weight: bold;
    margin: 0 2px;
}

.promo-code {
    font-weight: bold;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-transform: uppercase;
    white-space: nowrap;
}

.promo-close {
    position: absolute;
    right: 20px;
    background: none;
    border: none;
    color: #ffffff; /* White cross icon */
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.3s ease;
}

.promo-close:hover {
    color: #ffffff;
    opacity: 0.8;
    background: none;
}

/* -----------------------------------------
   2. TOP BAR STYLES (Row 2) - UPDATED with Logo Left
----------------------------------------- */
.top-bar {
    background-color: #ffffff;
    color: #333;
    padding: 2px 0;
    font-size: 12px;
    width: 100%;
    position: relative;
    z-index: 1001;
}

.top-bar .container-wide {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
    padding: 0 20px;
}

.top-bar-left {
    flex: 0 0 auto;
}

.top-bar-left .site-branding .custom-logo {
    max-height: 40px;
    width: auto;
    display: block;
}

.top-bar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.top-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.top-links a {
    color: #555555;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s ease;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.top-links a:hover {
    color: #000000;
    text-decoration: none;
}

.separator {
    color: #cccccc;
    font-size: 12px;
}

/* -----------------------------------------
   3. CUSTOM HEADER STYLES (Row 3) - UPDATED Menu starts left
----------------------------------------- */
.custom-header {
    background-color: #fff;
    padding: 0px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
    z-index: 1000;
    width: 100%;
    overflow: visible !important;
}

.custom-header .container-wide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
    padding: 0 20px;
    overflow: visible !important;
}

/* Hide mobile logo wrapper on desktop */
.mobile-logo-wrapper {
    display: none;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    margin: 0 30px 0 0; /* Removed left margin, kept right margin */
    overflow: visible !important;
}

/* Base WordPress Menu Styling - Now aligned left */
.header-center .nav-menu {
    display: flex;
    justify-content: flex-start; /* Changed from center to flex-start */
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 40px;
    overflow: visible !important;
}

.header-center .nav-menu > li {
    position: relative;
    padding-bottom: 10px; /* Add padding to create hover zone that doesn't cover submenu */
    margin-bottom: -10px; /* Negative margin to offset padding for alignment */
}

.header-center .nav-menu > li > a {
    color: #222222;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.3s ease;
    padding: 5px 0;
    display: inline-block;
    position: relative;
    letter-spacing: 0.5px;
    text-transform: capitalize;
    white-space: nowrap;
    cursor: pointer; /* Ensure pointer cursor */
    z-index: 10; /* Ensure link is above the hover zone */
}

/* Create a hover zone that extends down but doesn't cover the main link */
.header-center .nav-menu > li:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: transparent;
    z-index: 5;
}

/* Base Underline (Hidden by default) - Fixed using ::before */
.header-center .nav-menu > li > a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: transparent;
    transition: background-color 0.3s ease;
}

/* Green bottom border on hover/active - Using ::before removes strikethrough */
.header-center .nav-menu > li > a:hover::before,
.header-center .nav-menu > li.current-menu-item > a::before,
.header-center .nav-menu > li.current_page_item > a::before {
    background-color: #0b9070;
}

/* CSS Chevron Indicator - Uses ::after */
.header-center .nav-menu li.menu-item-has-children > a {
    padding-right: 15px;
}

.header-center .nav-menu li.menu-item-has-children > a::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border: none;
    border-right: 2px solid #333333;
    border-bottom: 2px solid #333333;
    transform: translateY(-70%) rotate(45deg); /* Down chevron */
    transition: transform 0.3s ease;
}

.header-center .nav-menu li.menu-item-has-children:hover > a::after {
    transform: translateY(-30%) rotate(225deg); /* Flips to up chevron */
}

/* ============================================================
   4. COMPACT BULLETPROOF SUBMENU - WITH GAP
   ============================================================ */
.header-center .nav-menu li {
    position: relative !important;
    overflow: visible !important;
    margin: 0;
}

/* Structure the submenu (hidden by default, compact styling) - WITH TOP GAP */
.header-center .nav-menu ul.sub-menu {
    position: absolute !important;
    top: calc(100% + 15px) !important; /* Added gap of 15px */
    left: 0 !important;
    display: block !important; 
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(15px) !important;
    pointer-events: none !important;
    z-index: 999999 !important;
    margin: 0 !important;
    padding: 5px 0 !important; 
    min-width: 140px !important; /* REDUCED WIDTH */
    background-color: #ffffff !important;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1) !important;
    border: 1px solid #e5e5e5 !important;
    border-top: 2px solid #0b9070 !important;
    border-radius: 0 0 4px 4px !important;
    transition: all 0.3s ease !important;
    list-style: none !important;
}

/* Show submenu on list item hover */
.header-center .nav-menu li:hover > ul.sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

/* OVERRIDE PARENT THEME PADDING ON SUBMENU LI */
.header-center .nav-menu ul.sub-menu li,
.header-center .nav-menu li li {
    border-bottom: 1px solid #f0f0f0 !important;
    padding: 0 !important; /* Forces removal of parent 10px padding */
    margin: 0 !important;
    display: block !important;
}

.header-center .nav-menu ul.sub-menu li:last-child,
.header-center .nav-menu li li:last-child {
    border-bottom: none !important;
}

.header-center .nav-menu ul.sub-menu li a {
    color: #333333 !important;
    font-weight: 500 !important;
    font-size: 12px !important; 
    text-transform: none !important;
    letter-spacing: 0.3px !important;
    padding: 15px 15px !important; /* DECREASED LEFT & RIGHT PADDING HEAVILY */
    display: block !important;
    white-space: nowrap !important;
    transition: all 0.3s ease !important;
    cursor: pointer; /* Ensure pointer cursor */
}

.header-center .nav-menu ul.sub-menu li a:hover {
    background-color: #f8f8f8 !important;
    color: #0b9070 !important;
    padding-left: 10px !important; /* Tightened hover indent to match new padding */
}

/* Second Level Submenus */
.header-center .nav-menu ul.sub-menu ul.sub-menu {
    top: 0 !important;
    left: 100% !important;
    margin-top: -6px !important;
    transform: translateX(15px) !important;
    border-radius: 0 4px 4px 4px !important;
}
.header-center .nav-menu ul.sub-menu li:hover > ul.sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) translateY(0) !important;
    pointer-events: auto !important;
}

/* -----------------------------------------
   5. HEADER RIGHT ICONS
----------------------------------------- */
.header-right {
    flex: 0 0 auto;
}

.header-right .header-icons {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 18px;
}

.header-right .header-icons a {
    color: #333333;
    font-size: 18px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer; /* Ensure pointer cursor */
}

.header-right .header-icons a:hover {
    color: #0b9070;
}

.header-right .header-icons .cart-contents .count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #0b9070;
    color: #ffffff;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    line-height: 1;
}

/* -----------------------------------------
   6. MOBILE NAVIGATION TOGGLE
----------------------------------------- */
.mobile-nav-toggle {
    display: none;
    cursor: pointer;
}

.mobile-nav-toggle .toggle-nav {
    display: block;
    width: 24px;
    height: 24px;
    position: relative;
}

.mobile-nav-toggle .icon-nav,
.mobile-nav-toggle .icon-nav:before,
.mobile-nav-toggle .icon-nav:after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background-color: #333;
    position: absolute;
    transition: all 0.3s ease;
}

.mobile-nav-toggle .icon-nav { top: 50%; transform: translateY(-50%); }
.mobile-nav-toggle .icon-nav:before { top: -8px; }
.mobile-nav-toggle .icon-nav:after { bottom: -8px; }


/* -----------------------------------------
   7. CUSTOM MOBILE DRAWER STYLES
----------------------------------------- */
/* Suppress Parent Theme Mobile Menu Entirely */
#mobile-menu, .mobile-menu {
    display: none !important;
}

.custom-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-mobile-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100%;
    background-color: #ffffff;
    z-index: 999999;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.custom-mobile-drawer.active {
    left: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    background-color: #f8f8f8;
}

.drawer-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #333;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.drawer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Hide ANY Search Box dynamically inserted into the mobile drawer */
#custom-mobile-drawer .menu-item-search,
#custom-mobile-drawer .search-form,
#custom-mobile-drawer li:has(form),
#custom-mobile-drawer .product-search {
    display: none !important;
}

/* Drawer Main Navigation - Compact Spacing */
.mobile-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-navigation li {
    position: relative;
}

.mobile-navigation a {
    display: block;
    padding: 10px 20px; /* Highly Compact spacing */
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    text-decoration: none;
    cursor: pointer; /* Ensure pointer cursor */
}

.mobile-navigation .sub-menu {
    display: none;
    background-color: #fcfcfc;
    border-top: 1px solid #f0f0f0;
}

.mobile-navigation .sub-menu a {
    padding: 8px 20px 8px 30px; /* Compact submenu padding */
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    color: #555;
    cursor: pointer; /* Ensure pointer cursor */
}

/* Mobile Chevron Toggle */
.mobile-submenu-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 40px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.mobile-submenu-toggle::after {
    content: '';
    width: 8px;
    height: 8px;
    border: none;
    border-right: 2px solid #666;
    border-bottom: 2px solid #666;
    transform: translateY(-2px) rotate(45deg); /* Down chevron */
    transition: all 0.3s ease;
}

.submenu-open > .mobile-submenu-toggle::after {
    transform: translateY(2px) rotate(225deg); /* Up chevron */
    border-color: #0b9070;
}

/* Extra Bottom Links (Grey Font) */
.mobile-extra-links {
    margin-top: auto;
    background-color: #f8f8f8;
    border-top: 1px solid #e5e5e5;
    padding: 10px 0;
}

.mobile-extra-links a {
    display: block;
    padding: 8px 20px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #888888 !important; /* Explicit grey font applied */
    text-decoration: none;
    text-transform: uppercase;
    line-height: 1.2 !important;
    cursor: pointer; /* Ensure pointer cursor */
}

.mobile-extra-links a:hover,
.mobile-navigation a:hover {
    color: #0b9070 !important;
}

/* -----------------------------------------
   8. MOBILE-ONLY ICON - FIXED
----------------------------------------- */
/* Desktop: Hide mobile icon completely */
.mobile-only-icon {
    display: none;
}

/* Mobile: Show icon only on mobile devices */
@media (max-width: 991px) {
    .mobile-only-icon {
        display: block !important;
        max-height: 32px !important;
        width: auto !important;
        margin: 0 auto !important;
    }
}

/* Adjust icon size for very small screens */
@media (max-width: 480px) {
    .mobile-only-icon {
        max-height: 45px !important;
    }
}

/* -----------------------------------------
   9. RESPONSIVE QUERIES - UPDATED
----------------------------------------- */
@media (min-width: 992px) {
    .hidden-lg { display: none !important; }
    .header-center { display: block !important; }
    .custom-mobile-drawer, .custom-drawer-overlay { display: none !important; }
}

@media (max-width: 1200px) {
    .header-center { margin: 0 20px 0 0; } /* Adjusted for smaller screens */
    .header-center .nav-menu { gap: 25px; } /* Reduced gap */
}

@media (max-width: 991px) {
    /* Hide top bar completely on mobile */
    .top-bar { display: none !important; }
    
    /* Fix Mobile Header Cramping & Spacing */
    .custom-header .container-wide { 
        display: flex !important;
        flex-wrap: nowrap !important; /* Force single line */
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 15px !important; 
    }
    
    .mobile-nav-toggle { 
        display: flex !important; 
        align-items: center !important;
        order: 1 !important; 
        flex: 0 0 40px !important; /* Dedicated space for toggle */
    }
    
    .mobile-logo-wrapper { 
        display: flex !important;
        order: 2 !important; 
        flex: 1 1 auto !important; 
        justify-content: center !important; /* Center logo perfectly */
        padding: 0 10px !important;
    }
    
    .header-right { 
        order: 3 !important; 
        flex: 0 0 auto !important; 
    }
    
    .header-right .header-icons {
        gap: 12px !important; /* Tighter gap for icons on mobile */
    }
    
    .header-center { display: none !important; }
    .promo-bar .container-wide { justify-content: space-between; padding: 0 15px; }
    
    /* Mobile promo slider styles - ALLOW WRAPPING */
    .promo-slide {
        flex-wrap: wrap !important;
        font-size: 11px;
        gap: 3px;
        text-align: center;
    }
    
    /* Allow text to wrap naturally on small screens */
    .promo-text,
    .promo-detail,
    .promo-code {
        white-space: normal !important;
    }
    
    .promo-detail {
        display: inline; /* Keep detail on same line where possible */
    }
    
    .promo-dot {
        margin: 0 1px;
    }
}

@media (max-width: 767px) {
    .promo-bar { padding: 10px 0; }
    .promo-content { flex-direction: row; gap: 3px; font-size: 12px; }
}

@media (max-width: 480px) {
    .promo-slide { font-size: 10px; }
    
    .promo-close {
    position: absolute;
    right: 0px;
    background: none;
    border: none;
    color: #ffffff; /* White cross icon */
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.3s ease;
}

.promo-close:hover {
    color: #ffffff;
    opacity: 0.8;
    background: none;
}

}