.custom-select-wrapper {
    position: relative;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    direction: rtl;
}

.custom-select-wrapper.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.custom-select-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 2px solid rgba(228, 16, 29, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #2c3e50;
    font-weight: 500;
    min-height: 50px;
    position: relative;
    direction: rtl;
    text-align: right;
}

.custom-select-display:hover {
    border-color: rgba(228, 16, 29, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
    box-shadow: 0 4px 12px rgba(228, 16, 29, 0.1);
}

.custom-select-display:focus,
.custom-select-display.active {
    outline: none;
    border-color: #E4101D;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(228, 16, 29, 0.2);
    transform: translateY(-2px);
}

.custom-select-display.placeholder {
    color: #adb5bd;
}

.custom-select-display-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 0.5rem;
    margin-right: 0;
    text-align: right;
}

.custom-select-display-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #E4101D;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
}

.custom-select-display.active .custom-select-display-icon {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: fixed;
    background: #ffffff;
    border: 2px solid #E4101D;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(228, 16, 29, 0.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    direction: rtl;
}

.custom-select-dropdown.custom-select-in-modal {
    z-index: 10000;
}

.custom-select-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-dropdown.custom-select-in-modal.show {
    transform: none;
}

.custom-select-search {
    padding: 1rem;
    border-bottom: 2px solid #f1f3f5;
    background: #fafbfc;
}

.custom-select-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: #ffffff;
    color: #2c3e50;
    transition: all 0.3s ease;
    direction: rtl;
    text-align: right;
}

.custom-select-search-input:focus {
    outline: none;
    border-color: #E4101D;
    box-shadow: 0 0 0 3px rgba(228, 16, 29, 0.1);
}

.custom-select-search-input::placeholder {
    color: #adb5bd;
}

.custom-select-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #E4101D 0%, #ff4757 100%);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff4757 0%, #ff6b7a 100%);
}

.custom-select-option {
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    color: #2c3e50;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    position: relative;
    text-align: right;
    direction: rtl;
}

.custom-select-option:hover {
    background: linear-gradient(135deg, #ffe8e8 0%, #fff0f0 100%);
    transform: translateX(-4px);
}

.custom-select-option.selected {
    background: linear-gradient(135deg, #ffe8e8 0%, #fff0f0 100%);
    color: #E4101D;
    font-weight: 600;
}

.custom-select-option.selected::after {
    content: "✓";
    position: absolute;
    left: 1rem;
    right: auto;
    color: #E4101D;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Multiple Select Styles */
.custom-select-multiple .custom-select-option.selected::after {
    display: none;
}

.custom-select-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 0.75rem;
    margin-right: 0;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    background: #ffffff;
    color: #E4101D;
    font-weight: bold;
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.custom-select-option.selected .custom-select-checkbox {
    background: #E4101D;
    border-color: #E4101D;
    color: #ffffff;
}

.custom-select-option:hover .custom-select-checkbox {
    border-color: #E4101D;
}

.custom-select-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.custom-select-option.disabled:hover {
    background: transparent;
    transform: none;
}

.custom-select-no-results {
    padding: 1.5rem;
    text-align: center;
    color: #adb5bd;
    font-size: 0.95rem;
    direction: rtl;
}

.custom-select-loading {
    padding: 1.5rem;
    text-align: center;
    color: #E4101D;
    direction: rtl;
}

.custom-select-loading::after {
    content: "⟳";
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
    margin-left: 0;
    font-size: 1.2rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.custom-select-wrapper.is-invalid .custom-select-display {
    border-color: #dc3545;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
}

.custom-select-wrapper.is-invalid .custom-select-display:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.custom-select-wrapper.is-valid .custom-select-display {
    border-color: #28a745;
}

.custom-select-wrapper.is-valid .custom-select-display:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

@media (max-width: 768px) {
    .custom-select-display {
        font-size: 16px;
        padding: 0.875rem 1rem;
    }

    .custom-select-search-input {
        font-size: 16px;
    }

    .custom-select-option {
        font-size: 16px;
        padding: 1rem 1.25rem;
    }
}
