/* Scoreboard Specific Styles - PHL Theme Integration */

/* Header Styles */
.scoreboard-header {
    margin-bottom: 1rem;
}

.scoreboard-header h2 {
    font-size: 1.5rem;
}

/* Season/Week dropdown styling */
.scoreboard-header .dropdown .btn {
    font-size: 0.9rem;
    padding: 0.375rem 0.75rem;
}

.scoreboard-header .dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .scoreboard-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    
    .scoreboard-header .d-flex:last-child {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Stack season/week dropdowns on mobile */
    .scoreboard-header .d-flex:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
    
    .scoreboard-header .d-flex:first-child > .d-flex:first-child {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 0.5rem;
    }
    
    .scoreboard-header .dropdown .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Filters panel now uses the shared .flt-* kit (phl-styles.css, Design System §10) */

.form-select-sm {
    font-size: 0.875rem;
}

.form-control-sm {
    font-size: 0.875rem;
}

/* Summary Tables - PHLweb2 Style Layout */
.summary-tables {
    height: fit-content;
}

.summary-tables .card {
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.summary-tables .card-header {
    background-color: var(--phl-surface);
    border-bottom: 1px solid var(--phl-line);
    padding: 0.5rem 0.75rem;
}

.summary-tables .card-header h6 {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Badge styling for summary counts */
.summary-tables .badge {
    font-size: 0.7rem;
    padding: 0.25em 0.4em;
}

.summary-tables .badge.bg-primary {
    background-color: var(--phl-orange, #ef7b00) !important;
}

/* Table styling within summary cards */
.summary-tables .table {
    font-size: 0.75rem;
    margin-bottom: 0;
}

.summary-tables .table th {
    border-top: none;
    font-weight: 600;
    color: var(--phl-steel);
    font-size: 0.7rem;
    padding: 0.4rem 0.2rem;
    white-space: nowrap;
    text-align: center;
}

.summary-tables .table td {
    padding: 0.4rem 0.2rem;
    vertical-align: middle;
    word-wrap: break-word;
    text-align: center;
}

/* Keep Stats and Play columns left-aligned for readability */

/* Players Summary table - Stats column is 6th column */
.summary-tables .table thead th:nth-child(6),
.summary-tables .table tbody tr td:nth-child(6) {
    text-align: left;
}

/* Plays Summary table - Play column is 8th column, ensure all others are centered */
.plays-summary-table thead th,
.plays-summary-table tbody tr td {
    text-align: center;
}

.plays-summary-table thead th:nth-child(8),
.plays-summary-table tbody tr td:nth-child(8) {
    text-align: left;
}

.summary-tables .table-hover tbody tr:hover {
    background-color: rgba(239, 123, 0, 0.05);
}

/* Fix hover row misalignment - prevent any pseudo-elements or layout shifts */
.summary-tables .table tbody tr:hover td {
    position: relative;
}

/* Remove any pseudo-elements that might be causing alignment issues */
.summary-tables .table tbody tr:hover::before,
.summary-tables .table tbody tr:hover::after {
    display: none !important;
}

/* Ensure consistent table cell widths on hover */
.summary-tables .table tbody tr:hover td {
    box-sizing: border-box;
    width: auto;
}

/* Sticky header for scrollable tables */
.summary-tables .sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--phl-surface);
}

/* Responsive table scrolling */
.table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

/* Row highlighting for significant changes - DISABLED to prevent misalignment */
tr[data-win-pct-change] {
    position: relative;
}

/* DISABLED: This pseudo-element was causing the hover misalignment issue */
/*
tr[data-win-pct-change]:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--phl-orange, #ef7b00);
}
*/

/* Color coding for positive/negative changes */
.text-success {
    color: var(--phl-win) !important;
}

.text-danger {
    color: var(--phl-loss) !important;
}

/* Site-wide color scale functionality - PHLweb2 style */
.color-scale-red-to-green {
    font-weight: bold;
}

.color-scale-green-to-red {
    font-weight: bold;
}

/* ==========================================================================
   Conditional color scales — PHL Design System heat scale.
   Diverging scales run steel (below avg) → white → orange (above avg);
   single-ended scales run white → orange (or white → steel for volume).
   All steps are color-mix() ramps over tokens — no new hues.
   ========================================================================== */

/* Text scale (win% change, 1 = most negative → 12 = most positive):
   steel pole → muted middle → orange pole, readable on white. */
.color-scale-1  { color: var(--phl-steel-deep) !important; font-weight: bold; }
.color-scale-2  { color: color-mix(in srgb, var(--phl-steel-deep) 75%, var(--phl-steel)) !important; font-weight: bold; }
.color-scale-3  { color: var(--phl-steel) !important; font-weight: bold; }
.color-scale-4  { color: color-mix(in srgb, var(--phl-steel) 60%, var(--phl-muted)) !important; font-weight: bold; }
.color-scale-5  { color: color-mix(in srgb, var(--phl-steel) 30%, var(--phl-muted)) !important; font-weight: bold; }
.color-scale-6  { color: var(--phl-muted) !important; font-weight: bold; }
.color-scale-7  { color: var(--phl-muted) !important; font-weight: bold; }
.color-scale-8  { color: color-mix(in srgb, var(--phl-orange-deep) 30%, var(--phl-muted)) !important; font-weight: bold; }
.color-scale-9  { color: color-mix(in srgb, var(--phl-orange-deep) 60%, var(--phl-muted)) !important; font-weight: bold; }
.color-scale-10 { color: color-mix(in srgb, var(--phl-orange-deep) 80%, var(--phl-muted)) !important; font-weight: bold; }
.color-scale-11 { color: var(--phl-orange-deep) !important; font-weight: bold; }
.color-scale-12 { color: color-mix(in srgb, var(--phl-orange-deep) 70%, var(--phl-orange)) !important; font-weight: bold; }

/* Background diverging scale: heat-lo (steel) → white → heat-hi (orange). */
.bg-color-scale-1  { background-color: var(--phl-heat-lo-2); color: var(--phl-text); }
.bg-color-scale-2  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 70%, white); color: var(--phl-text); }
.bg-color-scale-3  { background-color: var(--phl-heat-lo-1); color: var(--phl-text); }
.bg-color-scale-4  { background-color: color-mix(in srgb, var(--phl-heat-lo-1) 60%, white); color: var(--phl-text); }
.bg-color-scale-5  { background-color: color-mix(in srgb, var(--phl-heat-lo-1) 30%, white); color: var(--phl-text); }
.bg-color-scale-6  { background-color: var(--phl-heat-mid); color: var(--phl-text); }
.bg-color-scale-7  { background-color: var(--phl-heat-mid); color: var(--phl-text); }
.bg-color-scale-8  { background-color: color-mix(in srgb, var(--phl-heat-hi-1) 30%, white); color: var(--phl-text); }
.bg-color-scale-9  { background-color: color-mix(in srgb, var(--phl-heat-hi-1) 60%, white); color: var(--phl-text); }
.bg-color-scale-10 { background-color: var(--phl-heat-hi-1); color: var(--phl-text); }
.bg-color-scale-11 { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 70%, white); color: var(--phl-text); }
.bg-color-scale-12 { background-color: var(--phl-heat-hi-2); color: var(--phl-text); }

