/*
 * Header Styles
 * Premium Responsive Header System
 * 
 * Includes:
 * - Base Header
 * - Responsive Logo Logic
 * - Menu Systems
 * - Sticky Header
 * - E-commerce Icons & Drawers (New)
 */

/* -------------------------------------------------------------------------- */
/*  1. Variables (Default Fallbacks)                                          */
/* -------------------------------------------------------------------------- */
:root {
    --header-bg-color: #ffffff;
    --header-text-color: #333333;
    --header-text-hover-color: #000000;
    --header-height-desktop: 80px;
    --header-height-mobile: 60px;

    /* Sticky Variables */
    --header-sticky-bg-color: #ffffff;
    --header-sticky-text-color: #333333;
    --header-sticky-hover-color: #000000;

    /* Transition */
    --header-transition: 0.3s ease-in-out;
}

/* -------------------------------------------------------------------------- */
/*  2. Base Header Structure                                                  */
/* -------------------------------------------------------------------------- */
.site-header {
    position: relative;
    /* Changed from absolute to relative by default (Inner Pages) */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--header-bg-color);
    transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-family: 'Inter', sans-serif;
}

/* Compact header on mobile & tablet */
@media (max-width: 1024px) {
    .site-header {
        padding: 8px 0;
    }
}

/* Use Absolute positioning ONLY on Home Page for Transparent/Overlay effect */
body.home .site-header,
body.front-page .site-header {
    position: absolute;
    background-color: transparent;
    border-bottom-color: transparent;
    /* Start transparent on home */
}

/* Ensure header has background transparency override if set via customizer but we enforce it here for overlay */

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 767px) {
    .site-header-inner {
        padding: 0 12px;
    }
}

/* -------------------------------------------------------------------------- */
/*  3. Responsive Logo Logic (CSS Enforced)                                    */
/* -------------------------------------------------------------------------- */
.site-branding img {
    height: auto;
    transition: width 0.3s ease;
    display: none;
    /* Hide all by default, show via media query */
}

/* Mobile (Default or < 768px) */
@media (max-width: 767px) {
    .site-branding img.logo-mobile {
        display: block;
        max-height: 36px;
        width: auto !important;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .site-branding img.logo-tablet {
        display: block;
        max-height: 42px;
        width: auto !important;
    }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
    .site-branding img.logo-desktop {
        display: block;
    }
}

/* -------------------------------------------------------------------------- */
/*  4. Desktop Navigation                                                     */
/* -------------------------------------------------------------------------- */
.main-navigation-desktop {
    display: none;
    /* Hidden by default, shown on desktop */
}

@media (min-width: 1025px) {
    .main-navigation-desktop {
        display: block;
    }

    .main-navigation-desktop ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        gap: 30px;
        align-items: center;
    }

    .main-navigation-desktop ul li {
        position: relative;
    }

    .main-navigation-desktop ul li a {
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        color: var(--header-text-color);
        transition: color 0.2s ease;
        padding: 10px 0;
        display: block;
    }

    .main-navigation-desktop ul li a:hover {
        color: var(--header-text-hover-color);
    }

    /* Submenu Dropdown */
    .main-navigation-desktop ul li ul.sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        min-width: 200px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.3s ease;
        display: block;
        /* Override flex */
        padding: 10px 0;
        border-radius: 4px;
        z-index: 1001;
    }

    .main-navigation-desktop ul li:hover>ul.sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .main-navigation-desktop ul li ul.sub-menu li {
        display: block;
        margin: 0;
    }

    .main-navigation-desktop ul li ul.sub-menu li a {
        padding: 8px 20px;
        color: #333;
        /* Always dark for dropdown text usually */
        font-size: 14px;
    }

    .main-navigation-desktop ul li ul.sub-menu li a:hover {
        background-color: #f5f5f5;
        color: var(--header-text-hover-color);
    }
}

/* -------------------------------------------------------------------------- */
/*  5. Mobile/Tablet Navigation (Off-Canvas)                                  */
/* -------------------------------------------------------------------------- */
.mobile-menu-toggle {
    display: flex;
    /* Flex to center icon */
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 5px;
    z-index: 1002;
    /* Above overlay */
    color: var(--header-text-color);
}

