/* ===================================================
   Select2 Custom Styling - DreamPOS Themeforest Integration
   Primary Color: #FF9F43 (Golden/Yellow Orange)
   Version: 2.0 - Full Themeforest Compatibility
   =================================================== */

/* Base Container - Exact Themeforest Match */
.select2-container {
    min-width: 100% !important;
    width: auto !important;
    z-index: 99;
}

.select2-container .select2-selection--single {
    height: 40px;
}

.select2-container .select2-selection--multiple {
    min-height: 40px;
}

/* Default Selection Box - Themeforest Styling */
.select2-container--default .select2-selection--single {
    border: 1px solid rgba(145, 158, 171, 0.32);
    border-radius: 5px;
    background: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #637381;
    line-height: 40px;
    border-radius: 5px;
    padding-left: 12px;
    padding-right: 32px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #919EAB;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 6px;
    width: 20px;
}

/* Focus State - Golden Border (CRITICAL - Override Bootstrap Blue) */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    background: #fff !important;
    border-color: #FF9F43 !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 159, 67, 0.25) !important;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #FF9F43 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 159, 67, 0.25) !important;
}

/* Dropdown Container - Themeforest Style */
.select2-dropdown {
    border: 1px solid rgba(145, 158, 171, 0.32) !important;
    border-radius: 5px;
    box-shadow: 0 5px 10px rgba(30, 32, 37, 0.12);
    z-index: 9999;
}

.select2-container--open .select2-dropdown {
    border-top-color: #FF9F43 !important;
    border-color: #FF9F43 !important;
}

.select2-results {
    padding: 0;
}

/* Dropdown Options - Exact Template Matching */
.select2-results__options {
    max-height: 250px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

.select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
    color: #637381;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Highlighted Option - Golden Background (CRITICAL Themeforest Feature) */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option[aria-selected],
.select2-container--default .select2-results__option--highlighted {
    background: #FF9F43 !important;
    color: #fff !important;
}

/* Selected option in dropdown */
.select2-container--default .select2-results__option[aria-selected=true] {
    background: #f4f6f8;
    color: #212B36;
    font-weight: 500;
}

.select2-container--default .select2-results__option[aria-selected=true]:hover {
    background: #FF9F43 !important;
    color: #fff !important;
}

/* Disabled option */
.select2-container--default .select2-results__option[aria-disabled=true] {
    color: #919EAB;
    cursor: not-allowed;
    background: transparent;
}

.select2-container--default .select2-results__option[aria-disabled=true]:hover {
    background: transparent;
}

/* Group Labels */
.select2-container--default .select2-results__group {
    font-weight: 700;
    padding: 8px 12px;
    color: #212B36;
    font-size: 13px;
    background: #f9fafb;
}

/* Multiple Selection - Golden Tags */
.select2-container--default .select2-selection--multiple {
    border: 1px solid rgba(145, 158, 171, 0.32);
    border-radius: 5px;
    background: #fff;
    padding: 4px 8px;
    min-height: 40px;
    cursor: text;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    list-style: none;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #FF9F43;
    border: 1px solid #FF9F43;
    border-radius: 4px;
    color: #fff;
    padding: 4px 8px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    line-height: 1.5;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 6px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    opacity: 0.8;
}

/* Search Input in Dropdown - GOLDEN FOCUS (Override Bootstrap Blue) */
.select2-search--dropdown {
    padding: 8px;
    background: #f9fafb;
    border-bottom: 1px solid rgba(145, 158, 171, 0.32);
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid rgba(145, 158, 171, 0.32) !important;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
    width: 100%;
    outline: none !important;
    color: #637381;
    box-shadow: none !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: #FF9F43 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 159, 67, 0.25) !important;
    outline: none !important;
}

/* Inline Search (Multiple Select) */
.select2-container .select2-search--inline {
    flex-grow: 1;
}

.select2-container .select2-search--inline .select2-search__field {
    padding: 4px 0;
    margin: 0;
    font-size: 14px;
    border: none;
    outline: none;
    background: transparent;
    color: #637381;
    min-width: 5em;
}

.select2-container .select2-search--inline .select2-search__field::placeholder {
    color: #919EAB;
}

/* Loading State */
.select2-results__message {
    padding: 8px 12px;
    color: #637381;
    font-size: 14px;
}

/* Arrow Icon - Golden When Open */
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #919EAB transparent transparent transparent;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    height: 0;
    left: 50%;
    margin-left: -4px;
    margin-top: -2px;
    position: absolute;
    top: 50%;
    width: 0;
}

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

