/* =====================================
   SELECT COMPONENT STYLES
   ===================================== */

@layer components{
    /* ============= Select2 Base Container ============= */
    .select2-container{
        margin-top: 0px;
        min-width: 100px !important;
    }

    /* ============= Select2 Selection Base ============= */
    /* Single and Multiple Selection Base */
    .select2-container .select2-selection.select2-selection--single,.select2-container .select2-selection--multiple{
        border-radius: var(--input-radius);
        border: 1px solid var(--border);
        font-size: var(--font-size-base);
        background-color: var(--surface-primary);
        color: var(--foreground-second);
        font-family: var(--font-family-sans);
    }

    /* Single Selection Specific */
    .select2-selection--single{
        margin: 0px;
        cursor: pointer;
    }

    /* ============= Select2 Arrow Indicator ============= */
    /* Arrow Base */
    .select2-selection__arrow{
        width: 16px;
        height: 16px;
        position: absolute;
        right: 0.6em;
        top: 50%;
        transform: translateY(-50%);
        background-image: url('/client/images/icon_chevron-down.svg');
        background-repeat: no-repeat;
        background-size: 16px 16px;
        /* height: 26px;
        position: absolute;
        top: 3px;
        right: 8px;
        width: 20px; */
    }

    /* Arrow Open State */
    .select2-container--open .select2-selection__arrow{
        transform: rotate(180deg) translateY(50%);
    }

    /* Hide Default Arrow */
    .select2-selection__arrow b{
        display: none;
        /* border-color: var(--foreground-primary) transparent transparent transparent; */
    }

    /* ============= Select2 Selection Content ============= */
    /* Selection Rendered Content */
    .select2-selection__rendered{
        position: relative;
    }

    /* Selection Choice Tags */
    .select2-selection__rendered .select2-selection__choice{
        color: var(--foreground-primary);
        background-color: var(--surface-second);
        border: 1px solid var(--border);
        border-radius: var(--input-radius);
        margin-top: 0px;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    /* Selection Clear Button */
    .select2-selection__rendered .select2-selection__clear{
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0px;
    }

    .select2-container--open{
        border-radius: var(--input-radius);
        border-bottom-left-radius: 0px;
        border-bottom-right-radius: 0px;
        border-color: var(--input-focus-border) !important;
        /* box-shadow: 0 0 0 3px var(--ring) !important; */
    }

    .select2-container--open .select2-selection{
        border-color: var(--input-focus-border) !important;
        border-bottom-left-radius: 0px !important;
        border-bottom-right-radius: 0px !important;
    }

    /* ============= Select2 Dropdown ============= */
    /* Dropdown Container */
    .select2-dropdown{
        border-color: var(--border) !important;
        border-radius: var(--input-radius);
        border-top-left-radius: 0px;
        border-top-right-radius: 0px;
        background-color: var(--surface-primary);
        overflow: hidden;
    }

    .select2-container--open .select2-dropdown{
        border-color: var(--input-focus-border) !important;
        /* box-shadow: 0 0 0 3px var(--ring) !important; */
    }

    /* ============= Select2 Search ============= */
    /* Search Field */
    .select2-dropdown .select2-search__field{
        border: 1px solid var(--border);
        border-radius: var(--input-radius);
        font-size: var(--font-size-base);
        background-color: var(--surface-primary);
        color: var(--foreground-primary);
        font-family: var(--font-family-sans);
        padding: 4px;
    }

    /* Search Field Focus State */
    .select2-dropdown .select2-search__field:focus{
        border: 1px solid var(--input-focus-border);
        outline: none;

        box-shadow: 0 0 0 3px var(--ring) !important;
    }

    /* ============= Select2 Results ============= */
    /* Results Group Header */
    .select2-results__group{
        background-color: var(--surface-third);
        font-size: 1em;
        border-bottom: 1px solid var(--border);
        border-top: 1px solid var(--border);
        color: var(--foreground-primary);
        font-family: var(--font-family-sans);
        font-weight: 600;
    }

    /* Results Option */
    .select2-results__option{
        font-size: 1em;
        color: var(--foreground-primary);
        font-family: var(--font-family-sans);
    }

    /* Results Option Highlighted State */
    .select2-results__option--highlighted{
        background-color: var(--primary-light);
        color: var(--primary);
    }

    /* ============= Native Select Styles ============= */
    /* Native Select (Non-Select2) */
    select:not(.select2-hidden-accessible) {
        border-radius: var(--input-radius) !important;
        border: 1px solid var(--border) !important;
        font-size: var(--font-size-base) !important;
        color: var(--foreground-primary) !important;
        background: var(--surface-primary); 
        font-weight: 400 !important;
        padding: 0 2.5em 0 1em;
        
        appearance: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        
        background-image: url('/client/images/icon_chevron-down.svg');
        background-repeat: no-repeat;
        background-position: calc(100% - 0.6em) center; 
        background-size: 16px 16px;
    }

    /* Native Select Focus State */
    select:not(.select2-hidden-accessible):focus {
        border: 1px solid var(--input-focus-border) !important;
        outline: none !important;

        box-shadow: 0 0 0 3px var(--ring) !important;
    }

    /* ============= Misc ============= */
    #policy-revision-changer .select2-container .select2-selection--single{
        height: auto;
    }
}
