/* ======================== RESET E CONFIGURAÇÕES GERAIS ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

:root {
    --color-primary: #009c3b;
    --color-primary-light: #00e676;
    --color-bg: #f5f5f5;
    --color-dark-bg: #222;
    --color-white: #ffffff;
    --color-text: #333;
    --color-dark-text: #eee;
    --color-hover: #f0f8ff;
    --color-disabled: #f0f0f0;
}

/* ======================== CONTAINER E CABEÇALHO ======================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 20px;
    border-radius: 8px;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

header h2 {
    font-size: 1.6rem;
    font-weight: 500;
}

.instructions {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.2rem;
}

footer {
    text-align: center;
    margin-top: 20px;
}

footer button {
    margin: 0 6px;
}

/* ======================== CONTEÚDO PRINCIPAL ======================== */
.content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 30px;
}

.classification, .matches {
    flex: 1 1 48%;
    min-width: 300px;
    background-color: var(--color-white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

/* ======================== TÍTULOS ======================== */
h3 {
    margin-bottom: 15px;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
}

/* ======================== TABELAS ======================== */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

table th, table td {
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table th {
    background-color: var(--color-bg);
    font-weight: 700;
}

table tr:hover {
    background-color: #f9f9f9;
}

/* ======================== CLASSIFICAÇÃO ======================== */
.classification {
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    padding: 24px 16px;
    margin-bottom: 20px;
}

.classification table {
    min-width: 600px;
    border-spacing: 0;
    border-collapse: separate;
    background: var(--color-white);
    margin: 0 auto;
}

.classification th {
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 700;
    font-size: 1rem;
}

.classification tr:nth-child(even) { background: #f7fafc; }
.classification tr:nth-child(odd)  { background: #fff; }
.classification tr:hover { background: #e6f7ee; }

.classification td img.team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: 6px;
}

.classification td .team-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #222;
}

/* ======================== PARTIDAS ======================== */
.match {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: var(--color-white);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    position: relative;
    min-height: 50px;
}

.team {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-wrapper {
    width: 72px;
    height: 72px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    margin: 0 6px;
}

.team-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.team.home-team { 
    justify-content: flex-end; 
    text-align: right; 
}

.team.away-team { 
    justify-content: flex-start; 
    text-align: left; 
}

.team-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 70px;
    font-size: 1.05rem;
    height: 100%;
}

.score input {
    width: 30px;
    height: 25px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 3px;
    font-size: 0.9rem;
}

.versus {
    margin: 0 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.match:hover {
    background-color: var(--color-hover);
}

.score-input {
    width: 40px;
    height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 5px;
    appearance: none;
}

.score-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 156, 59, 0.2);
}

.score-input:disabled {
    background-color: var(--color-disabled);
    color: #666;
    cursor: not-allowed;
}

/* ======================== RODADAS E STATUS ======================== */
.round-header {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-primary);
    margin-bottom: 15px;
    padding-left: 10px;
}

.round-header[data-status]::after {
    content: attr(data-status);
    font-size: 0.8rem;
    margin-left: 10px;
    color: #666;
}

.match-status {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--color-primary);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75rem;
    z-index: 1;
}

/* ======================== MODO ESCURO ======================== */
.dark-mode {
    background-color: var(--color-dark-bg);
    color: var(--color-dark-text);
}

.dark-mode .classification, 
.dark-mode .matches {
    background-color: #333;
    color: var(--color-dark-text);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.dark-mode table th {
    background-color: #444;
}

.dark-mode table td {
    border-bottom: 1px solid #444;
}

.dark-mode .score-input {
    background-color: #444;
    color: #eee;
    border-color: #555;
}

.dark-mode .score-input:disabled {
    background-color: #333;
    color: #999;
}

/* ======================== BOTÕES DE NAVEGAÇÃO ======================== */
.nav-button {
    background-color: #00c853;
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    margin: 0 8px;
    position: relative;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.nav-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.nav-button:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
}

/* Remover setas antigas */
/* Todas as regras abaixo devem ser removidas para não sobrepor o SVG: */
/* .nav-button::after { ... } */
/* .prev-button::after { ... } */
/* .next-button::after { ... } */
/* .nav-button::before { ... } */
/* .nav-button:active::before { ... } */

/* ======================== AÇÕES ======================== */
.actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 24px 0 8px 0;
}

.actions button {
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, transform 0.1s;
    outline: none;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.actions button:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-2px) scale(1.03);
}