/* MATCHUPS SUMMARY: single-ended low → high = white → orange heat pole. */
.bg-matchups-scale-1  { background-color: var(--phl-heat-mid) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-2  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 9%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-3  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 18%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-4  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 27%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-5  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 36%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-6  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 45%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-7  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 54%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-8  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 63%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-9  { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 72%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-10 { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 81%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-11 { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 90%, white) !important; color: var(--phl-text) !important; }
.bg-matchups-scale-12 { background-color: var(--phl-heat-hi-2) !important; color: var(--phl-text) !important; }

/* PLAYERS SUMMARY: diverging negative → zero → positive = steel → white → orange. */
.bg-players-scale-1  { background-color: var(--phl-heat-lo-2) !important; color: var(--phl-text) !important; }
.bg-players-scale-2  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 60%, white) !important; color: var(--phl-text) !important; }
.bg-players-scale-3  { background-color: var(--phl-heat-lo-1) !important; color: var(--phl-text) !important; }
.bg-players-scale-4  { background-color: color-mix(in srgb, var(--phl-heat-lo-1) 60%, white) !important; color: var(--phl-text) !important; }
.bg-players-scale-5  { background-color: color-mix(in srgb, var(--phl-heat-lo-1) 30%, white) !important; color: var(--phl-text) !important; }
.bg-players-scale-6  { background-color: var(--phl-heat-mid) !important; color: var(--phl-text) !important; }
.bg-players-scale-7  { background-color: var(--phl-heat-mid) !important; color: var(--phl-text) !important; }
.bg-players-scale-8  { background-color: color-mix(in srgb, var(--phl-heat-hi-1) 30%, white) !important; color: var(--phl-text) !important; }
.bg-players-scale-9  { background-color: color-mix(in srgb, var(--phl-heat-hi-1) 60%, white) !important; color: var(--phl-text) !important; }
.bg-players-scale-10 { background-color: var(--phl-heat-hi-1) !important; color: var(--phl-text) !important; }
.bg-players-scale-11 { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 70%, white) !important; color: var(--phl-text) !important; }
.bg-players-scale-12 { background-color: var(--phl-heat-hi-2) !important; color: var(--phl-text) !important; }

