/*
Theme Name: Astra Child
Theme URI: https://wpastra.com/
Template: astra
Author: Child Theme Author
Author URI: https://example.com
Description: Astra Child Theme
Version: 1.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: astra-child
*/

/* Common layout fixes to prevent jumping */
.products {
    min-height: 200px;
    position: relative;
    transition: opacity 0.3s ease;
}

.site-content .ast-container {
    display: flex;
    flex-wrap: wrap;
}

/* Maintain sidebar width to prevent jumping */
.woocommerce-shop.ast-separate-container .ast-woocommerce-container .ast-left-sidebar #secondary,
.woocommerce-shop.ast-separate-container .ast-woocommerce-container .ast-right-sidebar #secondary,
.woocommerce.archive.ast-separate-container .ast-woocommerce-container .ast-left-sidebar #secondary,
.woocommerce.archive.ast-separate-container .ast-woocommerce-container .ast-right-sidebar #secondary {
    min-width: 270px;
    transition: none;
}

/* Prevent shop container from jumping */
.woocommerce-shop.ast-separate-container .ast-woocommerce-container,
.woocommerce.archive.ast-separate-container .ast-woocommerce-container {
    transition: none;
}

/* Price Range Filter Styles */
.wc-price-filter {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.wc-price-filter h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.price-slider-wrapper {
    padding: 10px 5px;
}

.price-slider-amount {
    text-align: center;
    margin: 15px 0 10px;
    font-size: 14px;
    height: 20px; /* Fixed height to prevent jumping */
}

.ui-slider {
    position: relative;
    height: 5px;
    border-radius: 3px;
    background: #e5e5e5;
    margin: 15px 10px;
}

.ui-slider .ui-slider-range {
    position: absolute;
    height: 5px;
    background: #2271b1;
    border-radius: 3px;
}

.ui-slider .ui-slider-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2271b1;
    top: -6px;
    margin-left: -8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 2;
}

.ui-slider .ui-slider-handle:hover,
.ui-slider .ui-slider-handle:active {
    background: #135e96;
}

/* Loading overlay - full page to prevent interaction */
.ajax-filtering .products {
    opacity: 0.5;
    pointer-events: none;
}

.ajax-filtering .products:before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.6);
    z-index: 9998;
}

/* Centered loading spinner */
.wc-price-filter.price-filter-loading:before, 
.wc-tag-filter.filter-loading:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9998;
    border-radius: 4px;
}

.wc-price-filter.price-filter-loading:after, 
.wc-tag-filter.filter-loading:after,
.ajax-filtering .products:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: filter-spin 0.8s linear infinite;
    z-index: 9999;
}

/* Make the main loading indicator larger and centered on the screen */
.ajax-filtering .products:after {
    position: fixed;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-width: 4px;
}

@keyframes filter-spin {
    to { transform: rotate(360deg); }
}

/* Prevent interaction during loading */
.ajax-filtering * {
    pointer-events: none;
}

/* Debug styles */
.debug-info {
    font-size: 10px !important; 
    color: #999 !important;
    margin-bottom: 5px !important;
    opacity: 0.7;
}

/* Responsive styles */
@media (max-width: 768px) {
    .wc-price-filter .filter-button {
        display: block;
        width: 100%;
        padding: 8px;
        margin-top: 10px;
        text-align: center;
        background: #2271b1;
        color: #fff;
        border: none;
        border-radius: 3px;
        cursor: pointer;
    }
    
    .wc-price-filter .filter-button:hover {
        background: #135e96;
    }
}

@media (min-width: 769px) {
    .wc-price-filter .filter-button {
        display: none;
    }
}

/* Tags Filter Styles */
.wc-tag-filter {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.wc-tag-filter ul.tag-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wc-tag-filter .tag-item {
    margin: 0;
    padding: 0;
}

.wc-tag-filter .tag-link {
    display: inline-block;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 3px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid #ddd;
}

.wc-tag-filter .tag-link:hover {
    background: #ebebeb;
    color: #000;
}

.wc-tag-filter .tag-item.active .tag-link {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.wc-tag-filter .tag-item.active .tag-link:hover {
    background: #135e96;
}

/* Mobile adjustments for tag filter */
@media (max-width: 544px) {
    .wc-tag-filter ul.tag-list {
        gap: 5px;
    }
    
    .wc-tag-filter .tag-link {
        padding: 5px 10px;
        font-size: 13px;
    }
} 