/* ══════════════════════════════════════════════════════
   RELATÓRIO DO JOGO
   ══════════════════════════════════════════════════════ */

.rj-modal-content {
    max-width: 900px;
    height: 88vh;
    max-height: 88vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#rj-corpo {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.rj-tab-content {
    flex: 1;
    min-height: 480px;
    overflow-y: auto;
}

/* ── Cabeçalho ────────────────────────────────────────── */
.rj-header-topo {
    display: flex;
    justify-content: flex-end;
}

.rj-fechar {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}
.rj-fechar:hover { color: var(--text); }

.rj-loading, .rj-erro {
    text-align: center;
    padding: 30px 0;
    color: var(--muted);
    font-size: 13px;
}
.rj-erro { color: #ef4444; }

/* Relatório apagado (jogos entre equipas bot com mais de 7 dias) */
.rj-apagado {
    text-align: center;
    padding: 28px 20px 34px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.rj-apagado-icone { font-size: 28px; margin-bottom: 8px; }

/* Indicador de carregamento da modal: um círculo a rodar + o texto, centrados.
   Nomes próprios (rj-spinner / rj-spin), porque o campeonato.css já define um
   .spinner / @keyframes spin diferente e este ficheiro é carregado em páginas
   que não carregam o campeonato.css. */
.rj-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 120px;       /* a modal não "salta" quando o relatório aparece */
}
.rj-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #334155;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rj-spin 0.8s linear infinite;
}
@keyframes rj-spin {
    to { transform: rotate(360deg); }
}
/* quem prefere menos movimento: o círculo pára de rodar e fica a pulsar de
   leve, para continuar a ser claro que a página está a trabalhar */
@media (prefers-reduced-motion: reduce) {
    .rj-spinner {
        animation: rj-pulso 1.6s ease-in-out infinite;
        border-top-color: #334155;
        background: var(--accent);
        opacity: 0.35;
    }
    @keyframes rj-pulso {
        50% { opacity: 0.9; }
    }
}

.rj-resultado-linha {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 6px 0 14px;
}

.rj-equipa-resultado { display: flex; }
.rj-equipa-casa { justify-content: flex-end; text-align: right; }
.rj-equipa-fora { justify-content: flex-start; text-align: left; }

.rj-equipa-nome {
    font-size: 17px;
    font-weight: bold;
}

.rj-placar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 26px;
    font-weight: bold;
    color: var(--accent);
}
.rj-placar-sep { color: var(--muted); font-weight: normal; }

.rj-competicao-info {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    padding: 4px 0;
}

.rj-data-hora {
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    padding: 4px 0 8px;
}

.rj-resultado-extra {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    margin-top: -6px;
    padding-bottom: 8px;
}

.rj-meta-linha {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
    padding-bottom: 10px;
    border-bottom: 1px solid #334155;
}
.rj-meta-sep { color: #475569; }

/* ── Separadores ──────────────────────────────────────── */
.rj-tabs {
    display: flex;
    gap: 4px;
    margin: 14px 0 12px;
    border-bottom: 2px solid #334155;
}

.rj-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    color: var(--muted);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
}
.rj-tab:hover  { color: var(--text); }
.rj-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Formações ────────────────────────────────────────── */
.rj-formacoes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.rj-formacao-col { display: flex; flex-direction: column; align-items: center; }

.rj-formacao-titulo {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
}

.rj-formacao-estrategia {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 10px;
    min-height: 14px;
}

.rj-campo-mini {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 320 / 380;
    background: linear-gradient(180deg, #14532d 0%, #166534 50%, #14532d 100%);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 3px;
}

.rj-campo-mini::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: rgba(255,255,255,0.4);
}
.rj-campo-mini::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 55px; height: 55px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
}

.rj-jogador-pos {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 68px;
    text-align: center;
}

.rj-jogador-funcoes {
    font-size: 10px;
    line-height: 1;
    margin-bottom: 1px;
    min-height: 11px;
    color: #fde68a;
}

.rj-jogador-bola {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.rj-jogador-nome {
    font-size: 9.5px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    margin-top: 2px;
    line-height: 1.1;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rj-jogador-eventos {
    font-size: 10px;
    line-height: 1;
    margin-top: 1px;
    min-height: 11px;
}

/* Suplentes usados */
.rj-suplentes {
    margin-top: 10px;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rj-suplente-linha {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    padding: 3px 6px;
    background: #1e293b;
    border-radius: 4px;
}
.rj-suplente-nome { color: var(--text); font-weight: bold; }
.rj-suplente-icone { flex-shrink: 0; }
.rj-suplente-por { color: var(--muted); font-style: italic; }

/* Legenda */
.rj-legenda {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 16px;
    margin-bottom: 12px;
    padding-top: 12px;
    padding-bottom: 4px;
    border-top: 1px solid #334155;
    font-size: 11px;
    color: var(--muted);
}
.rj-legenda-simb { margin-right: 3px; }

/* ── Estatísticas ─────────────────────────────────────── */
.rj-stats-lista { display: flex; flex-direction: column; gap: 12px; }

.rj-stat-item { display: flex; flex-direction: column; gap: 4px; }

.rj-stat-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
}

.rj-stat-valores {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: bold;
}

.rj-stat-barra {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #334155;
}
.rj-stat-barra-casa { background: var(--accent); }
.rj-stat-barra-fora { background: #f59e0b; }

/* ── Eventos ──────────────────────────────────────────── */
.rj-eventos-lista {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 420px;
    overflow-y: auto;
}

.rj-evento-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.4;
}
.rj-evento-item:hover { background: #1e293b; }

.rj-evento-minuto {
    flex-shrink: 0;
    width: 34px;
    text-align: right;
    font-weight: bold;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.rj-evento-icone { flex-shrink: 0; width: 18px; text-align: center; }

.rj-evento-desc { flex: 1; color: var(--text); }
.rj-evento-golo    .rj-evento-desc { color: #22c55e; font-weight: 600; }
.rj-evento-cartao  .rj-evento-desc { color: #f59e0b; }
.rj-evento-lesao   .rj-evento-desc { color: #ef4444; }
.rj-evento-info    .rj-evento-desc { color: var(--muted); font-style: italic; }
.rj-evento-inicio  .rj-evento-desc,
.rj-evento-fim     .rj-evento-desc,
.rj-evento-intervalo .rj-evento-desc { font-weight: bold; color: var(--accent); }

.rj-evento-equipa {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 7px;
    border-radius: 10px;
    margin-right: 7px;
    vertical-align: middle;
}
.rj-badge-casa { background: rgba(56,189,248,0.15); color: var(--accent); }
.rj-badge-fora { background: rgba(245,158,11,0.15); color: #f59e0b; }

/* Botão "Ver Relatório" nas listas de jogos */
.btn-ver-relatorio {
    white-space: nowrap;
}


/* ── Responsivo — as duas formações passam a empilhadas (uma por
   cima da outra) em vez de lado a lado, para cada campo ter espaço
   suficiente e os jogadores não ficarem sobrepostos ────────────── */
@media (max-width: 700px) {
    .rj-formacoes-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .rj-campo-mini {
        max-width: 280px;
    }
    .rj-jogador-pos {
        width: 56px;
        font-size: 11px;
    }
}
