/**
 * Product Filters CSS
 */

/* Product Filters Styles - Clean & Minimal */

/* Basic filter styling */
.sidebar-shop {
    background: #fff;
    padding: 20px;
}

.widget {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.widget:last-child {
    border-bottom: none;
}

.widget-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 15px;
    color: #333;
}

.widget-title a {
    color: #333;
    text-decoration: none;
    display: block;
    position: relative;
}

.widget-title a::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    transition: transform 0.3s;
}

.widget-title a.collapsed::after {
    transform: rotate(-90deg);
}

/* Clean checkbox styling */
.custom-control {
    position: relative;
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5rem;
    margin-bottom: 8px;
    cursor: pointer;
}

.custom-control-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1rem;
    height: 1rem;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.custom-control-label {
    position: relative;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 13px;
    color: #777;
    font-weight: 400;
    line-height: 1.5;
    display: block;
}

/* Checkbox appearance */
.custom-control-label::before {
    position: absolute;
    top: 0.25rem;
    left: -1.5rem;
    display: block;
    width: 1rem;
    height: 1rem;
    content: "";
    background-color: #fff;
    border: 1px solid #ccc;
}

/* Checked state - simple filled box */
.custom-control-input:checked~.custom-control-label::before {
    background-color: #333 !important;
    border-color: #333 !important;
}

/* Completely override Bootstrap's checkbox styling */
.custom-checkbox .custom-control-label::after {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
    background-size: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

.custom-checkbox .custom-control-input:checked~.custom-control-label::after {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
    background-size: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Force remove any pseudo elements */
.custom-control-label::after,
.custom-control-label::before::after {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
}

.custom-control-input:checked~.custom-control-label::after,
.custom-control-input:checked~.custom-control-label::before::after {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
}

/* Hover effect */
.custom-control:hover .custom-control-label::before {
    border-color: #999;
}

/* Filter lists */
.filter-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-items li {
    color: #777;
    font-weight: 500;
}

/* Price slider - simple styling */
#price-slider {
    height: 3px;
    background-color: #ddd;
    margin: 15px 0;
    border: none;
}

#price-slider .ui-slider-handle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #333;
    border: none;
    top: -4px;
    cursor: pointer;
    margin-left: -6px;
}

#price-slider .ui-slider-range {
    background-color: #333;
    height: 3px;
}

.filter-price-text {
    font-size: 13px;
    margin-bottom: 10px;
    color: #666;
}

.products-count {
    color: #999;
    margin-left: 0.25rem;
}

.toggle {
    float: right;
    line-height: 1.4;
}

/* Hierarchical Filter Styling */
.filter-items.hierarchical {
    padding: 0;
    margin: 0;
}

.filter-group {
    margin-bottom: 10px;
}

.parent-term {
    margin-bottom: 5px;
}

.parent-label {
    font-weight: 600;
    color: #333;
    position: relative;
}

.toggle-children {
    float: right;
    cursor: pointer;
    transition: transform 0.2s ease;
    color: #666;
    font-size: 12px;
}

.toggle-children.expanded {
    transform: rotate(180deg);
}

.child-terms {
    margin-left: 20px;
    border-left: 2px solid #eee;
    padding-left: 10px;
    display: none;
}

.child-terms.show {
    display: block;
}

.child-term {
    margin-bottom: 3px;
}

.child-label {
    font-weight: 400;
    color: #666;
    font-size: 13px;
}

.parent-term.has-active-children .parent-label {
    color: #0073aa;
}

.child-terms.show {
    animation: slideDown 0.2s ease-in-out;
}

/* Improved visual hierarchy (2-level) */
.parent-label {
    font-size: 14px;
    font-weight: 500;
}

.child-label {
    font-size: 13px;
    font-weight: 400;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 300px;
    }
}

/* Force product grid layout - override any conflicting styles */
.main-content .row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: -15px !important;
    margin-right: -15px !important;
}

.main-content .row>div[class*="col-"] {
    display: flex !important;
    flex-direction: column !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* Specific Bootstrap column widths */
.main-content .col-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
}

.main-content .col-sm-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
}

.main-content .col-md-3 {
    flex: 0 0 25% !important;
    max-width: 25% !important;
}

@media (min-width: 576px) {
    .main-content .col-sm-4 {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
    }
}

