/*
 * Searchable select (combo-select.js). The visible input reuses the classes of the
 * native select, so it keeps the same size, border and radius as the other fields.
 */

.ux-combo__native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ux-combo { position: relative; }

.ux-combo__input {
    padding-right: 44px !important;
    color: var(--ux-ink, #26251E) !important;
    cursor: pointer;
}

.ux-combo.is-open .ux-combo__input { cursor: text; border-color: var(--ux-ink, #26251E) !important; }
.ux-combo__input::placeholder { color: var(--ux-muted, #807D72); opacity: 1; }
.ux-combo.is-open .ux-combo__input::placeholder { color: var(--ux-muted-soft, #A09C92); }
.ux-combo__input.is-invalid { border-color: #EF4444 !important; }
.ux-combo__input:disabled { cursor: not-allowed; opacity: .6; }

/* Magnifier while open, chevron while closed */
.ux-combo__chevron {
    position: absolute;
    top: 0;
    right: 6px;
    bottom: 6px;
    display: grid;
    place-items: center;
    width: 36px;
    cursor: pointer;
    color: var(--ux-muted, #807D72);
}

.ux-combo__chevron::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border: solid currentColor;
    border-width: 0 1.6px 1.6px 0;
    transform: rotate(45deg);
    transition: transform .2s var(--ux-ease, ease);
}

.ux-combo.is-open .ux-combo__chevron::before { margin-top: 4px; transform: rotate(-135deg); }

.ux-combo__list {
    position: absolute;
    z-index: 40;
    top: calc(100% - 2px);
    left: 0;
    right: 0;
    max-height: 288px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    border: 1px solid var(--ux-line, #E6E5E0);
    border-radius: 12px;
    background: #FFF;
    box-shadow: 0 18px 40px -18px rgba(38, 37, 30, .35);
    animation: ux-combo-in .16s var(--ux-ease, ease) both;
}

.ux-combo.is-up .ux-combo__list { top: auto; bottom: calc(100% + 4px); }
.ux-combo__list[hidden] { display: none; }

@keyframes ux-combo-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.ux-combo__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.3;
    color: var(--ux-ink, #26251E);
    cursor: pointer;
}

.ux-combo__option.is-active { background: var(--ux-canvas, #F7F7F4); }

.ux-combo__option[aria-selected="true"] { font-weight: 600; }

.ux-combo__option[aria-selected="true"]::after {
    content: "";
    width: 5px;
    height: 10px;
    margin: 0 4px 3px auto;
    border: solid var(--ux-accent, #F54E00);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Separator after the pinned options (Peru) */
.ux-combo__option.is-last-pinned { position: relative; margin-bottom: 9px; }

.ux-combo__option.is-last-pinned::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: -5px;
    height: 1px;
    background: var(--ux-line, #E6E5E0);
}

.ux-combo__code {
    flex: none;
    min-width: 30px;
    padding: 1px 0;
    border-radius: 4px;
    font-family: var(--ux-mono, ui-monospace, monospace);
    font-size: 11px;
    letter-spacing: .04em;
    text-align: center;
    color: var(--ux-muted, #807D72);
    background: var(--ux-canvas, #F7F7F4);
}

.ux-combo__code:empty { display: none; }

.ux-combo__option.is-active .ux-combo__code { background: #FFF; }

.ux-combo__text mark {
    padding: 0;
    font-weight: 600;
    color: inherit;
    background: none;
    box-shadow: inset 0 -2px 0 var(--ux-accent, #F54E00);
}

.ux-combo__empty { padding: 12px 10px; font-size: 14px; color: var(--ux-muted, #807D72); }

/* Peru: live RUC / DNI hint under the tax ID (ubigeo-pe.js) */
.ux-taxhint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 6px;
    font-size: 12.5px;
    color: var(--ux-muted, #807D72);
}

.ux-taxhint[hidden] { display: none; }
.ux-taxhint.is-ok { color: #15803D; }
.ux-taxhint.is-bad { color: #B91C1C; }

.ux-taxhint.is-ok::before {
    content: "";
    width: 5px;
    height: 9px;
    margin: 0 3px 3px 2px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ux-taxhint.is-bad::before {
    content: "!";
    display: grid;
    place-items: center;
    width: 14px;
    height: 14px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    color: #FFF;
    background: currentColor;
}

/* Peru: province + district side by side (ubigeo-pe.js) */
.ux-ubigeo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 640px) {
    .ux-ubigeo { grid-template-columns: 1fr; gap: 0; }
    .ux-combo__list { max-height: 240px; }
    .ux-combo__option { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .ux-combo__list { animation: none; }
    .ux-combo__chevron::before { transition: none; }
}
