/* ──────────────────────────────────────────────────────────────
   player-search.css — the shared <PlayerSearch> picker
   (Components/Shared/PlayerSearch.razor) and anything that renders
   a resolved player the same way.
   Results float in a ranks-dropdown-menu panel instead of pushing the
   page down, and a picked player collapses to an input-height chip.
   New classes are prefixed `.player-search-*`.

   Sizing: rely on Bootstrap `fs-*` and `small` — do NOT add font-size.
   ────────────────────────────────────────────────────────────── */

.player-search {
    position: relative;
}

/* ── Field: icon and spinner sit inside the input ─────────────── */
.player-search-field {
    position: relative;
}

/* .form-control's backdrop-filter makes the input a stacking context, so the
   icon needs a z-index to paint over it (same trap as .inv-search). */
.player-search-icon {
    position: absolute;
    top: 50%;
    left: 0.85rem;
    z-index: 1;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.player-search-field > .form-control {
    padding-left: 2.35rem;
    padding-right: 2.35rem;
}

/* Centred with a margin: the spinner animates its own transform. */
.player-search-spinner {
    position: absolute;
    top: 50%;
    right: 0.85rem;
    z-index: 1;
    margin-top: -0.5rem;
}

/* ── Floating result panel ─────────────────────────────────────── */
.player-search-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 1000;
    width: max(100%, 20rem);
    padding: 0.3rem;
    color: #fff;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
    animation: playerSearchIn 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}

/* js/player-search.js lifts the panel into the top layer and places it against
   the viewport, so modal scroll boxes and glass cards cannot clip or cover it. */
.player-search-panel:popover-open {
    position: fixed;
    inset: auto;
    margin: 0;
    overflow: visible;
}

/* Fallback while the panel is still in flow: glass surfaces are stacking
   contexts, so lift the one holding the panel above the cards after it. */
:is(.glass-card, .bans-filter-card):has(.player-search-panel) {
    position: relative;
    z-index: 3;
}

@keyframes playerSearchIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Positioned so option offsets are relative to the list when scrolling to the active one. */
.player-search-list {
    position: relative;
    max-height: 16.5rem;
    overflow-y: auto;
}

.player-search-option {
    padding: 0.4rem 0.55rem;
    cursor: pointer;
}

.trades-avatar.player-search-avatar {
    width: 28px;
    height: 28px;
}

.player-search-badge {
    flex-shrink: 0;
    max-width: 10rem;
    overflow: hidden;
    padding: 0.05rem 0.5rem;
    border: 1px solid rgba(13, 202, 240, 0.35);
    border-radius: 50rem;
    background: rgba(13, 202, 240, 0.1);
    color: #0dcaf0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-search-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.6rem;
    color: rgba(255, 255, 255, 0.6);
}

.player-search-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    margin-top: 0.3rem;
    padding: 0.4rem 0.55rem 0.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.45);
}

.player-search-kbd {
    display: inline-block;
    min-width: 1.3rem;
    margin-right: 0.2rem;
    padding: 0 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.3rem;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* ── Picked player: a .form-control, so it is exactly input height ── */
.form-control.player-search-token {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-search-token-avatar {
    flex-shrink: 0;
    width: 1.45em;
    height: 1.45em;
    border: 1px solid rgba(13, 202, 240, 0.35);
    border-radius: 50%;
    object-fit: cover;
}

.player-search-token-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    color: #fff;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Zero basis, so the SteamID gives way before the name does. */
.player-search-token-id {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.45);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-search-token-action {
    flex-shrink: 0;
    padding: 0 0.15rem;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-search-token-action:hover {
    color: #0dcaf0;
}

.player-search-token-action.is-clear:hover {
    color: rgb(255, 19, 19);
}

/* ── A resolved player as a clickable pill (GlobalBans "did you mean") ── */
.player-search-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.85rem 0.3rem 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50rem;
    background: rgba(15, 22, 33, 0.7);
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-search-pill:hover {
    border-color: rgba(13, 202, 240, 0.6);
    background: rgba(13, 202, 240, 0.1);
    transform: translateY(-2px);
}
