/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #e0e0e0;
    --primary: #1a3a5c;
    --primary-light: #2d5a8e;
    --accent: #c41e3a;
    --accent-light: #e85d75;
    --success: #2e7d32;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'SF Mono', 'Fira Code', monospace;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* === NAVBAR === */
.navbar {
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-links {
    margin-left: 2rem;
    display: flex;
    gap: 0.25rem;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* === FILTER BAR === */
.filter-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select, .filter-group input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: white;
    min-width: 120px;
}

/* === BUTTONS === */
.btn {
    padding: 0.45rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

/* === CONTAINER === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* === CARDS === */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--primary);
    color: white;
}

.card-header.accent {
    background: var(--accent);
}

.card-body {
    padding: 1rem;
}

/* === COMPARISON TABLE === */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.comparison-table th,
.comparison-table td {
    padding: 0.4rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.comparison-table thead th {
    font-weight: 600;
    background: var(--bg);
}

/* === PITCHER REPORT === */
.report-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-header h1 {
    font-size: 1.5rem;
}

.report-header .hand-badge {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
}

.report-top {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.splits-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.heatmap-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    justify-items: center;
    margin-bottom: 1rem;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    justify-items: center;
}

.heatmap-cell {
    text-align: center;
    max-width: 280px;
}

.heatmap-plot {
    aspect-ratio: 1;
    width: 100%;
}

.heatmap-cell h4 {
    font-size: 0.8rem;
    margin-bottom: 0.1rem;
    color: var(--text-muted);
}

.heatmap-pov {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-style: italic;
}

/* Hitter heatmap row: scrollable horizontal strip */
.hitter-heatmap-row {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.hitter-heatmap-row .heatmap-cell {
    flex: 0 0 180px;
    max-width: 180px;
}

/* === SPLIT TABLES === */
.split-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.split-table th {
    text-align: right;
    padding: 0.3rem 0.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.split-table td {
    text-align: right;
    padding: 0.3rem 0.5rem;
}

.split-table td:first-child,
.split-table th:first-child {
    text-align: left;
    font-weight: 600;
}

/* === AG GRID OVERRIDES === */
.ag-theme-alpine {
    --ag-header-background-color: var(--primary);
    --ag-header-foreground-color: white;
    --ag-font-size: 13px;
    --ag-row-hover-color: #f0f4f8;
}

/* === LEADERBOARD === */
.leaderboard-container {
    height: 700px;
}

/* === LOADING === */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* === TRADITIONAL STATS ROW === */
.traditional-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 0;
    text-align: center;
    padding: 0.75rem 0.5rem;
}

.trad-stat {
    padding: 0.5rem 0.25rem;
    border-right: 1px solid var(--border);
}
.trad-stat:last-child { border-right: none; }

.trad-stat.highlight {
    background: rgba(26, 58, 92, 0.06);
}

.trad-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--mono);
}

.trad-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.15rem;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .report-top {
        grid-template-columns: 1fr;
    }
    .splits-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .heatmap-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 0 0.75rem;
    }
    .nav-links a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    .filter-bar {
        padding: 0.5rem 0.75rem;
    }
    .container {
        padding: 0.75rem;
    }
    .splits-row {
        grid-template-columns: 1fr;
    }
    .heatmap-overview {
        grid-template-columns: 1fr;
    }
    .heatmap-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
