/* ============================================
   TERMINAL CONTROL PANEL - STATS DASHBOARD
   Pure black theme with orange accents
   ============================================ */

/* CSS Variables & Theme System */
:root {
    /* Color Palette - Terminal/Control Panel Theme */
    --primary: #ff6b4a;       /* Orange/coral accent */
    --primary-dark: #e55a3a;
    --success: #ff6b4a;       /* Orange for highlights */
    --warning: #ff6b4a;       /* Orange for all accents */
    --danger: #ff6b4a;        /* Orange for emphasis */

    /* Terminal Dark Theme */
    --bg-main: #000000;       /* Pure black background */
    --bg-card: #0a0a0a;       /* Very dark card background */
    --bg-elevated: #1a1a1a;   /* Elevated elements */
    --bg-hover: #2a2a2a;

    --text-primary: #e8e8e8;
    --text-secondary: #999999;
    --text-muted: #666666;

    --border: #2a2a2a;
    --border-light: #3a3a3a;

    /* Spacing System - Compact */
    --spacing-xs: 4px;
    --spacing-sm: 6px;
    --spacing-md: 12px;
    --spacing-lg: 18px;
    --spacing-xl: 24px;

    /* Typography - Monospace */
    --font-mono: 'Courier New', 'Consolas', 'Monaco', monospace;
    --font-sans: 'Courier New', 'Consolas', 'Monaco', monospace;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.3px;
}

/* Main Container */
.stats-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* ============================================
   HEADER & CONTROLS
   ============================================ */

.dashboard-header {
    background: var(--bg-card);
    border-radius: 0;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border);
    position: relative;
}

.dashboard-header::before,
.dashboard-header::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
}

.dashboard-header::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.dashboard-header::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.team-identity {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.team-logo {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
}

.team-info h1 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.team-record {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
}

.season-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.control-select {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 0;
    font-size: 12px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.1s;
    text-transform: uppercase;
}

.control-select:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   COMPLETELY REDESIGNED METRICS LAYOUT
   ============================================ */

.metrics-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

/* Individual metric cards - auto-sizing based on content */
.primary-metrics {
    display: contents;
}

.secondary-metrics {
    display: contents;
}

/* Grid-based sizing: fill row and prevent overlap */
.record-card,
.run-diff-card,
.offense-card,
.defense-card {
    grid-column: span 3; /* 4 cards across on wide screens */
}

.batting-card,
.pitching-card {
    grid-column: span 6; /* 2 cards across below primary row */
}

.metric-card {
    background: var(--bg-card);
    border-radius: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    transition: all 0.1s;
    cursor: pointer;
    overflow: visible;
}

/* Corner bracket decorations */
.metric-card::before,
.metric-card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.1s;
}

.metric-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.metric-card::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.metric-card:hover {
    border-color: var(--primary);
}

.metric-card:hover::before,
.metric-card:hover::after {
    border-color: var(--primary);
}

.metric-card:active {
    background: var(--bg-elevated);
}

.metric-card.positive::before {
    border-color: var(--primary);
}

.metric-card.negative::before {
    border-color: var(--primary);
}

/* Unified card layout - all cards use same structure */
.metric-card {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    min-height: 100px;
    box-sizing: border-box;
    overflow: visible;
    width: 100%;
}

/* Compact primary cards */
.record-card,
.run-diff-card,
.offense-card,
.defense-card {
    text-align: center;
}

.metric-icon {
    font-size: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    margin: 0 auto 6px;
    color: var(--text-muted);
}

.metric-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

