/* General page styling */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f4f8 100%); /* Light ice-blue gradient */
    color: #1a1a1a;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* General table styling */
table {
    width: 100%; /* Full width for modern look */
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Softer shadow for depth */
    border-radius: 8px; /* Rounded corners */
    overflow: hidden; /* Ensure border-radius applies to content */
    table-layout: fixed;
}

/* Header styling */
th {
    background: linear-gradient(90deg, #003087 0%, #0033a0 100%); /* NHL blue gradient */
    color: #ffffff;
    border-bottom: 2px solid #ffcd00; /* NHL gold accent */
    padding: 12px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    height: 40px; /* Slightly taller for modern feel */
    vertical-align: middle;
    transition: background 0.3s ease; /* Smooth hover effect */
}

th:hover {
    background: linear-gradient(90deg, #00266f 0%, #002d8d 100%); /* Darker blue on hover */
}

/* Cell styling */
td {
    border-bottom: 1px solid #e0e0e0;
    padding: 12px;
    text-align: left;
    color: #1a1a1a;
    background-color: #ffffff;
    transition: background 0.3s ease; /* Smooth hover effect */
}

td:hover {
    background-color: #f5f7fa; /* Light hover effect */
}

/* Right-align numeric columns for Top Scorers */
#streaks-body tr td:nth-child(3), /* Games Played */
#streaks-body tr td:nth-child(4), /* Goals */
#streaks-body tr td:nth-child(5), /* Goals/Game */
#streaks-body tr td:nth-child(6), /* Shots */
#streaks-body tr td:nth-child(7) /* TOI/Game */ {
    text-align: right;
}

/* Right-align numeric columns for Goal Droughts */
#droughts-body tr td:nth-child(3), /* Games Played */
#droughts-body tr td:nth-child(4), /* Goals */
#droughts-body tr td:nth-child(5), /* Games Since Last Goal */
#droughts-body tr td:nth-child(6), /* Shots/Game */
#droughts-body tr td:nth-child(7), /* xG in Drought */
#droughts-body tr td:nth-child(8) /* Probability to Score (%) */ {
    text-align: right;
}

/* Sort indicator styling */
.sort-indicator::after {
    content: '↕';
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    color: #ffcd00; /* NHL gold */
    transition: transform 0.3s ease;
}

th.sort-asc .sort-indicator::after {
    content: '↑';
    transform: rotate(0deg);
}

th.sort-desc .sort-indicator::after {
    content: '↓';
    transform: rotate(0deg);
}

/* Ensure table fits screen without extra width */
table {
    max-width: 100%;
    overflow-x: auto; /* Horizontal scroll for small screens */
}

/* Set specific column widths for Top Scorers (7 columns) */
#top-scorers th:nth-child(1), #top-scorers td:nth-child(1) { width: 25%; min-width: 120px; } /* Player */
#top-scorers th:nth-child(2), #top-scorers td:nth-child(2) { width: 10%; min-width: 60px; }  /* Team */
#top-scorers th:nth-child(3), #top-scorers td:nth-child(3) { width: 10%; min-width: 70px; }  /* Games Played */
#top-scorers th:nth-child(4), #top-scorers td:nth-child(4) { width: 10%; min-width: 50px; }  /* Goals */
#top-scorers th:nth-child(5), #top-scorers td:nth-child(5) { width: 10%; min-width: 70px; }  /* Goals/Game */
#top-scorers th:nth-child(6), #top-scorers td:nth-child(6) { width: 15%; min-width: 90px; }  /* Shots */
#top-scorers th:nth-child(7), #top-scorers td:nth-child(7) { width: 20%; min-width: 90px; }  /* TOI/Game */

/* Set specific column widths for Goal Droughts (8 columns) */
#goal-droughts th:nth-child(1), #goal-droughts td:nth-child(1) { width: 20%; min-width: 150px; } /* Player */
#goal-droughts th:nth-child(2), #goal-droughts td:nth-child(2) { width: 10%; min-width: 70px; } /* Team */
#goal-droughts th:nth-child(3), #goal-droughts td:nth-child(3) { width: 10%; min-width: 90px; } /* Games Played */
#goal-droughts th:nth-child(4), #goal-droughts td:nth-child(4) { width: 10%; min-width: 70px; } /* Goals */
#goal-droughts th:nth-child(5), #goal-droughts td:nth-child(5) { width: 15%; min-width: 70px; } /* Games Since Last Goal */
#goal-droughts th:nth-child(6), #goal-droughts td:nth-child(6) { width: 10%; min-width: 70px; } /* Shots/Game */
#goal-droughts th:nth-child(7), #goal-droughts td:nth-child(7) { width: 15%; min-width: 90px; } /* xG in Drought */
#goal-droughts th:nth-child(8), #goal-droughts td:nth-child(8) { width: 10%; min-width: 90px; } /* Probability to Score (%) */

/* Team-specific themes using CSS variables */
:root {
    --default-bg: #ffffff;
    --default-accent: #0033a0;
}

