/*
Theme Name: Storefront Child
Template: storefront
Version: 1.0.0
Description: Child theme for Storefront with Mega Menu and Advanced Filters.
*/

/* =========================================
   VARIABLES
   ========================================= */
:root {
    --wicom-primary: #1e40af;
    --wicom-accent: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.18);
    --shadow-premium: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* =========================================
   MEGA MENU STYLES
   ========================================= */
/* Ensure menu items have relative position for absolute dropdowns */
.main-navigation ul.menu>li {
    position: static !important;
    /* Allow mega menu full width */
}

/* The Mega Menu Wrapper */
.wicom-mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--wicom-primary);
    box-shadow: var(--shadow-premium);
    padding: 30px 0;
    z-index: 9999;

    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
}

/* Hover State */
.main-navigation ul.menu>li.has-mega-menu:hover .wicom-mega-menu,
.wicom-mega-menu:hover {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Grid Layout */
.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1200px;
    /* Match storefront container */
    margin: 0 auto;
    padding: 0 15px;
}

/* Column Styles */
.mega-col h4 {
    color: var(--wicom-primary);
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.mega-col h4 img {
    height: 24px;
    width: auto;
}

.mega-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-col ul li {
    margin-bottom: 8px;
}

.mega-col ul li a {
    color: #4b5563;
    transition: transform 0.2s, color 0.2s;
    display: block;
}

.mega-col ul li a:hover {
    color: var(--wicom-accent);
    transform: translateX(5px);
}

/* =========================================
   PRODUCT GRID HOVER EFFECTS
   ========================================= */
ul.products li.product {
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid transparent;
}

ul.products li.product:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-premium);
    border-color: rgba(30, 64, 175, 0.1);
}

ul.products li.product img {
    transition: transform 0.5s ease;
}

ul.products li.product:hover img {
    transform: scale(1.05);
}

/* "Add to Cart" Button Enhancement */
ul.products li.product .button {
    background-color: var(--wicom-primary) !important;
    color: #fff !important;
    border-radius: 6px !important;
    opacity: 0;
    /* Hide initially */
    transform: translateY(10px);
    transition: all 0.3s ease;
}

ul.products li.product:hover .button {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   ADVANCED FILTERS (Sidebar)
   ========================================= */
.widget {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    padding-left: 15px;
}

.widget-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--wicom-accent);
    border-radius: 2px;
}

/* Price Filter Slider */
.widget_price_filter .price_slider_wrapper .ui-slider {
    background: #e5e7eb;
    border-radius: 4px;
}

.widget_price_filter .ui-slider .ui-slider-range {
    background: var(--wicom-primary);
}

.widget_price_filter .ui-slider .ui-slider-handle {
    background: #fff;
    border: 2px solid var(--wicom-primary);
    border-radius: 50%;
    cursor: grab;
    outline: none;
}

/* Checkbox Style for Categories / Attributes */
.widget_layered_nav li,
.widget_product_categories li {
    padding: 8px 0;
    border-bottom: 1px dashed #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget_layered_nav li:last-child,
.widget_product_categories li:last-child {
    border-bottom: none;
}

.widget_layered_nav li a,
.widget_product_categories li a {
    color: #4b5563;
    transition: color 0.2s;
}

.widget_layered_nav li a:hover,
.widget_product_categories li a:hover {
    color: var(--wicom-primary);
}

.count {
    background: #eff6ff;
    color: var(--wicom-primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* =========================================
   MOBILE OFF-CANVAS FILTER
   ========================================= */
@media (max-width: 768px) {

    /* Hide sidebar initially */
    #secondary {
        position: fixed;
        top: 0;
        right: -320px;
        width: 300px;
        height: 100vh;
        background: #fff;
        z-index: 10000;
        overflow-y: auto;
        padding: 30px 20px;
        /* Added padding to ensure content isn't flush against edge */
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
    }

    #secondary.active {
        right: 0;
    }

    /* Toggle Button */
    .wicom-filter-toggle {
        display: flex;
        /* Show flex on mobile */
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        background: var(--wicom-primary);
        color: #fff;
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 20px;
        font-weight: 600;
        cursor: pointer;
        position: sticky;
        top: 10px;
        z-index: 900;
        box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
    }

    .filter-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: 0.3s;
    }

    .filter-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Close Button inside Sidebar */
    .filter-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: #6b7280;
    }
}

@media (min-width: 769px) {

    .wicom-filter-toggle,
    .filter-close,
    .filter-overlay {
        display: none !important;
    }
}

/* =========================================
   MOBILE MEGA MENU OVERRIDES
   ========================================= */
@media (max-width: 767px) {

    /* Reset Absolute Positioning */
    .wicom-mega-menu {
        position: static;
        width: auto;
        box-shadow: none;
        border: none;
        background: transparent;
        backdrop-filter: none;
        padding: 0 0 0 15px;

        /* Controlled by JS SlideToggle */
        display: none;
        visibility: visible;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .mega-menu-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .mega-col {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 10px 0;
    }

    .mega-col h4 {
        margin-bottom: 5px;
        font-size: 1rem;
    }

    /* Ensure Parent Li handles toggle */
    .main-navigation ul.menu>li.has-mega-menu {
        position: relative;
    }

    /* Toggle Arrow */
    .child-toggle {
        font-size: 1.2rem;
        color: var(--wicom-primary);
    }
}