/**
 * MLB Data Hub - Design System CSS
 * Matches React App (Splunk-inspired dark theme)
 *
 * Design Tokens:
 * - Backgrounds: page #0D0D0D, panel #171819, elevated #1A1C21
 * - Accent: gold #F2B827, blue #5379AF, success #5BA94C, danger #DC4E41
 * - Text: primary #FFFFFF, secondary #B8BCC2, muted #6E7681
 * - Borders: default #2D2F34, subtle #232528
 * - Font: 'Inter' for body, 'JetBrains Mono' for data
 */

/* ==========================================
   CSS VARIABLES (Design Tokens)
   ========================================== */
:root {
    /* Backgrounds */
    --bg-page: #272727;
    --bg-panel: #171819;
    --bg-elevated: #1A1C21;
    --bg-hover: #242629;
    --bg-input: #1E2023;
    --bg-table-row: #131415;
    --bg-table-row-alt: #1A1C1E;

    /* Accent Colors */
    --accent-gold: #F2B827;
    --accent-blue: #5379AF;
    --accent-success: #5BA94C;
    --accent-warning: #F2B827;
    --accent-danger: #DC4E41;
    --accent-info: #5CC9FA;

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #B8BCC2;
    --text-muted: #6E7681;
    --text-inverse: #0D0D0D;

    /* Border Colors */
    --border-default: #2D2F34;
    --border-subtle: #232528;
    --border-strong: #3D4044;
    --border-focus: #5379AF;

    /* Cell Colors (for stats) */
    --cell-green-strong: #238636;
    --cell-green: #2EA043;
    --cell-yellow: #6E7681;
    --cell-orange: #565C63;
    --cell-red: #B62324;
    --cell-blue: #1F6FEB;
    --cell-neutral: #30363D;

    /* Font Colors for Stats */
    --font-green: #56D364;
    --font-red: #D94A4A;
    --font-blue: #58A6FF;
    --font-neutral: #484F58;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Font Families */
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */

/* Scoped to Data Hub content area to avoid WordPress conflicts */
.dh-page-content {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: calc(100vh - 200px);
}

.dh-page-content *, .dh-page-content *::before, .dh-page-content *::after {
    box-sizing: border-box;
}

/* Also support standalone body styling for backwards compatibility */
body.dh-page {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.dh-page-content a, body.dh-page a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color 0.15s ease;
}

.dh-page-content a:hover, body.dh-page a:hover {
    color: var(--text-primary);
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-panel);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* ==========================================
   LAYOUT CONTAINERS
   ========================================== */
.dh-container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.dh-page {
    min-height: 100vh;
    padding-bottom: 60px;
}

/* ==========================================
   HEADER / NAVIGATION
   ========================================== */
.dh-header {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 100;
}

.dh-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-lg);
    max-width: 1920px;
    margin: 0 auto;
}

.dh-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dh-logo img {
    height: 28px;
    width: auto;
}

.dh-nav {
    display: flex;
    gap: 0;
}

.dh-nav-item {
    padding: 10px 16px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.dh-nav-item:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.dh-nav-item.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    background: rgba(242, 184, 39, 0.08);
}

/* ==========================================
   SEARCH BAR
   ========================================== */
.dh-search {
    position: relative;
    width: 280px;
}

.dh-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: all 0.15s ease;
}

.dh-search-input::placeholder {
    color: var(--text-muted);
}

.dh-search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: var(--bg-elevated);
}

.dh-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

/* ==========================================
   PAGE TITLE / BREADCRUMB
   ========================================== */
.dh-page-header {
    padding: var(--space-xl) 0 var(--space-lg) 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-xl);
}

.dh-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.dh-breadcrumb a {
    color: var(--text-muted);
}

.dh-breadcrumb a:hover {
    color: var(--accent-gold);
}

.dh-breadcrumb-sep {
    color: var(--border-strong);
}

.dh-page-title {
    font-family: var(--font-body);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.dh-page-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================
   PANELS / CARDS
   ========================================== */
.dh-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.dh-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
}

.dh-panel-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.dh-panel-body {
    padding: var(--space-lg);
}

.dh-panel-body.no-padding {
    padding: 0;
}

/* ==========================================
   STAT CARDS (KPIs)
   ========================================== */
.dh-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
}

.dh-stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all 0.15s ease;
}

.dh-stat-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}

.dh-stat-card.highlight {
    border-color: var(--accent-gold);
    background: rgba(242, 184, 39, 0.05);
}

.dh-stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.dh-stat-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.dh-stat-card.highlight .dh-stat-value {
    color: var(--accent-gold);
}

.dh-stat-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ==========================================
   TABLES
   ========================================== */
.dh-table-wrap {
    overflow-x: auto;
}

