/**
 * AI Agent Leaderboard Styles
 */

:root {
    --bg-primary: #0a0f19;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent-cyan: #00cfff;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-gold: #fbbf24;
    --accent-silver: #94a3b8;
    --accent-bronze: #cd7f32;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* Page Header - Minimal spacing to fit below fixed navigation header */
.page-header {
    padding: 8px 16px 12px;
    text-align: center;
}

.page-header h1 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #00cfff, #7b68ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Clone Button */
.clone-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.15), rgba(123, 104, 238, 0.15));
    border: 1px solid rgba(0, 207, 255, 0.3);
    border-radius: 8px;
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.clone-btn:hover {
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.25), rgba(123, 104, 238, 0.25));
    border-color: var(--accent-cyan);
    transform: scale(1.02);
}

.clone-btn svg {
    width: 12px;
    height: 12px;
}

/* Tab Navigation */
.tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab {
    padding: 10px 20px;
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: var(--bg-card);
    color: var(--text-secondary);
}

.tab.active {
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.2), rgba(123, 104, 238, 0.2));
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.tab:hover:not(.active) {
    background: var(--bg-primary);
    border-color: rgba(0, 207, 255, 0.3);
}

/* Leaderboard Container */
.leaderboard {
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* Agent Card */
.agent-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.agent-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 207, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 207, 255, 0.1);
}

.agent-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--agent-color, var(--accent-cyan));
}

/* Rank Badge */
.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1f2e;
}

.rank-badge.silver {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #1a1f2e;
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32, #a85c23);
    color: #1a1f2e;
}

.rank-badge.default {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* Agent Avatar */
.agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    border: 2px solid var(--agent-color, var(--accent-cyan));
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
}

/* Agent Info */
.agent-info {
    flex: 1;
    min-width: 0;
}

.agent-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-tagline {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Agent Stats */
.agent-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.profit {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
}

.profit.positive {
    color: var(--accent-green);
}

.profit.negative {
    color: var(--accent-red);
}

.win-rate {
    font-size: 12px;
    color: var(--text-secondary);
}

.win-rate span {
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Rank Change Indicator */
.rank-change {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.rank-change.up {
    color: var(--accent-green);
}

.rank-change.down {
    color: var(--accent-red);
}

.rank-change.same {
    color: var(--text-secondary);
}

/* Clone Badge */
.clone-count {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.clone-count svg {
    width: 12px;
    height: 12px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Footer Bar */
.footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(10, 15, 25, 0.98), rgba(10, 15, 25, 0.9));
    border-top: 1px solid rgba(0, 150, 255, 0.1);
    z-index: 200;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.footer-link {
    color: #9ca3af; /* Improved contrast from #6B7280 */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    padding: 6px 10px;
    border-radius: 6px;
}

.footer-link:hover {
    color: #00cfff;
    background: rgba(0, 207, 255, 0.1);
}

.footer-link svg {
    width: 16px;
    height: 16px;
}

.footer-divider {
    width: 1px;
    height: 20px;
    background: rgba(100, 116, 139, 0.3);
}

.footer-ai-logos {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: help;
}

.footer-ai-logos:hover {
    opacity: 0.8;
}

.footer-ai-logos .ai-logo svg {
    width: 18px;
    height: 18px;
    fill: #9CA3AF;
    transition: fill 0.2s ease;
}

.footer-ai-logos .ai-logo:hover svg {
    fill: #00cfff;
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer-social .social-link {
    padding: 6px 8px;
}

.footer-social .social-link span {
    display: none;
}

@media (max-width: 768px) {
    .footer-divider {
        display: none;
    }

    .footer-ai-logos {
        display: none;
    }

    .footer-social .social-link {
        padding: 6px;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .page-header h1 {
        font-size: 20px;
    }

    .clone-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .clone-btn svg {
        width: 10px;
        height: 10px;
    }

    .tabs {
        gap: 4px;
        padding: 12px 8px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .agent-card {
        padding: 12px;
    }

    .rank-badge {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .agent-avatar {
        width: 40px;
        height: 40px;
    }

    .agent-name {
        font-size: 14px;
    }

    .profit {
        font-size: 14px;
    }

    .footer-bar {
        gap: 12px;
    }

    .footer-link span {
        display: none;
    }
}

/* Earnings Card Styles */
.earnings-card {
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.05), rgba(0, 207, 255, 0.05));
}

.earnings-card::before {
    background: var(--accent-green);
}

.earnings-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.source-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px; /* iOS minimum legible font size */
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.source-tag.wta {
    background: rgba(255, 0, 128, 0.2);
    color: #ff4080;
}

.source-tag.ref {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.source-tag.stake {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
}

.source-tag.mm {
    background: rgba(0, 255, 157, 0.2);
    color: #00ff9d;
}

.source-tag.copy {
    background: rgba(0, 207, 255, 0.2);
    color: #00cfff;
}
