/* ============================================================================
 * BRASILEIRÃO SÉRIE A 2026 — Dashboard Stylesheet
 * Redesign v4 — Dark Theme + Brazilian Identity
 * ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');


/* ─── 1. DESIGN TOKENS ──────────────────────────────────────────────────────── */
:root {
    /* Page & Cards */
    --bg-page:      #0d1117;
    --bg-card:      #161b22;
    --bg-card-2:    #1c2128;
    --bg-hover:     #21262d;
    --bg-input:     #0d1117;

    /* Header — Brazilian green */
    --bg-header:     #0a2318;
    --bg-header-end: #0f3526;
    --header-glow:   rgba(0, 200, 80, 0.08);

    /* Text */
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;

    /* Accent palette */
    --accent-green:  #2ea043;
    --accent-green-2: #3fb950;
    --accent-green-glow: rgba(46,160,67,0.25);
    --accent-blue:   #58a6ff;
    --accent-red:    #f85149;
    --accent-yellow: #f0a10f;
    --accent-purple: #bc8cff;

    /* Zone colors — Brazilian identity */
    --zone-lib:  #2ea043;   /* Libertadores (1-4) */
    --zone-pre-lib: #e68a2e; /* Pré-Libertadores (5) — laranja */
    --zone-sul:  #1f6feb;   /* Sudamericana (6-11) */
    --zone-rel:  #da3633;   /* Rebaixamento (17-20) */

    /* Borders */
    --border:       #30363d;
    --border-light: #21262d;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 20px rgba(46,160,67,0.15);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transition */
    --transition: all 0.18s ease;
    --transition-slow: all 0.35s cubic-bezier(.4,0,.2,1);
}

/* ─── LIGHT THEME ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg-page:      #f7f8fa;
    --bg-card:      #ffffff;
    --bg-card-2:    #f1f3f5;
    --bg-hover:     #edf0f3;
    --bg-input:     #ffffff;
    --bg-header:    #f0fdf4;
    --bg-header-end:#dcfce7;
    --header-glow:  rgba(0,200,80,0.04);
    --text-primary:   #1a202c;
    --text-secondary: #4a5568;
    --text-muted:     #a0aec0;
    --accent-green:   #16a34a;
    --accent-green-2: #22c55e;
    --accent-green-glow: rgba(22,163,74,0.15);
    --accent-blue:    #2563eb;
    --accent-red:     #dc2626;
    --accent-yellow:  #d97706;
    --zone-lib:       #16a34a;
    --zone-pre-lib:   #d97706;
    --zone-sul:       #2563eb;
    --zone-rel:       #dc2626;
    --border:       #e2e8f0;
    --border-light: #edf2f7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-glow: none;
}

[data-theme="light"] body {
    background-image: none;
}

[data-theme="light"] .header {
    border-bottom-color: rgba(22,163,74,0.15);
}

[data-theme="light"] .header-title h1 { color: #1a202c; }
[data-theme="light"] .header-title .subtitle { color: #4a5568; }
[data-theme="light"] .header-timestamp { color: #718096; border-top-color: rgba(0,0,0,0.06); }

[data-theme="light"] .select-team,
[data-theme="light"] .select-round {
    background: rgba(0,0,0,0.04);
    border-color: #d1d5db;
    color: #1a202c;
}

[data-theme="light"] .select-team option,
[data-theme="light"] .select-round option {
    background: #fff;
    color: #1a202c;
}

[data-theme="light"] .tab-bar {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

[data-theme="light"] .heatmap-team {
    background: #fff;
}

[data-theme="light"] .heatmap-win  { background: rgba(22,163,74,0.12); }
[data-theme="light"] .heatmap-draw { background: rgba(107,114,128,0.1); }
[data-theme="light"] .heatmap-loss { background: rgba(220,38,38,0.12); }


/* ─── 2. RESET & BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-page);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0,100,40,0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(31,111,235,0.06), transparent);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ─── 3. HEADER ─────────────────────────────────────────────────────────────── */
.header {
    background: linear-gradient(135deg, var(--bg-header) 0%, var(--bg-header-end) 100%);
    border-bottom: 1px solid rgba(46,160,67,0.2);
    padding: 20px 0 0;
    position: relative;
    overflow: hidden;
}

/* Simplified header decoration */
.header::before,
.header::after { display: none; }

.header-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.header-title h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-title .subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    margin-top: 3px;
    letter-spacing: 0.3px;
}

.header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* Header selects */
.select-team,
.select-round {
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    outline: none;
}

.select-team:hover,
.select-round:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.3);
}

.select-team:focus,
.select-round:focus {
    box-shadow: 0 0 0 2px rgba(63,185,80,0.4);
}

