/* Filter Spacing and Checkbox Fixes */

/* Add more spacing between Sort By dropdown and checkbox filters */
.filter-group:has(.form-select) {
    margin-bottom: 1.5rem !important;
}

/* Alternative selector for better compatibility */
.filter-group .form-select {
    margin-bottom: 1rem !important;
}

/* Ensure proper spacing for filter groups */
.filter-group {
    margin-bottom: 1.2rem;
}

/* Specific spacing for the sort filter group */
.filter-group:has(select[name="sort"]) {
    margin-bottom: 1.8rem !important;
}

/* Alternative for sort dropdown */
.filter-group select[name="sort"] {
    margin-bottom: 1rem !important;
}

/* Checkbox Filter Fixes */
.form-check {
    margin-bottom: 1rem;
    padding-left: 0 !important; /* Remove Bootstrap default padding */
    position: relative;
}

/* English checkbox styling (default) */
.form-check-input {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
    position: relative;
    float: none !important;
}

.form-check-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin-left: 0 !important;
}

/* Arabic RTL checkbox fixes */
html[lang="ar"] .form-check {
    direction: ltr !important; /* Force LTR for checkbox positioning */
    text-align: left !important; /* Align checkbox to left */
}

html[lang="ar"] .form-check-input {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
    position: relative;
    float: none !important;
}

html[lang="ar"] .form-check-label {
    direction: rtl !important; /* Text direction RTL */
    text-align: right !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
}

/* Ensure checkbox appears before text in Arabic */
html[lang="ar"] .form-check-label::before {
    content: none !important;
}

html[lang="ar"] .form-check-label::after {
    content: none !important;
}

/* Override any Bootstrap RTL that might interfere */
html[lang="ar"] .form-check {
    text-align: left !important;
}

html[lang="ar"] .form-check .form-check-input {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
    order: -1; /* Ensure checkbox comes first */
}

html[lang="ar"] .form-check .form-check-label {
    order: 1; /* Label comes after checkbox */
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Fix the container layout for Arabic */
html[lang="ar"] .filters-sidebar .form-check {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    text-align: left !important;
}

/* Ensure proper spacing in filter groups */
.filters-sidebar .filter-group .form-check {
    margin-top: 0.8rem;
    margin-bottom: 0.8rem;
}

/* Enhanced spacing for better visual separation */
.filter-group:nth-last-child(2) {
    margin-bottom: 1.5rem !important;
}

/* Apply button spacing */
.filters-sidebar .btn {
    margin-top: 1rem !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .filter-group {
        margin-bottom: 1rem;
    }
    
    .filter-group:has(.form-select) {
        margin-bottom: 1.2rem !important;
    }
}