@media (min-width: 1025px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1099;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sliding Panel */
.mobile-navigation-panel {
    position: fixed;
    top: 0;
    left: 0;
    /* Slide from Left */
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.4s ease-in-out;
    /* 0.35s - 0.45s as requested */
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.mobile-navigation-panel.active {
    transform: translateX(0);
}

/* Mobile Menu Header inside Panel */
.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 30px;
    color: #333;
    padding: 5px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-menu-close:hover {
    color: #000;
    transform: scale(1.1);
}

/* Mobile Menu List */
.mobile-navigation-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-navigation-panel ul li {
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.mobile-navigation-panel ul li a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
}

/* Submenu Toggles */
.submenu-toggle {
    position: absolute;
    right: 20px;
    top: 15px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.mobile-navigation-panel ul li.submenu-open>.submenu-toggle {
    transform: rotate(180deg);
}

.mobile-navigation-panel ul.sub-menu {
    display: none;
    /* JS will toggle slideDown */
    background: #f9f9f9;
}

.mobile-navigation-panel ul.sub-menu li a {
    padding-left: 40px;
    font-size: 15px;
}

/* -------------------------------------------------------------------------- */
/*  6. Sticky Header State                                                    */
/* -------------------------------------------------------------------------- */
.site-header.header-sticky-active {
    position: fixed;
    background-color: var(--header-sticky-bg-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 10px 0;
    /* Slightly smaller padding */
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.site-header.header-sticky-active .main-navigation-desktop ul li a {
    color: var(--header-sticky-text-color);
}

.site-header.header-sticky-active .main-navigation-desktop ul li a:hover {
    color: var(--header-sticky-hover-color);
}

.site-header.header-sticky-active .mobile-menu-toggle {
    color: var(--header-sticky-text-color);
}

.site-header.header-sticky-active .header-icon-btn {
    color: var(--header-sticky-text-color);
}

/* -------------------------------------------------------------------------- */
/*  7. E-Commerce Icons & Header Actions                                      */
/* -------------------------------------------------------------------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions .header-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text-color);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: color 0.3s ease;
}

/* Tablet — tighter spacing */
@media (min-width: 768px) and (max-width: 1024px) {
    .header-actions {
        gap: 8px;
    }

    .header-actions .header-icon-btn {
        padding: 3px;
    }
}

/* Mobile — compact like the reference */
@media (max-width: 767px) {
    .header-actions {
        gap: 4px;
    }

    .header-actions .header-icon-btn {
        padding: 2px;
    }

    .header-actions .header-icon-btn .material-symbols-outlined {
        font-size: 22px;
    }
}

.header-actions .header-icon-btn:hover {
    color: var(--header-text-hover-color);
}

/* Cart Specific */
.cart-toggle .cart-count-badge {
    position: absolute;
    top: 5px;
    right: -2px;
    min-width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    background-color: #000;
    color: #fff;
    border-radius: 50%;
    padding: 1px;
}

/* Cart Drawer */
.cart-drawer {
    /* Fixed Positioning handled in Tailwind classes in header.php for layout, 
       but we ensure visibility transitions here if not utilizing full Tailwind JS */
    z-index: 1005;
}

.cart-drawer.open {
    transform: translateX(0) !important;
}

.cart-close,
.search-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

/* Overlay for Cart */
#cart-overlay.open {
    display: block;
    opacity: 1;
}

/* Search Overlay */
#search-overlay.open {
    display: block;
    opacity: 1;
}

.search-container input[type="search"] {
    outline: none;
    box-shadow: none;
}

.search-container input[type="search"]::-webkit-search-cancel-button {
    display: none;
}


/* -------------------------------------------------------------------------- */
/*  8. Cart Drawer Styling (Premium)                                          */
/* -------------------------------------------------------------------------- */
.cart-drawer-header {
    background: #fff;
    padding: 20px 25px;
}

.cart-drawer-content {
    padding: 0;
}

/* Widget Container */
.widget_shopping_cart_content ul.cart_list {
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Individual Cart Item */
.widget_shopping_cart_content ul.cart_list li {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #f1f1f1;
    position: relative;
}

.widget_shopping_cart_content ul.cart_list li:last-child {
    border-bottom: none;
}

/* Product Image */
.widget_shopping_cart_content ul.cart_list li img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
    margin-left: 0;
    /* Override default */
    background: #f8f8f8;
}

/* Product Details */
.widget_shopping_cart_content ul.cart_list li a {
    color: #000;
    font-weight: 600;
    text-decoration: none;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    display: block;
    margin-bottom: 5px;
    line-height: 1.3;
}

.widget_shopping_cart_content ul.cart_list li .quantity {
    display: block;
    font-size: 13px;
    color: #666;
}

/* Price */
.widget_shopping_cart_content ul.cart_list li .amount {
    font-weight: 500;
    color: #333;
}

/* Remove Icon (Woo Default is usually absolutely positioned red x) */
.widget_shopping_cart_content ul.cart_list li a.remove {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 50%;
    color: #999;
    font-size: 16px;
    font-weight: 300;
    transition: all 0.2s;
    background: #fff;
}

.widget_shopping_cart_content ul.cart_list li a.remove:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

/* Empty Cart */
.widget_shopping_cart_content .woocommerce-mini-cart__empty-message {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 15px;
}

/* Total Section */
.widget_shopping_cart_content .total {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    background: #fcfcfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    position: absolute;
    bottom: 80px;
    /* Above buttons */
    width: 100%;
    box-sizing: border-box;
}

.widget_shopping_cart_content .total strong {
    font-weight: 600;
    font-size: 15px;
    text-transform: uppercase;
    color: #333;
}

.widget_shopping_cart_content .total .amount {
    font-weight: 700;
    font-size: 18px;
    color: #000;
}

/* Buttons */
.widget_shopping_cart_content .buttons {
    margin: 0;
    display: flex;
    gap: 10px;
    padding: 20px 25px;
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
}

.widget_shopping_cart_content .buttons a {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.widget_shopping_cart_content .buttons a.checkout {
    background: #000;
    color: #fff;
    border: 1px solid #000;
}

.widget_shopping_cart_content .buttons a.checkout:hover {
    background: #333;
    border-color: #333;
}

.widget_shopping_cart_content .buttons a:not(.checkout) {
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
}

.widget_shopping_cart_content .buttons a:not(.checkout):hover {
    border-color: #000;
    background: #f9f9f9;
}

/* Scrollable Area Adjustment */
.cart-drawer-content {
    /* Leave space for total + buttons */
    height: calc(100% - 70px) !important;
    /* Header height offset */
    padding-bottom: 160px;
    /* Space for Total + Buttons */
    position: relative;
    overflow-y: auto;
}


/* -------------------------------------------------------------------------- */
/*  9. Utility & Scroll Lock                                                  */
/* -------------------------------------------------------------------------- */
body.menu-open,
body.cart-open,
body.search-open {
    overflow: hidden;
}

/* Material Icons Helper */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 24px;
}