/*
 * ==========================================================================
 * Project Auxillary CSS: Select2 Bootstrap 5 & Theme Integration
 * Location: assets/auxillary/select2.css
 * ==========================================================================
 */

/* Form group in-flow container takes full width of its parent */
.select2-container:not(.select2-container--open) {
    width: 100% !important;
}

/* Base Single Selection Box */
.select2-container--default .select2-selection--single {
    min-height: 42px !important;
    height: 42px !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius, 8px) !important;
    background-color: var(--bg-card) !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out !important;
    box-sizing: border-box !important;
    outline: none !important;
}

.select2-container--default:hover .select2-selection--single:not([aria-disabled="true"]) {
    border-color: #cbd5e1 !important;
}

body[data-theme="dark"] .select2-container--default:hover .select2-selection--single:not([aria-disabled="true"]),
[data-theme="dark"] .select2-container--default:hover .select2-selection--single:not([aria-disabled="true"]) {
    border-color: #374151 !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main) !important;
    line-height: 40px !important;
    padding-left: 14px !important;
    padding-right: 40px !important;
    font-size: 0.9rem !important;
    font-family: inherit !important;
    width: 100%;
    box-sizing: border-box !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted) !important;
    opacity: 0.75 !important;
    font-size: 0.9rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 32px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 1.15rem !important;
    font-weight: 400 !important;
    color: var(--text-muted) !important;
    line-height: 1 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 4px !important;
    transition: color 0.15s ease !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: var(--danger) !important;
}

/* Arrow - Modern Chevron */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    width: 36px !important;
    position: absolute !important;
    top: 0 !important;
    right: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border: none !important;
    width: 8px !important;
    height: 8px !important;
    border-right: 2px solid var(--text-muted) !important;
    border-bottom: 2px solid var(--text-muted) !important;
    transform: rotate(45deg) translateY(-2px) !important;
    margin: 0 !important;
    position: static !important;
    display: inline-block !important;
    transition: transform 0.2s ease, border-color 0.15s ease !important;
}

/* Open / Focus State */
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    transform: rotate(-135deg) translateY(-2px) !important;
    border-color: var(--primary) !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
    outline: none !important;
}

/* Disabled State */
.select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: var(--bg-hover, #f8fafc) !important;
    border-color: var(--border) !important;
    opacity: 0.75 !important;
    cursor: not-allowed !important;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__rendered {
    color: var(--text-muted) !important;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__arrow b {
    opacity: 0.45 !important;
}

/* Multiple Selection Box */
.select2-container--default .select2-selection--multiple {
    min-height: 42px !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius, 8px) !important;
    background-color: var(--bg-card) !important;
    padding: 4px 8px !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--bg-hover) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    color: var(--text-main) !important;
    padding: 3px 8px 3px 22px !important;
    font-size: 0.83rem !important;
    margin-top: 4px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    border: none !important;
    color: var(--text-muted) !important;
    font-weight: bold !important;
    padding: 0 6px !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--danger) !important;
    background: transparent !important;
}

/* Dropdown Container */
.select2-dropdown {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius, 8px) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden !important;
    z-index: 1060 !important;
    margin-top: 4px !important;
    box-sizing: border-box !important;
}

/* Dropdown Search Field */
.select2-search--dropdown {
    padding: 8px 10px !important;
    background-color: var(--bg-card) !important;
    border-bottom: 1px solid var(--border) !important;
    box-sizing: border-box !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 0.88rem !important;
    font-family: inherit !important;
    background-color: var(--bg-hover) !important;
    color: var(--text-main) !important;
    outline: none !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
}

/* Options / Results */
.select2-results__options {
    max-height: 260px !important;
    padding: 4px !important;
}

.select2-results__option {
    font-size: 0.88rem !important;
    font-family: inherit !important;
    padding: 8px 14px !important;
    color: var(--text-main) !important;
    background-color: transparent !important;
    border-radius: 6px !important;
    margin-bottom: 2px !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
}

/* Highlighted (Hover/Keyboard) Option */
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--primary) !important;
    color: #ffffff !important;
}

/* Selected Option */
.select2-container--default .select2-results__option--selected {
    background-color: var(--bg-hover) !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
}

/* Disabled Option */
.select2-container--default .select2-results__option--disabled {
    color: var(--text-muted) !important;
    opacity: 0.55 !important;
}

/* Small Variant */
.form-select-sm + .select2-container .select2-selection--single,
.select2-container--sm .select2-selection--single {
    min-height: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    font-size: 0.825rem !important;
}

.form-select-sm + .select2-container .select2-selection--single .select2-selection__rendered,
.select2-container--sm .select2-selection--single .select2-selection__rendered {
    line-height: 30px !important;
    font-size: 0.825rem !important;
    padding-left: 10px !important;
    padding-right: 32px !important;
}

.form-select-sm + .select2-container .select2-selection--single .select2-selection__arrow,
.select2-container--sm .select2-selection--single .select2-selection__arrow {
    height: 30px !important;
    width: 28px !important;
}

/* Switcher Form Ustadz (Dashboard Guru & Admin Toolbar) */
.guru-switcher-form {
    min-width: 240px;
    max-width: 320px;
}

@media (max-width: 576px) {
    .guru-switcher-form {
        min-width: 100%;
        max-width: 100%;
    }
}

