/* --- General Styles --- */
:root {
    --primary-color: #007bff; 
    --secondary-color: #6c757d; 
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-color: #212529;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --standings-top-bg: #e9f5ff;
    --standings-top-bg-alt: #d6ebfa;
    --standings-bottom-bg: #fff0f1;
    --standings-bottom-bg-alt: #ffe6e8;
    --standings-separator-color: #adb5bd;
    --rank-column-width-desktop: 60px; 
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: #eef1f5; 
    color: var(--text-color);
    display: flex;
    justify-content: center;
    padding-top: 20px;
    padding-bottom: 20px;
    box-sizing: border-box; 
}
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--card-bg); 
    padding: 20px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}
.logo-container { display: flex; align-items: center; }
.logo-icon { font-size: 2.5em; color: var(--primary-color); margin-right: 15px; }
header h1 { margin: 0; font-size: 1.8em; color: var(--dark-color); }
nav.desktop-nav a { text-decoration: none; color: var(--secondary-color); margin-left: 20px; font-weight: 500; padding: 8px 12px; border-radius: 5px; transition: background-color 0.3s, color 0.3s; }
nav.desktop-nav a i { margin-right: 6px; }
nav.desktop-nav a:hover, nav.desktop-nav a.active { background-color: var(--primary-color); color: white; }
main h2 { color: var(--dark-color); margin-top: 0; margin-bottom: 25px; font-size: 1.6em; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; display: inline-block; }
.card { background-color: var(--card-bg); padding: 25px; margin-bottom: 30px; border-radius: var(--border-radius); box-shadow: 0 1px 5px rgba(0,0,0,0.07); border: 1px solid var(--border-color); }
.card h3 { margin-top: 0; margin-bottom: 20px; color: var(--primary-color); font-size: 1.3em; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
.form-group input[type="text"], .form-group input[type="number"], .form-group input[type="date"], .form-group input[type="email"], .form-group select, .form-group textarea { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 5px; box-sizing: border-box; font-size: 1em; transition: border-color 0.3s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); }
.form-group input[readonly] { background-color: var(--light-color); cursor: not-allowed; }
.error-message { color: #dc3545; font-size: 0.85em; display: block; margin-top: 5px; }

.view-switcher { display: flex; justify-content: center; margin-bottom: 20px; gap: 10px; }
.view-switcher button { padding: 10px 20px; font-size: 1em; font-weight: 500; cursor: pointer; border: 1px solid var(--primary-color); background-color: var(--light-color); color: var(--primary-color); border-radius: var(--border-radius); transition: background-color 0.3s, color 0.3s; }
.view-switcher button:hover { background-color: #dbeaff; }
.view-switcher button.active { background-color: var(--primary-color); color: white; }

.leaderboard-grid { display: grid; grid-template-columns: 1fr; gap: 25px; margin-bottom: 30px; }
.full-width-record { grid-column: 1 / -1; }

.leaderboard table, .standings-container > table.standings-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.leaderboard table th, .leaderboard table td,
.standings-container > table.standings-table th, .standings-container > table.standings-table td { padding: 12px 15px; border: 1px solid var(--border-color); text-align: left; word-wrap: break-word; }
.leaderboard table th, .standings-container > table.standings-table th { background-color: var(--light-color); font-weight: 600; color: var(--dark-color); }
.leaderboard table tbody tr:hover { background-color: #f1f1f1; }
.standings-container > table.standings-table tbody tr:hover { background-color: #d1d1d1; }
.leaderboard table th:first-child, .leaderboard table td:first-child,
.standings-container > table.standings-table th:first-child, .standings-container > table.standings-table td:first-child { text-align: center; font-weight: bold; width: var(--rank-column-width-desktop); }

#standingsTable tbody tr.standings-group-top { background-color: var(--standings-top-bg); }
#standingsTable tbody tr.standings-group-top:nth-child(even) { background-color: var(--standings-top-bg-alt); }
#standingsTable tbody tr.standings-group-bottom { background-color: var(--standings-bottom-bg); }
#standingsTable tbody tr.standings-group-bottom:nth-child(even) { background-color: var(--standings-bottom-bg-alt); }
#standingsTable tbody tr.standings-group-separator td { border-bottom: 2px solid var(--standings-separator-color); }

.standings-division-header td { background-color: #495057 !important; color: white !important; text-align: center !important; font-weight: bold; padding: 6px 0 !important; border: 1px solid #495057 !important; }
.standings-division-header h3 { margin: 0; font-size: 1.1em; letter-spacing: 2px; text-transform: uppercase; }
footer { text-align: center; padding: 20px 0; margin-top: 30px; border-top: 1px solid var(--border-color); font-size: 0.9em; color: var(--secondary-color); }
footer p { margin: 0; }
.mobile-nav-bottom { display: none; }

@media (min-width: 850px) {
    .leaderboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    body { padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
    .container { width: 100%; padding: 15px 10px; margin: 0; border-radius: 0; box-shadow: none; }
    main { padding-bottom: 70px; }
    header { flex-direction: column; align-items: center; margin-bottom: 20px; padding-bottom: 15px; }
    .logo-container { margin-bottom: 10px; }
    header h1 { font-size: 1.5em; }
    nav.desktop-nav { display: none; }
    .mobile-nav-bottom { display: flex; justify-content: space-around; align-items: center; position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--dark-color); padding: 5px 0; box-shadow: 0 -2px 8px rgba(0,0,0,0.15); z-index: 1000; border-top: 1px solid var(--secondary-color); }
    .mobile-nav-bottom a { color: var(--light-color); text-decoration: none; padding: 8px 5px; display: flex; flex-direction: column; align-items: center; font-size: 0.75em; text-align: center; flex-grow: 1; }
    .mobile-nav-bottom a i { font-size: 1.4em; margin-bottom: 3px; margin-right: 0; }
    .mobile-nav-bottom a.active, .mobile-nav-bottom a.active i { color: var(--primary-color); }
    
    .view-switcher button { padding: 8px 12px; font-size: 0.9em; }
    main h2 { margin-bottom: 15px; padding-bottom: 8px; font-size: 1.4em; }
    .card { padding: 0; border: none; box-shadow: none; margin-bottom: 20px; background-color: transparent; }
    .leaderboard, .standings-container { overflow-x: hidden; }
    
    .standings-table { table-layout: fixed; width: 100%; border-collapse: collapse; }
    
    /*
    ====================================================================
    == !! YOUR MANUAL CONTROL PANEL FOR MOBILE FONT SIZES !! ==
    ====================================================================
    */

    /* --- 1. CONTROL HEADER TEXT --- */
    .standings-table th {
        border: none;
        border-bottom: 2px solid var(--secondary-color);
        padding: 8px 2px;
        text-align: center;
        font-weight: bold;
        white-space: nowrap; /* <-- This is KEY. Forces text to one line. */
        font-size: 11px; /* <-- MANUAL CONTROL: Change this value (e.g., 10px, 12px) to fit. */
    }

    /* --- 2. CONTROL DATA CELL TEXT --- */
    .standings-table td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        padding: 9px 3px;
        text-align: center;
        white-space: nowrap; /* <-- This is KEY. Forces scores to one line. */
        font-size: 12px; /* <-- MANUAL CONTROL: Change this value if needed. */
    }

    /* --- 3. EXCEPTION: Allow player names to wrap if they are too long --- */
    .standings-table th:nth-child(2), 
    .standings-table td:nth-child(2) {
        text-align: left;
        padding-left: 5px;
        word-break: break-word; /* Helps with long names */
        white-space: normal; /* <-- This OVERRIDES the nowrap above, just for this column. */
    }

    .standings-table tr:last-child td { border-bottom: none; }
    .standings-division-header td { border-bottom: 1px solid var(--dark-color) !important; }

    /* Column widths can still be tweaked if necessary, but font size is the main tool now. */
    #standingsTable th:first-child, #standingsTable td:first-child { width: 14%; }
    #standingsTable th:nth-child(2), #standingsTable td:nth-child(2) { width: 32%; }
    #standingsTable th:nth-child(n+3) { width: 13.5%; }

    #playoffsStandingsTable th:first-child, #playoffsStandingsTable td:first-child { width: 15%; }
    #playoffsStandingsTable th:nth-child(2), #playoffsStandingsTable td:nth-child(2) { width: 35%; }
    #playoffsStandingsTable th:nth-child(n+3) { width: 16.66%; }

    .standings-division-header td { padding: 4px 0 !important; }
    .standings-division-header h3 { font-size: 0.9em; letter-spacing: 1px; }
}