/* Leaderboard Styles */

/* Player Name and Score - Consistent formatting */
.player-name {
    font-size: 10px !important;
    font-weight: 500;
    display: block;
    width: 100%;
    line-height: 25px !important;
    height: 25px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Player Score - Right aligned */
.player-score {
    text-align: right !important;
    font-size: 10px !important;
    font-weight: 500;
    display: block;
    width: 100%;
    line-height: 25px !important;
    height: 25px;
    color: var(--text-color) !important;
}

/* For the table-based player list */
.player-name-cell .player-name {
    font-size: 10px !important;
    font-weight: 500;
    display: block;
    width: 100%;
    line-height: 25px !important;
    height: 25px;
}

.player-score-cell .player-score {
    font-size: 10px !important;
    font-weight: 500;
    text-align: right !important;
    display: block;
    width: 100%;
    line-height: 25px !important;
    height: 25px;
    color: var(--text-color) !important;
}

/* For top 3 podium */
.player-card .player-name {
    font-size: 10px !important;
    font-weight: 500;
    display: block;
    width: 100%;
    line-height: 1.2 !important;
    height: auto;
    margin-bottom: 2px;
}

.player-card .player-score {
    font-size: 10px !important;
    font-weight: 500;
    text-align: center !important;
    display: block;
    width: 100%;
    line-height: 1.2 !important;
    height: auto;
    color: var(--text-color) !important;
}

/* Player row container */
.player-item {
    height: 25px !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 4px !important;
    padding: 0 !important;
}

/* Player avatar in list */
.player-avatar {
    width: 25px !important;
    height: 25px !important;
    border-radius: 50% !important;
    margin-right: 4px !important;
    object-fit: cover !important;
    border: 1px solid white !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* Top 3 player avatars - double size */
.top-players .player-avatar {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    margin-right: 8px !important;
    object-fit: cover !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* Top 3 podium styles */
.first-place {
    background: linear-gradient(135deg, #FFD700, #FDB931) !important;
    border: 2px solid #FFD700 !important;
    height: 90px !important;
    width: 100px !important;
    margin-bottom: 0 !important;
    padding: 8px 4px 4px 4px !important;
    margin-top: 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

.second-place {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8) !important;
    border: 2px solid #C0C0C0 !important;
    height: 80px !important;
    width: 100px !important;
    align-self: flex-end !important;
    margin-bottom: 0 !important;
    padding: 8px 4px 4px 4px !important;
    margin-top: 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

.third-place {
    background: linear-gradient(135deg, #CD7F32, #B87333) !important;
    border: 2px solid #CD7F32 !important;
    height: 70px !important;
    width: 100px !important;
    align-self: flex-end !important;
    margin-bottom: 0 !important;
    padding: 8px 4px 4px 4px !important;
    margin-top: 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

/* Player info within podiums */
.top-players .player-info {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin-top: auto !important;
    text-align: center !important;
    padding-bottom: 4px !important;
}

.top-players .player-score {
    font-size: 12px !important;
    font-weight: bold !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
    margin-bottom: 2px !important;
}

.top-players .player-name {
    font-size: 10px !important;
    font-weight: 500 !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
    text-align: center !important;
    line-height: 1.2 !important;
    max-width: 90px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Top players container */
.top-players {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-end !important;
    gap: var(--spacing) !important;
    margin-bottom: calc(var(--spacing) * 2) !important;
    padding-bottom: var(--spacing) !important;
    border-bottom: 1px solid #eee !important;
    min-height: 100px !important;
    padding-top: 10px !important;
}

/* Responsive styles */
@media (max-width: 480px) {
    .player-name,
    .player-score {
        font-size: 10px !important;
        line-height: 25px !important;
        height: 25px;
    }
    
    /* Top 3 avatars on mobile - slightly smaller but still larger than list */
    .top-players .player-avatar {
        width: 40px !important;
        height: 40px !important;
        margin-right: 6px !important;
    }
    
    /* Regular list avatars on mobile */
    .player-avatar {
        width: 20px !important;
        height: 20px !important;
        margin-right: 3px !important;
    }
    
    /* Mobile podium adjustments */
    .first-place {
        height: 75px !important;
        width: 80px !important;
        padding: 6px 2px 2px 2px !important;
        justify-content: flex-end !important;
    }
    
    .second-place {
        height: 70px !important;
        width: 80px !important;
        padding: 6px 2px 2px 2px !important;
        justify-content: flex-end !important;
    }
    
    .third-place {
        height: 65px !important;
        width: 80px !important;
        padding: 6px 2px 2px 2px !important;
        justify-content: flex-end !important;
    }
    
    .top-players {
        min-height: 85px !important;
        gap: 8px !important;
    }
    
    .top-players .player-score {
        font-size: 10px !important;
    }
    
    .top-players .player-name {
        font-size: 9px !important;
        max-width: 70px !important;
    }
}
    
    .player-name-cell .player-name,
    .player-score-cell .player-score {
        font-size: 10px !important;
        line-height: 25px !important;
        height: 25px;
    }
}

/* Overlay for leaderboard modal */
.leaderboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* Modal content for leaderboard - compact card style */
.leaderboard-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    height: auto;
    max-height: 90vh;
    padding: 0;
    background: none;
    border-radius: var(--border-radius);
    box-shadow: none;
}

.leaderboard-section {
    width: 100%;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    padding: 24px 16px 16px 16px;
    margin: 0;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

@media (max-width: 480px) {
    .leaderboard-modal {
        max-width: 98vw;
    }
    .leaderboard-section {
        padding: 12px 2vw 8px 2vw;
    }
}

/* ==========================================================================
   Event Navigation and Selection Styles
   ========================================================================== */

/* Event Navigation Header */
.event-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px; /* Reduced gap for mobile */
    flex: 1;
    margin: 0 8px; /* Reduced margins for mobile */
    margin-left: 16px; /* Reduced left margin for mobile */
}

/* Ensure proper spacing for the header layout */
.header.subpage {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced gap for mobile */
    padding: 0 8px; /* Reduced padding for mobile */
    position: relative; /* Ensure proper positioning context */
}

.back-button {
    flex-shrink: 0; /* Prevent back button from shrinking */
    margin-right: 4px; /* Reduced margin for mobile */
    position: relative; /* Change from absolute to relative for flexbox layout */
    left: auto; /* Remove absolute positioning */
}

.event-navigation {
    flex: 1; /* Take up remaining space */
    justify-content: center;
    margin-left: 8px; /* Reduced margin for mobile */
    margin-right: 8px; /* Reduced margin for mobile */
}

.header-spacer {
    flex-shrink: 0; /* Prevent spacer from shrinking */
    width: 32px; /* Reduced width for mobile */
}

.event-nav-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.event-nav-btn:hover {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primaryDark-color);
}

.event-nav-btn:active {
    transform: scale(0.95);
}

.event-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.event-nav-btn:disabled:hover {
    background: none;
    color: var(--primary-color);
}

/* Event Selection Cards */
.event-selection-cards {
    padding: 16px;
    background: var(--white-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mobile Responsive Adjustments for iPhone and small screens */
@media (max-width: 430px) {
    .header.subpage {
        padding: 0 4px; /* Minimal padding for very small screens */
        gap: 4px; /* Minimal gap for very small screens */
    }
    
    .event-navigation {
        gap: 8px; /* Reduced gap for very small screens */
        margin: 0 4px; /* Minimal margins for very small screens */
    }
    
    .event-nav-btn {
        min-width: 32px; /* Smaller buttons for mobile */
        min-height: 32px; /* Smaller buttons for mobile */
        padding: 4px; /* Reduced padding for mobile */
    }
    
    .event-nav-btn i {
        font-size: 16px; /* Smaller icons for mobile */
    }
    
    .header.subpage h1 {
        font-size: 16px; /* Smaller title for mobile */
        line-height: 1.2; /* Tighter line height for mobile */
    }
    
    .back-button {
        width: 32px; /* Smaller back button for mobile */
        height: 32px; /* Smaller back button for mobile */
        margin-right: 2px; /* Minimal margin for mobile */
    }
    
    .header-spacer {
        width: 24px; /* Smaller spacer for mobile */
    }
    
    /* Ensure leaderboard back button works correctly on mobile */
    #leaderboard-back-btn {
        position: relative !important;
        left: auto !important;
        width: 32px !important;
        height: 32px !important;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .header.subpage {
        padding: 0 2px; /* Very minimal padding */
        gap: 2px; /* Very minimal gap */
    }
    
    .event-navigation {
        gap: 6px; /* Very minimal gap */
        margin: 0 2px; /* Very minimal margins */
    }
    
    .event-nav-btn {
        min-width: 28px; /* Even smaller buttons */
        min-height: 28px; /* Even smaller buttons */
        padding: 2px; /* Very minimal padding */
    }
    
    .event-nav-btn i {
        font-size: 14px; /* Even smaller icons */
    }
    
    .header.subpage h1 {
        font-size: 14px; /* Even smaller title */
    }
    
    .back-button {
        width: 28px; /* Even smaller back button */
        height: 28px; /* Even smaller back button */
    }
    
    .header-spacer {
        width: 20px; /* Even smaller spacer */
    }
    
    /* Ensure leaderboard back button works correctly on very small screens */
    #leaderboard-back-btn {
        position: relative !important;
        left: auto !important;
        width: 28px !important;
        height: 28px !important;
    }
}

.event-selection-cards.hidden {
    display: none;
}

.event-cards-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.event-cards-container::-webkit-scrollbar {
    display: none;
}

.event-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    position: relative;
    border: 2px solid transparent;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.event-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.event-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 20px;
    color: var(--white-color);
}

.event-card.active .event-card-icon {
    background: var(--primary-color);
}

.event-card-score {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.event-card-name {
    font-size: 12px;
    color: var(--textLight-color);
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Event Card Color Variants */
.event-card.variant-1 {
    background: #f5f5f5;
}

.event-card.variant-2 {
    background: #fff3e0;
}

.event-card.variant-3 {
    background: #f3e5f5;
}

.event-card.variant-4 {
    background: #e8f5e8;
}

.event-card.variant-5 {
    background: #fff8e1;
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
    .event-navigation {
        margin: 0 8px;
        gap: 12px;
    }
    
    .event-nav-btn {
        min-width: 36px;
        min-height: 36px;
        font-size: 16px;
    }
    
    .event-selection-cards {
        padding: 12px;
    }
    
    .event-cards-container {
        gap: 8px;
    }
    
    .event-card {
        min-width: 100px;
        padding: 12px;
    }
    
    .event-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .event-card-score {
        font-size: 14px;
    }
    
    .event-card-name {
        font-size: 11px;
        max-width: 80px;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .event-selection-cards {
        background: var(--background-color);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .event-card.variant-1 {
        background: #424242;
    }
    
    .event-card.variant-2 {
        background: #5d4037;
    }
    
    .event-card.variant-3 {
        background: #4a148c;
    }
    
    .event-card.variant-4 {
        background: #1b5e20;
    }
    
    .event-card.variant-5 {
        background: #f57f17;
    }
}

