/* NHL Hockey Schedule Styles */
:root{
    --page_background_color: slategray;
    --away_background_color: rgb(41, 41, 41);
    --home_background_color: rgb(238, 238, 238);
    --tableheader_background_color: #f8f9fa;
    --table_background_color: rgb(238, 238, 238);
    --button_background_color: #006a94;
    --low_value_red: #ffbac0;
    --high_value_green: #c2ffd1;
    --neutral_value_white: white;
    --really_low_value_purple: #e8d4f8;
}


/* Base Styles */
html, body {
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh on mobile */
    overscroll-behavior-x: none; /* Prevent horizontal overscroll */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #050505;
    touch-action: pan-y; /* Allow vertical scrolling only, prevent pull-to-refresh */
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    background: var(--page_background_color);
    padding: 20px;
    border-radius: 0px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: visible; /* Ensure sticky positioning works */
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh on mobile */
    position: relative; /* For beta badge positioning */
}


h1 {
    color: white;
    text-align: center;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    background: var(--page_background_color);
    z-index: 100;
    padding: 10px 0 5px 0;
    margin-top: 0;
}

/* Controls */
.controls {
    margin-bottom: 5px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: sticky;
    top: 48px; /* h1 height: ~48px (10px + text + 5px) */
    background: var(--page_background_color);
    z-index: 99;
    padding: 10px 0;
    /*border-bottom: 1px solid #e0e0e0;*/
}

.nav-button {
    background: var(--button_background_color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 0px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.nav-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Today Button Special Styling */
.today-button {
    background: var(--button_background_color);
    color: white;
    font-weight: 600;
    padding: 10px 20px;
}

/*
.today-button:hover {
    background: #0056b3;
    border-color: #004085;
}
*/

select {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Table Styles */
.schedule-table {
    width: 100%;
    border-collapse: separate;
    background-color: white;
    border-spacing: 0;
    font-size: 12px;
    table-layout: fixed; /* Force fixed column widths */
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #ccc;
    border-top: 0;
    border-left: 0;
    padding: 0px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: var(--page_background_color);
}

.schedule-table th:first-child,
.schedule-table td:first-child {
    border-left: 1px solid #ccc;
}

.schedule-table thead tr:first-child th {
    border-top: 1px solid #ccc;
}

.schedule-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.schedule-table thead th {
    background-color: var(--tableheader_background_color);
    position: sticky !important;
    top: 104px !important; /* h1 (~48px) + controls (~50px with padding and border) */
    z-index: 98 !important;
}

/* Fixed column widths */
.schedule-table th:nth-child(1),
.schedule-table td:nth-child(1) {
    /*max-width: 80px; /* Team column */
    text-align: center;
    font-weight: bold;
    padding: 0 !important; /* Remove padding so wrapper fills entire cell */
    width: 10%;
}

.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) {
    /*min-width: 25px; /* GP column */
    text-align: center;
    width: 5%;
}

.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3),
.schedule-table th:nth-child(4),
.schedule-table td:nth-child(4) {
    /*width: 55px; /* Off and Def columns */
    text-align: center;
    width: 5%;
}

.schedule-table th:nth-child(5),
.schedule-table td:nth-child(5),
.schedule-table th:nth-child(6),
.schedule-table td:nth-child(6),
.schedule-table th:nth-child(7),
.schedule-table td:nth-child(7),
.schedule-table th:nth-child(8),
.schedule-table td:nth-child(8),
.schedule-table th:nth-child(9),
.schedule-table td:nth-child(9),
.schedule-table th:nth-child(10),
.schedule-table td:nth-child(10),
.schedule-table th:nth-child(11),
.schedule-table td:nth-child(11) {
    width: 80%/7; /* Day columns (Mon-Sun) */
}

/* Team Cell - wrapper div fills entire td */
.team-cell {
    display: flex;
    gap: 10px;
    width: 100%;
    height: 100%;
    font-weight: bold;
    text-align: center;
    background-color: var(--tableheader_background_color) !important;
    box-sizing: border-box;
    justify-content: center;
}

.team-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.team-name {
    font-weight: bold;
    font-size: 14px;
}

.last-ten-record {
    font-size: 12px;
    color: #444;
    font-weight: normal;
}

/* Sticky Columns */
.sticky-column {
    position: sticky;
    left: 0;
    background-color: white;
    z-index: 10;
}

/* Commented out for user's custom layout
.sticky-column:nth-child(2) {
    left: 80px;
}

.sticky-column:nth-child(3) {
    left: 135px;
}
*/

.sticky-column-right {
    position: sticky;
    right: 0;
    background-color: white;
    z-index: 10;
}

thead .sticky-column,
thead .sticky-column-right {
    background-color: #f8f9fa;
    position: sticky !important;
    top: 98px !important;
    z-index: 99 !important; /* Higher than regular sticky headers to stay on top */
}

/* GP Column Styling */
.gp-cell {
    font-size: 12px;
    background-color: var(--table_background_color) !important;
}

/* GP Column Styling - Ranked by value */
.gp-highest {
    background-color: var(--high_value_green) !important; /* Light green for highest value */
}

.gp-third {
    background-color: var(--low_value_red) !important; /* Light red for third highest */
}

.gp-lowest {
    background-color: var(--really_low_value_purple) !important; /* Light purple for lowest value */
}

/* Today's Date Column Highlighting */
.today-column {
    background-color: #eecc88 !important; /* Gold color for today */
    font-weight: bold !important;
    color: #000 !important;
}

/* Sortable Column Styling */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background-color: #e0e0e0 !important;
}