body[data-team="ANA"] { --team-bg: #F47A38; --team-accent: #B9975B; } /* Ducks: Orange & Gold */
body[data-team="BOS"] { --team-bg: #FFB81C; --team-accent: #000000; } /* Bruins: Yellow & Black */
body[data-team="BUF"] { --team-bg: #003087; --team-accent: #FFB81C; } /* Sabres: Blue & Gold */
body[data-team="CGY"] { --team-bg: #D2001C; --team-accent: #F1BE48; } /* Flames: Red & Yellow */
body[data-team="CAR"] { --team-bg: #CC0000; --team-accent: #000000; } /* Hurricanes: Red & Black */
body[data-team="CHI"] { --team-bg: #CF0A2C; --team-accent: #FF671F; } /* Blackhawks: Red & White */
body[data-team="COL"] { --team-bg: #6F263D; --team-accent: #A2AAAD; } /* Avalanche: Burgundy & Steel */
body[data-team="CBJ"] { --team-bg: #002654; --team-accent: #CE1126; } /* Blue Jackets: Blue & Red */
body[data-team="DAL"] { --team-bg: #006847; --team-accent: #FFFFFF; } /* Stars: Green & White */
body[data-team="DET"] { --team-bg: #CE1126; --team-accent: #FFFFFF; } /* Red Wings: Red & White */
body[data-team="EDM"] { --team-bg: #041E42; --team-accent: #FF4C00; } /* Oilers: Blue & Orange */
body[data-team="FLA"] { --team-bg: #C8102E; --team-accent: #B9975B; } /* Panthers: Red & Gold */
body[data-team="LAK"] { --team-bg: #111111; --team-accent: #A2AAAD; } /* Kings: Black & Silver */
body[data-team="MIN"] { --team-bg: #154734; --team-accent: #E03A3E; } /* Wild: Green & Red */
body[data-team="MTL"] { --team-bg: #AF1E2D; --team-accent: #192168; } /* Canadiens: Red & Blue */
body[data-team="NSH"] { --team-bg: #FFB81C; --team-accent: #041E42; } /* Predators: Gold & Navy */
body[data-team="NJD"] { --team-bg: #CE1126; --team-accent: #000000; } /* Devils: Red & Black */
body[data-team="NYI"] { --team-bg: #F47D30; --team-accent: #FFFFFF; } /* Islanders: Orange & White */
body[data-team="NYR"] { --team-bg: #0033A0; --team-accent: #CE1126; } /* Rangers: Blue & Red */
body[data-team="OTT"] { --team-bg: #C8102E; --team-accent: #FFFFFF; } /* Senators: Red & White */
body[data-team="PHI"] { --team-bg: #F74902; --team-accent: #000000; } /* Flyers: Orange & Black */
body[data-team="PIT"] { --team-bg: #FCB514; --team-accent: #000000; } /* Penguins: Gold & Black */
body[data-team="SJS"] { --team-bg: #006D75; --team-accent: #EA7200; } /* Sharks: Teal & Orange */
body[data-team="SEA"] { --team-bg: #001628; --team-accent: #99D9D9; } /* Kraken: Dark Blue & Light Blue */
body[data-team="STL"] { --team-bg: #002F87; --team-accent: #FCB514; } /* Blues: Blue & Yellow */
body[data-team="TBL"] { --team-bg: #002868; --team-accent: #FFFFFF; } /* Lightning: Blue & White */
body[data-team="TOR"] { --team-bg: #00205B; --team-accent: #FFFFFF; } /* Maple Leafs: Blue & White */
body[data-team="UTA"] { --team-bg: #041E42; --team-accent: #B9975B; } /* Utah Hockey Club: Blue & Gold */
body[data-team="VAN"] { --team-bg: #00843D; --team-accent: #FFFFFF; } /* Canucks: Green & White */
body[data-team="VGK"] { --team-bg: #B9975B; --team-accent: #000000; } /* Golden Knights: Gold & Black */
body[data-team="WSH"] { --team-bg: #041E42; --team-accent: #C8102E; } /* Capitals: Blue & Red */
body[data-team="WPG"] { --team-bg: #041E42; --team-accent: #AC162C; } /* Jets: Blue & Red */

body {
    background-color: var(--default-bg, #ffffff);
    --current-team-bg: var(--default-bg);
    --current-team-accent: var(--default-accent);
}

body[data-team]:not([data-team="all"]) {
    background: linear-gradient(135deg, var(--current-team-bg, #e0e7ff) 0%, #f0f4f8 100%);
}

#season, h2 {
    background: linear-gradient(90deg, var(--current-team-accent, #0033a0) 0%, #003087 100%);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#team-filter, #player-search {
    margin: 10px 0;
    padding: 10px;
    font-size: 14px;
    border: 2px solid var(--current-team-accent, #0033a0);
    border-radius: 6px;
    background-color: #ffffff;
    color: #1a1a1a;
    width: 250px;
    transition: border-color 0.3s ease;
}

#team-filter:focus, #player-search:focus {
    border-color: #ffcd00; /* NHL gold on focus */
    outline: none;
}

label {
    color: var(--current-team-accent, #0033a0);
    font-weight: 600;
    margin-right: 10px;
}

#loading {
    display: none;
    font-style: italic;
    color: #666666;
    text-align: center;
    margin: 20px 0;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 6px;
}

#loading.active {
    display: block;
}

/* Responsive design for smaller screens */
@media screen and (max-width: 768px) {
    th, td {
        padding: 6px;
        font-size: 12px;
    }
    table {
        font-size: 12px;
    }
    #top-scorers th:nth-child(1), #top-scorers td:nth-child(1) { width: 22%; min-width: 100px; }
    #top-scorers th:nth-child(2), #top-scorers td:nth-child(2) { width: 8%; min-width: 50px; }
    #top-scorers th:nth-child(3), #top-scorers td:nth-child(3) { width: 8%; min-width: 60px; }
    #top-scorers th:nth-child(4), #top-scorers td:nth-child(4) { width: 6%; min-width: 40px; }
    #top-scorers th:nth-child(5), #top-scorers td:nth-child(5) { width: 8%; min-width: 60px; }
    #top-scorers th:nth-child(6), #top-scorers td:nth-child(6) { width: 10%; min-width: 80px; }
    #top-scorers th:nth-child(7), #top-scorers td:nth-child(7) { width: 10%; min-width: 80px; }
   