/* Shop Filters - Premium Floating Panel */

.tazajmart-filters-container {
    --sf-radius: var(--sf-card-radius, 24px);
    --sf-shadow: var(--sf-card-shadow, 0 18px 34px rgba(15, 23, 42, 0.08));
    --sf-accent-color: var(--sf-accent, var(--primary, #0021ff));
    --sf-check-active: var(--sf-checkbox-active, var(--primary, #0021ff));
    --sf-swatch: var(--sf-swatch-size, 18px);
    --sf-gap: var(--sf-section-gap, 26px);
    --sf-panel-width: var(--sf-sidebar-width, 340px);
    --sf-input-h: var(--sf-input-height, 42px);

    width: 100%;
    max-width: var(--sf-panel-width);
    margin: 0;
    background: #ffffff;
    border: 1px solid #e6ebf4;
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    padding: 20px;
    position: relative;
}

.tazajmart-filters-form {
    display: flex;
    flex-direction: column;
    gap: var(--sf-gap);
}

.filter-widget {
    margin: 0;
    padding: 0;
}

.filter-title {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: -0.15px;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.filter-toggle {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: #edf2ff;
    color: #1e3a8a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.filter-toggle:hover {
    background: #dfe8ff;
    transform: scale(1.04);
}

.filter-widget.is-collapsed .filter-content {
    display: none;
}

.filter-content {
    width: 100%;
}

/* Search */
.search-input-wrapper {
    position: relative;
    display: flex;
}

.search-input-wrapper input {
    width: 100%;
    height: var(--sf-input-h);
    border: 1px solid #d8e1f1;
    border-radius: 12px;
    padding: 10px 46px 10px 13px;
    font-size: 14px;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--sf-accent-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sf-accent-color) 14%, transparent);
}

.search-input-wrapper button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: calc(var(--sf-input-h) - 10px);
    height: calc(var(--sf-input-h) - 10px);
    border: 0;
    border-radius: 10px;
    background: var(--sf-accent-color);
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.search-input-wrapper button:hover {
    transform: translateY(-50%) scale(1.03);
    filter: brightness(1.06);
}

/* List + Scroll */
.custom-scrollbar {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 6px;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #edf2fb;
    border-radius: 999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c4d0e3;
    border-radius: 999px;
}

.filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.filter-list li {
    margin: 0 0 8px;
}

.filter-list li:last-child {
    margin-bottom: 0;
}

/* Checkbox rows */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    min-height: 34px;
    border-radius: 10px;
    padding: 6px 8px 6px 34px;
    color: #334155;
    font-size: 14px;
    line-height: 1.35;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.custom-checkbox:hover {
    background: #f5f8ff;
    color: #0f172a;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1.5px solid #b7c4da;
    background: #ffffff;
    transition: all 0.2s ease;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark {
    border-color: var(--sf-check-active);
    background: var(--sf-check-active);
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.label-text {
    flex: 1;
    min-width: 0;
}

.count {
    margin-left: 6px;
    font-size: 11px;
    line-height: 1.2;
    color: #64748b;
    background: #edf2fb;
    border-radius: 999px;
    padding: 2px 7px;
}

/* Color filter swatches */
.filter-color .custom-checkbox.is-color-option {
    padding-left: calc(var(--sf-swatch) + 22px);
}

.filter-color .custom-checkbox.is-color-option .checkmark {
    display: none;
}

.color-swatch {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: var(--sf-swatch);
    height: var(--sf-swatch);
    border-radius: 999px;
    background: var(--swatch-color, #cbd5e1);
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 0 1px #cbd5e1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.color-swatch:after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 8px;
    color: #ffffff;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.filter-color .custom-checkbox.is-color-option:hover .color-swatch {
    transform: translateY(-50%) scale(1.06);
}

.filter-color .custom-checkbox.is-color-option input:checked ~ .color-swatch {
    box-shadow: 0 0 0 2px var(--sf-accent-color);
}

.filter-color .custom-checkbox.is-color-option input:checked ~ .color-swatch:after {
    opacity: 1;
}

/* Brand pills */
.filter-brand .filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-brand .filter-list li {
    margin: 0;
}

.filter-brand .custom-checkbox.is-brand-option {
    min-height: 32px;
    width: auto;
    padding: 6px 12px;
    border: 1px solid #d9e2f3;
    border-radius: 999px;
    background: #ffffff;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    gap: 4px;
}

.filter-brand .custom-checkbox.is-brand-option .checkmark {
    display: none;
}

.filter-brand .custom-checkbox.is-brand-option .count {
    background: transparent;
    color: #64748b;
    padding: 0;
}

.filter-brand .custom-checkbox.is-brand-option.is-active {
    border-color: var(--sf-accent-color);
    background: var(--sf-accent-color);
}

.filter-brand .custom-checkbox.is-brand-option.is-active .label-text,
.filter-brand .custom-checkbox.is-brand-option.is-active .count {
    color: #ffffff;
}

.filter-brand .custom-checkbox.is-brand-option.is-active .count {
    opacity: 0.86;
}

/* Price */
.filter-price .filter-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.price-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.price-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.price-field-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.price-field {
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--sf-input-h);
    border: 1px solid #d8e1f1;
    border-radius: 12px;
    padding: 0 9px;
    background: #ffffff;
}

.price-currency {
    font-size: 12px;
    color: #64748b;
    font-weight: 700;
}

.price-field input {
    width: 100%;
    border: 0;
    outline: none;
    font-size: 13px;
    color: #0f172a;
    background: transparent;
}

#price-slider,
.ui-slider {
    height: 6px;
    background: #dae4f6;
    border-radius: 999px;
    border: 0;
    margin: 2px 0 0;
}

.ui-slider .ui-slider-range {
    background: var(--sf-accent-color);
}

.ui-slider .ui-slider-handle {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    background: var(--sf-accent-color);
    box-shadow: 0 5px 12px color-mix(in srgb, var(--sf-accent-color) 26%, transparent);
    top: -5px;
}

/* Rating */
.rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    color: #f7b500;
}

.up-suffix {
    margin-left: 6px;
    font-size: 11px;
    color: #64748b;
}

/* Tags */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #d9e2f3;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.tag-item:hover,
.tag-item.active {
    border-color: var(--sf-accent-color);
    background: var(--sf-accent-color);
    color: #ffffff;
}

/* Actions */
.filter-actions {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-apply-filters {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: var(--sf-accent-color);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-apply-filters:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px color-mix(in srgb, var(--sf-accent-color) 24%, transparent);
    filter: brightness(1.04);
}

.btn-reset-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 10px;
    border: 1px dashed #e3aac0;
    background: #fff5f8;
    color: #be123c;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-reset-filters:hover {
    background: #ffeaf0;
    border-color: #d98da7;
    color: #9f1239;
}

/* Responsive */
@media (max-width: 991px) {
    .tazajmart-filters-container {
        max-width: 100%;
        border-radius: max(16px, calc(var(--sf-radius) - 6px));
        padding: 16px;
        padding-bottom: calc(92px + env(safe-area-inset-bottom));
    }

    .tazajmart-filters-form {
        gap: 18px;
    }

    .filter-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .custom-scrollbar {
        max-height: 180px;
    }

    .price-inputs {
        gap: 8px;
    }

    .filter-actions {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

@media (max-width: 767px) {
    /* Mobile shop/archive product grid: show 2 products per row */
    body.post-type-archive-product .elementor-widget-loop-grid .e-loop-items,
    body.tax-product_cat .elementor-widget-loop-grid .e-loop-items,
    body.tax-product_tag .elementor-widget-loop-grid .e-loop-items,
    body.post-type-archive-product .elementor-widget-loop-grid .elementor-loop-container,
    body.tax-product_cat .elementor-widget-loop-grid .elementor-loop-container,
    body.tax-product_tag .elementor-widget-loop-grid .elementor-loop-container {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    body.post-type-archive-product .woocommerce ul.products,
    body.tax-product_cat .woocommerce ul.products,
    body.tax-product_tag .woocommerce ul.products,
    body.post-type-archive-product ul.products,
    body.tax-product_cat ul.products,
    body.tax-product_tag ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        margin: 0 !important;
    }

    body.post-type-archive-product .woocommerce ul.products li.product,
    body.tax-product_cat .woocommerce ul.products li.product,
    body.tax-product_tag .woocommerce ul.products li.product,
    body.post-type-archive-product ul.products li.product,
    body.tax-product_cat ul.products li.product,
    body.tax-product_tag ul.products li.product,
    body.post-type-archive-product .elementor-widget-loop-grid .e-loop-item,
    body.tax-product_cat .elementor-widget-loop-grid .e-loop-item,
    body.tax-product_tag .elementor-widget-loop-grid .e-loop-item {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    body.post-type-archive-product .product-card,
    body.tax-product_cat .product-card,
    body.tax-product_tag .product-card {
        width: 100% !important;
    }
}
