* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #fff;
    min-height: 100vh;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

.refresh-icon {
    font-size: 18px;
    display: inline-block;
}

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

/* Search */
.search-container {
    margin-bottom: 24px;
}

.search-wrapper {
    position: relative;
}

#playerSearch {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: all 0.2s;
}

#playerSearch:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

#playerSearch::placeholder {
    color: #666;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 2px solid #333;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: #2a2a2a;
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-name {
    font-weight: 500;
}

.result-team {
    font-size: 13px;
    color: #888;
}

.result-team.injured {
    color: #ef4444;
}

/* Player Card */
.player-card {
    background: #111;
    border-radius: 16px;
    overflow: hidden;
}

.player-card.hidden {
    display: none;
}

.player-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.player-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--team-gradient, linear-gradient(135deg, #333 0%, #1a1a1a 100%));
    opacity: 0.3;
}

.player-info {
    position: relative;
    z-index: 1;
}

.player-info h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.player-info p {
    font-size: 14px;
    color: #aaa;
}

.player-number {
    position: relative;
    z-index: 1;
    font-size: 48px;
    font-weight: 800;
    opacity: 0.4;
}

/* Stats Layout - Side by side */
.stats-layout {
    display: flex;
    gap: 0;
}

/* Stats Toggle - Left side vertical tabs */
.stats-toggle {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    gap: 4px;
    background: #0a0a0a;
    min-width: 140px;
    border-right: 1px solid #222;
}

.stats-toggle::-webkit-scrollbar {
    display: none;
}

.toggle-btn {
    flex-shrink: 0;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    border-left: 3px solid transparent;
    border-bottom: none;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: left;
}

.toggle-btn:hover {
    color: #999;
    background: rgba(102, 126, 234, 0.05);
}

