/* ═══════════════════════════════════════════════════════════════
   Choices.js — Centralized Styles
   ═══════════════════════════════════════════════════════════════ */

.choices {
    margin-bottom: 0;
    position: relative;
}

.choices.is-open {
    z-index: 200;
}

.choices__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-4) !important; /* CDN uses higher specificity */
    min-height: var(--space-10);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    outline: none;
}

.choices__inner:hover {
    border-color: var(--primary-color);
}

.choices.is-focused .choices__inner,
.choices:focus-within .choices__inner {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.choices[data-type="select-one"]:focus-within:not(.is-open) .choices__inner:has(.choices__item[data-value=""]) {
    border-color: var(--border);
    box-shadow: none;
}

.choices:not(.is-focused) .choices__inner {
    box-shadow: none;
    outline: none;
}


/* ── Single select ── */
.choices[data-type*="select-one"] .choices__inner {
    height: var(--space-10);
    min-height: var(--space-10);
}

.choices[data-type*="select-one"]::after {
    display: none;
}

.choices[data-type*="select-one"] .choices__button,
.choices__clear-all {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-end: var(--space-2);
    width: calc(18px * var(--space-scale));
    height: calc(18px * var(--space-scale));
    border-radius: 50%;
    border: none;
    background: var(--text-secondary);
    background-image: none;
    cursor: pointer;
    opacity: 0.5;
    z-index: 5;
    padding: 0;
    margin: 0;
    font-size: 0;
    text-indent: 0;
}

.choices[data-type*="select-one"] .choices__button::before,
.choices[data-type*="select-one"] .choices__button::after,
.choices__clear-all::before,
.choices__clear-all::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(10px * var(--space-scale));
    height: 1.5px;
    background: white;
    border-radius: 1px;
}

.choices[data-type*="select-one"] .choices__button::before,
.choices__clear-all::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.choices[data-type*="select-one"] .choices__button::after,
.choices__clear-all::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.choices[data-type*="select-one"] .choices__button:hover,
.choices__clear-all:hover {
    opacity: 1;
    box-shadow: none;
}

.choices[data-type*="select-one"] .choices__button:focus {
    box-shadow: none;
}

.choices__list--single {
    padding: 0;
}

.choices__list--single .choices__item {
    padding: 0;
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: normal;
}

/* ── Multi select ── */
.choices__list--multiple {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
}

.choices__list--multiple .choices__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: var(--primary-dark);
    color: white;
    border-radius: var(--radius-xs);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border: none;
    margin: 0;
    line-height: 1.3;
}

.choices__list--multiple .choices__item:hover {
    background: var(--primary-color);
}

/* Driver chip accent style */
.choices__list--multiple .choices__item.driver-chip {
    background: var(--accent);
    gap: var(--space-1);
}
.choices__list--multiple .choices__item.driver-chip:hover {
    background: var(--accent-light);
}
.driver-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

/* Delete button on chips */
.choices__list--multiple .choices__item .choices__button {
    background: var(--white-20);
    border: none;
    border-radius: 50%;
    width: calc(14px * var(--space-scale));
    height: calc(14px * var(--space-scale));
    margin: 0;
    padding: 0;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.7;
    font-size: 0;
    background-image: none;
}

.choices__list--multiple .choices__item .choices__button::before,
.choices__list--multiple .choices__item .choices__button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--space-2);
    height: 1.5px;
    background: white;
    border-radius: 1px;
}

.choices__list--multiple .choices__item .choices__button::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.choices__list--multiple .choices__item .choices__button::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.choices__list--multiple .choices__item .choices__button:hover {
    background: var(--white-30);
    opacity: 1;
}


/* ── Input ── */
.choices__input {
    background: transparent;
    color: var(--text-primary);
    font-size: var(--text-sm);
    border: none;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 0 !important;
}

.choices__input::placeholder {
    color: var(--text-secondary);
    opacity: 1;
}

/* ── Placeholder ── */
.choices__placeholder,
.choices__item--selectable[data-value=""] {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    opacity: 1 !important; /* CDN sets .choices__placeholder { opacity: .5 } */
}

/* Hide placeholder when multi-select has items selected */
.choices.has-selection .choices__placeholder {
    display: none;
}
.choices.has-selection .choices__input::placeholder {
    color: transparent;
}

/* ── Dropdown ── */
.choices__list--dropdown,
.choices__list[aria-expanded] {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    box-shadow: var(--shadow-md);
    z-index: 200;
}

.choices__list--dropdown.is-active {
    animation: choicesDropdownSlide 0.2s ease-out;
}

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

.choices__list--dropdown .choices__item--selectable,
.choices__list[aria-expanded] .choices__item--selectable {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: background-color 0.15s;
}

.choices__list--dropdown .choices__item--selectable:hover,
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable:hover,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: var(--accent-glow);
    color: var(--text-primary);
}

.choices__list--dropdown .choices__item--selectable.is-selected,
.choices__list[aria-expanded] .choices__item--selectable.is-selected {
    background-color: var(--black-10);
}

/* Hide empty placeholder options */
.choices__list--dropdown [data-value=""] {
    display: none;
}

/* ── RTL ── */
[dir="rtl"] .choices[data-type*="select-one"]::after {
    right: auto;
    left: calc(11.5px * var(--space-scale));
}

[dir="rtl"] .choices[data-type*="select-one"] .choices__inner {
    padding-right: calc(7.5px * var(--space-scale));
    padding-left: calc(31.5px * var(--space-scale));
}
