/**
 * Listagens compartilhadas: Equipes participantes + Jogadores inscritos (grid pending-info)
 * e itens "times + jogadores" após sorteio (.teams-players-list).
 */
.teams-players-grid .tv-roster-list,
.tournament-teams-and-players .tv-roster-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.teams-players-grid .tv-roster-item,
.tournament-teams-and-players .tv-roster-item {
    --tv-roster-media-size: 56px;
    --tv-roster-min-height: 76px;
    --tv-roster-pad-y: 16px;
    --tv-roster-pad-x: 18px;
    --tv-roster-radius: 12px;
    display: grid;
    grid-template-columns: var(--tv-roster-media-size) minmax(0, 1fr);
    grid-template-rows: minmax(var(--tv-roster-min-height), auto);
    align-items: center;
    column-gap: 16px;
    row-gap: 0;
    min-height: var(--tv-roster-min-height);
    padding: var(--tv-roster-pad-y) var(--tv-roster-pad-x);
    border-radius: var(--tv-roster-radius);
    border: 1px solid var(--view-gray-200);
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.teams-players-grid .tv-roster-item:hover,
.tournament-teams-and-players .tv-roster-item:hover {
    border-color: var(--view-gray-300);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    background: #f8fafc;
}

/* Três colunas: mídia | conteúdo | ações */
.teams-players-grid .tv-roster-item.tv-roster-item--with-aside,
.tournament-teams-and-players .tv-roster-item.tv-roster-item--with-aside {
    grid-template-columns: var(--tv-roster-media-size) minmax(0, 1fr) auto;
}

.teams-players-grid .tv-roster-item__media,
.tournament-teams-and-players .tv-roster-item__media {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.teams-players-grid .tv-roster-item__body,
.tournament-teams-and-players .tv-roster-item__body {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-self: center;
}

.teams-players-grid .tv-roster-item.tv-roster-item--with-aside .tv-roster-item__aside,
.tournament-teams-and-players .tv-roster-item.tv-roster-item--with-aside .tv-roster-item__aside {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

/* Crescimento vertical quando há muitas ações ou texto extra */
.teams-players-grid .tv-roster-item.tv-roster-item--with-aside,
.tournament-teams-and-players .tv-roster-item.tv-roster-item--with-aside {
    grid-template-rows: auto;
    align-items: center;
}

.teams-players-grid .tv-roster-item__text-stack,
.tournament-teams-and-players .tv-roster-item__text-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Logos / avatares — mesmo tamanho visual */
.teams-players-grid .tv-roster-item .team-logo,
.tournament-teams-and-players .tv-roster-item .team-logo {
    width: var(--tv-roster-media-size);
    height: var(--tv-roster-media-size);
    min-width: var(--tv-roster-media-size);
    min-height: var(--tv-roster-media-size);
    border-radius: 10px;
}

.teams-players-grid .tv-roster-item .participant-logo,
.tournament-teams-and-players .tv-roster-item .participant-logo {
    width: var(--tv-roster-media-size);
    height: var(--tv-roster-media-size);
    min-width: var(--tv-roster-media-size);
    min-height: var(--tv-roster-media-size);
}

/* Títulos e links: leitura horizontal, quebra natural entre palavras */
.teams-players-grid .tv-roster-item .tv-roster-title,
.teams-players-grid .tv-roster-item .team-name,
.tournament-teams-and-players .tv-roster-item .team-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--view-gray-800);
    min-width: 0;
    max-width: 100%;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: manual;
}

.teams-players-grid .tv-roster-item .tv-roster-subtitle,
.teams-players-grid .tv-roster-item .team-country,
.tournament-teams-and-players .tv-roster-item .team-country,
.tournament-teams-and-players .tv-roster-item .team-players {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--view-gray-600);
    min-width: 0;
    max-width: 100%;
    word-break: normal;
    overflow-wrap: break-word;
}

.tournament-teams-and-players .tv-roster-item .team-players {
    text-align: left;
}

/* Participantes: identidade + status dentro do body */
.teams-players-grid .tv-roster-item.participant-item .participant-item__row--identity {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.teams-players-grid .tv-roster-item .participant-name,
.teams-players-grid .tv-roster-item .participant-name .participant-profile-link {
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--view-gray-800);
    min-width: 0;
    max-width: 100%;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: manual;
}

.teams-players-grid .tv-roster-item .participant-name .participant-profile-link {
    display: inline;
    vertical-align: baseline;
}

.teams-players-grid .tv-roster-item .participant-team {
    align-self: flex-start;
    margin: 0;
    max-width: 100%;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--view-gray-600);
    padding: 4px 10px;
    background: var(--view-gray-50);
    border-radius: 8px;
    border: 1px solid var(--view-gray-200);
    word-break: normal;
    overflow-wrap: break-word;
}

.teams-players-grid .tv-roster-item .participant-item__row--status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.teams-players-grid .tv-roster-item .participant-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    text-align: center;
}

