/* Import shared styles from review.css for consistent navigation */
@import url('review.css');

/* Leaderboard specific styles */

/* Ensure main content has proper spacing */
main {
    margin-top: 0 !important;
}

/* Desktop: constrain leaderboard width and center it */
@media (min-width: 769px) {
    main {
        max-width: 800px !important;
        padding: 0 2rem;
    }
}

/* Leaderboard table container with scrolling */
.leaderboard-table-container {
    max-height: calc(100vh - 400px);
    min-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .leaderboard-table-container {
        max-height: calc(100vh - 350px);
    }
}

/* Custom Scrollbar */
.leaderboard-table-container::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

html.dark .leaderboard-table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-table-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

html.dark .leaderboard-table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.leaderboard-table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

html.dark .leaderboard-table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Table styling */
.leaderboard-table {
    border-collapse: collapse;
}

.leaderboard-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f9fafb;
}

html.dark .leaderboard-table thead {
    background-color: #111827;
}

.leaderboard-table thead th {
    color: #6b7280;
}

html.dark .leaderboard-table thead th {
    color: #9ca3af;
}

.leaderboard-table tbody tr {
    transition: background-color 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background-color: rgba(251, 191, 36, 0.05);
}

html.dark .leaderboard-table tbody tr:hover {
    background-color: rgba(251, 191, 36, 0.1);
}

/* Table cell text colors */
.leaderboard-table tbody td {
    color: #1f2937;
}

html.dark .leaderboard-table tbody td {
    color: #ffffff !important;
}

/* Top 3 highlighting */
.leaderboard-table tbody tr.top-3 {
    background-color: rgba(251, 191, 36, 0.08);
    font-weight: 500;
}

html.dark .leaderboard-table tbody tr.top-3 {
    background-color: rgba(251, 191, 36, 0.12);
}

.leaderboard-table tbody tr.top-3 td {
    color: #1f2937;
}

html.dark .leaderboard-table tbody tr.top-3 td {
    color: #ffffff !important;
}

.leaderboard-table tbody tr.top-3 td:first-child {
    font-size: 18px;
    font-weight: 700;
}

/* Current user highlighting */
.leaderboard-table tbody tr.current-user {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 4px solid #3b82f6;
}

html.dark .leaderboard-table tbody tr.current-user {
    background-color: rgba(59, 130, 246, 0.15);
}

.leaderboard-table tbody tr.current-user td {
    color: #1f2937;
}

html.dark .leaderboard-table tbody tr.current-user td {
    color: #ffffff !important;
}

/* Current user badge */
.current-user-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #3b82f6;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading and error states */
#loading-state,
#error-state {
    min-height: 300px;
}

#loading-state span {
    color: #6b7280;
}

html.dark #loading-state span {
    color: #ffffff;
}

#error-state p {
    color: #6b7280;
}

html.dark #error-state p {
    color: #ffffff;
}

#retry-btn {
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

#retry-btn:hover {
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
    transform: translateY(-1px);
}

/* Mobile responsive table */
@media (max-width: 640px) {
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 8px;
        font-size: 14px;
    }

    .leaderboard-table tbody tr.top-3 td:first-child {
        font-size: 16px;
    }

    .current-user-badge {
        font-size: 9px;
        padding: 1px 6px;
    }
}

/* Ensure proper text alignment and spacing */
.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
    text-align: center;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
    text-align: center;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Footer text */
.bg-gray-50 p,
.dark\:bg-gray-900 p {
    color: #6b7280;
}

html.dark .bg-gray-50 p,
html.dark .dark\:bg-gray-900 p {
    color: #ffffff;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Smooth transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}
