/* Historical Daily Leaderboards Page Styles */

/* Page Header */
.page-header p {
    color: #666;
}

.dark-mode .page-header p {
    color: #aaa;
}

/* Date Selector Container */
.date-selector-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card-background, #fff);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.date-selector label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.dark-mode .date-selector label {
    color: #e0e0e0;
}

.date-selector input[type="date"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 4px;
    font-size: 1rem;
    background: var(--input-background, #fff);
    color: var(--text-color, #333);
}

.primary-btn {
    padding: 0.75rem 1.5rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #45a049;
}

.primary-btn:active {
    transform: translateY(1px);
}

/* Date Navigation */
.date-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-background, #fff);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background: var(--button-background, #f0f0f0);
    color: var(--text-color, #333);
    border: 1px solid var(--border-color, #ccc);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
    background: var(--button-hover, #e0e0e0);
    border-color: var(--border-hover, #999);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:active:not(:disabled) {
    transform: translateY(1px);
}

/* Selected Date Display */
.selected-date {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.selected-date h3 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.dark-mode .selected-date h3 {
    color: #f5f5f5;
}

/* Leaderboard Container */
.leaderboard-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Player History Clickable */
.player-history-clickable {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.player-history-clickable::after {
    content: "📊";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 1.2rem;
}

.player-history-clickable:hover {
    background: var(--hover-background, rgba(0, 0, 0, 0.05));
    transform: translateX(4px);
}

.player-history-clickable:hover::after {
    opacity: 1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s;
}

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

.modal-content {
    background-color: var(--card-background, #fff);
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.dark-mode .modal-header h3 {
    color: #f5f5f5;
}

.close-modal {
    color: var(--text-secondary, #666);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--text-color, #333);
}

.modal-body {
    padding: 2rem;
}

#player-history-chart-container {
    margin-bottom: 0;
    height: 350px;
}

#player-history-chart-container canvas {
    height: 100% !important;
}

/* Player History Stats Grid */
.player-history-stats {
    margin-top: 0;
}

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

.stat-item {
    padding: 1rem;
    background: var(--stat-background, #f9f9f9);
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color, #e0e0e0);
}

.secondary-text {
    font-size: 0.75em;
    color: #888;
    margin-top: 2px;
}

.dark-mode .secondary-text {
    color: #999;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.dark-mode .stat-value {
    color: #f5f5f5;
}

.stat-value.positive {
    color: #4CAF50;
}

.stat-value.negative {
    color: #f44336;
}

.stat-detail {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

.dark-mode .stat-detail {
    color: #aaa;
}

/* Dark Mode Support */
.dark-mode .date-selector,
.dark-mode .date-nav {
    background: var(--card-background, #2a2a2a);
}

.dark-mode .date-selector input[type="date"] {
    background: var(--input-background, #333);
    color: var(--text-color, #e0e0e0);
    border-color: var(--border-color, #444);
}

.dark-mode .nav-btn {
    background: var(--button-background, #333);
    color: var(--text-color, #e0e0e0);
    border-color: var(--border-color, #444);
}

.dark-mode .nav-btn:hover:not(:disabled) {
    background: var(--button-hover, #404040);
    border-color: var(--border-hover, #555);
}

.dark-mode .player-history-clickable:hover {
    background: var(--hover-background, rgba(255, 255, 255, 0.05));
}

.dark-mode .modal-content {
    background-color: var(--card-background, #2a2a2a);
}

.dark-mode .modal-header {
    border-bottom-color: var(--border-color, #444);
}

.dark-mode .stat-item {
    background: var(--stat-background, #333);
    border-color: var(--border-color, #444);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary, #666);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .date-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .date-selector label {
        text-align: center;
    }

    .date-nav {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    #player-history-chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .selected-date h3 {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
