/* Education Leaderboard Frontend Styles */

.edu-leaderboard {
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.leaderboard-title {
    text-align: center;
    margin: 0 0 30px 0;
    padding: 30px 20px 0;
    color: #1f2937;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 80px 1fr 100px;
    gap: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 80px 80px 1fr 100px;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
}

.leaderboard-entry:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leaderboard-entry:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.leaderboard-entry:nth-child(even) {
    background: #f9fafb;
}

.leaderboard-entry:nth-child(even):hover {
    background: #f1f5f9;
}

/* First place special styling */
.leaderboard-entry:first-child {
    background: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
    border-bottom: 2px solid #f59e0b;
}

.leaderboard-entry:first-child:hover {
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    transform: translateY(-2px);
}

/* Rank Column */
.rank-col {
    font-weight: 700;
    text-align: center;
    font-size: 1.25rem;
    color: #374151;
}

.leaderboard-entry:first-child .rank-col {
    color: #92400e;
    font-size: 1.5rem;
}

/* Photo Column */
.photo-col {
    text-align: center;
}

.entry-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.entry-photo:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.leaderboard-entry:first-child .entry-photo {
    border-color: #f59e0b;
    width: 70px;
    height: 70px;
}

.entry-photo-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto;
    color: #9ca3af;
    border: 3px solid #e5e7eb;
    transition: all 0.3s ease;
}

.leaderboard-entry:first-child .entry-photo-placeholder {
    width: 70px;
    height: 70px;
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    color: #92400e;
}

/* Name Column */
.name-col {
    font-weight: 600;
    line-height: 1.4;
    color: #374151;
    font-size: 1.1rem;
}

.leaderboard-entry:first-child .name-col {
    color: #92400e;
    font-size: 1.2rem;
}

/* Score Column */
.score-col {
    text-align: right;
    font-weight: 700;
    font-size: 1.5rem;
    color: #3b82f6;
    font-variant-numeric: tabular-nums;
}

.leaderboard-entry:first-child .score-col {
    color: #92400e;
    font-size: 1.75rem;
}

/* No entries message */
.no-entries {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 1.1rem;
    font-style: italic;
}

/* Medal animations */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0,-10px,0);
    }
    70% {
        transform: translate3d(0,-5px,0);
    }
    90% {
        transform: translate3d(0,-2px,0);
    }
}

.rank-col:hover {
    animation: bounce 1s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .edu-leaderboard {
        margin: 10px;
        border-radius: 8px;
    }
    
    .leaderboard-title {
        font-size: 1.875rem;
        padding: 20px 15px 0;
        margin-bottom: 20px;
    }
    
    .leaderboard-header,
    .leaderboard-entry {
        grid-template-columns: 60px 60px 1fr 80px;
        gap: 10px;
        padding: 15px;
    }
    
    .entry-photo,
    .entry-photo-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .leaderboard-entry:first-child .entry-photo,
    .leaderboard-entry:first-child .entry-photo-placeholder {
        width: 55px;
        height: 55px;
    }
    
    .name-col {
        font-size: 1rem;
    }
    
    .leaderboard-entry:first-child .name-col {
        font-size: 1.1rem;
    }
    
    .score-col {
        font-size: 1.25rem;
    }
    
    .leaderboard-entry:first-child .score-col {
        font-size: 1.5rem;
    }
    
    .rank-col {
        font-size: 1.1rem;
    }
    
    .leaderboard-entry:first-child .rank-col {
        font-size: 1.25rem;
    }
    
    .leaderboard-header {
        font-size: 0.875rem;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .edu-leaderboard {
        margin: 5px;
        border-radius: 6px;
    }
    
    .leaderboard-title {
        font-size: 1.5rem;
        padding: 15px 10px 0;
        margin-bottom: 15px;
    }
    
    .leaderboard-header,
    .leaderboard-entry {
        grid-template-columns: 50px 50px 1fr 70px;
        gap: 8px;
        padding: 12px;
    }
    
    .entry-photo,
    .entry-photo-placeholder {
        width: 40px;
        height: 40px;
    }
    
    .leaderboard-entry:first-child .entry-photo,
    .leaderboard-entry:first-child .entry-photo-placeholder {
        width: 45px;
        height: 45px;
    }
    
    .name-col {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .leaderboard-entry:first-child .name-col {
        font-size: 1rem;
    }
    
    .score-col {
        font-size: 1.1rem;
    }
    
    .leaderboard-entry:first-child .score-col {
        font-size: 1.25rem;
    }
    
    .rank-col {
        font-size: 1rem;
    }
    
    .leaderboard-entry:first-child .rank-col {
        font-size: 1.1rem;
    }
    
    .leaderboard-header {
        font-size: 0.8rem;
        padding: 12px;
        letter-spacing: 0.25px;
    }
    
    .no-entries {
        padding: 40px 15px;
        font-size: 1rem;
    }
}

/* Animation for new entries */
@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.leaderboard-entry.new-entry {
    animation: slideInFromTop 0.6s ease-out;
}

/* Loading state */
.edu-leaderboard.loading {
    opacity: 0.7;
    pointer-events: none;
}

.edu-leaderboard.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .edu-leaderboard {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .leaderboard-title {
        color: #f9fafb;
    }
    
    .leaderboard-entry {
        background: #1f2937;
        border-bottom-color: #374151;
        color: #f9fafb;
    }
    
    .leaderboard-entry:hover {
        background: #374151;
    }
    
    .leaderboard-entry:nth-child(even) {
        background: #111827;
    }
    
    .leaderboard-entry:nth-child(even):hover {
        background: #374151;
    }
    
    .rank-col,
    .name-col {
        color: #f9fafb;
    }
    
    .score-col {
        color: #60a5fa;
    }
    
    .no-entries {
        color: #9ca3af;
    }
    
    .entry-photo-placeholder {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        border-color: #4b5563;
        color: #9ca3af;
    }
    
    .entry-photo {
        border-color: #4b5563;
    }
}

/* Print styles */
@media print {
    .edu-leaderboard {
        box-shadow: none;
        border: 1px solid #000;
        margin: 0;
        max-width: 100%;
    }
    
    .leaderboard-header {
        background: #000 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .leaderboard-entry:hover {
        transform: none;
        box-shadow: none;
    }
    
    .entry-photo:hover {
        transform: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .edu-leaderboard {
        border: 2px solid #000;
    }
    
    .leaderboard-header {
        background: #000 !important;
        color: #fff !important;
    }
    
    .leaderboard-entry {
        border-bottom: 2px solid #000;
    }
    
    .entry-photo,
    .entry-photo-placeholder {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .leaderboard-entry,
    .entry-photo,
    .entry-photo-placeholder {
        transition: none;
    }
    
    .leaderboard-entry:hover {
        transform: none;
    }
    
    .entry-photo:hover {
        transform: none;
    }
    
    .rank-col:hover {
        animation: none;
    }
    
    .leaderboard-entry.new-entry {
        animation: none;
    }
}