﻿/* Select2 Bootstrap Form Control Styling */
/* Add this CSS to your site.css or create a separate select2-custom.css file */

/* Target all Select2 containers */
.select2-container {
    display: block !important;
    width: 100% !important;
}

    /* Main Select2 container styling to match Bootstrap form-control */
    .select2-container .select2-selection--single,
    .select2-container--bootstrap-5 .select2-selection--single {
        height: calc(2.25rem + 2px) !important; /* Match Bootstrap form-control height */
        padding: 0.375rem 0.75rem !important;
        font-size: 1rem !important;
        font-weight: 400 !important;
        line-height: 1.5 !important;
        color: #212529 !important;
        background-color: #fff !important;
        background-image: none !important;
        border: 1px solid #ced4da !important;
        border-radius: 0.25rem !important;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
        display: flex !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    /* Select2 selection rendered text */
    .select2-container .select2-selection__rendered,
    .select2-container--bootstrap-5 .select2-selection__rendered {
        color: #212529 !important;
        padding: 0 !important;
        margin: 0 !important;
        line-height: 1.5 !important;
    }

    /* Select2 placeholder styling */
    .select2-container .select2-selection__placeholder,
    .select2-container--bootstrap-5 .select2-selection__placeholder {
        color: #6c757d !important;
        font-weight: 400 !important;
    }

    /* Select2 arrow/caret styling */
    .select2-container .select2-selection__arrow,
    .select2-container--bootstrap-5 .select2-selection__arrow {
        display: none !important;
    }

        .select2-container .select2-selection__arrow b,
        .select2-container--bootstrap-5 .select2-selection__arrow b {
            display: none !important;
        }

    /* Focus state to match Bootstrap form-control:focus */
    .select2-container.select2-container--focus .select2-selection--single,
    .select2-container.select2-container--open .select2-selection--single,
    .select2-container--bootstrap-5.select2-container--focus .select2-selection--single,
    .select2-container--bootstrap-5.select2-container--open .select2-selection--single {
        border-color: #86b7fe !important;
        outline: 0 !important;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    }

    /* Dropdown styling */
    .select2-container .select2-dropdown,
    .select2-container--bootstrap-5 .select2-dropdown {
        border: 1px solid #ced4da !important;
        border-radius: 0.25rem !important;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
        background-color: #fff !important;
    }

/* Dropdown search input */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    color: #212529 !important;
    background-color: #fff !important;
    margin: 0.5rem !important;
    width: calc(100% - 1rem) !important;
}

/* Dropdown options */
.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.5rem 0.75rem !important;
    color: #212529 !important;
    background-color: #fff !important;
    border: none !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

/* Hover state for options */
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: #0d6efd !important;
    color: #fff !important;
}

/* Selected option styling */
.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

    .select2-container--bootstrap-5 .select2-results__option[aria-selected="true"]:hover {
        background-color: #0d6efd !important;
        color: #fff !important;
    }

/* Clear button styling */
.select2-container--bootstrap-5 .select2-selection__clear {
    display: none !important;
}

    .select2-container--bootstrap-5 .select2-selection__clear:hover {
        display: none !important;
    }

/* Disabled state */
.select2-container--bootstrap-5.select2-container--disabled .select2-selection--single {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    border-color: #ced4da !important;
}

/* Multiple select styling (if needed) */
.select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: calc(2.25rem + 2px) !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #212529 !important;
    background-color: #fff !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

/* Multiple select tags */
.select2-container--bootstrap-5 .select2-selection__choice {
    background-color: #0d6efd !important;
    border: 1px solid #0d6efd !important;
    border-radius: 0.25rem !important;
    color: #fff !important;
    font-size: 0.875rem !important;
    padding: 0.25rem 0.5rem !important;
    margin: 0.125rem !important;
}

.select2-container--bootstrap-5 .select2-selection__choice__remove {
    color: #fff !important;
    margin-right: 0.25rem !important;
}

    .select2-container--bootstrap-5 .select2-selection__choice__remove:hover {
        color: #fff !important;
        background-color: rgba(255, 255, 255, 0.2) !important;
        border-radius: 2px !important;
    }

/* Adjust padding for RTL and LTR */
.select2-container--bootstrap-5 .select2-selection--single {
    padding: 0.375rem 0.75rem !important;
}

/* RTL support */
[dir="rtl"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    text-align: right;
    padding-right: 0.75rem !important;
}

/* LTR support */
[dir="ltr"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    text-align: left;
    padding-left: 0.75rem !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .select2-container--bootstrap-5 .select2-selection--single {
        font-size: 0.9rem !important;
        padding: 0.3rem 0.6rem !important;
    }

    .select2-container--bootstrap-5 .select2-dropdown {
        font-size: 0.9rem !important;
    }
}

/* Animation for smooth dropdown opening */
.select2-container--bootstrap-5 .select2-dropdown {
    animation: slideDown 0.15s ease-out !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
