/**
 * FlyMacroPilot - Stats Page Styles
 * Player Statistics Dashboard
 * 
 * © 2026 ScrewCap, LLC
 */

/* Stats Page Layout */
.stats-page {
    min-height: 100vh;
}

/* Overview Cards */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-medium));
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(100, 120, 160, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.15);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-secondary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Badge Filters */
.badge-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    background: var(--bg-medium);
    border: 1px solid rgba(100, 120, 160, 0.3);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--bg-light);
    border-color: var(--accent-secondary);
}

.filter-btn.active {
    background: var(--accent-secondary);
    color: var(--bg-dark);
    border-color: var(--accent-secondary);
    font-weight: 600;
}

/* Badge Collection Grid */
.badge-collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.badge-item {
    background: var(--bg-medium);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.badge-item:hover {
    transform: scale(1.05);
    z-index: 10;
}

.badge-item.earned {
    border-color: var(--accent-secondary);
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), var(--bg-medium));
}

.badge-item.locked {
    opacity: 0.5;
    filter: grayscale(80%);
}

.badge-item.locked:hover {
    opacity: 0.8;
    filter: grayscale(50%);
}

/* Badge Rarity Colors */
.badge-item.rarity-legendary {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.badge-item.rarity-legendary.locked {
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: none;
}

.badge-item.rarity-epic {
    border-color: #a855f7;
}

.badge-item.rarity-rare {
    border-color: #3b82f6;
}

.badge-item.rarity-uncommon {
    border-color: #22c55e;
}

.badge-item.rarity-shameful {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), var(--bg-medium));
}

.badge-item.rarity-common {
    border-color: #6b7280;
}

.badge-icon-large {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.badge-icon-large img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
}

.badge-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.badge-description {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.badge-rarity-tag {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    font-weight: 700;
}

.badge-rarity-tag.legendary { background: #ffd700; color: #000; }
.badge-rarity-tag.epic { background: #a855f7; color: #fff; }
.badge-rarity-tag.rare { background: #3b82f6; color: #fff; }
.badge-rarity-tag.uncommon { background: #22c55e; color: #fff; }
.badge-rarity-tag.shameful { background: #ef4444; color: #fff; }
.badge-rarity-tag.common { background: #6b7280; color: #fff; }

.badge-lock-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0.7;
}

/* Badge Progress Bar */
.badge-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 12px;
    background: var(--bg-dark);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(100, 120, 160, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Scenario Tabs */
.scenario-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(100, 120, 160, 0.2);
    padding-bottom: 1rem;
}

.scenario-tab {
    background: transparent;
    border: 1px solid rgba(100, 120, 160, 0.3);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.scenario-tab:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.scenario-tab.active {
    background: var(--accent-secondary);
    color: var(--bg-dark);
    border-color: var(--accent-secondary);
    font-weight: 600;
}

/* Leaderboard Table */
.leaderboard-container {
    background: var(--bg-medium);
    border-radius: 0.75rem;
    padding: 1rem;
    min-height: 200px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(100, 120, 160, 0.2);
}

.leaderboard-table th {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-table tr:hover {
    background: rgba(0, 255, 136, 0.05);
}

.leaderboard-table .rank-1 { color: #ffd700; }
.leaderboard-table .rank-2 { color: #c0c0c0; }
.leaderboard-table .rank-3 { color: #cd7f32; }

.grade-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.grade-badge.grade-a { background: #22c55e; color: #fff; }
.grade-badge.grade-b { background: #3b82f6; color: #fff; }
.grade-badge.grade-c { background: #eab308; color: #000; }
.grade-badge.grade-d { background: #f97316; color: #fff; }
.grade-badge.grade-f { background: #ef4444; color: #fff; }

.no-scores {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Activity Feed */
.activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(100, 120, 160, 0.15);
    transition: background 0.2s ease;
}

.activity-item:hover {
    background: rgba(0, 255, 136, 0.05);
}

.activity-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.activity-details {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
}

.activity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.no-activity {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Stats Actions */
.stats-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.btn-danger {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
}

.btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

/* Reset Confirmation Modal */
.reset-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.reset-modal.active {
    opacity: 1;
    visibility: visible;
}

.reset-modal-content {
    background: var(--bg-light);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}

.reset-modal h3 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.reset-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .badge-collection {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    
    .badge-icon-large {
        font-size: 2rem;
    }
    
    .badge-icon-large img {
        width: 48px;
        height: 48px;
    }
    
    .scenario-tabs {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-overview {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .badge-filters {
        justify-content: center;
    }
}
