/* RESULTS TABLE - MOBILE-FIRST RESPONSIVE REDESIGN */

/* =======================================================================
   1. MOBILE FIRST BASE STYLES (320px - 767px)
   ======================================================================= */

.results-table {
    width: 100%;
    overflow: visible; /* Remove horizontal scroll */
}

/* Force container to accommodate wider win totals table */
.results-section--teams .results-table-container {
    width: 100% !important;
    overflow-x: auto !important;
    min-width: 900px !important;
}

.table-wrapper {
    width: 100%;
    overflow: visible;
}

/* Mobile: Hide table structure, use card layout */
@media (max-width: 767px) {
    .results-data-table {
        width: 100%;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    /* Hide table headers on mobile */
    .results-data-table thead {
        display: none;
    }

    /* Transform table rows into cards */
    .results-data-table tbody {
        display: block;
        width: 100%;
    }

    .results-data-table tbody tr {
        display: block;
        width: 100%;
        margin-bottom: 16px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: 1px solid #e5e7eb;
        padding: 16px;
        position: relative;
    }

    .results-data-table tbody tr.outlier-row {
        border-left: 4px solid #f59e0b;
        background: #fffbeb;
    }

    /* Transform table cells into card sections */
    .results-data-table tbody td {
        display: block;
        width: 100%;
        padding: 0;
        border: none;
        margin-bottom: 12px;
        overflow: visible;
        white-space: normal;
        text-overflow: clip;
    }

    .results-data-table tbody td:last-child {
        margin-bottom: 0;
    }

    /* Add mobile labels using CSS content */
    .results-data-table tbody td:before {
        content: attr(data-mobile-label);
        display: block;
        font-weight: 600;
        font-size: 11px;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 4px;
    }

    /* Hide labels for game and challenge columns */
    .results-data-table tbody td.col-game:before,
    .results-data-table tbody td.col-challenge:before {
        display: none;
    }

    /* Mobile Game Display - Prominent header */
    .results-data-table tbody td.col-game {
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f3f4f6;
    }

    .game-matchup {
        display: block;
    }

    .teams {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        font-size: 16px;
        font-weight: 600;
    }

    .team-row {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
    }

    .team-row.away-team {
        justify-content: flex-start;
    }

    .team-row.home-team {
        justify-content: flex-end;
        text-align: right;
    }

    .team-logo {
        width: 24px;
        height: 24px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .team-name {
        font-size: 14px;
        font-weight: 600;
        color: #111827;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .away-indicator {
        font-size: 18px;
        color: #6b7280;
        font-weight: 700;
        flex-shrink: 0;
    }

    /* Mobile Time Display - Compact */
    .results-data-table tbody td.col-time {
        position: absolute;
        top: 16px;
        right: 16px;
        margin: 0;
        background: #f3f4f6;
        padding: 4px 8px;
        border-radius: 6px;
        font-size: 11px;
        font-weight: 500;
    }

    .results-data-table tbody td.col-time:before {
        display: none;
    }

    .game-time .status-badge,
    .game-time .time-badge {
        background: transparent;
        padding: 0;
        font-size: 11px;
        color: #6b7280;
        border: none;
    }

    .game-time .status-badge.live {
        color: #dc2626;
        background: transparent;
        animation: none;
    }

    /* Mobile Prediction Display */
    .results-data-table tbody td.col-prediction {
        order: 1;
    }

    .prediction-display {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    .prediction-badge {
        font-size: 13px;
        font-weight: 600;
        padding: 6px 12px;
        border-radius: 6px;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        max-width: none;
    }

    /* Mobile Actual Line Display */
    .results-data-table tbody td.col-actual {
        order: 2;
    }

    .actual-line {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }

    .line-badge {
        font-size: 12px;
        padding: 4px 8px;
        border-radius: 4px;
    }

    .odds-badge {
        display: inline-block;
        margin-right: 8px;
        margin-bottom: 4px;
        font-size: 11px;
        padding: 3px 6px;
    }

    /* Mobile Result Display */
    .results-data-table tbody td.col-result {
        order: 3;
    }

    .result-badge {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        padding: 6px 12px;
        border-radius: 6px;
        max-width: none;
    }

    .result-badge .score {
        font-size: 12px;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    /* Hide Lean column on mobile (too complex) */
    .results-data-table tbody td.col-lean {
        display: none;
    }

    /* Mobile Challenge Controls */
    .results-data-table tbody td.col-challenge {
        position: absolute;
        top: 16px;
        left: 16px;
        margin: 0;
        width: auto;
    }

    .challenge-checkbox {
        width: 20px;
        height: 20px;
        cursor: pointer;
        accent-color: #16a34a;
    }

    /* Mobile Empty State */
    .empty-row td {
        display: block;
        padding: 32px 16px;
        text-align: center;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .empty-row td:before {
        display: none;
    }

    /* Mobile Table Header Controls */
    .table-header {
        margin-bottom: 16px;
        padding: 0;
    }

    .challenge-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .challenge-select-all label {
        font-size: 14px;
    }

    .selected-count {
        font-size: 13px;
    }
}

/* =======================================================================
   2. TABLET STYLES (768px - 1023px)
   ======================================================================= */

@media (min-width: 768px) and (max-width: 1023px) {
    .results-data-table {
        width: 100%;
        table-layout: auto;
        border-collapse: collapse;
        font-size: 13px;
        background: white;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    /* Tablet: Show reduced columns */
    .results-data-table thead th {
        background: #f8fafc;
        font-weight: 600;
        color: #374151;
        text-align: left;
        padding: 10px 6px;
        border-bottom: 2px solid #e5e7eb;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.025em;
    }

    .results-data-table tbody td {
        padding: 10px 6px;
        border-bottom: 1px solid #f3f4f6;
        vertical-align: top;
        font-size: 12px;
    }

    /* Tablet Column Widths - Flexible */
    .results-data-table thead th.col-game { width: 25%; }
    .results-data-table thead th.col-time { width: 10%; }
    .results-data-table thead th.col-prediction { width: 20%; }
    .results-data-table thead th.col-actual { width: 20%; }
    .results-data-table thead th.col-result { width: 20%; }
    .results-data-table thead th.col-challenge { width: 5%; }

    .results-data-table tbody td.col-game { width: 25%; }
    .results-data-table tbody td.col-time { width: 10%; }
    .results-data-table tbody td.col-prediction { width: 20%; }
    .results-data-table tbody td.col-actual { width: 20%; }
    .results-data-table tbody td.col-result { width: 20%; }
    .results-data-table tbody td.col-challenge { width: 5%; }

    /* Hide lean column on tablet */
    .results-data-table thead th.col-lean,
    .results-data-table tbody td.col-lean {
        display: none;
    }

    /* Tablet team display */
    .teams {
        display: flex;
        flex-direction: column;
        gap: 3px;
        font-size: 11px;
    }

    .team-row {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .team-logo {
        width: 16px;
        height: 16px;
    }

    .team-name {
        font-size: 11px;
        font-weight: 500;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        line-height: 1.2;
    }

    /* Tablet badges */
    .prediction-badge,
    .line-badge,
    .result-badge {
        font-size: 10px;
        padding: 3px 6px;
    }

    .challenge-checkbox {
        width: 16px;
        height: 16px;
    }
}

/* =======================================================================
   3. DESKTOP STYLES (1024px+) - ENHANCED ORIGINAL
   ======================================================================= */

@media (min-width: 1024px) {
    .results-data-table {
        width: 100%;
        max-width: 1200px;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 14px;
        background: white;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    /* Win totals table override within media query */
    .results-data-table.win-totals-table {
        width: 100% !important;
        max-width: none !important;
        min-width: 900px !important;
        table-layout: fixed !important;
        display: table !important;
        border-collapse: collapse !important;
    }

    /* Force proper table structure for win totals - MAXIMUM SPECIFICITY */
    .results-data-table.win-totals-table thead {
        display: table-header-group !important;
    }

    .results-data-table.win-totals-table tbody {
        display: table-row-group !important;
    }

    .results-data-table.win-totals-table tbody tr {
        display: table-row !important;
        width: auto !important;
        margin-bottom: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        position: static !important;
    }

    .results-data-table.win-totals-table tbody td {
        display: table-cell !important;
        width: auto !important;
        padding: 12px 8px !important;
        border: none !important;
        margin-bottom: 0 !important;
        overflow: visible !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        vertical-align: top !important;
    }

    .results-data-table.win-totals-table th {
        display: table-cell !important;
    }

    /* Desktop Header Styling */
    .results-data-table thead th {
        background: #f8fafc;
        font-weight: 600;
        color: #374151;
        text-align: left;
        padding: 12px 8px;
        border-bottom: 2px solid #e5e7eb;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.025em;
        white-space: nowrap;
        box-sizing: border-box;
    }

    /* Desktop Column Widths - Game-based betting - Fixed layout with exact percentages */
    .results-data-table thead th.col-game { width: 200px; }
    .results-data-table thead th.col-time { width: 100px; }
    .results-data-table thead th.col-prediction { width: 140px; }
    .results-data-table thead th.col-actual { width: 140px; }
    .results-data-table thead th.col-lean { width: 160px; }
    .results-data-table thead th.col-result { width: 180px; }
    .results-data-table thead th.col-challenge { width: 80px; }

    .results-data-table tbody td.col-game { width: 200px; }
    .results-data-table tbody td.col-time { width: 100px; }
    .results-data-table tbody td.col-prediction { width: 140px; }
    .results-data-table tbody td.col-actual { width: 140px; }
    .results-data-table tbody td.col-lean { width: 160px; }
    .results-data-table tbody td.col-result { width: 180px; }
    .results-data-table tbody td.col-challenge { width: 80px; }

    /* Desktop Cell Styling */
    .results-data-table tbody td {
        padding: 12px 8px;
        border-bottom: 1px solid #f3f4f6;
        vertical-align: top;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
    }
    
    /* Specific cell content handling */
    .results-data-table tbody td.col-game,
    .results-data-table tbody td.col-result {
        white-space: normal;
    }
    
    .results-data-table tbody td.col-time,
    .results-data-table tbody td.col-prediction,
    .results-data-table tbody td.col-actual,
    .results-data-table tbody td.col-lean,
    .results-data-table tbody td.col-challenge {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Win totals specific cell styling - improved text handling */
    .results-data-table.win-totals-table thead th,
    .results-data-table.win-totals-table tbody td {
        padding: 8px 6px; /* Consistent padding */
        vertical-align: top;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .results-data-table.win-totals-table tbody td.col-team,
    .results-data-table.win-totals-table tbody td.col-division,
    .results-data-table.win-totals-table tbody td.col-record {
        white-space: normal;
        line-height: 1.3;
    }
    
    .results-data-table.win-totals-table tbody td.col-prediction,
    .results-data-table.win-totals-table tbody td.col-actual,
    .results-data-table.win-totals-table tbody td.col-lean,
    .results-data-table.win-totals-table tbody td.col-challenge {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Desktop Game Column */
    .game-matchup {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .teams {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 12px;
    }

    .team-row {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        text-align: left;
    }

    .team-logo {
        width: 16px;
        height: 16px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .team-name {
        font-weight: 500;
        color: #374151;
        font-size: 12px;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        flex: 1;
        line-height: 1.2;
    }

    .away-indicator {
        color: #9ca3af;
        font-size: 10px;
        font-weight: 500;
        margin-left: auto;
        flex-shrink: 0;
    }


}

/* =======================================================================
   4. SHARED COMPONENT STYLES (ALL BREAKPOINTS)
   ======================================================================= */

/* ===================================================================
   WIN TOTALS TABLE - CLEAN & MAINTAINABLE (Option 2 Refactor)
   =================================================================== */

.results-data-table.win-totals-table {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 900px !important;
    max-width: none !important;
}

/* Clean table cell styling for win totals */
.results-data-table.win-totals-table th,
.results-data-table.win-totals-table td {
    display: table-cell !important;
    position: static !important;
    float: none !important;
    vertical-align: top !important;
    text-align: left !important;
}

/* Win totals column widths - using class selectors with high specificity */
.results-data-table.win-totals-table thead th.col-team,
.results-data-table.win-totals-table tbody td.col-team { 
    width: 25% !important; 

} 

.results-data-table.win-totals-table thead th.col-division,
.results-data-table.win-totals-table tbody td.col-division { 
    width: 10% !important; 

}

.results-data-table.win-totals-table thead th.col-prediction,
.results-data-table.win-totals-table tbody td.col-prediction { 
    width: 15% !important; 

}

.results-data-table.win-totals-table thead th.col-actual,
.results-data-table.win-totals-table tbody td.col-actual { 
    width: 13% !important; 

}

.results-data-table.win-totals-table thead th.col-lean,
.results-data-table.win-totals-table tbody td.col-lean { 
    width: 18% !important; 

}

.results-data-table.win-totals-table thead th.col-record,
.results-data-table.win-totals-table tbody td.col-record { 
    width: 13% !important; 

}

.results-data-table.win-totals-table thead th.col-challenge,
.results-data-table.win-totals-table tbody td.col-challenge { 
    width: 6% !important; 

}

/* Badge System */
.status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border: 1px solid transparent;
}

.status-badge.live {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.status-badge.completed {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #7dd3fc;
}

.status-badge.not-started {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
}

.prediction-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.prediction-badge.team-colored {
    font-weight: 600;
}

.prediction-badge.totals-badge {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.no-prediction-badge {
    display: inline-block;
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.line-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.odds-badge {
    display: block;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 3px;
    background: #f9fafb;
    margin-bottom: 2px;
    border: 1px solid #e5e7eb;
}

.odds-badge:last-child {
    margin-bottom: 0;
}

.no-line-badge {
    display: inline-block;
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.lean-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.lean-badge.clickable {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #7dd3fc;
    position: relative;
    padding-right: 20px; /* room for corner icon */
}

.lean-badge.clickable:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    transform: translateY(-1px);
}

/* Subtle corner icon to indicate clickability */
.lean-badge.clickable::after {
    content: "\2197"; /* ↗ external/link hint */
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
    line-height: 1;
    color: currentColor;
    opacity: 0.8;
    pointer-events: none;
}

.lean-badge.high {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.lean-badge.medium {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.lean-badge.low {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.lean-badge.perfect-match {
    background: #f0f9ff;
    color: #1e40af;
    border-color: #93c5fd;
}

.no-lean-badge {
    display: inline-block;
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.result-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.result-badge.win {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.result-badge.loss {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.result-badge.push {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.result-badge .result-icon {
    flex-shrink: 0;
}

.result-badge .score {
    font-size: 10px;
}

/* Outlier Styling */
.outlier-row {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
}

.outlier-row:hover {
    background: #fef3c7;
}

.outlier-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
    margin-top: 4px;
}

/* Challenge Controls */
.challenge-checkbox {
    cursor: pointer;
    accent-color: #16a34a;
}

.challenge-disabled {
    color: #9ca3af;
    font-size: 12px;
    font-style: italic;
}

.disabled-row {
    opacity: 0.6;
    pointer-events: none;
}

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 8px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.challenge-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.challenge-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-count {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Empty State */
.empty-table-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.empty-table-state p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

.empty-table-state .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #16a34a;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.empty-table-state .btn:hover {
    background: #15803d;
}

/* Win Totals Specific Styling */
.team-row .team-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-row .team-display .team-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.team-row .team-display .team-name {
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    flex: 1;
    line-height: 1.2;
}

.team-row .prediction-badge.win-totals-badge {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #7dd3fc;
    font-weight: 600;
}

.team-row .division-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 3px;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.team-row .record-badge {
    font-weight: 600;
    color: #374151;
    font-size: 12px;
}

.team-row .games-remaining {
    font-size: 10px;
    color: #6b7280;
    display: block;
    margin-top: 2px;
}

.team-row .no-record-badge {
    color: #9ca3af;
    font-size: 12px;
    font-style: italic;
}

.team-row .implied-lean {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-row .lean-recommendation {
    display: flex;
    align-items: center;
    gap: 4px;
}

.team-row .lean-badge.strong {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.team-row .lean-badge.medium {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.team-row .lean-badge.weak {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.team-row .record-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
} 