/*
    Select2 CSS - Themed for Bora v3 Design
*/

:root {
    /* SVG Close Icon (default and hover states) */
    --select2-close-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M9 3L3 9M3 3L9 9' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --select2-close-icon-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M9 3L3 9M3 3L9 9' stroke='%23374151' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.select2-container {
    margin: 0;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.select2-container,
.select2-drop,
.select2-search,
.select2-search input {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

/* --- Single Select --- */
.select2-container .select2-choice {
    display: block; height: 36px; padding: 0 0 0 12px; overflow: hidden; position: relative;
    border: 1px solid #d1d5db; white-space: nowrap; line-height: 34px;
    color: #374151; text-decoration: none; background-color: #fff; background-image: none;
    border-radius: 0 !important; -webkit-touch-callout: none; -webkit-user-select: none;
    -moz-user-select: none; -ms-user-select: none; user-select: none;
    transition: border-color .15s ease-in-out;
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: border-box;
}

html[dir="rtl"] .select2-container .select2-choice { padding: 0 12px 0 0; }
.select2-container.select2-drop-above .select2-choice { border-bottom-color: #d1d5db; background-image: none; }
.select2-container.select2-allowclear .select2-choice .select2-chosen { margin-right: 42px; }

.select2-container .select2-choice > .select2-chosen {
    margin-right: 38px; display: block; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis; float: none; width: auto;
}

html[dir="rtl"] .select2-container .select2-choice > .select2-chosen { margin-left: 38px; margin-right: 0; }

/* Clear 'x' button (SVG) */
.select2-container .select2-choice abbr {
    display: none; width: 16px; height: 16px; position: absolute; right: 38px;
    top: 50%; margin-top: -8px; border: 0; cursor: pointer; outline: 0;
    text-decoration: none;
    background-image: var(--select2-close-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
    transition: background-image .15s ease-in-out;
}

.select2-container.select2-allowclear .select2-choice abbr { display: inline-block; }
.select2-container .select2-choice abbr:hover { background-image: var(--select2-close-icon-hover); }

/* Arrow container */
.select2-container .select2-choice .select2-arrow {
    display: inline-block; width: 36px; height: 100%; position: absolute;
    right: 0; top: 0; border-left: 1px solid #d1d5db;
    border-radius: 0 !important; background: #f9fafb; background-image: none;
}

html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
    left: 0; right: auto; border-left: none; border-right: 1px solid #d1d5db;
}

/* SVG Arrow Icon */
.select2-container .select2-choice .select2-arrow b {
    display: block; width: 100%; height: 100%; background: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z' clip-rule='evenodd' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    transition: transform 0.2s ease-in-out;
}

.select2-dropdown-open .select2-choice .select2-arrow b { transform: rotate(180deg); }

.select2-drop-mask {
    border: 0; margin: 0; padding: 0; position: fixed; left: 0; top: 0; min-height: 100%;
    min-width: 100%; height: auto; width: auto; opacity: 0; z-index: 9998;
    background-color: #fff; filter: alpha(opacity=0);
}

/* --- Dropdown --- */
.select2-drop {
    width: 100%; margin-top: -1px; position: absolute; z-index: 9999; top: 100%;
    background: #fff; color: #1f2937; border: 1px solid #d1d5db; border-top: 0;
    border-radius: 0 !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.select2-drop.select2-drop-above {
    margin-top: 1px; border-top: 1px solid #d1d5db; border-bottom: 0;
    box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1), 0 -2px 4px -2px rgb(0 0 0 / 0.1);
}

.select2-drop-active { border-color: #ef4444 !important; }
.select2-drop-auto-width { border-top: 1px solid #d1d5db; width: auto; }

/* --- Search Input --- */
.select2-search {
    display: inline-block; width: 100%; min-height: 26px; margin: 0;
    padding: 4px; position: relative; z-index: 10000; white-space: nowrap;
}

.select2-search input {
    width: 100%; height: 36px !important; min-height: 36px;
    padding: 8px 12px; margin: 0; outline: 0;
    font-family: 'Instrument Sans', sans-serif; font-size: 1em;
    border: 1px solid #d1d5db; border-radius: 0 !important;
    box-shadow: none; background: #fff !important;
}
.select2-search input:focus { border-color: #ef4444; box-shadow: 0 0 0 1px #ef4444; }
.select2-search input.select2-active { background: #fff !important; }

/* --- Active & Open States --- */
.select2-container-active .select2-choice,
.select2-container-active .select2-choices {
    border-color: #ef4444; outline: 0; box-shadow: 0 0 0 1px #ef4444;
}

.select2-dropdown-open .select2-choice {
    border-color: #ef4444; box-shadow: none; background-color: #f9fafb; background-image: none;
}
.select2-dropdown-open.select2-drop-above .select2-choice,
.select2-dropdown-open.select2-drop-above .select2-choices {
    border: 1px solid #ef4444; border-top-color: #d1d5db; background-image: none;
}
.select2-dropdown-open .select2-choice .select2-arrow {
    background: transparent; border-left: 1px solid #d1d5db;
}
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow { border-right: 1px solid #d1d5db; }

.select2-hidden-accessible {
    border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px;
    overflow: hidden; padding: 0; position: absolute; width: 1px;
}

/* --- Results List --- */
.select2-results {
    max-height: 250px; padding: 4px; margin: 0; position: relative;
    overflow-x: hidden; overflow-y: auto; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html[dir="rtl"] .select2-results { padding: 4px; }
.select2-results ul.select2-result-sub { margin: 0; padding-left: 0; }
.select2-results li { list-style: none; display: list-item; background-image: none; }
.select2-results li.select2-result-with-children > .select2-result-label { font-weight: 600; }

.select2-results .select2-result-label {
    padding: 8px 10px; margin: 0; cursor: pointer; min-height: 1em;
    -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
}

.select2-results-dept-1 .select2-result-label { padding-left: 20px }
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
.select2-results-dept-7 .select2-result-label { padding-left: 120px }

.select2-results .select2-highlighted { background: #ef4444; color: #fff; }
.select2-results li em { background: transparent; font-style: normal; text-decoration: underline; font-weight: 600; }
.select2-results .select2-highlighted em { background: transparent; }
.select2-results .select2-highlighted ul { background: #fff; color: #000; }

.select2-results .select2-no-results,
.select2-results .select2-searching,
.select2-results .select2-ajax-error,
.select2-results .select2-selection-limit {
    background: #f9fafb; color: #6b7280; display: list-item; padding: 8px 10px;
}

.select2-results .select2-disabled,
.select2-results .select2-disabled.select2-highlighted {
    color: #9ca3af; background: #f3f4f6; display: list-item; cursor: default;
}
.select2-results .select2-selected { display: none; }
.select2-more-results { background: #f9fafb; display: list-item; }
.select2-more-results.select2-active { background: #f9fafb; }
.select2-results .select2-ajax-error { background: rgba(255, 45, 32, .2); }

/* --- Disabled State --- */
.select2-container.select2-container-disabled .select2-choice {
    background-color: #f3f4f6; border: 1px solid #e5e7eb; cursor: not-allowed; color: #9ca3af;
}
.select2-container.select2-container-disabled .select2-choice .select2-arrow {
    background-color: #f3f4f6; border-left: 1px solid #e5e7eb;
}
.select2-container.select2-container-disabled .select2-choice abbr { display: none; }

/*
--- Multiselect ---
Final version using Flexbox for perfect alignment.
*/
.select2-container-multi .select2-choices {
    height: 36px;
    border: 1px solid #d1d5db;
    padding: 0 5px;
    margin: 0;
    cursor: text;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #fff;
    background-image: none;
    border-radius: 0 !important;
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: border-box;

    /* Flexbox for perfect centering */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
html[dir="rtl"] .select2-container-multi .select2-choices {
    padding-right: 2px;
    padding-left: 5px;
}
.select2-locked { padding: 3px 5px !important; }

.select2-container-multi.select2-container-active .select2-choices {
    border-color: #ef4444; outline: 0; box-shadow: 0 0 0 1px #ef4444;
}

.select2-container-multi .select2-choices li {
    list-style: none;
    margin: 2px 0; /* Provides vertical gap for wrapped lines */
    padding: 0;
    float: none !important; /* Override default float */
}

.select2-container-multi .select2-choices .select2-search-field {
    margin: 0;
    padding: 0;
    white-space: nowrap;
}
.select2-container-multi .select2-choices .select2-search-field input {
    padding: 5px;
    margin: 0;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 100%;
    color: #6b7280;
    outline: 0;
    border: 0;
    box-shadow: none;
    background: transparent !important;
    height: auto; /* Let input size naturally */
    line-height: normal;
}
.select2-default { color: #9ca3af !important; }

.select2-container-multi .select2-choices .select2-search-choice {
    padding: 3px 24px 3px 8px;
    margin: 0 0 0 5px;
    position: relative;
    line-height: 1.5;
    color: #374151;
    cursor: default;
    border: 1px solid #d1d5db;
    border-radius: 0 !important;
    box-shadow: none;
    background-color: #e5e7eb;
    background-image: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice {
    margin: 0 5px 0 0;
    padding: 3px 8px 3px 24px;
}
.select2-container-multi .select2-choices .select2-search-choice-focus {
    background-color: #d1d5db; border-color: #9ca3af;
}

/* Close 'x' on multi-select choice (SVG) */
.select2-search-choice-close {
    display: block; width: 14px; height: 14px; position: absolute;
    right: 5px; top: 50%; margin-top: -7px;
    font-size: 1px; outline: none; background: none; text-decoration: none;
    background-image: var(--select2-close-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}
.select2-search-choice-close:hover { background-image: var(--select2-close-icon-hover); }

html[dir="rtl"] .select2-search-choice-close { right: auto; left: 5px; }

/* Disabled multiselect */
.select2-container-multi.select2-container-disabled .select2-choices {
    background-color: #f3f4f6; border: 1px solid #e5e7eb; cursor: not-allowed;
}
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
    padding: 3px 8px; border: 1px solid #e5e7eb; background-color: #f9fafb; color: #9ca3af;
}
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close {
    display: none;
}

/* --- Final Cleanup --- */
.select2-result-selectable .select2-match,
.select2-result-unselectable .select2-match {
    text-decoration: underline;
}

.select2-offscreen, .select2-offscreen:focus {
    clip: rect(0 0 0 0) !important; width: 1px !important; height: 1px !important;
    border: 0 !important; margin: 0 !important; padding: 0 !important;
    overflow: hidden !important; position: absolute !important; outline: 0 !important;
    left: 0px !important; top: 0px !important;
}
.select2-display-none { display: none; }
.select2-measure-scrollbar {
    position: absolute; top: -10000px; left: -10000px;
    width: 100px; height: 100px; overflow: scroll;
}