/* Select2 Integration Styles */
.creators-video-archive-filters .select2-container {
    width: 100% !important;
}

.creators-video-archive-filters .select2-container .select2-selection--single {
    height: 42px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    background-color: #fff !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.2s ease !important;
}

.creators-video-archive-filters .select2-container .select2-selection--single:focus-within {
    border-color: #007cba !important;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1) !important;
}

.creators-video-archive-filters .select2-container .select2-selection__rendered {
    color: #333 !important;
    font-size: 14px !important;
    line-height: 1 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.creators-video-archive-filters .select2-container .select2-selection__placeholder {
    color: #999 !important;
}

.creators-video-archive-filters .select2-container .select2-selection__arrow {
    height: 100% !important;
    right: 8px !important;
    top: 0 !important;
    width: 20px !important;
}

.creators-video-archive-filters .select2-container .select2-selection__arrow b {
    border-color: #666 transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    left: 50% !important;
    margin-left: -4px !important;
    margin-top: -2px !important;
    position: absolute !important;
    top: 50% !important;
    width: 0 !important;
}

.creators-video-archive-filters .select2-container .select2-selection__clear {
    color: #999 !important;
    cursor: pointer !important;
    float: left !important;
    font-weight: bold !important;
    margin-right: 10px !important;
}

.creators-video-archive-filters .select2-container .select2-selection__clear:hover {
    color: #333 !important;
}

/* Dropdown Styles */
.select2-dropdown {
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    background-color: #fff !important;
    z-index: 9999 !important;
}

.select2-search--dropdown {
    padding: 8px !important;
    background-color: #f9f9f9 !important;
    border-bottom: 1px solid #eee !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
}

.select2-search--dropdown .select2-search__field:focus {
    outline: none !important;
    border-color: #007cba !important;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1) !important;
}

.select2-results {
    max-height: 250px !important;
    overflow-y: auto !important;
}

.select2-results__options {
    padding: 0 !important;
}

.select2-results__option {
    padding: 10px 12px !important;
    font-size: 14px !important;
    color: #333 !important;
    cursor: pointer !important;
    border-bottom: 1px solid #f5f5f5 !important;
    transition: background-color 0.2s ease !important;
}

.select2-results__option:last-child {
    border-bottom: none !important;
}

.select2-results__option:hover,
.select2-results__option--highlighted {
    background-color: #f0f8ff !important;
    color: #007cba !important;
}

.select2-results__option[aria-selected="true"] {
    background-color: #007cba !important;
    color: #fff !important;
}

.select2-results__option[aria-disabled="true"] {
    color: #999 !important;
    font-style: italic !important;
    cursor: not-allowed !important;
    background-color: #f9f9f9 !important;
}

/* No results message */
.select2-results__message {
    padding: 12px !important;
    font-size: 14px !important;
    color: #999 !important;
    text-align: center !important;
    font-style: italic !important;
}

/* Loading state for Select2 */
.creators-video-archive-filters .select2-container.loading {
    opacity: 0.7 !important;
}

.creators-video-archive-filters .select2-container.loading .select2-selection--single {
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="none" stroke="%23667eea" stroke-width="2" stroke-linecap="round" stroke-dasharray="9.42" stroke-dashoffset="9.42"><animateTransform attributeName="transform" dur="1s" type="rotate" values="0 8 8;360 8 8" repeatCount="indefinite"/></circle></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 30px) center !important;
    background-size: 16px 16px !important;
}

/* RTL Support for Select2 */
body.rtl .creators-video-archive-filters .select2-container .select2-selection__rendered {
    padding-left: 12px !important;
    padding-right: 15px !important;
    overflow: visible !important;
}

body.rtl .creators-video-archive-filters .select2-container .select2-selection__arrow {
    left: 8px !important;
    right: auto !important;
}

body.rtl .creators-video-archive-filters .select2-container .select2-selection__clear {
    float: right !important;
    margin-left: 10px !important;
    margin-right: 0 !important;
}

body.rtl .creators-video-archive-filters .select2-container.loading .select2-selection--single {
    background-position: 30px center !important;
}



/* Integration with existing filter loading styles */
.creators-video-archive-filters .filter-group.loading .select2-container {
    opacity: 0.6 !important;
    pointer-events: none !important;
}

/* Ensure Select2 dropdown appears above other elements */
.select2-container--open .select2-dropdown {
    z-index: 9999 !important;
}

/* Custom styling for "No results" text in Persian */
.select2-results__option.select2-results__message {
    background-color: #f9f9f9 !important;
    color: #666 !important;
    font-style: normal !important;
    text-align: center !important;
}

 /* Responsive Design for Select2 */
 @media (max-width: 768px) {
    .select2-dropdown {
        border-radius: 6px !important;
        margin-top: 2px !important;
    }

    .select2-results {
        max-height: 200px !important;
    }

    .select2-results__option {
        padding: 12px !important;
        font-size: 16px !important;
    }
}