@media (min-width: 768px) {
    .main-content .col-md-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

.product-default {
    height: 100%;
    margin-bottom: 20px;
}

/* Mobile responsive */
.filter-toggle-container {
    margin-bottom: 1rem;
    text-align: right;
}

.filter-toggle {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* TEMPORARILY DISABLED - Mobile rules that break desktop
@media (max-width: 991px) {

    // Remove default sidebar display 
    .sidebar-shop:not(.mobile-sidebar) {
        display: none !important;
    }

    .mobile-sidebar {
        position: fixed !important;
        top: 0 !important;
        right: -320px !important;
        width: 300px !important;
        height: 100vh !important;
        background-color: #fff !important;
        z-index: 1000 !important;
        padding: 1.5rem !important;
        overflow-y: auto !important;
        transition: right 0.3s ease !important;
        box-shadow: -2px 0 15px rgba(0, 0, 0, 0.2) !important;
        border-left: 1px solid #eee !important;
        display: block !important;
    }

    .mobile-sidebar.open {
        right: 0 !important;
    }

    // Ensure main content takes full width when sidebar is hidden 
    .main-content {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}
*/

/* ===============================================
   FIXED LOADING STATE - PREVENT CONTAINER SPIN
   =============================================== */

/* Override theme's problematic .loading rule that spins entire containers */
.products-container.loading:not(.load-more-overlay) {
    animation: none !important;
    border: none !important;
    border-radius: 0 !important;
    content: none !important;
    display: block !important;
    height: auto !important;
    width: auto !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    margin: 0 !important;
    min-height: 200px;
    z-index: auto !important;
}

/* Create proper overlay background */
.products-container.loading:before {
    content: '';
    position: fixed !important;
    /* Fixed position for full screen overlay */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(255, 255, 255, 0.8) !important;
    z-index: 9998 !important;
    pointer-events: auto !important;
}

/* Create centered spinner */
.products-container.loading:after {
    content: '' !important;
    position: fixed !important;
    /* Fixed position for center of screen */
    top: 50% !important;
    left: 50% !important;
    margin-top: -20px !important;
    margin-left: -20px !important;
    width: 40px !important;
    height: 40px !important;
    border: 3px solid #f3f3f3 !important;
    border-top: 3px solid #007cba !important;
    border-radius: 50% !important;
    z-index: 9999 !important;
    animation: spin 1s linear infinite !important;
    display: block !important;
    pointer-events: none !important;
}

/* Define the spin animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Ensure products don't interfere during loading */
.products-container.loading .product-item {
    pointer-events: none;
    opacity: 0.6;
}

/* ===============================================
   WISHLIST PAGE PROTECTION - PREVENT LOADING OVERLAY
   =============================================== */

/* Prevent loading overlay on wishlist pages */
body:has(.wishlist-title),
body:has(.wishlist-table-container),
.wishlist-title~.products-container.loading,
.wishlist-table-container~.products-container.loading {
    position: static !important;
}

/* Remove loading overlay on wishlist pages */
.wishlist-title~.products-container.loading:before,
.wishlist-table-container~.products-container.loading:before,
.wishlist-title~.products-container.loading:after,
.wishlist-table-container~.products-container.loading:after {
    display: none !important;
    content: none !important;
}

/* Alternative selector for browsers that don't support :has() */
.wishlist-page .products-container.loading:before,
.wishlist-page .products-container.loading:after {
    display: none !important;
    content: none !important;
}

/* Additional wishlist page protection */
body.wishlist-page .products-container.loading:before,
body.wishlist-page .products-container.loading:after,
body.wishlist-page .loading-overlay,
body.wishlist-page .loading-spinner {
    display: none !important;
}

/* Force remove loading state on wishlist pages */
body.wishlist-page.loading {
    position: static !important;
    overflow: auto !important;
}

body.wishlist-page.loading:before,
body.wishlist-page.loading:after {
    display: none !important;
}

/* ===============================================
   ORIGINAL LOADING STATE (KEEPING AS BACKUP)
   =============================================== */

/* Loading State - OLD VERSION (disabled)
.products-container.loading {
    position: relative;
    min-height: 200px;
}

.products-container.loading:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 1;
}

.products-container.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -15px;
    margin-left: -15px;
    width: 30px;
    height: 30px;
    border: 2px solid #08c;
    border-top-color: transparent;
    border-radius: 50%;
    z-index: 2;
    animation: spin 0.75s infinite linear;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}
*/

/* No Products Found */
.no-products-found {
    padding: 2rem;
    text-align: center;
    font-size: 1.1rem;
    color: #777;
}

/* Fix for Bootstrap Collapse */
.collapse:not(.show) {
    display: none;
}

.collapse.show {
    display: block;
}

.collapsing {
    position: relative;
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
}

/* Category List */
.cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cat-list li {
    margin-bottom: 0.5rem;
}

.cat-list a {
    color: #777;
    text-decoration: none;
}

.cat-list a:hover {
    color: #08c;
}

.cat-sublist {
    list-style: none;
    padding-left: 1rem;
    margin: 0.5rem 0 0;
}

.cat-sublist li {
    margin-bottom: 0.5rem;
}

/* Center product images in product cards */
.product-default figure {
    text-align: center !important;
}

.product-default figure>a {
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
}

.product-default figure img {
    width: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
    display: block !important;
}

/* Ensure proper centering in both view modes */
.products-container[data-view="tiles"] .product-default figure img,
.products-container[data-view="list"] .product-default figure img {
    object-fit: contain !important;
    margin: 0 auto !important;
}

/* ABV Slider Styles */
#abv-slider {
    height: 3px;
    background-color: #ddd;
    margin: 15px 0;
    border: none;
}

#abv-slider .ui-slider-handle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #333;
    border: none;
    top: -4px;
    cursor: pointer;
    margin-left: -6px;
}

#abv-slider .ui-slider-range {
    background-color: #333;
    height: 3px;
}