.actions button:active {
    background-color: #007a2f;
    transform: scale(0.98);
}

.actions #theme-toggle {
    font-size: 1.2rem;
    padding: 10px 12px;
    background: #eee;
    color: #222;
    border: 1px solid #ccc;
    border-radius: 50%;
    box-shadow: none;
    transition: background 0.2s, color 0.2s;
}

.actions #theme-toggle:hover {
    background: #ddd;
    color: var(--color-primary);
}

/* Remove scroll horizontal da tabela de classificação */
.classification {
    overflow-x: visible;
}

.classification table {
    min-width: unset;
    width: 100%;
}

/* Inputs de placar mais modernos */
.score input, .score-input {
    width: 36px;
    height: 32px;
    border-radius: 6px;
    border: 1.5px solid #bbb;
    font-size: 1.1rem;
    font-weight: 600;
    background: #fafafa;
    color: #222;
    margin: 0 4px;
    transition: border 0.2s, box-shadow 0.2s;
}

.score input:focus, .score-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0,156,59,0.13);
    outline: none;
}

.score input:disabled, .score-input:disabled {
    background: var(--color-disabled);
    color: #888;
    border-color: #ddd;
}

/* Espaçamento entre instruções e botões */
.instructions {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 1.08rem;
}

footer {
    margin-top: 32px;
    font-size: 0.98rem;
    color: #888;
}

/* Responsividade extra para botões */
@media (max-width: 600px) {
    .actions {
        flex-direction: column;
        gap: 10px;
    }
    .actions button {
        width: 100%;
        justify-content: center;
    }
}

/* ======================== RESPONSIVIDADE ======================== */
@media (max-width: 900px) {
    .classification table { min-width: 700px; }
    .classification th, .classification td { font-size: 0.95rem; }
}