.toggle-btn.active {
    color: #fff;
    border-left-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Stats Content - Right side */
.stats-content {
    flex: 1;
    min-width: 0;
}

/* Stats Section */
.stats-section {
    padding: 20px;
}

.stats-section.hidden {
    display: none;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 12px;
    margin-top: 16px;
}

.section-label:first-child {
    margin-top: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    gap: 10px;
}

.stats-grid.two { grid-template-columns: repeat(2, 1fr); }
.stats-grid.three { grid-template-columns: repeat(3, 1fr); }
.stats-grid.four { grid-template-columns: repeat(4, 1fr); }
.stats-grid.five { grid-template-columns: repeat(5, 1fr); }
.stats-grid.six { grid-template-columns: repeat(6, 1fr); }

.stat-box {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-box.highlight {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Predictions Section */
.predictions-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #2a2a2a;
}

.prediction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);
    border-radius: 10px;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.prediction-title {
    font-size: 16px;
    font-weight: 700;
    color: #22c55e;
}

.prediction-matchup {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #333;
    padding: 4px 12px;
    border-radius: 6px;
}

.prediction-label {
    color: #22c55e !important;
}

.prediction-grid {
    margin-bottom: 12px;
}

.stat-box.prediction {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.stat-box.prediction .stat-value {
    color: #22c55e;
}

.stat-box.prediction.highlight {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.prediction-footer {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    background: #1a1a1a;
    border-radius: 6px;
}

.prediction-methodology {
    margin-bottom: 12px;
}

/* Source Games Section */
.source-games-section {
    margin-top: 12px;
    border-top: 1px solid #333;
    padding-top: 8px;
}

.source-games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
    color: #22c55e;
    font-size: 12px;
    font-weight: 500;
}

.source-games-header:hover {
    color: #4ade80;
}

.source-games-toggle {
    font-size: 10px;
    transition: transform 0.2s;
}

.source-games-content {
    display: none;
    margin-top: 8px;
}

.source-games-content.expanded {
    display: block;
}

.source-player {
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}

.source-player:last-child {
    margin-bottom: 0;
}

.source-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.source-player-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}

.source-player-sim {
    font-size: 11px;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

.source-player-avg {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 6px;
}

.source-games-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-game {
    display: flex;
    gap: 6px;
    align-items: center;
    background: #1a1a1a;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.source-game-date {
    color: #888;
}

.source-game-stats {
    color: #22c55e;
    font-weight: 500;
}

.source-game-loc {
    color: #666;
    font-size: 10px;
}

.predictions-section.no-prediction {
    opacity: 0.5;
}

.predictions-section.no-prediction .prediction-header {
    background: rgba(100, 100, 100, 0.15);
    border-color: rgba(100, 100, 100, 0.3);
}

.predictions-section.no-prediction .prediction-title {
    color: #888;
}

/* Team Impact Section */
.team-record {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.record-item {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 16px 20px;
    flex: 1;
    text-align: center;
}

.record-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.record-value.wins { color: #22c55e; }
.record-value.losses { color: #ef4444; }

.record-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

/* On/Off Court Comparison */
.onoff-comparison {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.onoff-box {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 12px 16px;
    flex: 1;
    text-align: center;
}

.onoff-box.on {
    border-left: 3px solid #22c55e;
}

.onoff-box.off {
    border-left: 3px solid #ef4444;
}

.onoff-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.onoff-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.onoff-stats-table {
    background: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.onoff-stats-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px 80px;
    padding: 10px 16px;
    border-bottom: 1px solid #2a2a2a;
    align-items: center;
}

.onoff-stats-row:last-child {
    border-bottom: none;
}

.onoff-stats-row.header {
    background: #0a0a0a;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
}

.onoff-stat-label {
    font-size: 13px;
    color: #ccc;
}

.onoff-stat-value {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.onoff-stat-value.on {
    color: #22c55e;
}

.onoff-stat-value.off {
    color: #ef4444;
}

.onoff-stat-value.diff {
    color: #667eea;
}

.onoff-stat-value.diff.positive {
    color: #22c55e;
}

.onoff-stat-value.diff.negative {
    color: #ef4444;
}

.share-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-note {
    margin-bottom: 8px;
}

.share-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-label {
    width: 75px;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.share-bar-container {
    flex: 1;
    height: 24px;
    background: #1a1a1a;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.share-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.share-bar.stl {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.share-bar.blk {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.share-bar.fg3 {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.share-bar.ft {
    background: linear-gradient(90deg, #06b6d4 0%, #0891b2 100%);
}

.share-value {
    width: 50px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.starter-bench-info {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 16px;
}

.starter-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.starter-badge.starter {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.starter-badge.bench {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.start-ratio {
    font-size: 13px;
    color: #888;
}

/* Compare Section */
.compare-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #2a2a2a;
}

.compare-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.compare-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compare-icon {
    font-size: 18px;
}

/* Custom Select */
.custom-select-wrapper {
    position: relative;
}

.custom-search {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: all 0.2s;
}

.custom-search:focus {
    border-color: #667eea;
}

.custom-search::placeholder {
    color: #666;
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 2px solid #333;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.select-dropdown.active {
    display: block;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #2a2a2a;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item-team {
    color: #888;
    font-size: 12px;
}

/* Comparison Result */
.comparison-result {
    margin-top: 16px;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 10px 10px 0 0;
    border-bottom: 1px solid #2a2a2a;
}

.compare-player-name {
    font-weight: 600;
    font-size: 14px;
}

.compare-player-name.left {
    color: #667eea;
}

.compare-player-name.right {
    color: #764ba2;
    text-align: right;
}

.vs-badge {
    background: #333;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
}

.comparison-rows {
    background: #1a1a1a;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #2a2a2a;
}

.comparison-row:last-child {
    border-bottom: none;
}

.compare-value {
    font-size: 15px;
    font-weight: 600;
}

.compare-value.left {
    text-align: left;
}

.compare-value.right {
    text-align: right;
}

.compare-value.winner {
    color: #22c55e;
}

.compare-stat-name {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    padding: 0 10px;
}

.comparison-row.highlight-row {
    background: rgba(102, 126, 234, 0.1);
}

/* Historical player styling */
.historical-note {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
    font-style: italic;
}

/* Similar Players Section */
.similar-description {
    font-size: 12px;
    color: #888;
    margin-bottom: 16px;
    line-height: 1.5;
}

.similar-players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.similar-player-card {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #2a2a2a;
}

.similar-player-card > .similar-rank {
    flex: 0 0 32px;
}

.similar-player-card > .similar-player-info {
    flex: 1;
    min-width: 120px;
}

.similar-player-card > .similar-scores {
    flex: 0 0 auto;
}

.similar-player-card > .similar-categories {
    flex: 0 0 100%;
}

.similar-player-card:hover {
    background: #222;
    border-color: #667eea;
    transform: translateX(4px);
}

.similar-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.similar-rank.top-3 {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.similar-player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.similar-player-name {
    font-weight: 600;
    font-size: 14px;
}

.similar-player-meta {
    font-size: 12px;
    color: #888;
}

.similar-scores {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.similar-main-score {
    font-size: 18px;
    font-weight: 700;
    color: #22c55e;
}

.similar-sub-score {
    font-size: 11px;
    color: #888;
}

/* Category breakdown modal */
.similar-categories {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #333;
}

.similar-player-card.expanded .similar-categories {
    display: grid;
}

.category-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #252525;
    border-radius: 6px;
    font-size: 11px;
}

.category-name {
    color: #888;
    text-transform: capitalize;
}

.category-value {
    font-weight: 600;
    color: #fff;
}

.category-value.high {
    color: #22c55e;
}

.category-value.medium {
    color: #f59e0b;
}

.category-value.low {
    color: #ef4444;
}

/* Responsive */
@media (max-width: 700px) {
    .app {
        max-width: 100%;
        padding: 12px;
    }
    
    .stats-layout {
        flex-direction: column;
    }
    
    .stats-toggle {
        flex-direction: row;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #222;
        padding: 0 8px;
        overflow-x: auto;
    }
    
    .toggle-btn {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 10px 14px;
        text-align: center;
    }
    
    .toggle-btn.active {
        border-left-color: transparent;
        border-bottom-color: #667eea;
    }
}

@media (max-width: 480px) {
    .stats-grid.six {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stats-grid.four {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .toggle-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .similar-categories {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.data-freshness {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .header-actions {
        gap: 4px;
    }

    .data-freshness {
        display: none;
    }
}
