/**
 * Custom Header/Navbar Styles
 * 
 * Edit this file to customize your navbar appearance.
 * All styles are self-contained - no conflicts with Astra.
 */

/* Hide Astra's default header */
.ast-primary-header,
.ast-above-header,
.ast-below-header,
#masthead,
.site-header {
    display: none !important;
}

/* ========================================
   CUSTOM HEADER - Main Container
   ======================================== */
.custom-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}

.custom-header-inner {
    max-width: calc(var(--ast-normal-container-width, 1200px) + 40px);
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

/* ========================================
   LEFT SECTION - Logo/Site Title
   ======================================== */
.header-left {
    flex-shrink: 0;
}

.header-left .site-logo {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.header-left .site-logo:hover {
    color: var(--ast-global-color-0, #0073aa);
}

/* If using custom logo image */
.header-left .custom-logo {
    max-height: 40px;
    width: auto;
}

/* ========================================
   MEGA MENU NAVIGATION
   ======================================== */
.header-nav {
    flex-shrink: 0;
}

.mega-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.mega-menu-item {
    position: static;
}

.mega-menu-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.mega-menu-link:hover {
    color: var(--ast-global-color-0, #0073aa);
}

.mega-menu-link i {
    font-size: 10px;
    transition: transform 0.2s;
}

.mega-menu-item.active .mega-menu-link i {
    transform: rotate(180deg);
}

/* Mega Dropdown - Click to open */
.mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 30px 20px;
    display: none;
    z-index: 1000;
}

.mega-menu-item.active .mega-dropdown {
    display: block;
}

.mega-dropdown-inner {
    max-width: calc(var(--ast-normal-container-width, 1200px) + 40px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 200px));
    gap: 20px;
    justify-content: center;
    justify-items: center;
}

.mega-dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    text-decoration: none;
    color: #333;
    border-radius: 8px;
    transition: background 0.2s;
    width: 100%;
    max-width: 200px;
}

.mega-dropdown-item:hover {
    background: #f5f5f5;
}

.mega-dropdown-item img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 8px;
}

.mega-item-name {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    color: #333;
}

/* ========================================
   CENTER SECTION - Search Bar
   ======================================== */
.header-center {
    flex: 1;
    max-width: 500px;
}

.custom-search-form {
    display: flex;
    align-items: stretch;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
    min-width: 200px;
}

