/* team_lobby.css - 2v2 lobby: team panel, per-slot swap buttons, queue toggle.
   Deliberately static (no infinite animations) so it adds no idle GPU/CPU cost. */

/* One place to change the team colours everywhere (lobby, scoreboard, mobile banner, results). */
:root {
    --team1-rgb: 248, 113, 113;   /* Team 1: red  */
    --team2-rgb: 96, 165, 250;    /* Team 2: blue */
}

#lobby-player-list .lobby-players-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 10px;
}

#lobby-player-list .lobby-players-header h3 {
    margin: 0;
}

/* ---- Queue toggle (Shuffle / Manual) ---- */
.queue-controls,
.queue-first-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: #cbd5e1;
}

.queue-first-row {
    display: flex;
    margin: 0 0 10px;
}

.queue-segmented {
    display: inline-flex;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.55);
}

.queue-segmented button {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    padding: 5px 12px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
}

.queue-segmented button + button {
    border-left: 1px solid rgba(148, 163, 184, 0.25);
}

.queue-segmented button.is-active {
    background: linear-gradient(145deg, #7c3aed, #4f46e5);
    color: #fff;
}

.queue-segmented button:disabled {
    cursor: default;
    opacity: 0.75;
}

.queue-segmented button:not(:disabled):not(.is-active):hover {
    background: rgba(148, 163, 184, 0.18);
}

/* ---- Team panel ---- */
.team-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: stretch;
}

.team-column {
    --team-color: var(--team1-rgb);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(var(--team-color), 0.55);
    background: rgba(var(--team-color), 0.07);
    min-width: 0;
}

.team-column.team-2 {
    --team-color: var(--team2-rgb);
}

.team-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 800;
    color: rgb(var(--team-color));
}

.team-count {
    font-size: 0.8em;
    font-weight: 700;
    color: #cbd5e1;
}

.team-vs {
    align-self: center;
    font-weight: 900;
    font-size: 1.4em;
    letter-spacing: 1px;
    color: #e2e8f0;
    text-shadow: 0 0 10px rgba(148, 163, 184, 0.55);
}

.team-slot {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-slot-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 26px;
}

.team-slot-order {
    font-size: 0.72em;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #94a3b8;
}

.team-swap-btn {
    margin-left: auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(var(--team-color), 0.7);
    background: rgba(15, 23, 42, 0.7);
    color: rgb(var(--team-color));
    font-size: 0.95em;
    line-height: 1;
    cursor: pointer;
}

.team-swap-btn:not(:disabled):hover {
    background: rgba(var(--team-color), 0.25);
}

.team-swap-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.team-slot-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.6);
}

.team-slot-card.is-me {
    border-color: rgba(var(--team-color), 0.85);
    box-shadow: 0 0 0 1px rgba(var(--team-color), 0.35);
}

.team-slot-card.is-empty {
    border-style: dashed;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.9em;
}

.team-slot-card .lobby-player-main {
    min-width: 0;
}

.team-slot-card .player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-slot-tag {
    font-size: 0.72em;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(var(--team-color), 0.25);
    color: rgb(var(--team-color));
}

.team-slot-lock {
    font-size: 0.9em;
}

/* ---- Status / preview lines ---- */
.team-order-preview,
.team-start-note,
.team-unassigned {
    margin-top: 10px;
    font-size: 0.85em;
    color: #cbd5e1;
}

.team-start-note.is-ready {
    color: #4ade80;
}

.team-start-note.is-blocked {
    color: #fbbf24;
}

@media (max-width: 560px) {
    .team-panel {
        grid-template-columns: 1fr;
    }

    .team-vs {
        padding: 2px 0;
    }
}

/* ---- Mobile score banner: team colours (2v2 only; the cards get team-1 / team-2 from JS) ---- */
.mobile-carousel-preview.team-1 {
    --team-color: var(--team1-rgb);
}

.mobile-carousel-preview.team-2 {
    --team-color: var(--team2-rgb);
}

.mobile-carousel-preview.team-1 .mobile-player-name,
.mobile-carousel-preview.team-2 .mobile-player-name,
.mobile-carousel-preview.team-1 .mobile-side-score,
.mobile-carousel-preview.team-2 .mobile-side-score,
.mobile-carousel-preview.team-1 .mobile-main-score,
.mobile-carousel-preview.team-2 .mobile-main-score {
    color: rgb(var(--team-color));
}

.mobile-carousel-preview.team-1 .mobile-player-avatar,
.mobile-carousel-preview.team-2 .mobile-player-avatar {
    outline: 2px solid rgba(var(--team-color), 0.9);
    outline-offset: 1px;
}

/* ---- Game-finished banner: teams, winner heading, crowns ---- */
.results-winner.team-result-heading.team-1 {
    color: rgb(var(--team1-rgb));
}

.results-winner.team-result-heading.team-2 {
    color: rgb(var(--team2-rgb));
}

.team-results {
    --team-color: var(--team1-rgb);
    margin-top: 12px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(var(--team-color), 0.45);
    background: rgba(var(--team-color), 0.06);
}

.team-results.team-2 {
    --team-color: var(--team2-rgb);
}

.team-results.is-winner {
    border-width: 2px;
    border-color: rgba(var(--team-color), 0.9);
    background: rgba(var(--team-color), 0.12);
}

.team-results.is-winner .results-row {
    margin-top: 16px;
}

.team-results-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-weight: 800;
    color: rgb(var(--team-color));
}

.team-results .results-row {
    justify-content: flex-start;
}

.team-results .results-row__meta {
    flex: 1 1 auto;
}

.results-badge {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    font-weight: 800;
    color: #eff6ff;
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.95), rgba(30, 41, 59, 0.95));
    outline: 2px solid rgba(var(--team-color), 0.9);
    outline-offset: 1px;
}

.results-crown {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(-8deg);
    font-size: 18px;
    line-height: 1;
    pointer-events: none;
}

.team-score-card {
    --team-color: var(--team1-rgb);
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(var(--team-color), 0.5);
    background: rgba(var(--team-color), 0.06);
}

.team-score-card.team-2 {
    --team-color: var(--team2-rgb);
}

.team-score-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 800;
    color: rgb(var(--team-color));
}

.team-score-total {
    color: #e2e8f0;
    font-weight: 700;
}