.dh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dh-table th {
    background: var(--bg-elevated);
    padding: var(--space-md) var(--space-sm);
    text-align: left;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.1s ease;
}

.dh-table th:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.dh-table th.text-center,
.dh-table td.text-center {
    text-align: center;
}

.dh-table th.text-right,
.dh-table td.text-right {
    text-align: right;
}

.dh-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
}

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

.dh-table tbody tr:nth-child(even) {
    background: var(--bg-table-row-alt);
}

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

.dh-table tbody tr:hover td {
    color: var(--text-primary);
}

/* Sticky first column */
.dh-table th.sticky,
.dh-table td.sticky {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
}

/* ==========================================
   STAT CELL COLORS
   ========================================== */
.cell-green-strong { background: var(--cell-green-strong) !important; color: #fff !important; }
.cell-green { background: var(--cell-green) !important; color: #fff !important; }
.cell-yellow { background: var(--cell-yellow) !important; color: var(--text-inverse) !important; }
.cell-orange { background: var(--cell-orange) !important; color: #fff !important; }
.cell-red { background: var(--cell-red) !important; color: #fff !important; }
.cell-blue { background: var(--cell-blue) !important; color: #fff !important; }
.cell-neutral { background: var(--cell-neutral) !important; color: var(--text-secondary) !important; }

.font-green { color: var(--font-green) !important; }
.font-red { color: var(--font-red) !important; }
.font-blue { color: var(--font-blue) !important; }
.font-gold { color: var(--accent-gold) !important; }
.font-muted { color: var(--text-muted) !important; }

/* ==========================================
   TEAM CARDS / GRID
   ========================================== */
.dh-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
}

.dh-team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    cursor: pointer;
    text-align: center;
}

.dh-team-card:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.dh-team-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: var(--space-sm);
}

.dh-team-name {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ==========================================
   DIVISION HEADERS
   ========================================== */
.dh-division {
    margin-bottom: var(--space-xl);
}

.dh-division-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-md);
}

/* ==========================================
   PLAYER CARD (Detail Header)
   ========================================== */
.dh-player-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-xl);
    padding: var(--space-xl);
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
}

.dh-player-photo {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-elevated);
    border: 2px solid var(--border-default);
}

.dh-player-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text-muted);
}

.dh-player-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dh-player-name {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: var(--space-xs);
}

.dh-player-team {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
}

.dh-player-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.dh-player-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.dh-player-meta-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.dh-player-meta-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dh-player-quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    align-content: center;
}

.dh-quick-stat {
    text-align: center;
    padding: var(--space-sm);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.dh-quick-stat-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-gold);
}

.dh-quick-stat-label {
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================
   TABS
   ========================================== */
.dh-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-lg);
}

.dh-tab {
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dh-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.dh-tab.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    background: rgba(242, 184, 39, 0.08);
}

.dh-tab-content {
    display: none;
}

.dh-tab-content.active {
    display: block;
}

/* ==========================================
   BUTTONS
   ========================================== */
.dh-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.dh-btn-primary {
    background: var(--accent-gold);
    color: var(--text-inverse);
}

.dh-btn-primary:hover {
    background: #e5ad24;
}

.dh-btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.dh-btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.dh-btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.dh-btn-ghost:hover {
    color: var(--accent-gold);
}

/* ==========================================
   FORMS / INPUTS
   ========================================== */
.dh-select {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dh-select:hover {
    border-color: var(--border-strong);
}

.dh-select:focus {
    outline: none;
    border-color: var(--accent-gold);
}

/* ==========================================
   FILTER BAR
   ========================================== */
.dh-filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.dh-filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.dh-filter-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* ==========================================
   BADGES / TAGS
   ========================================== */
.dh-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.dh-badge-gold {
    background: var(--accent-gold);
    color: var(--text-inverse);
}

.dh-badge-green {
    background: var(--cell-green);
    color: #fff;
}

.dh-badge-red {
    background: var(--cell-red);
    color: #fff;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.dh-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.dh-empty-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
}

.dh-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.dh-empty-text {
    font-size: 13px;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-mono { font-family: var(--font-mono); }
.text-xs { font-size: 10px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.5px; }
.tracking-wider { letter-spacing: 1px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
    .dh-player-header {
        grid-template-columns: auto 1fr;
    }
    .dh-player-quick-stats {
        display: none;
    }
}

@media (max-width: 768px) {
    .dh-container {
        padding: 0 var(--space-sm);
    }

    .dh-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dh-player-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .dh-player-photo,
    .dh-player-photo-placeholder {
        margin: 0 auto;
    }

    .dh-player-meta {
        justify-content: center;
    }

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

    .dh-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dh-tab {
        white-space: nowrap;
    }
}