.sort-indicator {
    font-size: 10px;
    color: #666;
}

/* Stat Value Boxes for Off/Def Columns */
.stat-value-box {
    display: inline-block;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: normal;
    border: 1px solid #999;
    background-color: white;
}

.stat-value-box.stat-indicator-good {
    background-color: var(--high_value_green); /* Pastel green */
}

.stat-value-box.stat-indicator-bad {
    background-color: var(--low_value_red); /* Pastel red */
}

.stat-value-box.stat-indicator-neutral {
    background-color: var(--neutral_value_white);
}

/* Opponent Stat Indicators for Unplayed Games */
.stat-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin: 0 1px;
    vertical-align: middle;
    border: 1px solid #999;
}

.stat-indicator-good {
    background-color: var(--high_value_green); /* Same as stat-good pastel green */
}

.stat-indicator-bad {
    background-color: var(--low_value_red); /* Same as stat-bad pastel red */
}

.stat-indicator-neutral {
    background-color: var(--neutral_value_white);
}

.mobile-indicator-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    margin-top: 2px;
}

/* Stat Cell */
.stat-cell {
    text-align: center;
    font-size: 12px;
    color: #333;
    /*background-color: var(--table_background_color) !important;*/
}

/* Team Logo */
.team-logo {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin: 0;
}

.opponent-logo {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 3px;
}

/* Desktop Game Cell Split Layout */
.desktop-game-container {
    display: flex;
    align-items: center;
    height: 100%;
}

.desktop-game-team {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 4px;
    border-right: 1px solid #ccc;
}

.desktop-game-info {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
    gap: 2px;
}

/* Game Cells */
.game-away {
    background-color: var(--away_background_color) !important;
    color: white !important;
}

.game-home {
    background-color: var(--home_background_color) !important;
}

.score-win {
    background-color: #008004;
    color: white;
    padding: 2px 4px;
    border-radius: 0px;
    font-weight: bold;
    font-size: 11px;
    width: 100%;
}

.score-loss {
    background-color: #b11a0f;
    color: white;
    padding: 2px 4px;
    border-radius: 0px;
    font-weight: bold;
    font-size: 11px;
    width: 100%;
}

