/* ==========================================
   SWS League 2025 - Leaderboard Styles
   ========================================== */

/* ---- Top 3 podium rows ---- */
.rank-1 {
    border-left: 3px solid #fbbf24;
    background: rgba(251, 191, 36, 0.05);
}

.rank-2 {
    border-left: 3px solid #94a3b8;
    background: rgba(148, 163, 184, 0.05);
}

.rank-3 {
    border-left: 3px solid #d97706;
    background: rgba(217, 119, 6, 0.05);
}

/* ---- Rank number colors ---- */
.rank-num-1 {
    color: #fbbf24;
    font-weight: 800;
}

.rank-num-2 {
    color: #94a3b8;
    font-weight: 800;
}

.rank-num-3 {
    color: #d97706;
    font-weight: 800;
}

/* ---- Sticky columns for mobile horizontal scroll ---- */
.sticky-col {
    position: sticky;
    z-index: 10;
    background: inherit;
}

.sticky-rank {
    left: 0;
    min-width: 2.5rem;
}

.sticky-team {
    left: 2.5rem;
    min-width: 8rem;
}

/* Ensure sticky cells get the correct background */
thead .sticky-col {
    background: #111827;
}

tbody tr .sticky-col {
    background: #1f2937;
}

tbody tr.rank-1 .sticky-col {
    background: #1f2937;
    background: linear-gradient(to right, rgba(251, 191, 36, 0.05), #1f2937);
}

tbody tr.rank-2 .sticky-col {
    background: #1f2937;
    background: linear-gradient(to right, rgba(148, 163, 184, 0.05), #1f2937);
}

tbody tr.rank-3 .sticky-col {
    background: #1f2937;
    background: linear-gradient(to right, rgba(217, 119, 6, 0.05), #1f2937);
}

tbody tr:hover .sticky-col {
    background: rgba(255, 255, 255, 0.03);
}

/* ---- Table row hover ---- */
.team-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.team-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ---- Category tabs ---- */
.tab-btn {
    color: #9ca3af;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: #d1d5db;
}

.tab-btn.active {
    color: #ffffff;
    border-bottom-color: #ef4444;
}

/* ---- Modal transitions ---- */
.modal-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-content {
    transition: transform 0.2s ease;
    transform: translateY(100%);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* On desktop, modal slides up from slight offset */
@media (min-width: 640px) {
    .modal-content {
        transform: translateY(2rem);
    }
    .modal-overlay.active .modal-content {
        transform: translateY(0);
    }
}

/* ---- Skeleton shimmer (loading state) ---- */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.25rem;
}

/* ---- Refresh spin animation ---- */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.refresh-spinning {
    animation: spin 0.8s linear infinite;
}

/* ---- Custom scrollbar for dark theme ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #111827;
}

::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #374151 #111827;
}

/* ---- Leaderboard table base styles ---- */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

.leaderboard-table thead th {
    padding: 0.75rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
    white-space: nowrap;
}

.leaderboard-table thead th.text-center {
    text-align: center;
}

.leaderboard-table tbody td {
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    vertical-align: middle;
}

.leaderboard-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Score cell styling ---- */
.score-cell {
    text-align: center;
    white-space: nowrap;
}

.score-value {
    font-weight: 500;
    color: #f9fafb;
    line-height: 1.2;
}

.score-points {
    font-size: 0.6875rem;
    color: #6b7280;
    line-height: 1.2;
}

.score-points-gold {
    color: #fbbf24;
    font-weight: 700;
}

.score-points-silver {
    color: #94a3b8;
    font-weight: 600;
}

.score-missing {
    color: #374151;
    font-weight: 500;
}

/* ---- Total column ---- */
.total-cell {
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    color: #f9fafb;
}

/* ---- Category badge ---- */
.category-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
}

.category-badge.fitness {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.category-badge.intermediate {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.category-badge.advanced {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ---- Modal detail table ---- */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.detail-table thead th {
    padding: 0.5rem 0.625rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
}

.detail-table tbody td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    color: #d1d5db;
}

.detail-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Error state ---- */
.error-message {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.error-message .error-title {
    font-weight: 600;
    font-size: 1rem;
    color: #f87171;
    margin-bottom: 0.5rem;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

/* ---- WO (walkover) styling ---- */
.rank-wo {
    color: #6b7280;
    font-weight: 700;
    font-style: italic;
}

.rank-wo-row {
    opacity: 0.6;
}

.rank-wo-row:hover {
    opacity: 0.8;
}

.score-wo {
    color: #6b7280;
    font-weight: 600;
    font-style: italic;
}