.select-team option,
.select-round option {
    background: #1c2128;
    color: var(--text-primary);
}

/* Theme toggle */
.theme-toggle {
    padding: 6px 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.14); }

[data-theme="light"] .theme-toggle {
    background: rgba(0,0,0,0.04);
    border-color: #d1d5db;
}
[data-theme="light"] .theme-toggle:hover { background: rgba(0,0,0,0.08); }

.header-timestamp {
    max-width: 1440px;
    margin: 0 auto;
    padding: 7px 32px;
    text-align: right;
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    border-top: 1px solid rgba(255,255,255,0.06);
    position: relative;
    z-index: 1;
}


/* ─── 4. TAB BAR ────────────────────────────────────────────────────────────── */
.tab-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab-bar-inner {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    padding: 0 32px;
}

.tab-btn {
    padding: 14px 22px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.tab-btn:hover { color: var(--text-secondary); }

.tab-btn.active {
    color: var(--accent-green-2);
    border-bottom-color: var(--accent-green-2);
    font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Stagger animation — KPI cards */
.tab-content.active .kpi-card {
    opacity: 0;
    animation: slideUp 0.35s ease forwards;
}
.tab-content.active .kpi-card:nth-child(1) { animation-delay: 0.03s; }
.tab-content.active .kpi-card:nth-child(2) { animation-delay: 0.06s; }
.tab-content.active .kpi-card:nth-child(3) { animation-delay: 0.09s; }
.tab-content.active .kpi-card:nth-child(4) { animation-delay: 0.12s; }

/* Stagger — wrappers e tabelas */
.tab-content.active .standings-wrapper,
.tab-content.active .rodada-wrapper,
.tab-content.active .chart-wrapper,
.tab-content.active .market-table-wrapper {
    opacity: 0;
    animation: slideUp 0.4s ease 0.1s forwards;
}


/* ─── 5. CONTAINER ──────────────────────────────────────────────────────────── */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 32px 32px;
}


/* ─── 6. KPI CARDS ──────────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.kpi-card {
    background: var(--bg-card);
    padding: 18px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    cursor: default;
}

.kpi-card::before { display: none; }

.kpi-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.kpi-icon {
    font-size: 18px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.kpi-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.kpi-value.small { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }

.kpi-detail {
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
    color: var(--text-secondary);
}

/* Empty state */
.kpi-empty-wrapper { grid-column: 1/-1; }
.kpi-empty {
    padding: 32px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}
.kpi-empty strong { color: var(--accent-green-2); }


/* ─── 7. SECTION TITLE ──────────────────────────────────────────────────────── */
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--accent-green);
    border-radius: 2px;
}


/* ─── 8. MAIN LAYOUT ────────────────────────────────────────────────────────── */
.main-content-grid {
    display: grid;
    grid-template-columns: 58% 1fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}

.main-content-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}


/* ─── 9. STANDINGS TABLE ────────────────────────────────────────────────────── */
.standings-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.standings-table thead {
    background: var(--bg-card-2);
    border-bottom: 1px solid var(--border);
}

.standings-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.standings-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    text-align: center;
}

.standings-table tbody tr {
    transition: background-color 0.12s ease;
}

.standings-table tbody tr:last-child td { border-bottom: none; }

.standings-table tbody tr:hover { background: var(--bg-hover); }

/* Highlighted row */
.standings-table tbody tr.highlighted { background: rgba(46,160,67,0.06); }
.standings-table tbody tr.highlighted .team-name { color: var(--accent-green-2); font-weight: 700; }

/* Zones — left gutter */
.zone-libertadores      { border-left: 3px solid var(--zone-lib); }
.zone-pre-libertadores  { border-left: 3px solid var(--zone-pre-lib); }
.zone-sudamericana      { border-left: 3px solid var(--zone-sul); }
.zone-rebaixamento      { border-left: 3px solid var(--zone-rel); }

/* Zone row tints */
.zone-libertadores td:first-child  { /* handled by border-left */ }

/* Cells */
.th-center, .stat-cell, .points-cell, .goal-diff { text-align: center; }

