body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
}

.header, .footer {
    background-color: #004080;
    color: white;
    text-align: center;
    padding: 1em 0;
}

header h1 {
    margin: 0;
    font-size: 2em;
}

main {
    padding: 1em;
}

.team-stats, .player-stats {
    margin-bottom: 2em;
}

.team-stats h2, .player-stats h2 {
    text-align: center;
    margin-bottom: 1em;
    color: #004080;
}

.team-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.team-panel {
    width: 25%;
    text-align: center;
    font-size: 1.1em;
    padding: 0.5em;
}

canvas {
    flex-grow: 1;
    max-width: 50%;
}

.team-players {
    margin-top: 2em;
}

.player-charts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
}

footer {
    padding: 1em 0;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1em;
    border-radius: 10px;
    margin: 20px auto; /* Center the header and limit width */
    width: 90%;
    max-width: 800px;
    background: linear-gradient(
        to right,
        var(--away-color, #004080), /* Fallback color */
        var(--home-color, #ffcc00) /* Fallback color */
    );
    color: white;
    font-family: Arial, sans-serif;
    text-align: center;
    gap: 1.5em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Subtle shadow */
}

.team-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
}

.team-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 0.5em;
}

.vs-text {
    font-size: 1.5em;
    font-weight: bold;
    color: white;
}

/* Updated CSS for team stats tables */
/* Combined Team Stats Table (Default Layout for Larger Screens) */
.combined-team-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    font-size: 0.85em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    table-layout: fixed; /* Enables fixed column width */
}

.combined-team-stats-table thead th {
    background: linear-gradient(to bottom, #004080, #0059b3);
    color: white;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85em;
}

.combined-team-stats-table tbody td {
    padding: 6px;
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    color: white;
    word-wrap: break-word; /* Ensures long text doesn't overflow */
}

/* Team Name Styling */
.combined-team-stats-table .team-name {
    font-size: 1em;
    font-weight: bold;
    text-align: left;
    padding-left: 10px;
}

/* Row Styling */
.combined-team-stats-table tbody tr {
    transition: background-color 0.3s ease;
}

.combined-team-stats-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.combined-team-stats-table tbody tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Scrollable Table for Smaller Screens */
.team-stats-container {
    overflow-x: auto;
}

/* Mobile Tables - Hidden by Default */
.mobile-team-stats {
    display: none;
}

/* Individual Mobile Team Tables */
.mobile-team-table {
    margin: 1em 0;
    border-radius: 8px;
    padding: 1em;
    background-color: rgba(0, 0, 0, 0.05); /* Light background for readability */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.mobile-team-table h3 {
    margin-bottom: 1em;
    text-transform: uppercase;
    font-size: 1.2em;
    font-weight: bold;
    color: black; /* Ensure header text is black */
}

.mobile-team-table table {
    width: 100%;
    border-collapse: collapse;
}

.mobile-team-table td {
    padding: 8px;
    font-size: 0.9em;
    font-weight: bold;
    text-align: left;
    color: black; /* Set table text color to black */
    background-color: white; /* Ensure rows have a white background */
    border-bottom: 1px solid #ddd; /* Subtle row separation */
}

.mobile-team-table td:last-child {
    text-align: right; /* Align stat values to the right */
}

/* Row Hover Effect for Mobile */
.mobile-team-table tr:hover td {
    background-color: rgba(0, 0, 0, 0.1); /* Light gray hover effect */
}


/* Media Query for Mobile Layout */
@media (max-width: 768px) {
    .team-stats-container {
        display: none; /* Hide combined table */
    }
    .mobile-team-stats {
        display: block; /* Show vertical tables for mobile */
    }
}
