/* Koosha Smart Attribute Filter */
.ksaf-filter-wrap,
.ksaf-products-grid {
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.ksaf-filter-wrap *,
.ksaf-products-grid * {
    box-sizing: border-box;
}

.ksaf-filter-wrap {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 22px;
}

.ksaf-filter-main-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
    color: #1f2937;
}

.ksaf-filter-group {
    margin-bottom: 18px;
}

.ksaf-filter-group:last-child {
    margin-bottom: 0;
}

.ksaf-filter-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #374151;
}

.ksaf-filter-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ksaf-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
    transition: 0.2s ease;
    line-height: 1.5;
}

.ksaf-option input.ksaf-filter-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    pointer-events: none;
}

.ksaf-option-button {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f9fafb;
    color: #374151;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 13px;
}

.ksaf-option-button:hover {
    border-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.ksaf-option-button.is-active,
.ksaf-option-checkbox.is-active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.ksaf-option-checkbox {
    color: #374151;
    font-size: 14px;
    padding: 4px 0;
}

.ksaf-option-checkbox input.ksaf-filter-input {
    position: static;
    opacity: 1;
    width: auto;
    height: auto;
    overflow: visible;
    pointer-events: auto;
    margin-left: 6px;
}

.ksaf-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    background: var(--ksaf-swatch-color, #ddd);
    border: 1px solid rgba(0, 0, 0, 0.18);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.ksaf-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.07);
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ksaf-option.is-active .ksaf-count {
    background: rgba(255, 255, 255, 0.2);
}

.ksaf-filter-select {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 8px 12px;
    background: #fff;
    color: #111827;
}

.ksaf-clear-filters {
    border: 0;
    background: #f3f4f6;
    color: #111827;
    border-radius: 12px;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s ease;
}

.ksaf-clear-filters:hover {
    background: #e5e7eb;
}

.ksaf-products-grid {
    position: relative;
}

.ksaf-products-grid.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.ksaf-products-grid.is-loading:after {
    content: attr(data-loading-text);
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background: rgba(17, 24, 39, 0.9);
    color: #fff;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
}

.ksaf-result-info {
    margin-bottom: 14px;
    color: #6b7280;
    font-size: 13px;
}

.ksaf-grid-list {
    display: grid;
    grid-template-columns: repeat(var(--ksaf-cols, 4), minmax(0, 1fr));
    gap: 20px;
}

.ksaf-product-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    transition: 0.22s ease;
    height: 100%;
}

.ksaf-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.ksaf-product-image {
    position: relative;
    display: block;
    overflow: hidden;
    background: #fafafa;
    aspect-ratio: 1 / 1;
}

.ksaf-product-img,
.ksaf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: 0.25s ease;
}

.ksaf-product-card:hover .ksaf-product-img,
.ksaf-product-card:hover .ksaf-product-image img {
    transform: scale(1.035);
}

.ksaf-match-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
}

.ksaf-product-content {
    padding: 14px;
}

.ksaf-product-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.65;
}

.ksaf-product-title a {
    color: #111827;
    text-decoration: none;
}

.ksaf-variation-summary {
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.7;
}

.ksaf-product-price {
    margin: 9px 0 12px;
    font-weight: 800;
    color: #111827;
    min-height: 24px;
}

.ksaf-product-price del {
    opacity: 0.55;
    font-weight: 500;
}

.ksaf-product-price ins {
    text-decoration: none;
}

.ksaf-product-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    background: #111827;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 13px;
    transition: 0.2s ease;
}

.ksaf-product-button:hover {
    color: #fff;
    opacity: 0.9;
}

.ksaf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.ksaf-page-link {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    color: #111827;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.ksaf-page-link.is-current,
.ksaf-page-link:hover {
    background: #111827;
    color: #fff;
}

.ksaf-message {
    padding: 18px;
    border-radius: 14px;
    background: #f9fafb;
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

@media (max-width: 1024px) {
    .ksaf-grid-list {
        grid-template-columns: repeat(var(--ksaf-cols-tablet, 3), minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .ksaf-grid-list {
        grid-template-columns: repeat(var(--ksaf-cols-mobile, 2), minmax(0, 1fr));
        gap: 12px;
    }

    .ksaf-filter-wrap {
        padding: 14px;
        border-radius: 16px;
    }

    .ksaf-option-button {
        padding: 7px 10px;
        font-size: 12px;
    }

    .ksaf-product-content {
        padding: 11px;
    }

    .ksaf-product-title {
        font-size: 13px;
    }

    .ksaf-match-badge {
        font-size: 10px;
        padding: 5px 8px;
    }
}


.ksaf-empty {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 24px;
    background: #fff7ed;
    border-color: rgba(251, 146, 60, 0.28);
}

.ksaf-empty-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(251, 146, 60, 0.12);
    color: #9a3412;
    font-size: 24px;
    font-weight: 900;
}

.ksaf-empty-content {
    flex: 1;
    min-width: 0;
}

.ksaf-empty-title {
    margin-bottom: 10px;
    color: #111827;
    font-weight: 900;
    font-size: 15px;
    line-height: 1.8;
}

.ksaf-empty-selected {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.ksaf-empty-selected-title {
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
}

.ksaf-empty-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #374151;
    font-size: 12px;
    font-weight: 800;
}

.ksaf-empty-chip-label {
    color: #6b7280;
}

.ksaf-clear-filters-global {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 0;
    background: #111827;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.ksaf-error {
    background: #fef2f2;
    border-color: rgba(239, 68, 68, 0.25);
    color: #991b1b;
}
