:root {
    --bg-dark: #0f1115;
    --bg-card: #1a1d24;
    --bg-card-hover: #222630;
    --text-primary: #ffffff;
    --text-secondary: #8b9bb4;
    --accent: #00f2ff;
    --accent-glow: rgba(0, 242, 255, 0.3);
    --gradient-1: linear-gradient(135deg, #00f2ff 0%, #00a8ff 100%);
    --border: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.team-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.accent {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

/* Dropdown Fix */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '▼';
    font-size: 0.8rem;
    color: var(--accent);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#season-select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.75rem 2.5rem 0.75rem 1.5rem;
    /* Extra padding right for arrow */
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
}

#season-select:hover {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-1);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.stat-card .value {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(0, 242, 255, 0.1);
}

.stat-card .player {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.2rem;
}

.leaderboard {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-header,
.player-row {
    display: grid;
    grid-template-columns: 2fr repeat(7, 1fr);
    padding: 1.25rem 1.5rem;
    align-items: center;
}

.table-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.stat-col {
    text-align: right;
    cursor: pointer;
    transition: color 0.2s;
}

.stat-col:hover {
    color: var(--accent);
}

.player-row {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

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

.player-row:hover {
    background: var(--bg-card-hover);
}

.player-col {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rank-badge {
    background: rgba(255, 255, 255, 0.1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.player-row:nth-child(1) .rank-badge {
    background: #ffd700;
    color: #000;
}

.player-row:nth-child(2) .rank-badge {
    background: #c0c0c0;
    color: #000;
}

.player-row:nth-child(3) .rank-badge {
    background: #cd7f32;
    color: #000;
}

.stat-val {
    text-align: right;
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-val.highlight {
    color: var(--accent);
    font-weight: 700;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 1000px;
    /* Increased width for table */
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

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

#modal-player-name {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.modal-stat-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.modal-stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.modal-stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.chart-wrapper {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Full Stats Table */
.full-stats-container h3 {
    color: var(--text-primary);
    font-family: var(--font-display);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.full-stats-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
    min-width: 800px;
    /* Ensure scroll on mobile */
}

.full-stats-table th,
.full-stats-table td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.full-stats-table th:first-child,
.full-stats-table td:first-child {
    text-align: left;
    padding-left: 1.5rem;
}

.full-stats-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.full-stats-table td {
    color: var(--text-primary);
    font-family: var(--font-display);
}

.full-stats-table tr:last-child td {
    border-bottom: none;
}

.full-stats-table tr:hover {
    background: var(--bg-card-hover);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.player-row {
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

.player-row:nth-child(1) {
    animation-delay: 0.05s;
}

.player-row:nth-child(2) {
    animation-delay: 0.1s;
}

.player-row:nth-child(3) {
    animation-delay: 0.15s;
}

@media (max-width: 900px) {

    .table-header,
    .player-row {
        grid-template-columns: 2fr repeat(3, 1fr);
    }

    .stat-col:nth-child(n+5),
    .stat-val:nth-child(n+5) {
        display: none;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .controls {
        width: 100%;
    }

    .select-wrapper,
    #season-select {
        width: 100%;
    }
}