/* Searchable lookup selects — shared by public site and admin panels */

.tb-lookup-wrap,
.tb-clearable-select-wrap {
    position: relative;
    width: 100%;
}

.tb-lookup-wrap > select[data-tb-lookup-enhanced="1"],
.tb-lookup-wrap > select[data-tb-local-search-enhanced="1"] {
    display: none !important;
}

.tb-lookup-display {
    width: 100%;
    border-radius: var(--radius-md, 0.5rem);
    border: 1px solid #cbd5e1;
    background: #fff;
    padding: 0.625rem 2.25rem 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--color-text, #0f172a);
    color-scheme: light;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tb-lookup-display::placeholder {
    color: #94a3b8;
    -webkit-text-fill-color: #94a3b8;
    opacity: 1;
}

.tb-lookup-display:focus {
    outline: none;
    border-color: var(--color-cta, #0369a1);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.15);
}

.tb-lookup-panel {
    position: absolute;
    z-index: 50;
    top: calc(100% + 0.25rem);
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    color-scheme: light;
}

.tb-lookup-panel.is-floating {
    position: fixed;
    z-index: 9050;
    top: auto;
    right: auto;
    left: auto;
}

.tb-lookup-panel.is-open-up {
    box-shadow: 0 -8px 25px rgba(15, 23, 42, 0.1);
}

.tb-lookup-panel.hidden {
    display: none !important;
}

.tb-lookup-list {
    max-height: 14rem;
    overflow-y: auto;
}

.tb-lookup-item,
.tb-lookup-empty,
.tb-lookup-loading {
    display: block;
    width: 100%;
    text-align: right;
    padding: 0.65rem 0.85rem;
    border: 0;
    background: transparent;
    font-size: 0.875rem;
    color: #334155;
    cursor: pointer;
}

.tb-lookup-item:hover,
.tb-lookup-item.is-selected,
.tb-lookup-item.is-active {
    background: #eff6ff;
    color: #1d4ed8;
}

.tb-lookup-item.is-active {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: -2px;
}

.tb-lookup-empty,
.tb-lookup-loading {
    cursor: default;
    color: #64748b;
}

.tb-clearable-select-wrap .tb-clearable-select__btn,
.tb-lookup-wrap .tb-lookup-clear {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
}

.tb-clearable-select-wrap .tb-clearable-select__btn:hover,
.tb-lookup-wrap .tb-lookup-clear:hover {
    color: #64748b;
    background: #f1f5f9;
}

/*
 * Public / light surfaces (landing, auth, registration): always match .form-input.
 * Panels are portaled to <body>, so mark them with .tb-lookup--light-surface in JS.
 * Use !important so html[data-theme=dark] input rules on .landing-page cannot paint these dark.
 */
html[data-theme="dark"] .landing-page .tb-lookup-display,
html[data-theme="dark"] .auth-shell .tb-lookup-display,
html[data-theme="dark"] .registration-form .tb-lookup-display,
html[data-theme="dark"] .tb-lookup--light-surface .tb-lookup-display,
.tb-lookup--light-surface .tb-lookup-display,
.tb-lookup-display.tb-lookup--light-surface,
.landing-page .tb-lookup-display,
.auth-shell .tb-lookup-display,
.registration-form .tb-lookup-display {
    background: #fff !important;
    border-color: #cbd5e1 !important;
    color: var(--color-text, #0f172a) !important;
    -webkit-text-fill-color: var(--color-text, #0f172a);
    caret-color: var(--color-text, #0f172a);
    color-scheme: light;
}

html[data-theme="dark"] .landing-page .tb-lookup-display::placeholder,
html[data-theme="dark"] .auth-shell .tb-lookup-display::placeholder,
html[data-theme="dark"] .registration-form .tb-lookup-display::placeholder,
html[data-theme="dark"] .tb-lookup--light-surface .tb-lookup-display::placeholder,
.tb-lookup--light-surface .tb-lookup-display::placeholder,
.tb-lookup-display.tb-lookup--light-surface::placeholder,
.landing-page .tb-lookup-display::placeholder,
.auth-shell .tb-lookup-display::placeholder,
.registration-form .tb-lookup-display::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
}

html[data-theme="dark"] .landing-page .tb-lookup-panel,
html[data-theme="dark"] .auth-shell .tb-lookup-panel,
html[data-theme="dark"] .registration-form .tb-lookup-panel,
html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface,
.tb-lookup-panel.tb-lookup--light-surface,
.landing-page .tb-lookup-panel,
.auth-shell .tb-lookup-panel,
.registration-form .tb-lookup-panel {
    background: #fff !important;
    border-color: #e2e8f0 !important;
    color-scheme: light;
}

html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item,
html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-empty,
html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-loading,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-empty,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-loading {
    color: #334155 !important;
}

html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item:hover,
html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item.is-selected,
html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item.is-active,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item:hover,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item.is-selected,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-item.is-active {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
}

html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-empty,
html[data-theme="dark"] .tb-lookup-panel.tb-lookup--light-surface .tb-lookup-loading,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-empty,
.tb-lookup-panel.tb-lookup--light-surface .tb-lookup-loading {
    color: #64748b !important;
}

/*
 * Admin dark theme:
 * - display stays under .admin-app
 * - panel is often portaled to <body>, so exclude .tb-lookup--light-surface
 */
html[data-theme="dark"] .admin-app .tb-lookup-display {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
    color-scheme: dark;
}

html[data-theme="dark"] .admin-app .tb-lookup-panel,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) {
    background: #1e293b;
    border-color: #334155;
    color-scheme: dark;
}

html[data-theme="dark"] .admin-app .tb-lookup-panel .tb-lookup-item,
html[data-theme="dark"] .admin-app .tb-lookup-panel .tb-lookup-empty,
html[data-theme="dark"] .admin-app .tb-lookup-panel .tb-lookup-loading,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) .tb-lookup-item,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) .tb-lookup-empty,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) .tb-lookup-loading {
    color: #e2e8f0;
}

html[data-theme="dark"] .admin-app .tb-lookup-panel .tb-lookup-item:hover,
html[data-theme="dark"] .admin-app .tb-lookup-panel .tb-lookup-item.is-selected,
html[data-theme="dark"] .admin-app .tb-lookup-panel .tb-lookup-item.is-active,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) .tb-lookup-item:hover,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) .tb-lookup-item.is-selected,
html[data-theme="dark"] .tb-lookup-panel.is-floating:not(.tb-lookup--light-surface) .tb-lookup-item.is-active {
    background: rgba(3, 105, 161, 0.25);
    color: #7dd3fc;
}