/* PLAYS SUMMARY WIN%: same diverging heat scale. */
.bg-plays-winpct-scale-1  { background-color: var(--phl-heat-lo-2) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-2  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 60%, white) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-3  { background-color: var(--phl-heat-lo-1) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-4  { background-color: color-mix(in srgb, var(--phl-heat-lo-1) 60%, white) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-5  { background-color: color-mix(in srgb, var(--phl-heat-lo-1) 30%, white) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-6  { background-color: var(--phl-heat-mid) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-7  { background-color: var(--phl-heat-mid) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-8  { background-color: color-mix(in srgb, var(--phl-heat-hi-1) 30%, white) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-9  { background-color: color-mix(in srgb, var(--phl-heat-hi-1) 60%, white) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-10 { background-color: var(--phl-heat-hi-1) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-11 { background-color: color-mix(in srgb, var(--phl-heat-hi-2) 70%, white) !important; color: var(--phl-text) !important; }
.bg-plays-winpct-scale-12 { background-color: var(--phl-heat-hi-2) !important; color: var(--phl-text) !important; }

/* PLAYS SUMMARY POINTS: volume scale low → high = white → steel heat pole. */
.bg-plays-pts-scale-1  { background-color: var(--phl-heat-mid) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-2  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 9%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-3  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 18%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-4  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 27%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-5  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 36%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-6  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 45%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-7  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 54%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-8  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 63%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-9  { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 72%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-10 { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 81%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-11 { background-color: color-mix(in srgb, var(--phl-heat-lo-2) 90%, white) !important; color: var(--phl-text) !important; }
.bg-plays-pts-scale-12 { background-color: color-mix(in srgb, var(--phl-steel) 55%, white) !important; color: var(--phl-text) !important; }

/* Weekly matchups spacing adjustment for scoreboard */
.weekly-matchups-header {
    margin-bottom: 1rem;
}

.weekly-matchups-header .small {
    color: var(--phl-muted);
    font-style: italic;
}

/* Weekly Matchups Grid styles are defined in boxscore.css and shared between pages */

/* Live indicator pulse animation enhancement */
.pulse-animation {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(239, 123, 0, 0.7);
    }
    50% { 
        opacity: 0.7; 
        box-shadow: 0 0 0 10px rgba(239, 123, 0, 0);
    }
    100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(239, 123, 0, 0);
    }
}

/* Button enhancements */
.btn-outline-phl-secondary:hover {
    background-color: var(--phl-secondary, var(--phl-muted));
    border-color: var(--phl-secondary, var(--phl-muted));
    color: white;
}

.btn-outline-phl-primary:hover {
    background-color: var(--phl-steel);
    border-color: var(--phl-steel);
    color: white;
}

.btn-phl-primary {
    background-color: var(--phl-steel);
    border-color: var(--phl-steel);
    color: white;
}

.btn-phl-primary:hover {
    background-color: var(--phl-orange, #ef7b00);
    border-color: var(--phl-orange, #ef7b00);
    color: white;
}

/* Toast notifications positioning */
#toast-container {
    z-index: 1050;
}

/* Mobile responsive adjustments */
@media (max-width: 992px) {
    /* Stack columns on tablet */
    
    .summary-tables {
        margin-top: 1rem;
    }
    
    /* Stack matchups and players vertically on smaller screens */
    .summary-tables .col-md-6:first-child {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    /* Mobile optimizations */
    .scoreboard-header h2 {
        font-size: 1.25rem;
    }
    
    /* Make tables more readable on mobile */
    .summary-tables .table {
        font-size: 0.65rem;
    }
    
    .summary-tables .table th,
    .summary-tables .table td {
        padding: 0.3rem 0.15rem;
    }
    
    .summary-tables .card-header h6 {
        font-size: 0.8rem;
    }
    
    /* Stack all summary tables vertically on mobile */
    .summary-tables .row .col-md-6,
    .summary-tables .row .col-12 {
        margin-bottom: 1rem;
    }
    
    /* Adjust card heights for mobile */
    .summary-tables .table-responsive {
        max-height: 200px;
    }
    
    .form-select-sm,
    .form-control-sm {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    /* Extra small screens - further optimize */
    .summary-tables .table {
        font-size: 0.6rem;
    }
    
    .summary-tables .table th,
    .summary-tables .table td {
        padding: 0.25rem 0.1rem;
    }
    
    /* Make some columns narrower on very small screens */
    .summary-tables .table th:nth-child(3),
    .summary-tables .table th:nth-child(4),
    .summary-tables .table th:nth-child(5),
    .summary-tables .table td:nth-child(3),
    .summary-tables .table td:nth-child(4),
    .summary-tables .table td:nth-child(5) {
        width: 15%;
        text-overflow: ellipsis;
        overflow: hidden;
    }
    
    /* Hide Before/After columns on very small screens to save space (Plays Summary only) */
    .plays-summary-table td:nth-child(5), /* Before (now column 5 due to Loser column addition) */
    .plays-summary-table td:nth-child(6), /* After (now column 6 due to Loser column addition) */
    .plays-summary-table th:nth-child(5), /* Before header */
    .plays-summary-table th:nth-child(6)  /* After header */ {
        display: none;
    }
}

/* Accessibility improvements */
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25);
}

.nav-tabs .nav-link:focus {
    outline: 2px solid var(--phl-steel);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .scoreboard-header .d-flex,
    .flt-panel {
        display: none !important;
    }
    
    .tab-pane:not(.show) {
        display: block !important;
        margin-top: 1rem;
    }
    
    .tab-pane::before {
        content: attr(aria-labelledby);
        font-weight: bold;
        margin-bottom: 0.5rem;
        display: block;
    }
}

/* Loading states */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.fa-spinner {
    animation: fa-spin 2s infinite linear;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(359deg); }
}

/* Score update highlighting */
.score-update {
    background: var(--phl-blue, #4682b4);
    color: white;
    padding: 0.375rem;
    margin-top: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
}

/* Enhanced consolation bracket styling */
.consolation-bracket {
    opacity: 0.7;
}

.consolation-bracket:hover {
    opacity: 1;
}

/* Filter state indicators */
.form-check-input:checked {
    background-color: var(--phl-steel);
    border-color: var(--phl-steel);
}

.form-select:focus,
.form-control:focus {
    border-color: var(--phl-steel);
    box-shadow: 0 0 0 0.25rem rgba(70, 130, 180, 0.25);
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .table-light th {
        background-color: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .nav-tabs .nav-link {
        color: #a0aec0;
    }
    
    .nav-tabs .nav-link.active {
        background-color: #2d3748;
        border-color: #4a5568 #4a5568 #2d3748;
        color: var(--phl-orange, #ef7b00);
    }
}