/* Additional styles specific to stats page */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Account for fixed header - matches header height from styles.css */
body {
    padding-top: 80px; /* Matches header height plus small buffer */
}

.stats-hero {
    background: linear-gradient(135deg, #4a8d54 0%, #3a7244 100%);
    color: white;
    padding: 20px 0 60px 0; /* Reduced top padding since body has padding-top: 76px */
    text-align: center;
}

.stats-hero h1 {
    font-size: 3em;
    margin: 0 0 20px 0;
    font-weight: bold;
}

.stats-hero p {
    font-size: 1.2em;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

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

.stats-section {
    margin: 60px 0;
}

.stats-section h2 {
    color: #fff;
    margin-bottom: 3rem;
    text-align: center;
    /* No font-size specified - matches Rules section in index.html */
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #4a8d54;
    margin: 0 0 10px 0;
    line-height: 1;
}

.stat-card p {
    color: #666;
    margin: 0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.leaderboard-controls {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-box:focus {
    outline: none;
    border-color: #4a8d54;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    background: #4a8d54;
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.3s;
}

/* Keep player column header left-aligned */
.leaderboard-table th:nth-child(2) {
    text-align: left;
}

.leaderboard-table th:hover {
    background: #3a7244;
}

.leaderboard-table th.sortable::after {
    content: '↕️';
    position: absolute;
    right: 8px;
    opacity: 0.5;
}

.leaderboard-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.leaderboard-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.leaderboard-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s;
    color: #333;
    background-color: white;
    text-align: center;
}

/* Keep player column left-aligned */
.leaderboard-table td:nth-child(2) {
    text-align: left;
}

.leaderboard-table tr {
    background-color: white;
}

.leaderboard-table tr:hover {
    background: #f8f9fa;
}

.player-name {
    color: #4a8d54;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.3s;
}

.player-name:hover {
    color: #3a7244;
    text-decoration: underline;
}

/* Player Modal Styles */
.player-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.player-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

.player-modal h2 {
    margin: 0 0 20px 0;
    color: #4a8d54;
    font-size: 1.8em;
}

.player-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #4a8d54;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.rank-cell {
    font-weight: bold;
    color: #4a8d54;
    font-size: 1.1em;
}

.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.game-type-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.game-type-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: left;
    color: #333;
    transition: transform 0.2s;
}

.game-type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.game-type-name {
    font-size: 1.4em;
    font-weight: bold;
    color: #4a8d54;
    margin-bottom: 20px;
    text-transform: capitalize;
}

.game-type-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-row {
    display: flex;
    gap: 25px;
}

.game-type-metric {
    display: flex;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.game-type-metric span {
    color: #666;
    white-space: nowrap;
}

.trends-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.trend-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.trend-card h3 {
    margin: 0 0 20px 0;
    color: #4a8d54;
    font-size: 1.3em;
}

.daily-chart {
    display: flex;
    justify-content: space-between;
    align-items: end;
    height: 120px;
    gap: 8px;
}

.day-bar {
    flex: 1;
    background: linear-gradient(to top, #4a8d54, #6ab06f);
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 4px;
    transition: all 0.3s ease;
}

.day-bar:hover {
    background: linear-gradient(to top, #3a7244, #4a8d54);
    transform: scaleY(1.1);
}

.day-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #666;
    white-space: nowrap;
}

.day-count {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #4a8d54;
    font-weight: bold;
}

.peak-hours {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.peak-hour {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a8d54;
}

.peak-hour-time {
    font-weight: bold;
    color: #333;
}

.peak-hour-count {
    color: #4a8d54;
    font-weight: bold;
}

.game-type-metric strong {
    color: #333;
    font-weight: bold;
}

.last-updated {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 40px 0;
}

/* Header Navigation Styles - Stats page specific overrides */

/* Desktop: Center nav-links, position logo absolutely on left */
nav {
    justify-content: center;
}

.logo {
    position: absolute;
    left: 2rem;
}

/* Stats-specific nav overrides */
.nav-links li {
    margin: 0 0.3rem;
}


@media (max-width: 768px) {
    /* Mobile: Use space-between for logo and hamburger */
    nav {
        justify-content: space-between;
        padding: 1rem;
        max-width: 100%;
    }

    .logo {
        position: static;
        flex: 0 0 auto;
        margin-right: 0.5rem;
        font-size: 1.4rem;
    }

    .hamburger {
        flex: 0 0 auto;
        margin: 0;
    }

    .stats-hero h1 {
        font-size: 2.2em;
    }

    .stats-hero p {
        font-size: 1.1em;
        padding: 0 20px;
    }

    .leaderboard-container {
        overflow-x: auto;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 8px;
        font-size: 0.9em;
    }

    .game-type-stats {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

