/* --- Wrapper --- */
.sew-filter-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    direction: rtl;
    /* RTL برای فارسی */
    font-family: inherit;
    margin-bottom: 30px;
    position: relative;
}

.sew-filter-form {
    display: flex !important;
    flex-direction: column;
    /* در موبایل ستونی */
    gap: 20px;
}

.sew-title-group span {
    font-size: 18px;
    color: #333;
    font-weight: 700;
}

/* --- Grid Layout --- */
.sew-grid-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    /* کمی عریض‌تر برای تام سلکت */
    gap: 15px;
    width: 100%;
}

@media (max-width: 1024px) {
    .sew-grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sew-grid-container {
        grid-template-columns: 1fr;
        /* تک ستونه در موبایل */
    }

    .sew-submit-wrapper {
        justify-content: center;
        width: 100%;
    }
}

/* --- Field Group --- */
.sew-field-group {
    display: flex;
    flex-direction: column;
}

.sew-select-wrapper {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: stretch;
    /* کشیدن ارتفاع برای هماهنگی با تام سلکت */
    transition: all 0.2s;
}

.sew-select-wrapper:focus-within {
    border-color: #d30000;
    box-shadow: 0 0 0 3px rgba(211, 0, 0, 0.1);
}

/* --- Icon --- */
.sew-icon {
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    background: #eee;
    border-radius: 0 8px 8px 0;
    /* گوشه‌های راست گرد */
    border-left: 1px solid #e2e8f0;
    min-width: 45px;
}

.sew-filter-icon {
    width: 24px !important;
    height: 24px;
    object-fit: contain;
}

/* --- Tom Select Overrides for RTL & Theme --- */
.ts-wrapper {
    width: 100%;
    border: none !important;
    padding: 0 !important;
}

.ts-control {
    border: none !important;
    background: transparent !important;
    padding: 10px 12px !important;
    box-shadow: none !important;
    border-radius: 8px 0 0 8px !important;
    /* چپ گرد */
    text-align: right;
    min-height: 45px;
    display: flex;
    align-items: center;
}

.ts-dropdown {
    text-align: right;
    border-color: #d30000 !important;
    border-radius: 8px !important;
    margin-top: 5px;
    z-index: 10000 !important;
    overflow: hidden;
    /* جلوگیری از افتادن زیر سایر المان‌ها */
}

/* باکس جستجو درون دراپ‌دان */
.ts-dropdown .dropdown-input-wrap {
    padding: 10px;
}
.ts-dropdown .dropdown-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    width: 100%;
    font-family: inherit;
}

.ts-wrapper.sew-select-tom.single.plugin-no_backspace_delete.rtl.focus.input-active.full.has-items .ts-control .item{
    height: 100%;
    display: flex !important;
    align-items: center;
}

.ts-wrapper.sew-select-tom.single.plugin-no_backspace_delete.rtl.focus.input-active.full.has-items .ts-control input{
    height: 0 !important;
}

.ts-dropdown .option {
    padding: 10px 15px;
}

.ts-dropdown .active {
    background-color: #ffe6e6 !important;
    /* قرمز خیلی روشن */
    color: #000 !important;
}

.ts-wrapper.single .ts-control:after {
    left: 15px !important;
    right: auto !important;
    /* فلش سمت چپ باشد */
}

/* --- Buttons --- */
.sew-submit-wrapper {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.sew-submit-btn,
.sew-reset-btn {
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
    font-family: inherit;
}

.sew-submit-btn {
    background-color: #0B7347 !important;
    color: #fff;
}

.sew-submit-btn:hover {
    background-color: #0D854D !important;
}

.sew-reset-btn {
    background-color: #d30000 !important;
    color: #fff;
}

.sew-reset-btn:hover {
    background: #9D1F20 !important;
}

.sew-submit-btn-icon {
    width: 20px;
}

/* --- Loading Overlay --- */
.sew-overlay-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.sew-overlay-loader.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #d30000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}