/* ============================================
   Leaderboard Widget - Reusable Component
   ============================================ */

.leaderboard-widget {
    background: linear-gradient(135deg, #000 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    /* position: relative;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden; */
}

.leaderboard-widget::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    /* width: 100%; */
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Header */
.leaderboard-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.leaderboard-icon {
    font-size: 40px;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.leaderboard-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 5px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.leaderboard-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
    font-weight: 500;
}

/* User Streak Display */
.user-streak-display {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: streakGlow 2s ease-in-out infinite;
}

@keyframes streakGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5); }
}

.streak-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.streak-icon {
    font-size: 32px;
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.streak-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.streak-number {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.streak-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.streak-message {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    opacity: 0.95;
}

.game-streak-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 13px;
    font-weight: 600;
    opacity: 0.95;
}

/* Auth Section */
.leaderboard-auth {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-message {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-align: center;
}

.auth-form {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.auth-input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: var(--surface-color, rgba(255,255,255,0.95));
    color: var(--text-primary, #333);
}

.auth-input::placeholder {
    color: var(--text-secondary, #999);
}

.auth-button {
    padding: 10px 16px;
    /* background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); */
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s;
}

.auth-button:hover {
    transform: scale(1.05);
}

/* Leaderboard List */
.leaderboard-list {
    position: relative;
    z-index: 1;
}

.loading-state {
    text-align: center;
    padding: 30px 0;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

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

.loading-state p {
    font-size: 14px;
    opacity: 0.8;
    margin: 0;
}

/* Rank Cards */
.rank-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.2s, background 0.2s;
}

.rank-card:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.15);
}

.rank-card:last-child {
    margin-bottom: 0;
}

/* Top 3 Special Styling */
.rank-card.rank-1 {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.rank-card.rank-2 {
    background: rgba(192, 192, 192, 0.2);
    border: 2px solid rgba(192, 192, 192, 0.5);
}

.rank-card.rank-3 {
    background: rgba(205, 127, 50, 0.2);
    border: 2px solid rgba(205, 127, 50, 0.5);
}

/* Rank Badge */
.rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.rank-badge.rank-1 { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #333; }
.rank-badge.rank-2 { background: linear-gradient(135deg, #C0C0C0 0%, #A9A9A9 100%); color: #333; }
.rank-badge.rank-3 { background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%); color: #fff; }

/* Player Info */
.player-info {
    flex: 1;
    min-width: 0;
}

.player-email {
    display: block;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-meta {
    display: block;
    font-size: 11px;
    opacity: 0.8;
    margin-top: 2px;
}

/* Score Display */
.player-score {
    font-weight: 700;
    font-size: 18px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* User Position */
.user-position {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.position-divider {
    text-align: center;
    font-size: 20px;
    opacity: 0.5;
    margin-bottom: 10px;
    font-weight: 700;
}

.user-rank-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}

.rank-badge.your-rank {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* View Full Link */
.view-full-leaderboard {
    display: block;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.view-full-leaderboard:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state p {
    font-size: 14px;
    opacity: 0.8;
    margin: 10px 0;
}

/* Responsive */
@media (max-width: 640px) {
    .leaderboard-widget {
        padding: 16px;
    }
    
    .leaderboard-title {
        font-size: 18px;
    }
    
    .auth-form {
        flex-direction: column;
    }
    
    .auth-button {
        width: 100%;
    }
}

/* ============================================
   Daily "already played today" banner
   (created in dashboard.js applyDailyOncePerDay)
   ============================================ */
.daily-already-played-banner {
    background: #8f1f1f;
    color: #fff;
    padding: 25px 16px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 600;
    text-align: center;
}

.daily-already-played-banner p {
    margin: 0;
}