/* Secondary cards - side-by-side layout */
.batting-card,
.pitching-card {
    padding: 14px 16px;
    overflow: visible;
    min-width: 300px;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.metric-header .metric-icon {
    margin: 0;
    font-size: 14px;
    width: 24px;
    height: 24px;
}

.metric-header .metric-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* Enhanced accessibility */
.metric-card:focus {
    outline: 1px solid var(--primary);
    outline-offset: 2px;
}

.metric-card:hover .metric-value {
    color: var(--primary);
}

.metric-label {
    font-size: 9px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    font-family: var(--font-mono);
    line-height: 1.1;
    margin-bottom: 2px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
    overflow: visible;
    text-overflow: initial;
}

.metric-vs {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.metric-secondary {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.metric-vs-small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.metric-comparison {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    overflow: visible;
    flex-wrap: wrap;
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 0;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.metric-trend.up {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.metric-trend.down {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.metric-trend-small {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    border-radius: 0;
    font-size: 9px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.metric-trend-small.up {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.metric-trend-small.down {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

/* ============================================
   REDESIGNED STAT ROWS - HORIZONTAL LAYOUT
   ============================================ */

.stat-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    overflow: visible;
    padding: 8px 0;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-radius: 0;
    transition: background 0.1s;
    width: 100%;
    overflow: visible;
    gap: 12px;
}

.stat-row:hover {
    background: var(--bg-elevated);
}

.stat-row.positive .stat-trend.up {
    color: var(--primary);
}

.stat-row.negative .stat-trend.down {
    color: var(--text-muted);
}

.stat-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
    overflow: visible;
}

.stat-name {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    letter-spacing: 1px;
    min-width: 45px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.stat-comparison {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    overflow: visible;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    white-space: nowrap;
}

.stat-league {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.stat-row .stat-trend {
    font-size: 13px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 0;
    background: transparent;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   LEAGUE POSITION CARDS
   ============================================ */

.league-position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.position-card {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    padding: var(--spacing-md);
    position: relative;
}

.position-card::before,
.position-card::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.position-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.position-card::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.position-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.position-rank {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.position-suffix {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.position-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 0;
    overflow: hidden;
    margin-top: var(--spacing-sm);
}

.position-fill {
    height: 100%;
    border-radius: 0;
    transition: width 0.3s;
}

.position-fill.top-tier {
    background: var(--primary);
}

.position-fill.mid-tier {
    background: #ff6b4a;
}

.position-fill.bottom-tier {
    background: #ff6b4a;
}

/* ============================================
   DATA TABLES - COMPACT DESIGN
   ============================================ */

.stats-tables-container {
    display: grid;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.stats-table-section {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

.stats-table-section::before,
.stats-table-section::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 1;
}

.stats-table-section::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.stats-table-section::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

.table-header {
    padding: var(--spacing-md);
    background: transparent;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.table-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.table-filter {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
}

.table-search {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    font-size: 11px;
    font-family: var(--font-mono);
    width: 180px;
}

.table-search:focus {
    outline: none;
    border-color: var(--primary);
}

.compact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.compact-table thead {
    background: transparent;
}

.compact-table th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.compact-table th.sortable:hover {
    color: var(--primary);
}

.compact-table th.sorted-asc::after,
.compact-table th.sorted-desc::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.compact-table th.sorted-asc::after {
    border-bottom: 4px solid var(--primary);
}

.compact-table th.sorted-desc::after {
    border-top: 4px solid var(--primary);
}

.compact-table tbody tr {
    transition: background 0.05s;
}

.compact-table tbody tr:hover {
    background: var(--bg-elevated);
}

.compact-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    color: #e5e7eb;
    font-family: var(--font-mono);
    font-weight: 500;
}

.compact-table td:first-child {
    font-weight: 700;
    color: #ffffff;
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 5;
}

.compact-table tbody tr:hover td:first-child {
    background: var(--bg-elevated);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Stat cell highlights */
.stat-cell {
    font-family: var(--font-mono);
}

.stat-cell.highlight-good {
    color: var(--primary);
    font-weight: 500;
}

.stat-cell.highlight-bad {
    color: var(--text-muted);
}

.stat-cell.league-better {
    position: relative;
    color: var(--primary);
}

.stat-cell.league-better::after {
    content: '▲';
    color: var(--primary);
    font-size: 9px;
    margin-left: 3px;
}

.stat-cell.league-worse::after {
    content: '▼';
    color: var(--text-muted);
    font-size: 9px;
    margin-left: 3px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card { grid-column: span 3; }
    .batting-card,
    .pitching-card { grid-column: span 6; }
}

@media (max-width: 992px) {
    .metrics-container {
        grid-template-columns: repeat(12, 1fr);
    }
    .record-card,
    .run-diff-card,
    .offense-card,
    .defense-card { grid-column: span 6; } /* 2 per row */
    .batting-card,
    .pitching-card { grid-column: span 12; } /* full width each */
}

@media (max-width: 768px) {
    .stats-dashboard {
        padding: var(--spacing-sm);
    }

    .dashboard-header {
        border-radius: 0;
        margin: -8px -8px 16px -8px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    .team-info h1 {
        font-size: 20px;
    }

    .team-record {
        font-size: 11px;
    }

    .metrics-container { gap: var(--spacing-sm); }

    .record-card, .run-diff-card, .offense-card, .defense-card { grid-column: span 12; }
    .batting-card, .pitching-card { grid-column: span 12; }

    .metric-card {
        padding: 10px 12px;
        height: auto;
        min-height: 90px;
    }

    .metric-value {
        font-size: 20px;
    }

    .stat-value {
        font-size: 14px;
    }

    .league-position-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile table scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .compact-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .metrics-container {
        gap: 8px;
    }

    .record-card, .run-diff-card, .offense-card, .defense-card {
        flex: 1;
        min-width: 120px;
        max-width: 180px;
    }

    .batting-card, .pitching-card {
        flex: 1.5;
        min-width: 260px;
        max-width: 360px;
    }

    .metric-card {
        padding: 8px 10px;
        height: auto;
        min-height: 80px;
    }

    .metric-value {
        font-size: 18px;
    }

    .stat-value {
        font-size: 12px;
    }

    .stat-rows {
        gap: 6px;
    }

    .stat-row {
        padding: 2px 0;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-skeleton {
    background: var(--bg-elevated);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 0;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-content::before,
.modal-content::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.modal-content::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.modal-content::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

.modal-header {
    padding: var(--spacing-md);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.modal-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.modal-subtitle {
    font-size: 11px;
    color: #e5e7eb;
    margin-top: 4px;
    font-weight: 500;
}

.modal-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 0;
    transition: all 0.1s;
    line-height: 1;
    font-family: var(--font-mono);
}

.modal-close:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* Rankings Table in Modal */
.rankings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.rankings-table thead {
    background: transparent;
}

.rankings-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.rankings-table th:first-child {
    text-align: center;
    width: 50px;
}

.rankings-table tbody tr {
    transition: background 0.05s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.rankings-table tbody tr:hover {
    background: var(--bg-elevated);
}

.rankings-table tbody tr.current-team {
    background: rgba(255, 107, 74, 0.1);
    border-left: 3px solid var(--primary);
    border-right: 1px solid var(--primary);
}

.rankings-table tbody tr.current-team:hover {
    background: rgba(255, 107, 74, 0.15);
}

.rankings-table tbody tr.current-team td {
    color: var(--text-primary);
    font-weight: 600;
}

.rankings-table tbody tr.current-team .team-name {
    color: var(--primary);
    font-weight: 700;
}

.rankings-table tbody tr.current-team .rank-badge {
    background: var(--primary);
    color: var(--bg-main);
    border-color: var(--primary);
    font-weight: 700;
}

.rankings-table tbody tr.current-team .rank-badge.rank-1,
.rankings-table tbody tr.current-team .rank-badge.rank-2,
.rankings-table tbody tr.current-team .rank-badge.rank-3 {
    background: var(--primary);
    color: var(--bg-main);
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 8px rgba(255, 107, 74, 0.3);
}

.rankings-table td {
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-mono);
}

.rankings-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.rankings-table .team-name {
    font-weight: 500;
    color: var(--text-primary);
}

.rankings-table .stat-value {
    font-family: var(--font-mono);
    font-weight: 500;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 0;
    font-weight: 600;
    font-size: 13px;
    font-family: var(--font-mono);
    border: 1px solid var(--border);
}

.rank-badge.rank-1 {
    background: var(--primary);
    color: var(--bg-main);
    border-color: var(--primary);
}

.rank-badge.rank-2 {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.rank-badge.rank-3 {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.rank-badge.top-tier {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.rank-badge.mid-tier {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.rank-badge.bottom-tier {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

/* Click hint on position cards */
.position-card {
    cursor: pointer;
    transition: all 0.1s;
}

.position-card:hover {
    border-color: var(--primary);
}

.position-card:hover::before,
.position-card:hover::after {
    border-color: var(--primary);
}

.position-card:active {
    background: var(--bg-elevated);
}

/* ============================================
   CUSTOM HIT LOCATION TOOLTIP
   ============================================ */

.hit-tooltip {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 12px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    min-width: 180px;
    max-width: 260px;
    display: none;
}

.hit-tooltip.visible {
    display: block;
    opacity: 1;
}

.hit-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.hit-tooltip-player {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.hit-tooltip-result {
    padding: 2px 5px;
    border-radius: 0;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
}

.hit-tooltip-result.hit {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.hit-tooltip-result.home-run {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.hit-tooltip-result.out {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.hit-tooltip-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12px;
}

.hit-tooltip-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hit-tooltip-detail-label {
    color: var(--text-muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.hit-tooltip-detail-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-mono);
    font-size: 11px;
}

.hit-tooltip-stats {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}

.hit-tooltip-stat {
    text-align: center;
}

.hit-tooltip-stat-value {
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.hit-tooltip-stat-label {
    color: var(--text-muted);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

/* ============================================
   HIT LOCATION SECTION (UNCHANGED)
   Keep your existing hit location styles here
   ============================================ */

.hit-location-section {
    /* Your existing hit location styles remain untouched */
}

/* ============================================
   LOADING SKELETON STYLES
   ============================================ */

.page-skeleton {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.skeleton-header {
    margin-bottom: 32px;
}

.skeleton-title {
    height: 28px;
    width: 280px;
    background: var(--bg-elevated);
    border-radius: 0;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.skeleton-subtitle {
    height: 16px;
    width: 180px;
    background: var(--bg-elevated);
    border-radius: 0;
    border: 1px solid var(--border);
}

.skeleton-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.skeleton-card {
    height: 120px;
    background: var(--bg-card);
    border-radius: 0;
    border: 1px solid var(--border);
}

.skeleton-section {
    margin-bottom: 24px;
}

.skeleton-section-title {
    height: 24px;
    width: 220px;
    background: var(--bg-elevated);
    border-radius: 0;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.skeleton-table {
    background: var(--bg-card);
    border-radius: 0;
    padding: 12px;
    border: 1px solid var(--border);
}

.skeleton-row {
    height: 40px;
    background: var(--bg-elevated);
    border-radius: 0;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.skeleton-row:last-child {
    margin-bottom: 0;
}

/* Fade in effect for main content */
#main-content {
    transition: opacity 0.3s ease-in-out;
}

/* ============================================
   BOX SCORE MODAL STYLES
   ============================================ */

.boxscore-modal-content {
    max-width: 900px;
    width: 95%;
}

/* ESPN-style Box Score Layout */
.boxscore-team-section {
    margin-bottom: 24px;
}

.boxscore-team-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.boxscore-team-header .team-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.boxscore-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--bg-main);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.boxscore-table thead {
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border);
}

.boxscore-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid var(--border);
}

.boxscore-table th:first-child {
    text-align: left;
    padding-left: 16px;
}

.boxscore-table th:last-child {
    border-right: none;
}

.boxscore-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.boxscore-table tbody tr:hover {
    background: rgba(255, 107, 74, 0.05);
}

.boxscore-table .player-row td {
    padding: 10px 8px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.boxscore-table .player-name {
    text-align: left !important;
    padding-left: 16px !important;
    font-weight: 600;
    color: var(--text-primary);
}

.boxscore-table .position {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
}

.boxscore-table .stat {
    font-weight: 500;
    color: var(--text-primary);
}

.boxscore-table .stat.avg,
.boxscore-table .stat.era {
    font-weight: 600;
    color: var(--primary);
}

.boxscore-table .team-totals {
    background: rgba(255, 107, 74, 0.1);
    border-top: 2px solid var(--primary);
    font-weight: 700;
}

.boxscore-table .team-totals td {
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 700;
}

.boxscore-table .totals-label {
    text-align: left !important;
    padding-left: 16px !important;
    color: var(--primary) !important;
    font-weight: 800 !important;
}

.boxscore-table .totals-dash {
    color: var(--text-secondary) !important;
}

.boxscore-table .totals-stat {
    color: var(--text-primary) !important;
    font-weight: 800 !important;
}

.boxscore-table .totals-stat.avg,
.boxscore-table .totals-stat.era {
    color: var(--primary) !important;
}

.boxscore-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.boxscore-header {
    text-align: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-date {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.game-location {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Enhanced Game Score Display */
.game-score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 12px 0;
    font-family: var(--font-mono);
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    min-width: 120px;
    transition: all 0.2s ease;
}

.team-score.winner {
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    color: #22c55e;
}

.team-score.loser {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.team-score.tie {
    background: rgba(156, 163, 175, 0.15);
    border: 2px solid #9ca3af;
    color: #9ca3af;
}

.team-score .team-name {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.team-score .score {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.score-separator {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 8px;
}

.boxscore-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.boxscore-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.boxscore-table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0;
}

.boxscore-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--font-mono);
}

.boxscore-table thead {
    background: var(--bg-elevated);
}

.boxscore-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.boxscore-table th:first-child {
    text-align: left;
    width: 120px;
}

.boxscore-table th:last-child {
    border-right: none;
}

.boxscore-table tbody tr {
    transition: background 0.1s;
}

.boxscore-table tbody tr:hover {
    background: var(--bg-elevated);
}

.boxscore-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.boxscore-table tbody tr:nth-child(even):hover {
    background: var(--bg-elevated);
}

.boxscore-table td {
    padding: 10px 8px;
    text-align: center;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    font-weight: 500;
}

.boxscore-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.boxscore-table td:last-child {
    border-right: none;
}

.boxscore-table .team-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

.boxscore-table .team-header {
    background: var(--bg-elevated);
    border-top: 2px solid var(--border);
}

.boxscore-table .team-header .team-name {
    font-weight: 800;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    padding: 8px 12px;
}

.boxscore-table .team-totals {
    background: rgba(255, 107, 74, 0.1);
    border-top: 1px solid var(--primary);
    font-weight: 600;
}

.boxscore-table .team-totals td {
    color: var(--text-primary);
    font-weight: 700;
}

/* Responsive box score */
@media (max-width: 768px) {
    .boxscore-modal-content {
        width: 98%;
        max-width: none;
    }
    
    .boxscore-table {
        font-size: 11px;
    }
    
    .boxscore-table th,
    .boxscore-table td {
        padding: 8px 4px;
    }
    
    .boxscore-table th:first-child,
    .boxscore-table td:first-child {
        width: 80px;
    }
}

/* ============================================
   RECENT GAMES SECTION
   ============================================ */

.game-row {
    transition: all 0.2s ease;
    cursor: pointer;
}

.game-row:hover {
    background: var(--bg-elevated) !important;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-row:hover td {
    color: var(--text-primary);
}

.table-info {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.result-indicator {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.game-won .result-indicator {
    color: var(--primary);
}

.game-lost .result-indicator {
    color: var(--text-muted);
}

.game-tied .result-indicator {
    color: var(--text-secondary);
}

.wl-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-weight: 600;
    font-size: 11px;
    font-family: var(--font-mono);
}

.wl-badge.wl-win {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.wl-badge.wl-loss {
    color: var(--text-muted);
    border-color: var(--border);
    background: transparent;
}

.wl-badge.wl-tie {
    color: var(--text-secondary);
    border-color: var(--border);
    background: transparent;
}

.game-won:hover {
    background: var(--bg-elevated);
}

.game-lost:hover {
    background: var(--bg-elevated);
}

.game-tied:hover {
    background: var(--bg-elevated);
}
