/* ShiftCore — Searchable select (Phase 13, worker B).
 * Styles for wwwroot/js/searchable-select.js. All selectors use the
 * `ss-` prefix; colours reuse the FitCore theme variables from
 * fitcore.css (with fallbacks, so this file also works standalone).
 * RTL-first: logical properties (inset-inline-*) so the chevron and
 * check mark sit on the correct side in fa/RTL automatically.
 */

/* Wrapper takes the select's place in the layout (full column width). */
.ss-wrap {
    position: relative;
    display: block;
    width: 100%;
}

/* The REAL <select>: kept in the DOM (name/value/id intact, still the
 * posted control, still validated by jQuery Unobtrusive Validation),
 * only visually hidden. NOT display:none — jQuery Validate ignores
 * :hidden elements, and a 1px transparent element is not :hidden. */
.ss-original {
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Visible control. .form-control (Bootstrap + fitcore.css) supplies the
 * border, radius, background and focus ring; only the chevron space
 * and the invalid state are added here. */
.ss-input {
    padding-inline-end: 2.25rem;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.88);
}

.ss-input:focus {
    cursor: text;
}

/* Mirrors jQuery Unobtrusive Validation's .input-validation-error,
 * which lands on the visually-hidden real select. */
.ss-input.ss-invalid {
    border-color: #dc3545;
}

.ss-input.ss-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Decorative chevron (clicks pass through to the input). */
.ss-chevron {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.75rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: #3d5a78;
    font-size: 0.85rem;
    line-height: 1;
}

/* Dropdown list. Phase 9 — the list is appended to <body> and fixed to
 * the viewport (top/left/width/max-height are set inline by the script
 * from the input's rect), so it escapes the glass cards'
 * backdrop-filter stacking contexts that used to slide it under the
 * next card. z-index 1070 sits above Bootstrap modals (1060) and the
 * Jalali date-picker popup (1050). */
.ss-list {
    position: fixed;
    z-index: 1070;
    max-height: 15rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(11, 61, 145, 0.20);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(11, 61, 145, 0.18);
    text-align: start;
}

.ss-list[hidden] {
    display: none;
}

.ss-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #0f2a44;
    cursor: pointer;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ss-item:hover {
    background: rgba(56, 161, 242, 0.10);
}

/* Keyboard-highlighted row. */
.ss-item.ss-active {
    background: #d6e9ff;
}

/* Currently selected row: tinted + check mark at the inline end. */
.ss-item.ss-selected {
    background: rgba(56, 161, 242, 0.10);
    font-weight: 700;
}

.ss-item.ss-selected::after {
    content: "✓";
    margin-inline-start: auto;
    color: #1565d8;
    font-weight: 700;
}

/* Phase 12 duplicate guard: disabled options stay visible with their
 * full label («— قبلاً اضافه شده»), muted, and unpickable. */
.ss-item.ss-disabled {
    color: #8aa0b5;
    cursor: not-allowed;
    background: transparent;
}

.ss-item.ss-disabled:hover {
    background: transparent;
}

/* Empty-filter message row. */
.ss-item.ss-no-results {
    color: #3d5a78;
    cursor: default;
    justify-content: center;
}

.ss-item.ss-no-results:hover {
    background: transparent;
}