.score-in-progress {
    background-color: #808080;
    color: white;
    padding: 2px 4px;
    border-radius: 0px;
    font-weight: bold;
    font-size: 11px;
    width: 100%;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

.error {
    color: red;
    text-align: center;
    padding: 20px;
}

.debug-info {
    margin-top: 20px;
    padding: 10px;
    background-color: #f5f5f5;
    font-size: 12px;
    border-radius: 4px;
}

/* Table Container */
/* Removed overflow to allow sticky positioning to work relative to viewport */

/* Mobile Responsive Design */
@media (max-width: 1024px) {
    .table-container {
        margin: 0 -0px; /* Extend slightly beyond container padding */
    }

    .container {
        padding: 0px 0px 0px 0px;
        margin: 0;
        max-width: 100%;
    }
    
    body {
        margin: 0;
        padding: 0;
    }

    h1 {
        font-size: 16px;
        margin: 0px 0 0 0;
        top: 0px;
        padding: 10px 0 5px 0;
    }

    .controls {
        margin-bottom: 5px;
        font-size: 12px;
        gap: 8px;
        top: 33px; /* h1 mobile height: ~28px */
        padding: 5px 0;
    }
    
    .schedule-table thead th {
        top: 68px !important; /* h1 (28px) + controls (50px) = 78px */
    }
    
    thead .sticky-column,
    thead .sticky-column-right {
        top: 68px !important; /* Same as regular thead th for mobile */
    }
    
    .schedule-table {
        font-size: 12px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 0px;
        line-height: 1.1;
        border-width: 0.5px;
    }

    .stat-cell {
        font-size: 10px;
    }

    .stat-indicator {
        display: inline-block;
        width: 10px;
        height: 10px;
        margin: 0 1px;
        vertical-align: middle;
        border: 1px solid #999;
    }

    .stat-value-box {
        display: inline-block;
        padding: 2px 2px;
        font-size: 12px;
        font-weight: normal;
        border: 1px solid #999;
        background-color: white;
    }
    
    /* Stack opponent and score vertically on mobile */
    .mobile-game-cell {
        display: table-cell !important;
        vertical-align: middle;
        text-align: center;
    }
    
    .mobile-game-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0px;
    }
    
    .mobile-opponent-line {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-score-line {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    /* Optimized column widths for mobile - fit ~350px */
    .schedule-table th:nth-child(1),
    .schedule-table td:nth-child(1) {
        width: 14%; /* Team column - increased for logo + stacked text */
        padding: 0 !important; /* Remove padding, let wrapper handle spacing */
    }
    
    .schedule-table th:nth-child(2),
    .schedule-table td:nth-child(2) {
        width: 6%; /* GP column - very compact */
        /*font-size: 10px;*/
    }

    .schedule-table th:nth-child(3),
    .schedule-table td:nth-child(3),
    .schedule-table th:nth-child(4),
    .schedule-table td:nth-child(4) {
        width: 7%; /* Off and Def columns */
    }

    .schedule-table th:nth-child(5),
    .schedule-table td:nth-child(5),
    .schedule-table th:nth-child(6),
    .schedule-table td:nth-child(6),
    .schedule-table th:nth-child(7),
    .schedule-table td:nth-child(7),
    .schedule-table th:nth-child(8),
    .schedule-table td:nth-child(8),
    .schedule-table th:nth-child(9),
    .schedule-table td:nth-child(9),
    .schedule-table th:nth-child(10),
    .schedule-table td:nth-child(10),
    .schedule-table th:nth-child(11),
    .schedule-table td:nth-child(11) {
        width: 66%/7; /* Day columns (7 × 32px = 224px) */
    }

    /* Commented out for user's custom layout
    .sticky-column:nth-child(2) {
        left: 50px;
    }
    
    .sticky-column:nth-child(3) {
        left: 75px;
    }
    */
    
    .team-logo {
        width: 14px;
        height: 14px;
        margin: 0;
        flex-shrink: 0;
    }

    .team-cell {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 2px !important; /* Small padding to fill cell */
        min-height: 34px; /* Match typical row height */
        width: 100%;
        box-sizing: border-box;
    }

    /* Team Info - Stack vertically on mobile */
    .team-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0px;
        line-height: 1;
    }
    
    .team-name {
        font-size: 12px;
        line-height: 1.1;
    }
    
    .last-ten-record {
        font-size: 10px;
        color: #444;
        line-height: 1.1;
    }
    
    .opponent-logo {
        width: 10px;
        height: 10px;
        margin-right: 1px;
    }
    
    .score-win,
    .score-loss,
    .score-in-progress {
        font-size: 10px; /* Slightly larger for better readability */
        font-weight: regular;
        padding: 0.5px;
    }
    
    
    
    .nav-button {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    select {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .debug-info {
        font-size: 10px;
    }
}