@media (max-width: 768px) {
    .content {
        display: block;
    }

    .classification, .matches {
        display: block;
        width: 100%;
        margin-bottom: 20px;
    }

    .match {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .team.home-team, .team.away-team {
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .classification table { min-width: 320px; }
    .classification th, .classification td {
        padding: 1px 0.5px;
        font-size: 0.75rem;
        min-width: 24px;
        max-width: 50px;
    }
    .classification th:nth-child(4), .classification td:nth-child(4),
    .classification th:nth-child(9), .classification td:nth-child(9),
    .classification th:nth-child(10), .classification td:nth-child(10) {
        display: none;
    }
}

/* ======================== AJUSTES ESPECÍFICOS DE NAVEGADOR ======================== */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .content, .match, .team, .score {
        display: table;
        width: 100%;
    }
}

@-moz-document url-prefix() {
    .score input {
        -moz-appearance: none;
        appearance: none;
    }
}

/* Ajuste para nomes de times na classificação */
.classification th:nth-child(2), .classification td:nth-child(2) {
    min-width: 140px;
    max-width: 220px;
    white-space: normal;
    text-overflow: unset;
    overflow: visible;
    word-break: break-word;
    text-align: left;
    padding-left: 10px;
}

.classification td .team-info {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

@media (max-width: 700px) {
    .classification th:nth-child(2), .classification td:nth-child(2) {
        min-width: 80px;
        max-width: 120px;
        font-size: 0.85rem;
        padding-left: 4px;
    }
}

/* --- CLASSIFICAÇÃO BONITA E PROFISSIONAL --- */
.classification th, .classification td {
    padding: 7px 3px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.97rem;
    background: none;
}

.classification th {
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}

.classification th:nth-child(2), .classification td:nth-child(2) {
    min-width: 140px;
    max-width: 180px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 12px;
}

.classification td .team-info {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    font-size: 1rem;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.classification td img.team-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    margin-right: 4px;
}

.classification tr {
    background: #fff;
    transition: background 0.2s;
}
.classification tr:nth-child(even) { background: #f7fafc; }
.classification tr:hover { background: #e6f7ee; }

/* Colunas numéricas mais compactas */
.classification th:not(:nth-child(2)), .classification td:not(:nth-child(2)) {
    min-width: 36px;
    max-width: 48px;
    font-size: 0.95rem;
    padding-left: 0;
    padding-right: 0;
}

/* Responsividade: esconder colunas menos importantes */
@media (max-width: 900px) {
    .classification th:nth-child(10), .classification td:nth-child(10),
    .classification th:nth-child(11), .classification td:nth-child(11) {
        display: none;
    }
    .classification th, .classification td {
        font-size: 0.9rem;
    }
    .classification th:nth-child(2), .classification td:nth-child(2) {
        min-width: 90px;
        max-width: 120px;
        font-size: 0.9rem;
    }
}

@media (max-width: 700px) {
    .classification th:nth-child(8), .classification td:nth-child(8),
    .classification th:nth-child(9), .classification td:nth-child(9) {
        display: none;
    }
    .classification th, .classification td {
        font-size: 0.8rem;
        padding: 3px 1px;
    }
    .classification th:nth-child(2), .classification td:nth-child(2) {
        min-width: 60px;
        max-width: 90px;
        font-size: 0.8rem;
        padding-left: 2px;
    }
}

/* --- MELHORIA NA ÁREA DE PRÓXIMOS JOGOS --- */
.round-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.round-navigation .nav-button {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    margin: 0;
    box-shadow: none;
}

#round-title {
    flex: 1;
    text-align: left;
    font-size: 1.2rem;
    color: var(--color-primary);
    margin: 0 8px;
}

.matches {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    padding: 18px 16px 18px 16px;
    box-sizing: border-box;
}

/* --- ALINHAMENTO PERFEITO DOS JOGOS --- */
.match {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    gap: 10px;
    background: var(--color-white);
    border-radius: 8px;
    padding: 10px 8px;
    margin-bottom: 10px;
    min-height: 48px;
    box-shadow: none;
    position: relative;
}

.team.home-team {
    justify-content: flex-end;
    text-align: right;
    min-width: 110px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.team.away-team {
    justify-content: flex-start;
    text-align: left;
    min-width: 110px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.score {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    font-size: 1.05rem;
    justify-content: center;
}

.score input, .score-input {
    width: 44px;
    height: 36px;
    font-size: 1.15rem;
    border-radius: 7px;
    margin: 0 4px;
}

.versus {
    margin: 0 2px;
    font-size: 1rem;
    font-weight: 600;
}

.match-status {
    position: static;
    background: #e6f7ee;
    color: #009c3b;
    border-radius: 10px;
    font-size: 0.85rem;
    padding: 2px 10px;
    margin-left: 0;
    font-weight: 500;
    box-shadow: none;
    min-width: 36px;
    text-align: center;
    justify-self: end;
}

@media (max-width: 600px) {
    .match {
        grid-template-columns: 1fr auto 1fr;
    }
    .match-status {
        grid-column: 1 / -1;
        justify-self: center;
        margin-top: 4px;
    }
}

@media (max-width: 900px) {
    .matches {
        max-width: 100%;
        padding: 14px 6px;
    }
}

.team-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 6px;
}

@media (max-width: 600px) {
    .team-logo {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 600px) {
    .logo-wrapper {
        width: 48px;
        height: 48px;
    }
    .team-logo {
        width: 32px;
        height: 32px;
    }

}

/* --- BOTÕES APRIMORADOS --- */
.actions button, .nav-button {
    box-shadow: 0 2px 8px rgba(0,156,59,0.10);
    transition: all 0.18s cubic-bezier(.4,0,.2,1);
    position: relative;
}

.actions button:active, .nav-button:active {
    transform: scale(0.96) translateY(1px);
    box-shadow: 0 1px 3px rgba(0,156,59,0.10);
}

.actions button:hover, .nav-button:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 16px rgba(0,156,59,0.13);
}

/* Ícone de refresh no botão de reiniciar simulação */
#reset-btn {
    padding-left: 38px;
}
#reset-btn::before {
    content: '';
    display: block;
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%23009c3b" stroke-width="2.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.93 19.07A10 10 0 1 0 12 2v3"/><path d="M12 5l-1.5-1.5L12 2"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.85;
}
