/* ================================
   NIKASPORT ACCORDION - OPTIMIZED (Best Practices)
   Based on WPB Accordion Menu analysis
=================================== */

.widget_nav_menu * {
    -webkit-font-smoothing: antialiased;
}

.widget_nav_menu {
    margin-bottom: 0;
}

.widget_nav_menu .widget-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.widget_nav_menu .widget-title::before,
.widget_nav_menu .widget-title::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30px;
    height: 1px;
    background: #e5e5e5;
}

.widget_nav_menu .widget-title::before { left: 0; }
.widget_nav_menu .widget-title::after { right: 0; }

/* Reset - Best practice from WPB */
.widget_nav_menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget_nav_menu ul li {
    list-style: none;
    display: block;
    position: relative;
    margin: 0;
    padding: 0;
}

.widget_nav_menu ul > li {
    border-bottom: 1px solid #f0f0f0;
}

.widget_nav_menu ul > li:last-child {
    border-bottom: 0;
}

/* Main links - Optimized styling */
.widget_nav_menu ul > li > a {
    display: block;
    position: relative;
    font-size: 14px;
    line-height: 20px;
    padding: 14px 22px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s linear, background 0.2s linear;
    outline: none;
}

/* Accordion indicator - Best practice positioning */
.widget_nav_menu ul > li:has(ul) > a::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 0;
    width: 47px;
    height: 100%;
    text-align: center;
    font-size: 20px;
    font-weight: bolder;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    color: #999;
    transition: transform 0.3s linear, color 0.3s linear;
}

/* Active/Open state - Rotate and change color */
.widget_nav_menu ul > li.current-menu-item:has(ul) > a::after,
.widget_nav_menu ul > li.current-menu-ancestor:has(ul) > a::after,
.widget_nav_menu ul > li.current-menu-parent:has(ul) > a::after,
.widget_nav_menu ul > li.current_page_item:has(ul) > a::after,
.widget_nav_menu ul > li.current_page_parent:has(ul) > a::after,
.widget_nav_menu ul > li.current_page_ancestor:has(ul) > a::after,
.widget_nav_menu ul > li.current-cat:has(ul) > a::after,
.widget_nav_menu ul > li.wpb-wmca-current-cat-parent:has(ul) > a::after,
.widget_nav_menu ul > li.wpb-submenu-indicator-minus:has(ul) > a::after {
    content: "−";
    color: #7c3aed;
    transform: rotate(0deg);
}

/* Hide icons on subcategories */
.widget_nav_menu ul ul li a::after,
.widget_nav_menu ul ul li a::before {
    display: none !important;
}

/* Subcategories - Hidden by default (like WPB) */
.widget_nav_menu ul ul,
.widget_nav_menu ul .children,
.widget_nav_menu ul .sub-menu {
    display: none;
    margin: 0;
    padding: 0;
    list-style: none;
    background: #fafafa;
}

/* Show subcategories for current/ancestor items */
.widget_nav_menu ul li.current-menu-item ul,
.widget_nav_menu ul li.current-menu-ancestor ul,
.widget_nav_menu ul li.current-menu-parent ul,
.widget_nav_menu ul li.current_page_item ul,
.widget_nav_menu ul li.current_page_parent ul,
.widget_nav_menu ul li.current_page_ancestor ul,
.widget_nav_menu ul li.current-cat ul,
.widget_nav_menu ul li.wpb-wmca-current-cat-parent ul,
.widget_nav_menu ul li.wpb-submenu-indicator-minus ul {
    display: block;
}

/* Subcategory links - Optimized styling */
.widget_nav_menu ul ul li a {
    display: block;
    position: relative;
    font-size: 12px;
    line-height: 18px;
    padding: 14px 22px 14px 42px;
    font-weight: 600;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s linear;
    background: #f7fafc;
}

/* Active states - All WordPress classes */
.widget_nav_menu ul > li.current-menu-item > a,
.widget_nav_menu ul > li.current-menu-ancestor > a,
.widget_nav_menu ul > li.current-menu-parent > a,
.widget_nav_menu ul > li.current_page_item > a,
.widget_nav_menu ul > li.current_page_parent > a,
.widget_nav_menu ul > li.current_page_ancestor > a,
.widget_nav_menu ul > li.current-cat > a,
.widget_nav_menu ul > li.wpb-wmca-current-cat-parent > a,
.widget_nav_menu ul > li.wpb-submenu-indicator-minus > a {
    color: #7c3aed;
    background: #f3f0ff;
}

.widget_nav_menu ul ul li.current-menu-item > a,
.widget_nav_menu ul ul li.current_page_item > a,
.widget_nav_menu ul ul li.current-cat > a {
    color: #7c3aed;
    font-weight: 600;
    background: #f8f4ff;
}

/* Hover effects */
.widget_nav_menu ul > li > a:hover {
    color: #7c3aed;
    background: #f3f0ff;
}

.widget_nav_menu ul ul li a:hover {
    color: #7c3aed;
    background: #f8fafc;
}

/* Focus states */
.widget_nav_menu li a:focus {
    outline: 0;
}

/* Product count */
.widget_nav_menu ul li a .count {
    float: right;
    background: #e9ecef;
    color: #6c757d;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 10px;
    margin-top: -2px;
}

.widget_nav_menu ul li a:hover .count {
    background: #7c3aed;
    color: #fff;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .widget_nav_menu ul > li > a {
        padding: 12px 18px;
        font-size: 13px;
    }
    
    .widget_nav_menu ul ul li a {
        padding: 12px 18px 12px 36px;
        font-size: 11px;
    }
    
    .widget_nav_menu ul > li:has(ul) > a::after {
        width: 40px;
        font-size: 18px;
    }
}

/* Breadcrumb home icon */
.ct-breadcrumbs .first-item,
.ct-breadcrumbs .first-item .ct-home-icon,
.ct-breadcrumbs .first-item a,
.ct-breadcrumbs .first-item .ct-separator {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fallback for browsers that don't support :has() */
.widget_nav_menu ul > li.has-children > a::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 0;
    width: 47px;
    height: 100%;
    text-align: center;
    font-size: 20px;
    font-weight: bolder;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    color: #999;
    transition: transform 0.3s linear, color 0.3s linear;
}

.widget_nav_menu ul > li.has-children.wpb-submenu-indicator-minus > a::after {
    content: "−";
    color: #7c3aed;
    transform: rotate(0deg);
}