.filter-abv-text {
    font-size: 13px;
    margin-bottom: 10px;
    color: #666;
}

/* ===============================================
   CUSTOM SORTING DROPDOWN STYLES
   =============================================== */

/* Sorting dropdown in shop controls area (left-aligned) */
.custom-sorting-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 23%;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    justify-content: flex-start;
}

.sorting-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.woocommerce-ordering {
    margin: 0;
    flex: 0 0 auto;
}

.woocommerce-ordering select.orderby {
    min-width: 160px;
    max-width: 180px;
    padding: 8px 12px;
    margin-top: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 8px;
    padding-right: 25px;
    appearance: none;
}

.woocommerce-ordering select.orderby:hover {
    border-color: #999;
}

.woocommerce-ordering select.orderby:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Mobile responsive for sorting */
@media (max-width: 768px) {
    .custom-sorting-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
    }

    .sorting-label {
        text-align: center;
        font-size: 13px;
    }

    .woocommerce-ordering select.orderby {
        min-width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .custom-sorting-container {
        padding: 12px;
        margin-bottom: 15px;
    }

    .woocommerce-ordering select.orderby {
        font-size: 14px;
        padding: 10px 12px;
        padding-right: 30px;
    }
}

/* Integration with existing shop controls */
.shop-controls-bar+.custom-sorting-container {
    margin-top: 0;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 4px 4px;
}

/* ===============================================
   FINAL WISHLIST PAGE PROTECTION - COMPLETE OVERLAY DISABLE
   =============================================== */

/* Nuclear option: Completely disable loading overlay on wishlist pages */
body.wishlist-page,
body.wishlist-page *,
.wishlist-page,
.wishlist-page * {
    position: static !important;
    overflow: visible !important;
}

body.wishlist-page:before,
body.wishlist-page:after,
.wishlist-page:before,
.wishlist-page:after,
body.wishlist-page *:before,
body.wishlist-page *:after,
.wishlist-page *:before,
.wishlist-page *:after {
    display: none !important;
    content: none !important;
}

/* Ensure wishlist content is always visible */
.wishlist-title,
.wishlist-table-container,
.wishlist-table {
    position: relative !important;
    z-index: 9999 !important;
    background: white !important;
}

/* ===============================================
   THEME GLOBAL LOADING OVERRIDE - CRITICAL FIX
   =============================================== */

/* Override theme's global loading system that hides all content */
body:not(.loaded)> :not(.loading-overlay) {
    visibility: visible !important;
    transition: none !important;
}

body:not(.loaded)> :not(.loading-overlay) * {
    visibility: visible !important;
    transition: none !important;
}

/* Force wishlist pages to always be visible regardless of theme loading state */
body.wishlist-page,
body.wishlist-page *,
.wishlist-page,
.wishlist-page * {
    visibility: visible !important;
    opacity: 1 !important;
    transition: none !important;
}

/* Ensure wishlist content is always visible and accessible */
.wishlist-title,
.wishlist-table-container,
.wishlist-table,
.wishlist-table * {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
    position: relative !important;
    z-index: 9999 !important;
}

/* Override any theme loading overlays on wishlist pages */
body.wishlist-page .loading-overlay,
.wishlist-page .loading-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* ===============================================
   NUCLEAR OPTION - COMPLETE THEME LOADING OVERRIDE
   =============================================== */

/* Completely disable the theme's loading system on wishlist pages */
body.wishlist-page:not(.loaded)> :not(.loading-overlay),
body.wishlist-page:not(.loaded)> :not(.loading-overlay) *,
.wishlist-page:not(.loaded)> :not(.loading-overlay),
.wishlist-page:not(.loaded)> :not(.loading-overlay) * {
    visibility: visible !important;
    opacity: 1 !important;
    transition: none !important;
    animation: none !important;
    transform: none !important;
    filter: none !important;
}

/* Force all wishlist elements to be visible regardless of theme state */
body.wishlist-page *,
.wishlist-page * {
    visibility: visible !important;
    opacity: 1 !important;
    display: revert !important;
    position: revert !important;
    z-index: revert !important;
}

/* Ensure wishlist content is always on top and visible */
.wishlist-title,
.wishlist-table-container,
.wishlist-table,
.wishlist-table *,
.wishlist-table-container * {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
    position: relative !important;
    z-index: 99999 !important;
    background: white !important;
    color: black !important;
    border: revert !important;
    padding: revert !important;
    margin: revert !important;
}

/* Override any CSS that might hide content */
body.wishlist-page [style*="visibility: hidden"],
body.wishlist-page [style*="opacity: 0"],
body.wishlist-page [style*="display: none"],
.wishlist-page [style*="visibility: hidden"],
.wishlist-page [style*="opacity: 0"],
.wishlist-page [style*="display: none"] {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}