.custom-search-input:focus {
    border-color: var(--ast-global-color-0, #0073aa);
}

.custom-search-input::placeholder {
    color: #999;
}

.custom-search-button {
    background: var(--ast-global-color-0, #0073aa);
    color: #fff;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 0 4px 4px 0;
}

.custom-search-button:hover {
    background: color-mix(in srgb, var(--ast-global-color-0, #0073aa) 85%, black);
}

/* ========================================
   RIGHT SECTION - Links & Cart
   ======================================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.header-link {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.header-link:hover {
    color: var(--ast-global-color-0, #0073aa);
}

/* ========================================
   CART WITH FLYOUT
   ======================================== */
.header-cart-container {
    position: relative;
}

.header-cart {
    position: relative;
    color: var(--ast-global-color-0, #0073aa);
    font-size: 22px;
    text-decoration: none;
    padding: 5px;
    display: block;
}

.header-cart:hover {
    color: color-mix(in srgb, var(--ast-global-color-0, #0073aa) 70%, black);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--ast-global-color-0, #0073aa);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Flyout Cart Panel */
.custom-header .cart-flyout {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    width: 320px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 9999 !important;
    display: none;
    margin-top: 10px !important;
}

.custom-header .cart-flyout.active {
    display: block !important;
}

.custom-header .cart-flyout::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 15px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-left: 1px solid #ddd;
    border-top: 1px solid #ddd;
    transform: rotate(45deg);
}

.custom-header .cart-flyout-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 15px !important;
    border-bottom: 1px solid #e5e5e5 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    background: #fff !important;
    border-radius: 8px 8px 0 0 !important;
}



.custom-header .cart-flyout-items {
    max-height: 300px !important;
    overflow-y: auto !important;
    background: #fff !important;
}

.custom-header .cart-flyout-empty {
    padding: 30px 15px !important;
    text-align: center !important;
    color: #999 !important;
}

/* Individual Cart Item */
.custom-header .cart-flyout-item {
    display: flex !important;
    align-items: flex-start !important;
    padding: 12px 15px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    gap: 12px !important;
    background: #fff !important;
}

.custom-header .cart-flyout-item:last-child {
    border-bottom: none !important;
}

.custom-header .cart-item-image {
    flex-shrink: 0 !important;
    width: 60px !important;
    height: 60px !important;
}

.custom-header .cart-item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 4px !important;
}

.custom-header .cart-item-details {
    flex: 1 !important;
    min-width: 0 !important;
}

.custom-header .cart-item-name {
    display: block !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-decoration: none !important;
    margin-bottom: 4px !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.custom-header .cart-item-name:hover {
    color: #0073aa !important;
}

.custom-header .cart-item-price {
    font-size: 13px !important;
    color: #666 !important;
    margin-bottom: 6px !important;
}

.custom-header .cart-item-qty {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12px !important;
}

.custom-header .cart-item-qty label {
    color: #666 !important;
}

.custom-header .cart-item-qty-select {
    padding: 3px 6px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    font-size: 12px !important;
    cursor: pointer !important;
}

.custom-header .cart-item-remove {
    background: none !important;
    border: none !important;
    color: #ccc !important;
    cursor: pointer !important;
    padding: 8px !important;
    font-size: 14px !important;
    transition: color 0.2s !important;
    flex-shrink: 0 !important;
}

.custom-header .cart-item-remove:hover {
    color: #e74c3c !important;
}

.custom-header .cart-item-remove i {
    pointer-events: none !important;
}



/* Flyout Footer */
.custom-header .cart-flyout-footer {
    padding: 15px !important;
    border-top: 1px solid #e5e5e5 !important;
    background: #f9f9f9 !important;
    border-radius: 0 0 8px 8px !important;
}

.custom-header .cart-flyout-subtotal {
    display: flex !important;
    justify-content: space-between !important;
    font-weight: 600 !important;
    margin-bottom: 12px !important;
    font-size: 14px !important;
}

.custom-header .cart-flyout-btn {
    display: block !important;
    text-align: center !important;
    padding: 10px 15px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    margin-bottom: 8px !important;
    transition: all 0.2s !important;
}

.custom-header .cart-flyout-btn:last-child {
    margin-bottom: 0 !important;
}

.custom-header .cart-flyout-btn.view-cart {
    background: #fff !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
}

.custom-header .cart-flyout-btn.view-cart:hover {
    border-color: #999 !important;
}

.custom-header .cart-flyout-btn.checkout {
    background: #0073aa !important;
    color: #fff !important;
    border: none !important;
}

.custom-header .cart-flyout-btn.checkout:hover {
    background: #005a87 !important;
}

/* Flyout responsive */
@media (max-width: 480px) {
    .custom-header .cart-flyout {
        width: 280px !important;
        right: -10px !important;
    }
}

/* ========================================
   MOBILE MENU TOGGLE
   ======================================== */
.mobile-menu-toggle {
    display: none;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    padding: 5px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus,
.mobile-menu-toggle:active {
    background: transparent !important;
    color: #333;
}

/* ========================================
   MOBILE MENU - Slide-out Drawer
   ======================================== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.mobile-menu-overlay.active {
    display: block;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: #fff;
    z-index: 9999;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #f8f9fa;
}

.mobile-menu-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.mobile-menu-close {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mobile-menu-close:hover,
.mobile-menu-close:focus,
.mobile-menu-close:active {
    background: transparent !important;
    color: #333;
}

.mobile-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.mobile-nav-section {
    padding: 10px 0;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
}

.mobile-nav-item a {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
}

.mobile-nav-item a:hover {
    background: #f5f5f5;
}

.mobile-nav-item a i {
    width: 20px;
    text-align: center;
    color: var(--ast-global-color-0, #0073aa);
    font-size: 16px;
}

/* Mobile nav item as toggle button */
button.mobile-nav-item.has-submenu {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    text-align: left;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: background 0.2s;
}

button.mobile-nav-item.has-submenu:hover,
button.mobile-nav-item.has-submenu:focus {
    background: #f5f5f5 !important;
}

button.mobile-nav-item.has-submenu > i:first-child {
    width: 20px;
    text-align: center;
    color: var(--ast-global-color-0, #0073aa);
    font-size: 16px;
}

button.mobile-nav-item.has-submenu > span {
    flex: 1;
}

button.mobile-nav-item.has-submenu .submenu-arrow {
    color: #999;
    font-size: 12px;
    transition: transform 0.2s;
}

button.mobile-nav-item.has-submenu.active .submenu-arrow {
    transform: rotate(180deg);
}

.mobile-submenu {
    display: none;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.mobile-submenu.active {
    display: block;
}

.mobile-submenu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 10px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s, color 0.2s;
}

.mobile-submenu a:last-child {
    border-bottom: none;
}

.mobile-submenu a:hover {
    background: #eee;
    color: var(--ast-global-color-0, #0073aa);
}

.mobile-submenu a img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

.mobile-submenu a span {
    flex: 1;
}

.mobile-nav-divider {
    height: 1px;
    background: #e5e5e5;
    margin: 5px 20px;
}

.mobile-cart-badge {
    background: var(--ast-global-color-0, #0073aa);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */
@media (max-width: 1020px) {
    .custom-header-inner {
        display: grid;
        grid-template-columns: 40px 1fr 40px;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 10px 0;
        padding: 12px 15px;
    }
    
    .header-nav {
        display: none;
    }
    
    /* Hamburger in first column */
    .mobile-menu-toggle {
        display: block;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }
    
    /* Logo centered in middle column */
    .header-left {
        grid-column: 2;
        grid-row: 1;
        text-align: center;
        justify-self: center;
    }
    
    /* Hide right section completely */
    .header-right {
        display: none !important;
    }
    
    /* Search bar spans full width on second row */
    .header-center {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .custom-header-inner {
        padding: 10px 15px;
    }
    
    .header-left .site-logo {
        font-size: 18px;
    }
    
    .custom-search-input {
        min-width: 0;
    }
    
    .custom-search-button {
        padding: 10px 12px;
        font-size: 12px;
    }
}
