/**
 * WooCommerce Mega Menu - Mobile Side Panel Styles
 * This file contains the mobile-specific side panel design
 */

/* ========================================
   MOBILE SIDE PANEL DESIGN
   ======================================== */

/* Mobile CSS Variables */
.wc-mega-menu {
    --mobile-panel-width: 320px;
    --mobile-panel-bg: #ffffff;
    --mobile-header-bg: #f8f9fa;
    --mobile-header-text: #333333;
    --mobile-overlay-bg: rgba(0, 0, 0, 0.5);
    --mobile-border-color: #e0e0e0;
}

/* Mobile Overlay */
.wc-mega-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mobile-overlay-bg);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wc-mega-menu.menu-open .wc-mega-menu-overlay {
    opacity: 1;
}

/* Hide mobile elements by default (Desktop view) */
.wc-mega-menu-mobile-header,
.wc-mega-menu-breadcrumb {
    display: none;
}

/* Mobile Responsive (max-width: 768px) */
@media (max-width: 768px) {

    /* Show overlay when menu is open */
    .wc-mega-menu.menu-open .wc-mega-menu-overlay {
        display: block;
    }

    /* Side Panel Container */
    .wc-mega-menu-list {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: var(--mobile-panel-width) !important;
        max-width: 85vw !important;
        background: var(--mobile-panel-bg) !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 9999 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
        max-height: none !important;
        border: none !important;
    }

    /* Show panel when menu is open */
    .wc-mega-menu.menu-open .wc-mega-menu-list {
        transform: translateX(0) !important;
    }

    /* Show hamburger icon on mobile */
    .wc-mega-menu-toggle-icon {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        width: 24px;
    }

    .wc-mega-menu-toggle-icon span {
        display: block !important;
        height: 3px;
        background: var(--menu-text-color);
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* Ensure toggle button styling */
    .wc-mega-menu-toggle {
        display: flex !important;
        background: transparent !important;
        border: none !important;
        padding: 12px 0 !important;
        cursor: pointer !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Hide breadcrumb text and arrow */
    .wc-mega-menu-toggle-text {
        display: none !important;
    }

    .wc-mega-menu-toggle-text::before {
        display: none !important;
    }

    /* Hamburger animation when menu is open */
    .wc-mega-menu.menu-open .wc-mega-menu-toggle-icon span:nth-child(1) {
        transform: rotate(45deg) translateY(7px);
    }

    .wc-mega-menu.menu-open .wc-mega-menu-toggle-icon span:nth-child(2) {
        opacity: 0;
    }

    .wc-mega-menu.menu-open .wc-mega-menu-toggle-icon span:nth-child(3) {
        transform: rotate(-45deg) translateY(-7px);
    }


    /* Mobile Panel Header */
    .wc-mega-menu-mobile-header {
        background: var(--mobile-header-bg);
        padding: 16px 20px;
        border-bottom: 1px solid var(--mobile-border-color);
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }

    .wc-mega-menu-mobile-title {
        font-size: 18px;
        font-weight: 600;
        color: var(--mobile-header-text);
        margin: 0;
    }

    .wc-mega-menu-mobile-close {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
        color: var(--mobile-header-text);
        padding: 0;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity 0.2s;
        border-radius: 0 !important;
        margin: 0 !important;
    }

    .wc-mega-menu-mobile-close:hover {
        opacity: 0.7;
        background: transparent !important;
    }

    /* Breadcrumb Navigation */
    .wc-mega-menu-breadcrumb {
        background: rgba(0, 0, 0, 0.03);
        padding: 14px 20px;
        border-bottom: 1px solid var(--mobile-border-color);
        display: none;
        align-items: center;
        gap: 10px;
        cursor: pointer;
        transition: background 0.2s;
        flex-shrink: 0;
        width: 100%;
    }

    .wc-mega-menu-breadcrumb:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .wc-mega-menu-breadcrumb.active {
        display: flex;
    }

    .wc-mega-menu-breadcrumb-icon {
        font-size: 20px;
        line-height: 1;
        font-weight: bold;
    }

    .wc-mega-menu-breadcrumb-text {
        font-size: 16px;
        font-weight: 600;
        color: var(--menu-text-color);
        text-transform: uppercase;
    }

    /* Content Area */
    .wc-mega-menu-content {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        position: relative;
        width: 100%;
    }

    /* Category Levels Container */
    .wc-mega-menu-level {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--mobile-panel-bg);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .wc-mega-menu-level.active {
        transform: translateX(0);
        position: absolute;
        z-index: 2;
    }

    .wc-mega-menu-level.prev {
        transform: translateX(-30%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        position: absolute;
        z-index: 1;
        display: none;
    }

    /* Menu Items in Side Panel */
    .wc-mega-menu-item {
        width: 100% !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        position: relative !important;
    }

    .wc-mega-menu-item:last-child {
        border-bottom: none !important;
    }

    .wc-mega-menu-link {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 18px 20px !important;
        font-size: 16px !important;
        color: var(--menu-text-color) !important;
        text-decoration: none !important;
        transition: background 0.2s !important;
        min-height: 56px !important;
        white-space: normal !important;
        gap: 12px !important;
    }

    .wc-mega-menu-link:hover,
    .wc-mega-menu-link:active {
        background: var(--menu-hover-bg-color) !important;
    }

    .wc-mega-menu-link .category-name {
        flex: 1;
        line-height: 1.4;
        text-align: left;
    }

    .wc-mega-menu-link .product-count {
        font-size: 13px !important;
        opacity: 0.6 !important;
        font-weight: 400 !important;
        flex-shrink: 0 !important;
        margin-left: auto;
    }

    /* Arrow indicator for items with children */
    .wc-mega-menu-item.has-children .wc-mega-menu-link::after {
        content: '›';
        font-size: 24px;
        line-height: 1;
        opacity: 0.5;
        flex-shrink: 0;
        margin-left: auto;
    }

    /* Hide default dropdown indicator */
    .wc-mega-menu-link .dropdown-indicator {
        display: none !important;
    }

    /* Hide nested dropdowns - we use level replacement instead */
    .wc-mega-menu-dropdown {
        display: none !important;
    }

    .subcategories-grid,
    .subcategory-column,
    .subcategory-list,
    .dropdown-inner {
        display: none !important;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .wc-mega-menu {
        --mobile-panel-width: 280px;
    }

    .wc-mega-menu-mobile-header {
        padding: 14px 16px;
        width: 100%;
    }

    .wc-mega-menu-mobile-title {
        font-size: 16px;
    }

    .wc-mega-menu-link {
        padding: 16px 16px !important;
        font-size: 15px !important;
        min-height: 52px !important;
    }

    .wc-mega-menu-breadcrumb {
        padding: 12px 16px;
    }

    .wc-mega-menu-breadcrumb-text {
        font-size: 15px;
    }
}

/* Smooth Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}