/* ============================================
   Standardized Select2 Dropdown Styles
   ============================================ */

/* Force orange color for highlighted options - override any green defaults */
.select2-container--default .select2-results__option--highlighted,
.select2-container--default .select2-results__option[aria-selected="true"].select2-results__option--highlighted,
.select2-dropdown .select2-results__option--highlighted,
.select2-results__option.select2-results__option--highlighted {
    background-color: var(--colorSecondary, #ff9010) !important;
    background: var(--colorSecondary, #ff9010) !important;
    color: #fff !important;
}

/* Force orange hover for options */
.select2-container--default .select2-results__option:hover,
.select2-dropdown .select2-results__option:hover,
.select2-results__option:hover {
    background-color: rgba(255, 144, 16, 0.1) !important;
}

/* Base Select2 Container */
.select2-container {
    width: 100% !important;
}

/* Selection Field Styling */
.select2-container--default .select2-selection--single {
    height: 45px;
    border: 1px solid #ececec;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    background-color: #fff;
    color: #253D4E;
    transition: all 0.3s ease;
}

.select2-container--default .select2-selection--single:hover {
    border-color: var(--colorSecondary, #ff9010);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--colorSecondary, #ff9010);
    box-shadow: 0 0 0 3px rgba(255, 144, 16, 0.1);
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 43px;
    padding-left: 0;
    color: #253D4E;
    font-size: 14px;
    font-weight: 400;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #7E7E7E;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 43px;
    right: 15px;
    top: 1px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #7E7E7E transparent transparent transparent;
    border-width: 6px 5px 0 5px;
    margin-top: -3px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #7E7E7E transparent;
    border-width: 0 5px 6px 5px;
}

/* Dropdown Styling */
.select2-dropdown {
    border: 1px solid #ececec;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    margin-top: 4px;
    background-color: #fff;
    overflow: hidden;
}

/* Search Field in Dropdown */
.select2-search--dropdown {
    padding: 12px;
    background-color: #f8f9fa;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #ececec;
    border-radius: 6px;
    height: 40px;
    padding: 0 15px;
    font-size: 14px;
    transition: all 0.3s ease;
    width: 100%;
    background-color: #fff;
    color: #253D4E;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--colorSecondary, #ff9010);
    box-shadow: 0 0 0 3px rgba(255, 144, 16, 0.1);
    outline: none;
}

/* Results Container */
.select2-results {
    max-height: 300px;
    overflow-y: auto;
}

.select2-results__options {
    padding: 4px 0;
}

/* Options Styling */
.select2-results__option {
    padding: 12px 20px;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #253D4E;
    cursor: pointer;
}

.select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted {
    background-color: var(--colorSecondary, #ff9010) !important;
    background: var(--colorSecondary, #ff9010) !important;
    color: #fff !important;
}

.select2-results__option--selected {
    background-color: rgba(255, 144, 16, 0.1);
    color: var(--colorSecondary, #ff9010);
    font-weight: 500;
}

.select2-results__option:hover,
.select2-container--default .select2-results__option:hover {
    background-color: rgba(255, 144, 16, 0.1) !important;
}

/* Loading State */
.select2-results__option--loading {
    padding: 12px 20px;
    color: #7E7E7E;
}

/* No Results */
.select2-results__message {
    padding: 12px 20px;
    color: #7E7E7E;
    font-style: italic;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #7E7E7E;
    opacity: 0.8;
}

/* Custom Scrollbar for Dropdown */
.select2-results::-webkit-scrollbar {
    width: 8px;
}

.select2-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.select2-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.select2-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Multiple Select Styling */
.select2-container--default .select2-selection--multiple {
    min-height: 45px;
    border: 1px solid #ececec;
    border-radius: 6px;
    padding: 5px 10px;
    background-color: #fff;
    transition: all 0.3s ease;
}

.select2-container--default .select2-selection--multiple:hover {
    border-color: var(--colorSecondary, #ff9010);
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--colorSecondary, #ff9010);
    box-shadow: 0 0 0 3px rgba(255, 144, 16, 0.1);
    outline: none;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--colorSecondary, #ff9010);
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    color: #fff;
    font-size: 13px;
    margin-top: 5px;
    margin-right: 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
    font-size: 16px;
    font-weight: bold;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ff3b3b;
}

/* Dark mode multiple select */
body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--multiple,
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--multiple,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--tblr-bg-surface, #1d2433);
    border-color: var(--tblr-border-color, #313d53);
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--multiple .select2-selection__choice,
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--multiple .select2-selection__choice,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--tblr-primary, #4299e1);
    color: #ffffff;
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default.select2-container--focus .select2-selection--multiple,
.page[data-bs-theme="dark"] ~ * .select2-container--default.select2-container--focus .select2-selection--multiple,
[data-bs-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple,
html[data-bs-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--tblr-primary, #4299e1);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

/* Disabled State */
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
    color: #999;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__rendered {
    color: #999;
}

/* ============================================
   Admin Panel Specific Overrides (Light Mode)
   ============================================ */
.page .select2-container--default .select2-selection--single,
[data-bs-theme="light"] .select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid var(--tblr-border-color, #d0d7de);
    border-radius: 6px;
    background-color: var(--tblr-bg-forms, #ffffff);
    color: var(--tblr-body-color, #1d2939);
}

.page .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-bs-theme="light"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    color: var(--tblr-body-color, #1d2939);
}

.page .select2-container--default .select2-selection--single .select2-selection__arrow,
[data-bs-theme="light"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.page .select2-container--default .select2-selection--single .select2-selection__arrow b,
[data-bs-theme="light"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #6c757d transparent transparent transparent;
}

.page .select2-dropdown,
[data-bs-theme="light"] .select2-dropdown {
    border: 1px solid var(--tblr-border-color, #d0d7de);
    background-color: var(--tblr-bg-surface, #ffffff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page .select2-container--default.select2-container--focus .select2-selection--single,
.page .select2-container--default.select2-container--open .select2-selection--single,
[data-bs-theme="light"] .select2-container--default.select2-container--focus .select2-selection--single,
[data-bs-theme="light"] .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--tblr-primary, #0969da);
    box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb, 9, 105, 218), 0.12);
}

.page .select2-search--dropdown .select2-search__field,
[data-bs-theme="light"] .select2-search--dropdown .select2-search__field {
    background-color: var(--tblr-bg-forms, #ffffff);
    border-color: var(--tblr-border-color, #d0d7de);
    color: var(--tblr-body-color, #1d2939);
}

.page .select2-results__option,
[data-bs-theme="light"] .select2-results__option {
    padding: 8px 12px;
    color: var(--tblr-body-color, #1d2939);
}

.page .select2-results__option--highlighted,
[data-bs-theme="light"] .select2-results__option--highlighted {
    background-color: var(--tblr-primary, #0969da) !important;
    color: #ffffff !important;
}

.page .select2-results__option--selected,
[data-bs-theme="light"] .select2-results__option--selected {
    background-color: var(--tblr-bg-surface-secondary, #f6f8fa);
    color: var(--tblr-primary, #0969da);
    font-weight: 500;
}

/* ============================================
   Dark Mode Support (Admin Panel)
   ============================================ */

/* Apply dark mode when page has dark theme */
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--single {
    background-color: var(--tblr-bg-surface, #1d2433);
    border-color: var(--tblr-border-color, #313d53);
    color: var(--tblr-body-color, #e8eaed);
    height: 38px;
}

.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--single:hover,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single:hover,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single:hover,
body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--single:hover {
    border-color: var(--tblr-border-color-active, #4a5568);
}

.page[data-bs-theme="dark"] ~ * .select2-container--default.select2-container--focus .select2-selection--single,
.page[data-bs-theme="dark"] ~ * .select2-container--default.select2-container--open .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default.select2-container--open .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default.select2-container--open .select2-selection--single,
body:has(.page[data-bs-theme="dark"]) .select2-container--default.select2-container--focus .select2-selection--single,
body:has(.page[data-bs-theme="dark"]) .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--tblr-primary, #4299e1);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
    background-color: var(--tblr-bg-surface, #1d2433);
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--single .select2-selection__rendered,
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--tblr-body-color, #e8eaed);
    line-height: 36px;
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--single .select2-selection__placeholder,
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--single .select2-selection__placeholder,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--tblr-text-muted, #a0aec0);
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--single .select2-selection__arrow,
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--single .select2-selection__arrow,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default .select2-selection--single .select2-selection__arrow b,
.page[data-bs-theme="dark"] ~ * .select2-container--default .select2-selection--single .select2-selection__arrow b,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow b,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--tblr-text-muted, #a0aec0) transparent transparent transparent;
}

/* Dark mode dropdown - most important selector */
body:has(.page[data-bs-theme="dark"]) .select2-dropdown,
.page[data-bs-theme="dark"] ~ * .select2-dropdown,
[data-bs-theme="dark"] .select2-dropdown,
html[data-bs-theme="dark"] .select2-dropdown {
    background-color: var(--tblr-bg-surface, #1d2433) !important;
    border-color: var(--tblr-border-color, #313d53) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-search--dropdown,
.page[data-bs-theme="dark"] ~ * .select2-search--dropdown,
[data-bs-theme="dark"] .select2-search--dropdown,
html[data-bs-theme="dark"] .select2-search--dropdown {
    background-color: var(--tblr-bg-surface-dark, #151924) !important;
    padding: 12px;
    border-bottom: 1px solid var(--tblr-border-color, #313d53) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-search--dropdown .select2-search__field,
.page[data-bs-theme="dark"] ~ * .select2-search--dropdown .select2-search__field,
[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field,
html[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: var(--tblr-bg-forms, #151924) !important;
    border-color: var(--tblr-border-color, #313d53) !important;
    color: var(--tblr-body-color, #e8eaed) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-search--dropdown .select2-search__field:focus,
.page[data-bs-theme="dark"] ~ * .select2-search--dropdown .select2-search__field:focus,
[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field:focus,
html[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--tblr-primary, #4299e1) !important;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2) !important;
    background-color: var(--tblr-bg-forms, #1d2433) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-search--dropdown .select2-search__field::placeholder,
.page[data-bs-theme="dark"] ~ * .select2-search--dropdown .select2-search__field::placeholder,
[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field::placeholder,
html[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--tblr-text-muted, #718096) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-results__option,
.page[data-bs-theme="dark"] ~ * .select2-results__option,
[data-bs-theme="dark"] .select2-results__option,
html[data-bs-theme="dark"] .select2-results__option {
    color: var(--tblr-body-color, #e8eaed) !important;
    padding: 10px 14px;
}

body:has(.page[data-bs-theme="dark"]) .select2-results__option--highlighted,
.page[data-bs-theme="dark"] ~ * .select2-results__option--highlighted,
[data-bs-theme="dark"] .select2-results__option--highlighted,
html[data-bs-theme="dark"] .select2-results__option--highlighted {
    background-color: var(--tblr-primary, #4299e1) !important;
    color: #ffffff !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-results__option--selected,
.page[data-bs-theme="dark"] ~ * .select2-results__option--selected,
[data-bs-theme="dark"] .select2-results__option--selected,
html[data-bs-theme="dark"] .select2-results__option--selected {
    background-color: var(--tblr-bg-surface-secondary, #2d3748) !important;
    color: var(--tblr-primary, #63b3ed) !important;
    font-weight: 500;
}

body:has(.page[data-bs-theme="dark"]) .select2-results__option:hover,
.page[data-bs-theme="dark"] ~ * .select2-results__option:hover,
[data-bs-theme="dark"] .select2-results__option:hover,
html[data-bs-theme="dark"] .select2-results__option:hover {
    background-color: var(--tblr-bg-surface-secondary, #2d3748) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-results__message,
.page[data-bs-theme="dark"] ~ * .select2-results__message,
[data-bs-theme="dark"] .select2-results__message,
html[data-bs-theme="dark"] .select2-results__message {
    color: var(--tblr-text-muted, #a0aec0) !important;
}

body:has(.page[data-bs-theme="dark"]) .select2-container--default.select2-container--disabled .select2-selection--single,
.page[data-bs-theme="dark"] ~ * .select2-container--default.select2-container--disabled .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default.select2-container--disabled .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: var(--tblr-bg-surface-dark, #151924);
    border-color: var(--tblr-border-color, #313d53);
    opacity: 0.5;
}

/* Dark mode scrollbar */
body:has(.page[data-bs-theme="dark"]) .select2-results::-webkit-scrollbar,
.page[data-bs-theme="dark"] ~ * .select2-results::-webkit-scrollbar,
[data-bs-theme="dark"] .select2-results::-webkit-scrollbar,
html[data-bs-theme="dark"] .select2-results::-webkit-scrollbar {
    width: 8px;
}

body:has(.page[data-bs-theme="dark"]) .select2-results::-webkit-scrollbar-track,
.page[data-bs-theme="dark"] ~ * .select2-results::-webkit-scrollbar-track,
[data-bs-theme="dark"] .select2-results::-webkit-scrollbar-track,
html[data-bs-theme="dark"] .select2-results::-webkit-scrollbar-track {
    background: var(--tblr-bg-surface-dark, #151924);
    border-radius: 4px;
}

body:has(.page[data-bs-theme="dark"]) .select2-results::-webkit-scrollbar-thumb,
.page[data-bs-theme="dark"] ~ * .select2-results::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .select2-results::-webkit-scrollbar-thumb,
html[data-bs-theme="dark"] .select2-results::-webkit-scrollbar-thumb {
    background: var(--tblr-border-color, #4a5568);
    border-radius: 4px;
}

body:has(.page[data-bs-theme="dark"]) .select2-results::-webkit-scrollbar-thumb:hover,
.page[data-bs-theme="dark"] ~ * .select2-results::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] .select2-results::-webkit-scrollbar-thumb:hover,
html[data-bs-theme="dark"] .select2-results::-webkit-scrollbar-thumb:hover {
    background: var(--tblr-border-color-active, #5a6678);
}

/* ============================================
   Dark Mode Dropdown Class (Applied via JS)
   ============================================ */
.select2-dropdown.dark-mode-dropdown,
.select2-dropdown[data-bs-theme="dark"] {
    background-color: #1d2433 !important;
    border-color: #313d53 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

.select2-dropdown.dark-mode-dropdown .select2-search--dropdown,
.select2-dropdown[data-bs-theme="dark"] .select2-search--dropdown {
    background-color: #151924 !important;
    border-bottom: 1px solid #313d53 !important;
}

.select2-dropdown.dark-mode-dropdown .select2-search--dropdown .select2-search__field,
.select2-dropdown[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: #151924 !important;
    border-color: #313d53 !important;
    color: #e8eaed !important;
}

.select2-dropdown.dark-mode-dropdown .select2-results__option,
.select2-dropdown[data-bs-theme="dark"] .select2-results__option {
    color: #e8eaed !important;
    background-color: transparent !important;
}

.select2-dropdown.dark-mode-dropdown .select2-results__option--highlighted,
.select2-dropdown[data-bs-theme="dark"] .select2-results__option--highlighted {
    background-color: #4299e1 !important;
    color: #ffffff !important;
}

.select2-dropdown.dark-mode-dropdown .select2-results__option--selected,
.select2-dropdown[data-bs-theme="dark"] .select2-results__option--selected {
    background-color: #2d3748 !important;
    color: #63b3ed !important;
}

.select2-dropdown.dark-mode-dropdown .select2-results__option:hover,
.select2-dropdown[data-bs-theme="dark"] .select2-results__option:hover {
    background-color: #2d3748 !important;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 767px) {
    .select2-container--default .select2-selection--single {
        height: 42px;
    }

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 40px;
        font-size: 13px;
    }

    .select2-results__option {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* ============================================
   Animation
   ============================================ */
.select2-dropdown {
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Native Browser Select Styling (Non-Select2)
   ============================================ */

/* Override browser default green highlighting with brand orange */
select.form-control option:checked,
select.form-control option:hover {
    background-color: #FF9900 !important;
    background: linear-gradient(#FF9900, #FF9900) !important;
    color: white !important;
}

/* Firefox specific */
@-moz-document url-prefix() {
    select.form-control option:checked,
    select.form-control option:hover {
        background-color: #FF9900 !important;
        color: white !important;
    }
}

/* Webkit browsers (Chrome, Safari, Edge) */
select.form-control option:checked {
    background: linear-gradient(#FF9900, #FF9900);
    color: white;
}

/* Additional specificity for stubborn browsers */
.form-group select.form-control option:checked,
.form-group select.form-control option:hover,
.form-group select.form-control option:focus {
    background-color: #FF9900 !important;
    background: #FF9900 !important;
    color: white !important;
}