.position-cell {
    font-weight: 700;
    width: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.team-logo {
    width: 20px; height: 20px;
    vertical-align: middle;
    border-radius: 3px;
    object-fit: contain;
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    text-align: left;
}

/* Coluna "Time" na standings — header e cells à esquerda */
.standings-table th:nth-child(2),
.standings-table td:nth-child(2),
.standings-table th:nth-child(3),
.standings-table td:nth-child(3) { text-align: left; }

.team-name {
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.points-cell {
    font-weight: 800;
    font-size: 14px;
    color: var(--text-primary);
}

.stat-cell {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 24px;
}

.goal-diff { font-weight: 600; }
.goal-diff.positive { color: var(--accent-green-2); }
.goal-diff.negative { color: var(--accent-red); }

/* Form dots */
.form-dots { display: flex; gap: 3px; align-items: center; justify-content: center; }

.form-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.form-dot.win  { background: var(--accent-green-2); }
.form-dot.draw { background: var(--text-muted); opacity: 0.6; }
.form-dot.loss { background: var(--accent-red); }

.last-match-date { font-size: 10px; color: var(--text-muted); text-align: center; }

/* Zone legend */
.zone-legend {
    padding: 10px 14px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card-2);
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.zone-legend-item { display: flex; align-items: center; gap: 5px; }
.zone-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Fixture row — próximos jogos (nome x nome à esquerda, rodada/data à direita) */
.fixture-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s;
}
.fixture-row:last-child { border-bottom: none; }
.fixture-row:hover { background: var(--bg-hover); }

.fixture-row-teams {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
}

.fixture-row-x {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    margin: 0 2px;
}

.fixture-row-meta {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 16px;
}

.standings-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}


/* ─── 10. CHARTS ────────────────────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.charts-grid--wide { grid-template-columns: 1fr; }
.chart-wrapper--wide { grid-column: 1/-1; }
.chart-container--tall { height: 260px; }

.chart-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 20px;
}

.chart-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-container {
    position: relative;
    height: 340px;
}


/* ─── 11. MERCADO ───────────────────────────────────────────────────────────── */
.market-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.market-search {
    flex: 1;
    min-width: 200px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    background: var(--bg-card-2);
    color: var(--text-primary);
    transition: var(--transition);
}

.market-search::placeholder { color: var(--text-muted); }
.market-search:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px var(--accent-green-glow);
}

.market-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    background: var(--bg-card-2);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.market-select:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px var(--accent-green-glow);
}

.market-select option { background: var(--bg-card-2); color: var(--text-primary); }

.market-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 20px;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.market-table thead { background: var(--bg-card-2); border-bottom: 1px solid var(--border); }

.market-table th {
    padding: 10px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.market-table th:hover { color: var(--text-primary); }
.market-table th.sorted-asc::after  { content: ' ↑'; }
.market-table th.sorted-desc::after { content: ' ↓'; }
.sort-th { cursor: pointer; user-select: none; }
.sort-th:hover { color: var(--text-primary); }
.sort-icon { color: var(--text-muted); font-size: 9px; margin-left: 3px; }

.market-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    text-align: center;
}

/* Coluna de nome/texto principal — alinhada à esquerda */
.market-table td:nth-child(2),
.market-table th:nth-child(2) { text-align: left; }
/* Tabelas sem coluna # (Casa vs Fora, etc.) — 1ª coluna à esquerda */
.market-table td:first-child:not(.market-rank):not(.stat-cell),
.market-table th:first-child { text-align: left; }

.market-table tbody tr { transition: background-color 0.12s ease; }
.market-table tbody tr:hover { background: var(--bg-hover); }
.market-table tbody tr:last-child td { border-bottom: none; }

.market-value-cell {
    font-weight: 700;
    color: var(--accent-green-2);
    white-space: nowrap;
    text-align: center;
}

.market-value-brl {
    font-weight: 600;
    color: var(--accent-blue);
    white-space: nowrap;
    font-size: 11px;
    text-align: center;
}

.market-position-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.market-rank {
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    width: 36px;
}

.market-source {
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 8px;
    font-style: italic;
}

.market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.market-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.market-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.market-empty-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}


/* ─── 12. LOADING / ERROR / FOOTER ─────────────────────────────────────────── */
.loading-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    gap: 16px;
}

.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.error-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 32px;
}

.error-message {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 420px;
}

.error-icon { font-size: 40px; margin-bottom: 14px; }
.error-title { font-size: 16px; font-weight: 700; color: var(--accent-red); margin-bottom: 8px; }
.error-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }

.btn-retry {
    padding: 9px 24px;
    background: var(--accent-green);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-retry:hover { background: var(--accent-green-2); transform: translateY(-1px); }

.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border-light);
    margin-top: 24px;
}

.footer a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--text-secondary); }

.hidden { display: none !important; }


/* ─── 13. UPDATE OVERLAY (SSE) ──────────────────────────────────────────────── */
.update-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.update-overlay.hidden { display: none; }

.update-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px 40px;
    width: 440px;
    max-width: 92vw;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.update-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.update-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    min-height: 18px;
}

