/* Leaderboard Page Styling - Matching Block Page */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #e0e0e0;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
}

.container {
    max-width: 800px;
    margin: 15px auto;
    padding: 12px;
    background-color: #A0826D;
    flex: 1;
    width: 100%;
    border: 2px solid black;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
}

.container > * {
    margin-bottom: 0 !important;
}

/* Breadcrumb */
.blk-breadcrumb {
    font-size: 16px;
    color: #333333;
    margin: -12px -12px 12px -12px;
    padding: 12px 20px;
    background-color: #8B4513;
    border-bottom: 2px solid black;
    box-shadow: 0 4px 0 rgba(0,0,0,0.3);
    display: block;
}

.blk-breadcrumb a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

.blk-breadcrumb a:hover {
    color: #ffeb3b;
    text-decoration: underline;
}

.blk-breadcrumb-separator {
    margin: 0 8px;
    color: #ffffff;
    font-weight: 600;
}

.blk-breadcrumb-current {
    color: #ffeb3b;
    font-weight: 700;
}

.leaderboard-wrapper {
    display: flex;
    flex-direction: column;
}

/* Header Section */
.leaderboard-header {
    background-color: white;
    border: 2px solid #404040;
    padding: 12px 12px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
    margin-top: 12px;
    margin-bottom: 12px;
}

.leaderboard-title {
    text-align: center;
    font-size: 22px;
    color: #1a1a1a;
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 2px 2px 0 rgba(0,0,0,0.2);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 3px solid #404040;
    padding: 10px 20px;
    display: inline-block;
}

.leaderboard-subtitle {
    text-align: center;
    font-size: 13px;
    color: white;
    margin: 0;
    background: linear-gradient(180deg, #9b6ba8 0%, #8b5b9b 50%, #7a4b8a 100%);
    padding: 8px 12px;
    border: 3px solid #5a2b6a;
    border-radius: 2px;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.4), inset -1px -1px 0 rgba(0,0,0,0.3), 1px 1px 0 rgba(0,0,0,0.2);
    line-height: 1.4;
}

/* Help Button */
.leaderboard-title-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 12px;

}

.help-button-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4CAF50;
    border: 2px solid #2E7D32;
    border-radius: 0;
    width: 36px;
    height: 36px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.help-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-button:hover {
    background-color: transparent;
}

.help-text {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.help-button:hover .help-text {
    opacity: 1;
}

/* Help Modal Content */
.help-content {
    color: #333;
    line-height: 1.4;
    font-size: 13px;
}

.help-section {
    margin-bottom: 12px;
    padding: 12px;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-content p {
    margin-bottom: 15px;
}

.contribution-guide h3 {
    color: #8B4513;
    margin-bottom: 8px;
    font-size: 1rem;
}

.contribution-guide ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.contribution-guide li {
    margin-bottom: 6px;
}

.contribution-guide ol {
    padding-left: 20px;
    margin-bottom: 0;
}

/* Leaderboard Table */
.leaderboard-table {
    background-color: white;
    border: 2px solid #404040;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
    padding: 12px 12px;
    margin-bottom: 0;
}

/* Individual Section Containers */
.leaderboard-section {
    margin-bottom: 12px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    background-color: white;
    border: 2px solid #333;
    padding: 10px 12px;
    border-radius: 0;
    transition: none;
    gap: 12px;
    box-shadow: none;
    margin-bottom: 0;
}

@keyframes shimmer-gold {
    0% {
        box-shadow: 4px 4px 0 rgba(204, 153, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 4px 4px 0 rgba(204, 153, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.8);
    }
    100% {
        box-shadow: 4px 4px 0 rgba(204, 153, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0);
    }
}

@keyframes shimmer-silver {
    0% {
        box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(255, 255, 255, 0.6);
    }
    100% {
        box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(255, 255, 255, 0);
    }
}

@keyframes shimmer-bronze {
    0% {
        box-shadow: 4px 4px 0 rgba(139, 111, 71, 0.5), inset 0 0 20px rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 4px 4px 0 rgba(139, 111, 71, 0.5), inset 0 0 20px rgba(255, 200, 124, 0.6);
    }
    100% {
        box-shadow: 4px 4px 0 rgba(139, 111, 71, 0.5), inset 0 0 20px rgba(255, 255, 255, 0);
    }
}

/* Top 3 Medals */
.leaderboard-row.top-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #cc9900;
    padding: 18px;
    animation: shimmer-gold 2s ease-in-out infinite;
}

.leaderboard-row.top-2 {
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
    border: 3px solid #888;
    padding: 18px;
    animation: shimmer-silver 2s ease-in-out infinite;
}

.leaderboard-row.top-3 {
    background: linear-gradient(135deg, #d4915d 0%, #cd7f32 100%);
    border: 3px solid #8b6f47;
    padding: 18px;
    animation: shimmer-bronze 2s ease-in-out infinite;
    color: white;
}

.leaderboard-row.top-3 .leaderboard-username,
.leaderboard-row.top-3 .leaderboard-rank {
    color: white;
}

.leaderboard-row.top-3 .stat-label {
    color: rgba(0, 0, 0, 0.95);
}

.leaderboard-row.top-3 .stat-value {
    color: rgb(0, 0, 0);
}

.leaderboard-rank {
    font-size: 28px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
    color: #1a1a1a;
}

.leaderboard-rank img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.leaderboard-username {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    flex: 1;
    min-width: 120px;
}

.leaderboard-stats {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: linear-gradient(180deg, #e8e8e8 0%, #d0d0d0 50%, #b8b8b8 100%);
    padding: 6px 10px;
    border-radius: 2px;
    border: 2px solid #999;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.6), inset -1px -1px 0 rgba(0,0,0,0.3), 1px 1px 0 rgba(0,0,0,0.2);
    min-width: 70px;
}

.leaderboard-row.top-3 .stat {
    background: linear-gradient(180deg, #e8e8e8 0%, #d0d0d0 50%, #b8b8b8 100%);
    border-color: #999;
    color: #1a3a52;
}

.stat-label {
    font-size: 9px;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 700;
    margin-bottom: 0;
}

.leaderboard-row.top-3 .stat-label {
    color: rgba(0, 0, 0, 0.95);
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #000000;
    line-height: 1;
}

.leaderboard-row.top-3 .stat-value {
    color: rgb(0, 0, 0);
}

/* Image Container */
.leaderboard-rank img {
    border: 2px solid black;
    padding: 4px;
    background-color: white;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 2px 2px 0 rgba(0,0,0,0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 10px auto;
        padding: 15px;
    }

    .leaderboard-title {
        font-size: 32px;
    }

    .leaderboard-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .leaderboard-rank {
        align-self: center;
        font-size: 32px;
    }

    .leaderboard-stats {
        width: 100%;
        margin-left: 0;
        flex-direction: row;
        gap: 20px;
    }

    .stat {
        flex: 1;
        align-items: center;
    }
}


/* CSP-compliant styling for leaderboard.php */

/* Loading/empty state message */
.leaderboard-loading,
.leaderboard-empty,
.leaderboard-error {
    text-align: center;
    padding: 40px;
    color: #1a1a1a;
}

/* Regular positions container layout */
.leaderboard-regular-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Help Modal */
#helpModal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
}

#helpModal .modal-content {
    background-color: #A0826D;
    border: 2px solid black;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: block;
    visibility: visible;
    opacity: 1;
}

#helpModal .blk-title-outer {
    margin: 0;
}

#helpModal .modal-form-container {
    padding: 20px;
}

#helpModal .close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #ffffff;
    padding: 0 10px;
}

#helpModal .close:hover {
    color: #cccccc;
}

