/* HOTFIX 15 — global local professional select system */
.wa-smart-select {
    position: relative;
    width: 100%;
    min-width: 0;
    font-family: var(--wa-font, "Estedad", system-ui, sans-serif);
}

.wa-smart-select > select.wa-select-native {
    position: absolute !important;
    inset-inline-start: 0 !important;
    bottom: 0 !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
}

.wa-smart-select__trigger {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    padding: .58rem .75rem;
    border: 1px solid var(--wa-border, #ddd5cf);
    border-radius: var(--wa-radius-sm, 10px);
    background: var(--wa-surface, #fff);
    color: var(--wa-text, #211a16);
    font: inherit;
    text-align: start;
    cursor: pointer;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
}

.wa-smart-select__trigger:hover:not(:disabled),
.wa-smart-select.is-open .wa-smart-select__trigger {
    border-color: var(--wa-primary, #945225);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa-primary, #945225) 12%, transparent);
}

.wa-smart-select__trigger:focus-visible {
    border-color: var(--wa-primary, #945225);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa-primary, #945225) 16%, transparent);
}

.wa-smart-select.is-invalid .wa-smart-select__trigger,
.wa-smart-select__trigger[aria-invalid="true"] {
    border-color: var(--wa-danger, #b42318);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa-danger, #b42318) 10%, transparent);
}

.wa-smart-select.is-disabled .wa-smart-select__trigger,
.wa-smart-select__trigger:disabled {
    opacity: .62;
    cursor: not-allowed;
    background: var(--wa-surface-soft, #f8f5f2);
}

.wa-smart-select__selection {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-wrap: wrap;
    text-align: start;
}

.wa-smart-select:not(.is-multiple) .wa-smart-select__selection {
    display: grid;
    gap: .08rem;
}

.wa-smart-select__selected-title,
.wa-smart-select__selected-meta,
.wa-smart-select__placeholder {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
}

.wa-smart-select__selected-title {
    display: block;
    font-size: .86rem;
    line-height: 1.5;
    font-weight: 850;
    color: var(--wa-text, #211a16);
}

.wa-smart-select__selected-meta {
    display: block;
    font-size: .72rem;
    line-height: 1.55;
    font-weight: 600;
    color: var(--wa-muted, #746a64);
}

.wa-smart-select__placeholder {
    color: var(--wa-muted, #746a64);
    font-size: .82rem;
    font-weight: 650;
}

.wa-smart-select__arrow {
    flex: 0 0 auto;
    font-size: 1.05rem;
    line-height: 1;
    color: var(--wa-muted, #746a64);
    transition: transform .16s ease;
}

.wa-smart-select.is-open .wa-smart-select__arrow { transform: rotate(180deg); }

.wa-smart-select__chip,
.wa-smart-select__more {
    max-width: min(210px, 70%);
    border: 1px solid color-mix(in srgb, var(--wa-primary, #945225) 22%, var(--wa-border, #ddd5cf));
    background: color-mix(in srgb, var(--wa-primary, #945225) 8%, var(--wa-surface, #fff));
    color: var(--wa-text, #211a16);
    border-radius: 999px;
    padding: .18rem .5rem;
    font-size: .7rem;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-smart-select__more {
    max-width: none;
    flex: 0 0 auto;
    color: var(--wa-primary, #945225);
}

.wa-smart-select__panel[hidden] { display: none !important; }

.wa-smart-select__panel {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    direction: rtl;
    overflow: hidden;
    background: var(--wa-surface, #fff);
    color: var(--wa-text, #211a16);
    border: 1px solid var(--wa-border, #ddd5cf);
    border-radius: 14px;
    box-shadow: 0 20px 55px rgba(38, 28, 22, .20);
    font-family: var(--wa-font, "Estedad", system-ui, sans-serif);
}

.wa-smart-select__search-wrap {
    padding: .65rem;
    background: var(--wa-surface, #fff);
    border-bottom: 1px solid var(--wa-border, #e5dfda);
}

.wa-smart-select__search-wrap[hidden] { display: none !important; }

.wa-smart-select__search {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: .52rem .7rem;
    border: 1px solid var(--wa-border, #ddd5cf);
    border-radius: 10px;
    background: var(--wa-surface-soft, #faf8f6);
    color: var(--wa-text, #211a16);
    font: inherit;
    outline: none;
}

.wa-smart-select__search:focus {
    border-color: var(--wa-primary, #945225);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa-primary, #945225) 10%, transparent);
}

.wa-smart-select__actions {
    display: flex;
    justify-content: flex-end;
    gap: .4rem;
    padding: .45rem .65rem;
    border-bottom: 1px solid var(--wa-border, #e5dfda);
    background: var(--wa-surface-soft, #faf8f6);
}

.wa-smart-select__actions[hidden] { display: none !important; }

.wa-smart-select__action {
    appearance: none;
    border: 1px solid var(--wa-border, #ddd5cf);
    border-radius: 8px;
    background: var(--wa-surface, #fff);
    color: var(--wa-text, #211a16);
    padding: .35rem .58rem;
    font: inherit;
    font-size: .7rem;
    font-weight: 750;
    cursor: pointer;
}

.wa-smart-select__action:hover {
    border-color: var(--wa-primary, #945225);
    color: var(--wa-primary, #945225);
}

.wa-smart-select__options {
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding: .35rem;
    scrollbar-width: auto;
    scrollbar-color: color-mix(in srgb, var(--wa-primary, #945225) 58%, #9b8e85) var(--wa-surface-soft, #f4efeb);
}

.wa-smart-select__options::-webkit-scrollbar { width: 12px; }
.wa-smart-select__options::-webkit-scrollbar-track { background: var(--wa-surface-soft, #f4efeb); border-radius: 999px; }
.wa-smart-select__options::-webkit-scrollbar-thumb {
    min-height: 38px;
    border: 3px solid var(--wa-surface-soft, #f4efeb);
    border-radius: 999px;
    background: color-mix(in srgb, var(--wa-primary, #945225) 62%, #9b8e85);
}
.wa-smart-select__options::-webkit-scrollbar-thumb:hover { background: var(--wa-primary, #945225); }

.wa-smart-select__group { display: grid; gap: .16rem; }
.wa-smart-select__group + .wa-smart-select__group { margin-top: .3rem; padding-top: .3rem; border-top: 1px solid var(--wa-border, #e5dfda); }
.wa-smart-select__group-label {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: .4rem .6rem .25rem;
    background: var(--wa-surface, #fff);
    color: var(--wa-muted, #746a64);
    font-size: .68rem;
    font-weight: 850;
}

.wa-smart-select__option {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .62rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--wa-text, #211a16);
    padding: .62rem .7rem;
    font: inherit;
    text-align: start;
    cursor: pointer;
    outline: none;
}

.wa-smart-select__option[hidden] { display: none !important; }
.wa-smart-select__option:disabled { opacity: .45; cursor: not-allowed; }
.wa-smart-select__option:hover:not(:disabled),
.wa-smart-select__option:focus-visible {
    background: color-mix(in srgb, var(--wa-primary, #945225) 8%, var(--wa-surface, #fff));
}
.wa-smart-select__option.is-selected {
    background: color-mix(in srgb, var(--wa-primary, #945225) 13%, var(--wa-surface, #fff));
    box-shadow: inset -3px 0 0 var(--wa-primary, #945225);
}

.wa-smart-select__option-image {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 9px;
    border: 1px solid var(--wa-border, #ddd5cf);
    object-fit: cover;
    background: var(--wa-surface-soft, #faf8f6);
}

.wa-smart-select__option-copy {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: .12rem;
}

.wa-smart-select__option-title,
.wa-smart-select__option-meta {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
}

.wa-smart-select__option-title { font-size: .84rem; line-height: 1.55; font-weight: 850; }
.wa-smart-select__option-meta { font-size: .72rem; line-height: 1.6; color: var(--wa-muted, #746a64); font-weight: 600; }
.wa-smart-select__mark {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: grid;
    place-items: center;
    border: 1px solid var(--wa-border, #ddd5cf);
    border-radius: 7px;
    color: var(--wa-primary, #945225);
    font-size: .72rem;
    font-weight: 900;
}
.wa-smart-select:not(.is-multiple) .wa-smart-select__mark { border-radius: 999px; font-size: .55rem; }
.wa-smart-select__option.is-selected .wa-smart-select__mark {
    border-color: var(--wa-primary, #945225);
    background: color-mix(in srgb, var(--wa-primary, #945225) 10%, var(--wa-surface, #fff));
}

.wa-smart-select__empty {
    padding: 1rem;
    text-align: center;
    color: var(--wa-muted, #746a64);
    font-size: .76rem;
}

.wa-smart-select.is-compact { width: auto; min-width: 76px; }
.wa-smart-select.is-compact .wa-smart-select__trigger { min-height: 36px; padding: .35rem .55rem; gap: .35rem; }
.wa-smart-select.is-compact .wa-smart-select__selected-title,
.wa-smart-select.is-compact .wa-smart-select__placeholder { font-size: .75rem; white-space: nowrap; }
.wa-smart-select.is-compact .wa-smart-select__chip { max-width: 100px; }

/* The global component replaces Select2 presentation. Keep any stale container hidden. */
.wa-smart-select + .select2-container,
.select2-container:has(+ .wa-smart-select) { display: none !important; }

@media (max-width: 640px) {
    .wa-smart-select__trigger { align-items: flex-start; }
    .wa-smart-select__panel { border-radius: 12px; }
    .wa-smart-select__option { padding: .7rem .65rem; }
    .wa-smart-select__option-title { font-size: .81rem; }
    .wa-smart-select__option-meta { font-size: .7rem; }
    .wa-smart-select__actions { justify-content: stretch; }
    .wa-smart-select__action { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .wa-smart-select__trigger,
    .wa-smart-select__arrow { transition: none; }
}
