/* --- Reset Básico e Configurações Gerais --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Roboto', "Google Sans Text", sans-serif;
    background-color: #f4f7f9;
    color: #3e4a59;
    line-height: 1.6;
    padding-top: 100px; /* Será ajustado pelo JS */
}
.container { max-width: 1200px; margin: 30px auto; padding: 0 15px; }

/* --- Cabeçalho --- */
header {
    background-color: #ffffff; color: #1a237e; padding: 15px 20px; text-align: center;
    /* COR ATUALIZADA */
    border-bottom: 4px solid #b18a53; 
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
}
/* LOGO DO TOPO AUMENTADO */
.logo-header { max-height: 70px; margin-bottom: 10px; } 
header h1 { font-weight: 700; font-size: 1.6rem; text-transform: uppercase; line-height: 1.2; }
header .subtitle { font-size: 0.9rem; font-weight: 400; opacity: 0.8; }

/* --- Menu de Navegação Rápida --- */
.quick-nav {
    background-color: #1a237e; padding: 10px 0; text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: fixed; top: 90px; /* Será ajustado pelo JS */
    left: 0; width: 100%; z-index: 999; overflow-x: auto; white-space: nowrap;
}
.quick-nav a {
    color: #ffffff; text-decoration: none; padding: 8px 15px; margin: 0 5px;
    font-size: 0.9rem; font-weight: 500; border-radius: 4px;
    transition: background-color 0.2s ease; display: inline-block;
}
.quick-nav a:hover { background-color: rgba(255, 255, 255, 0.2); }

/* --- Indicador de Carregamento --- */
#loading-indicator { text-align: center; padding: 40px 20px; font-size: 1.2rem; color: #6c757d; display: block; }
#loading-indicator.hidden { display: none; }