/* Clear Button - Golden on Hover */
.select2-container--default .select2-selection__clear {
    color: #919EAB;
    font-weight: bold;
    margin-right: 10px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.select2-container--default .select2-selection__clear:hover {
    color: #FF9F43;
}

/* Modal Compatibility - Critical Z-Index Management */
.modal .select2-container {
    z-index: 1056;
}

.modal .select2-dropdown {
    z-index: 1057;
}

/* Form Control Integration */
.form-control.select2-hidden-accessible + .select2-container {
    width: 100% !important;
}

/* Small Select Variant */
.select2-container--default.select2-container--small .select2-selection--single {
    height: 32px;
    font-size: 13px;
}

.select2-container--default.select2-container--small .select2-selection--single .select2-selection__rendered {
    line-height: 32px;
    padding-left: 10px;
}

.select2-container--default.select2-container--small .select2-selection--single .select2-selection__arrow {
    height: 32px;
}

/* Large Select Variant */
.select2-container--default.select2-container--large .select2-selection--single {
    height: 48px;
    font-size: 16px;
}

.select2-container--default.select2-container--large .select2-selection--single .select2-selection__rendered {
    line-height: 48px;
    padding-left: 14px;
}

.select2-container--default.select2-container--large .select2-selection--single .select2-selection__arrow {
    height: 48px;
}

/* Dark Theme Support - Themeforest Dark Mode */
body[data-theme=dark] .select2-container--default .select2-selection--single,
body[data-theme=dark] .select2-container--default .select2-selection--multiple {
    background: #1d1d42 !important;
    border-color: #26264e;
}

body[data-theme=dark] .select2-container--default .select2-selection--single .select2-selection__rendered,
body[data-theme=dark] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #97A2D2;
}

body[data-theme=dark] .select2-dropdown {
    background: #1d1d42;
    border-color: #26264e;
}

body[data-theme=dark] .select2-results__option {
    color: #97A2D2;
    background: #1d1d42;
}

body[data-theme=dark] .select2-container--default .select2-results__option--highlighted[aria-selected],
body[data-theme=dark] .select2-container--default .select2-results__option--highlighted {
    background: #FF9F43 !important;
    color: #fff !important;
}

body[data-theme=dark] .select2-container--default .select2-results__option[aria-selected=true] {
    background: #26264e;
    color: #97A2D2;
}

body[data-theme=dark] .select2-search--dropdown {
    background: #26264e;
    border-bottom-color: #404066;
}

body[data-theme=dark] .select2-search--dropdown .select2-search__field {
    background: #1d1d42;
    border-color: #404066;
    color: #97A2D2;
}

body[data-theme=dark] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #FF9F43;
    border-color: #FF9F43;
}

body[data-theme=dark] .select2-container--default .select2-results__group {
    background: #26264e;
    color: #97A2D2;
}

/* Responsive Design - Mobile Optimization */
@media (max-width: 768px) {
    .select2-container .select2-selection--single {
        height: 38px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 38px;
        font-size: 14px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 38px;
    }
    
    .select2-dropdown {
        font-size: 14px;
    }
    
    .select2-results__option {
        padding: 10px 12px;
    }
}

@media (max-width: 576px) {
    .select2-container .select2-selection--single {
        height: 36px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 36px;
        font-size: 13px;
        padding-left: 10px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 36px;
    }
}

/* RTL (Right-to-Left) Support */
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 32px;
    padding-right: 12px;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    left: 6px;
    right: auto;
}

[dir="rtl"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin-left: 4px;
    margin-right: 0;
}

[dir="rtl"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    margin-left: 6px;
    margin-right: 0;
}

/* Accessibility Improvements */
.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--multiple:focus {
    outline: 2px solid #FF9F43;
    outline-offset: 2px;
}

.select2-container--default .select2-results__option[aria-selected]:focus {
    outline: 2px solid #FF9F43;
    outline-offset: -2px;
}

/* Animation & Transitions */
.select2-dropdown {
    animation: select2FadeIn 0.15s ease-in-out;
}

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

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    animation: tagFadeIn 0.2s ease-in-out;
}

@keyframes tagFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Validation States */
.is-invalid ~ .select2-container--default .select2-selection--single,
.is-invalid ~ .select2-container--default .select2-selection--multiple {
    border-color: #dc3545;
}

.is-invalid ~ .select2-container--default.select2-container--focus .select2-selection--single,
.is-invalid ~ .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.is-valid ~ .select2-container--default .select2-selection--single,
.is-valid ~ .select2-container--default .select2-selection--multiple {
    border-color: #28a745;
}

.is-valid ~ .select2-container--default.select2-container--focus .select2-selection--single,
.is-valid ~ .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

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

.select2-container--default.select2-container--disabled .select2-selection__choice {
    opacity: 0.65;
}

/* Print Styles */
@media print {
    .select2-container {
        display: none;
    }
    
    select.select2-hidden-accessible {
        display: inline-block !important;
        visibility: visible !important;
        position: relative !important;
        opacity: 1 !important;
    }
}

/* ===================================================
   END OF THEMEFOREST-COMPATIBLE SELECT2 GOLDEN THEME
   =================================================== */
