/* WooCommerce Category Menu Widget Styles */

.wc-category-menu-wrapper {
    position: relative;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.wc-category-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.wc-category-menu li {
    position: relative;
    margin: 0;
    padding: 0;
}

.wc-category-menu > li > a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.wc-category-menu .arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: bold;
}

/* Mobile: Make arrow a clear clickable square button */
@media screen and (max-width: 768px) {
    .wc-category-menu .arrow {
        display: inline-block;
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        right: 5px;
        background: rgba(0, 0, 0, 0.15);
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 20px;
        transform: translateY(-50%);
    }
    
    .wc-category-menu .arrow:hover,
    .wc-category-menu .arrow:active {
        background: rgba(0, 0, 0, 0.25);
    }
    
    .wc-category-menu li.mobile-active > a .arrow {
        transform: translateY(-50%) rotate(90deg);
        background: rgba(0, 0, 0, 0.25);
    }
    
    /* Make sure arrow is above the link but still clickable */
    .wc-category-menu .has-children > a {
        position: relative;
        padding-right: 55px; /* Extra space for the arrow button */
    }
}

/* Submenu styles */
.wc-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 220px;
    display: none;
    z-index: 1000;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
}

.wc-category-menu li:hover > .wc-submenu {
    display: block;
}

.wc-submenu li {
    position: relative;
}

.wc-submenu li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 13px;
    white-space: nowrap;
}

.wc-submenu .arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

/* Nested submenus */
.wc-submenu .wc-submenu {
    left: 100%;
    top: 0;
}

/* Mobile responsive styles */
@media screen and (max-width: 768px) {
    .wc-category-menu-wrapper {
        width: 100%;
    }

    .wc-category-menu > li > a {
        padding: 15px 20px;
        font-size: 16px;
        cursor: pointer;
    }

    /* CRITICAL: Disable all hover effects on mobile */
    .wc-category-menu li:hover > .wc-submenu {
        display: none !important;
    }

    /* Mobile: Convert to accordion style */
    .wc-submenu {
        position: static !important;
        left: auto !important;
        top: auto !important;
        display: none !important;
        width: 100%;
        box-shadow: none;
        border: none;
        border-left: 3px solid rgba(255, 255, 255, 0.3);
        margin-left: 15px;
    }

    /* Only show submenu when mobile-active class is added via JavaScript */
    .wc-category-menu li.mobile-active > .wc-submenu {
        display: block !important;
    }

    .wc-submenu li a {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    /* Arrow styles for submenu items on mobile */
    .wc-submenu .has-children > a {
        padding-right: 50px; /* Extra space for arrow in submenu */
    }
    
    /* Style all arrows at all levels consistently on mobile */
    .wc-submenu .arrow {
        width: 36px;
        height: 36px;
        line-height: 36px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.15);
        border-radius: 4px;
        cursor: pointer;
        right: 5px;
    }
    
    .wc-submenu .arrow:hover,
    .wc-submenu .arrow:active {
        background: rgba(0, 0, 0, 0.25);
    }
    
    /* Rotate arrow when submenu item is active */
    .wc-submenu li.mobile-active > a .arrow {
        transform: translateY(-50%) rotate(90deg);
        background: rgba(0, 0, 0, 0.25);
    }

    /* Change arrow rotation for mobile when active */
    /* Removed duplicate - already defined in main arrow mobile styles above */

    /* Nested submenus on mobile */
    .wc-submenu .wc-submenu {
        position: static !important;
        left: auto !important;
        margin-left: 15px;
    }
    
    /* Prevent any pointer events conflicts */
    .wc-category-menu li {
        pointer-events: auto;
    }
}

@media screen and (max-width: 480px) {
    .wc-category-menu > li > a {
        padding: 12px 15px;
        font-size: 15px;
    }

    .wc-submenu li a {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Animation for smooth transitions */
.wc-category-menu a {
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Ensure proper stacking on desktop */
@media screen and (min-width: 769px) {
    .wc-category-menu li {
        z-index: auto;
    }

    .wc-category-menu li:hover {
        z-index: 1001;
    }

    .wc-category-menu li:hover > a {
        position: relative;
        z-index: 1002;
    }
}