/* --- Estrutura de "Cards" para Seções --- */
section {
    background-color: #ffffff; margin-bottom: 25px; padding: 25px; border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.07); border-top: 3px solid #1a237e;
}
.section-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
    padding-bottom: 15px; border-bottom: 1px solid #e0e0e0; flex-wrap: wrap;
}
section h2 {
    font-size: 1.6rem; font-weight: 700; color: #1a237e; margin-bottom: 0;
    padding-bottom: 0; border-bottom: none; display: flex; align-items: center; flex-grow: 1;
}
section h2 small { font-size: 0.9rem; color: #6c757d; font-weight: 400; margin-left: 10px; }
section h2 i { 
    margin-right: 12px; font-size: 1.4rem; 
    /* COR ATUALIZADA */
    color: #b18a53; 
    width: 25px; text-align: center;
}

/* Botão Toggle */
.toggle-button {
    background-color: #1a237e; color: white; border: none; padding: 8px 15px; border-radius: 5px;
    cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: background-color 0.2s ease; margin-left: 15px;
}
.toggle-button:hover { background-color: #283593; }
@media (max-width: 500px) { .section-header { flex-direction: column; align-items: flex-start; } .toggle-button { margin-left: 0; margin-top: 10px; width: 100%; } }

.table-wrapper { overflow-x: auto; }

/* --- Tabelas Refinadas --- */
table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 0.85rem; }
table th, table td { padding: 10px 8px; text-align: center; border: none; vertical-align: middle; }
table th {
    background-color: #f8f9fa; color: #1a237e; font-weight: 700; font-size: 0.75rem;
    text-transform: uppercase; border-bottom: 2px solid #dee2e6; padding: 8px 6px;
}
table tbody tr { border-bottom: 1px solid #f1f3f5; }
table tbody tr:last-child { border-bottom: none; }
table tbody tr:nth-child(even) { background-color: #fdfdff; }
table tbody tr:hover { background-color: #e9ecef; }

/* Exceção: Coluna Equipe (Classificação/Rank/Artilharia/Assistencias) */
#tabela-grupo-a th:nth-child(2), #tabela-grupo-a td:nth-child(2),
#tabela-grupo-b th:nth-child(2), #tabela-grupo-b td:nth-child(2),
#tabela-rank-geral th:nth-child(2), #tabela-rank-geral td:nth-child(2),
#tabela-artilheiros th:nth-child(3), #tabela-artilheiros td:nth-child(3),
#tabela-assistencias th:nth-child(3), #tabela-assistencias td:nth-child(3) {
    text-align: left;
}
/* Mantém primeira coluna em negrito */
table td:first-child, table th:first-child { font-weight: bold; }

/* --- Layout para Classificação (Grupos A e B) --- */
.group-container { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 15px; }
.group-item { flex: 1 1 100%; display: flex; flex-direction: column; background-color: #ffffff; padding: 15px; border: 1px solid #e0e7f1; border-radius: 8px; }
@media (min-width: 768px) { .group-item { flex-basis: 48%; } }
.group-item h3 { 
    font-size: 1.1rem; color: #1a237e; padding-bottom: 8px; 
    /* COR ATUALIZADA */
    border-bottom: 2px solid #b18a53; 
    margin-bottom: 10px; text-align: center; 
}

/* --- Seção Sanfona (Collapsible) --- */
#resultados h2, #sobre h2 { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.collapsible-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding-bottom: 15px; border-bottom: 1px solid #e0e0e0; }
.collapsible-header .arrow { font-size: 1.5rem; color: #1a237e; transition: transform 0.3s ease-in-out; }
.collapsible-header.active .arrow { transform: rotate(180deg); }
.collapsible-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-in-out; padding-top: 0; }
.collapsible-content.open { padding-top: 15px; margin-top: 15px; max-height: 2000px; }
#sobre .collapsible-content p { margin-bottom: 10px; }

/* --- Mata-Mata --- */
.knockout-stage { margin-bottom: 20px; }
.knockout-stage h3 { background-color: #f1f3f5; color: #495057; padding: 6px 12px; border-radius: 4px; margin-bottom: 12px; text-align: center; font-size: 1rem; font-weight: 500; }
.match-card { display: flex; flex-direction: column; align-items: center; padding: 10px; border: 1px solid #e9ecef; border-radius: 6px; margin-bottom: 6px; background-color: #ffffff; }
.match-main { display: flex; width: 100%; align-items: center; justify-content: space-between; }
/* ATUALIZADO: Adicionado display:flex e align-items para alinhar logos */
.team { flex: 1; font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; }
.team-a {
    justify-content: flex-end; /* Era text-align: right */
    padding-right: 8px;
}
.team-b {
    justify-content: flex-start; /* Era text-align: left */
    padding-left: 8px;
}
.score { font-size: 1.2rem; font-weight: 700; margin: 0 8px; color: #1a237e; white-space: nowrap; }
.match-details { width: 100%; text-align: center; font-size: 0.75rem; color: #6c757d; margin-top: 5px; padding-top: 5px; border-top: 1px dashed #e0e0e0; }
.penalties { font-size: 0.8rem; color: #d32f2f; font-weight: bold; line-height: 1; }


/* --- Container de Estatísticas (Artilharia / Assistências) --- */
.stats-container {
    display: flex;
    flex-wrap: wrap;     /* Garante que no mobile um fique embaixo do outro */
    gap: 20px;           /* Espaçamento entre os cards */
    margin-bottom: 25px; /* Mantém o espaçamento padrão das seções */
}
/* Remove a margem de baixo das seções filhas, pois o 'gap' do container já cuida disso */
.stats-container > section {
    margin-bottom: 0;
    flex-basis: 100%; 
    
    /* --- CORREÇÃO ADICIONADA AQUI --- */
    /* Força o card a ocupar 100% da largura no mobile */
    width: 100%;
}


/* --- Rodapé --- */
footer { text-align: center; padding: 30px 20px; margin-top: 20px; color: #6c757d; font-size: 0.85em; border-top: 1px solid #e0e0e0; background-color: #ffffff; display: flex; flex-direction: column; align-items: center; }
.logo-footer { max-height: 40px; margin-bottom: 15px; opacity: 0.7; }

/* --- Responsividade Geral --- */
@media (max-width: 768px) {
    body { padding-top: 120px; } 
    header { padding: 10px 15px; } 
    .logo-header { max-height: 50px; } /* Aumentado no mobile também */
    header h1 { font-size: 1.3rem; } 
    header .subtitle { font-size: 0.8rem; }
    .quick-nav { top: 88px; padding: 5px 0; } /* Ajuste fino na posição do nav */
    .quick-nav a { padding: 6px 10px; font-size: 0.8rem; margin: 0 2px;}
    
    /* --- ATUALIZADO: Padding lateral reduzido no mobile --- */
    section { padding: 15px 10px; } 
    
    section h2 { font-size: 1.4rem; } 
    section h2 i { font-size: 1.2rem; margin-right: 8px; }
    table { font-size: 0.8rem; } 
    table th, table td { padding: 8px 4px; } 
    table th { font-size: 0.7rem; }
    .team { font-size: 0.85rem; } 
    .score { font-size: 1.1rem; }

    /* --- NOVO: Reduz o tamanho do logo no mobile --- */
    .team-logo {
        max-height: 16px; /* Reduzido de 20px */
        margin-right: 5px; /* Reduzido de 8px */
    }
    .team-logo-right {
        margin-left: 5px; /* Reduzido de 8px */
        margin-right: 0;
    }
}

/* --- Destaque para Classificados --- */
.group-item tbody tr:nth-child(1), .group-item tbody tr:nth-child(2) { background-color: #e6ffed !important; font-weight: 500; }
.group-item tbody tr:nth-child(1) td:first-child, .group-item tbody tr:nth-child(2) td:first-child { border-left: 3px solid #28a745; }
.group-item tbody tr:nth-child(-n+2):hover { background-color: #d4f5dd !important; }
#general-rank-view tbody tr:nth-child(-n+4) { background-color: #e6ffed !important; font-weight: 500; }
#general-rank-view tbody tr:nth-child(-n+4) td:first-child { border-left: 3px solid #28a745; }
#general-rank-view tbody tr:nth-child(-n+4):hover { background-color: #d4f5dd !important; }

/* --- Estilos para Logos das Equipes nas Tabelas --- */
.team-logo {
    max-height: 20px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
}
/* NOVO: Classe para logos à direita */
.team-logo-right {
    margin-left: 8px;
    margin-right: 0;
}
.team-name-cell {
    text-align: left;
    display: flex;
    align-items: center;
    padding-left: 10px;
}

/* --- NOVO: Força o "Confronto" (Resultados/Próximos Jogos) a ficar em uma linha --- */
#tabela-resultados td:nth-child(3),
#tabela-proximos-jogos td:nth-child(4) {
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- ATUALIZAÇÃO: Media Query de Desktop --- */
@media (min-width: 768px) { 
    .group-item { flex-basis: 48%; } 
    
    /* Regra adicionada para o layout lado-a-lado da Artilharia/Assistência */
    .stats-container > section {
        flex: 1 1 48%; /* Isso substitui o flex-basis e o width: 100% no desktop */
    }
}