.teams-players-grid .tv-roster-item .participant-status.is-approved {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.teams-players-grid .tv-roster-item .participant-status.is-pending {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* Ações na coluna direita */
.teams-players-grid .tv-roster-item__aside .participant-actions {
    margin: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.teams-players-grid .tv-roster-item__aside .participant-actions .action-btn {
    min-height: 38px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

/**
 * Remover (X): equipes + jogadores — classe única .action-btn--remove (+ .remove-team-btn para JS).
 */
.teams-players-grid .tv-roster-item__aside .action-btn--remove.remove-team-btn,
.tournament-teams-and-players .tv-roster-item__aside .action-btn--remove.remove-team-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    align-self: flex-end;
    border: 1px solid #000000;
    border-radius: 10px;
    /* !important: tema/Luma aplica fundo escuro em button no desktop */
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #dc3545;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.teams-players-grid .tv-roster-item__aside .action-btn--remove.remove-team-btn:hover,
.tournament-teams-and-players .tv-roster-item__aside .action-btn--remove.remove-team-btn:hover {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #000000;
    color: #c82333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.teams-players-grid .tv-roster-item__aside .action-btn--remove.remove-team-btn:active,
.tournament-teams-and-players .tv-roster-item__aside .action-btn--remove.remove-team-btn:active {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

.teams-players-grid .tv-roster-item__aside .action-btn--remove.remove-team-btn:focus-visible,
.tournament-teams-and-players .tv-roster-item__aside .action-btn--remove.remove-team-btn:focus-visible {
    background: #ffffff !important;
    background-color: #ffffff !important;
    outline: 2px solid rgba(220, 53, 69, 0.45);
    outline-offset: 2px;
}

.teams-players-grid .tv-roster-item__aside .action-btn--remove.remove-team-btn i,
.tournament-teams-and-players .tv-roster-item__aside .action-btn--remove.remove-team-btn i {
    color: #dc3545;
    font-size: 15px;
    line-height: 1;
}

.teams-players-grid .tv-roster-item__aside .action-btn--remove.remove-team-btn:hover i,
.tournament-teams-and-players .tv-roster-item__aside .action-btn--remove.remove-team-btn:hover i {
    color: #c82333;
}

/* Lista pós-sorteio: alinhar como cards de roster (não centralizar texto) */
.tournament-teams-and-players .teams-players-list.tv-roster-list .tv-roster-item {
    justify-items: stretch;
}

.tournament-teams-and-players .tv-roster-item .tv-roster-item__body {
    align-items: flex-start;
    text-align: left;
}

/**
 * Times e jogadores (pós-sorteio): neutraliza legado tournament-view.css
 * (.team-player-item display:flex + .team-player-info centralizado).
 * Layout: grid [ escudo fixo | coluna título + jogador(es) ]; jogador = flex [ avatar 32px | gamertag ].
 */
.tournament-teams-and-players .teams-players-list.tv-roster-list > .tv-roster-item.team-player-item {
    --tv-player-avatar-size: 32px;
    --tv-team-name-gamertag-gap: 8px;
    --tv-players-roster-gap: 8px;
    display: grid !important;
    grid-template-columns: var(--tv-roster-media-size) minmax(0, 1fr);
    align-items: center;
    align-content: center;
    justify-content: start;
    justify-items: stretch;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.tournament-teams-and-players .teams-players-list > .tv-roster-item.team-player-item .tv-roster-item__media {
    align-self: center;
}

.tournament-teams-and-players .teams-players-list .tv-roster-item__text-stack.team-player-info {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    gap: var(--tv-team-name-gamertag-gap);
}

.tournament-teams-and-players .teams-players-list .team-name.tv-roster-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--view-gray-900, #0f172a);
}

.tournament-teams-and-players .team-players-roster {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--tv-players-roster-gap);
    width: 100%;
    min-width: 0;
}

.tournament-teams-and-players .team-player-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.tournament-teams-and-players .team-player-row__avatar.participant-logo {
    flex-shrink: 0;
    width: var(--tv-player-avatar-size);
    height: var(--tv-player-avatar-size);
    min-width: var(--tv-player-avatar-size);
    min-height: var(--tv-player-avatar-size);
    border-radius: 50%;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--view-gray-200);
    background: var(--view-gray-50);
}

.tournament-teams-and-players .team-player-row__avatar.participant-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.tournament-teams-and-players .team-player-row__avatar.participant-logo--placeholder i {
    font-size: 16px;
    color: var(--view-gray-400);
    line-height: 1;
}

.tournament-teams-and-players .team-player-row__gamertag {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--view-gray-600);
}

.tournament-teams-and-players .team-player-row__gamertag .participant-profile-link {
    font-size: inherit;
    color: var(--view-green);
    font-weight: 600;
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: inherit;
}

.tournament-teams-and-players .team-player-row__gamertag .participant-profile-link:hover {
    text-decoration: underline;
    color: var(--view-green-light);
}

/* Sobrescreve flex legado (.participant-item, .team-list li) neste escopo */
.teams-players-grid ul.pending-participants-list > li.tv-roster-item.participant-item,
.teams-players-grid ul.team-list.tv-roster-list > li.tv-roster-item {
    display: grid !important;
    flex-direction: unset !important;
    flex-wrap: unset !important;
    align-items: center !important;
    align-content: unset !important;
}

/*
 * Sobrescreve ellipsis/nowrap de tournament-view.css (.tournament-pending-info …),
 * que tem especificidade alta sobre .teams-players-grid .tv-roster-item …
 */
.tournament-pending-info ul.pending-participants-list > li.tv-roster-item .participant-name,
.tournament-pending-info ul.pending-participants-list > li.tv-roster-item .participant-name .participant-profile-link {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    hyphens: manual !important;
}

.tournament-pending-info ul.pending-participants-list > li.tv-roster-item .participant-name .participant-profile-link {
    display: inline !important;
    vertical-align: baseline !important;
}

.tournament-pending-info ul.pending-participants-list > li.tv-roster-item .participant-team {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}