.progress-bar-track {
    background: var(--bg-hover);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-green-2));
    border-radius: 99px;
    transition: width 0.35s ease;
    will-change: width;
    box-shadow: 0 0 8px rgba(63,185,80,0.5);
}

.progress-pct {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-variant-numeric: tabular-nums;
}

.btn-close {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 22px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-close:hover { background: var(--border); }
.btn-close.hidden { display: none; }


/* ─── 14. HISTÓRICO ─────────────────────────────────────────────────────────── */
.hsub-btn {
    padding: 8px 18px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.hsub-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.hsub-btn.active {
    background: var(--accent-green);
    color: #fff;
    font-weight: 600;
}

.hist-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

/* H2H Summary */
.h2h-summary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 20px 24px;
    text-align: center;
    margin-bottom: 4px;
}

.h2h-team .h2h-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.h2h-team .h2h-wins { font-size: 28px; font-weight: 800; color: var(--accent-green-2); }
.h2h-middle { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.h2h-total { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.h2h-draws, .h2h-goals { font-size: 11px; color: var(--text-secondary); }


/* ─── 15. FORM TABLE (Estatísticas) ─────────────────────────────────────────── */
.form-table { overflow-x: auto; }


/* ─── 16. ABA TIME ─────────────────────────────────────────────────────────── */
.time-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.time-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.time-header-badge {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
}

.time-header-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.time-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.time-position-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.time-voltar {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card-2);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}
.time-voltar:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-green);
}


/* Resultados por rodada */
.rodada-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 24px;
}

.rodada-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card-2);
}

.rodada-header-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rodada-select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}
.rodada-select:focus { outline: none; border-color: var(--accent-green); }

[data-theme="light"] .rodada-select {
    background: #fff;
    border-color: #d1d5db;
}

.rodada-list { }

.rodada-match {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s;
}
.rodada-match:last-child { border-bottom: none; }
.rodada-match:hover { background: var(--bg-hover); }

.rodada-team {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rodada-team--home { justify-content: flex-end; text-align: right; }
.rodada-team--away { justify-content: flex-start; }

.rodada-score {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    padding: 3px 8px;
    border-radius: 4px;
}

.rodada-date {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
}

/* Heatmap */
.heatmap-wrapper {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.heatmap-table {
    border-collapse: collapse;
    font-size: 10px;
    width: max-content;
    min-width: 100%;
}

.heatmap-table th,
.heatmap-table td {
    padding: 3px 2px;
    text-align: center;
    border: 1px solid var(--border-light);
}

.heatmap-th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 9px;
    min-width: 24px;
    background: var(--bg-card-2);
}

.heatmap-team-th {
    text-align: left !important;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 9px;
    background: var(--bg-card-2);
    min-width: 100px;
}

.heatmap-team {
    text-align: left !important;
    font-weight: 500;
    font-size: 10px;
    color: var(--text-primary);
    white-space: nowrap;
    padding: 4px 6px !important;
    min-width: 100px;
    background: var(--bg-card);
    position: sticky;
    left: 0;
    z-index: 1;
}

.heatmap-cell {
    font-weight: 700;
    font-size: 9px;
    width: 24px;
    height: 22px;
    transition: transform 0.1s;
}

.heatmap-win  { background: rgba(16,185,129,0.25); color: var(--accent-green); }
.heatmap-draw { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.heatmap-loss { background: rgba(218,54,51,0.25); color: var(--accent-red); }
.heatmap-cell:hover { transform: scale(1.3); z-index: 2; }

/* ─── 17. RESPONSIVO ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .main-content-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .market-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }

    .header { padding: 16px 0 0; }
    .header-content { padding: 0 16px 14px; }
    .header-timestamp { padding: 7px 16px; }

    .header-content { flex-direction: column; align-items: flex-start; gap: 12px; }
    .header-controls { width: 100%; flex-wrap: wrap; }

    .tab-bar { overflow-x: auto; }
    .tab-bar-inner { padding: 0 12px; }
    .tab-btn { padding: 12px 16px; font-size: 12px; white-space: nowrap; }

    .time-header { flex-direction: column; gap: 12px; padding: 16px; }
    .time-header-badge { width: 40px; height: 40px; }
    .time-header-name { font-size: 18px; }
    .time-voltar { width: 100%; text-align: center; }

    .container { padding: 16px; }

    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: 22px; }
    .kpi-value.small { font-size: 14px; }

    .standings-table th,
    .standings-table td { padding: 7px 5px; }

    .team-name { font-size: 11px; max-width: 90px; }

    .market-controls { flex-direction: column; }
    .market-search { min-width: 100%; }

    .h2h-summary { grid-template-columns: 1fr; }
}
