/**
 * GeneralsX Online Statistics & Intel Stylesheet
 * Tactical Dark Sci-Fi Command Center Aesthetic
 */

:root {
    --stats-bg: #07090e;
    --stats-card-bg: rgba(13, 17, 26, 0.92);
    --stats-card-border: rgba(255, 170, 0, 0.2);
    --stats-card-border-glow: rgba(255, 170, 0, 0.45);
    --primary-gold: #ffaa00;
    --gold-glow: rgba(255, 170, 0, 0.35);
    --cyan-accent: #00d4ff;
    --cyan-glow: rgba(0, 212, 255, 0.3);
    --green-victory: #2ecc71;
    --green-glow: rgba(46, 204, 113, 0.3);
    --red-defeat: #e74c3c;
    --text-white: #ffffff;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --table-header: rgba(19, 26, 38, 0.95);
    --table-row-even: rgba(15, 21, 31, 0.6);
    --table-row-hover: rgba(255, 170, 0, 0.08);
    --usa-blue: #3b82f6;
    --china-red: #ef4444;
    --gla-green: #10b981;
}

body.stats-body {
    background-color: var(--stats-bg);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: block;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Background overlay */
.stats-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 50% 10%, rgba(255, 170, 0, 0.05) 0%, transparent 60%),
        linear-gradient(180deg, rgba(7, 9, 14, 0.85) 0%, rgba(7, 9, 14, 0.98) 100%),
        url('/assets/images/splash2.png') center center / cover no-repeat;
    z-index: -1;
    filter: blur(3px);
}

.stats-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 60px 20px;
}

/* Header & Top Bar */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 170, 0, 0.15);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.stats-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.stats-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.stats-brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.stats-brand-title span {
    color: var(--primary-gold);
}

.stats-brand-sub {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    color: var(--cyan-accent);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 2px;
}

.stats-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-stats-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 170, 0, 0.08);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: 8px;
    color: var(--primary-gold);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-stats-link:hover {
    background: rgba(255, 170, 0, 0.18);
    border-color: var(--primary-gold);
    box-shadow: 0 0 14px var(--gold-glow);
    color: #fff;
}

/* Nav Tabs */
.stats-nav-tabs {
    display: flex;
    gap: 8px;
    background: rgba(13, 17, 26, 0.6);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 28px;
    overflow-x: auto;
}

.stats-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.stats-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.stats-tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.2) 0%, rgba(255, 170, 0, 0.08) 100%);
    border: 1px solid rgba(255, 170, 0, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stats-tab-btn.active svg {
    color: var(--primary-gold);
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--stats-card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--stats-card-border);
    border-radius: 14px;
    padding: 22px 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--stats-card-border-glow);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 20px var(--gold-glow);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-gold), transparent);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 170, 0, 0.1);
    color: var(--primary-gold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.kpi-desc {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Two-column layout */
.stats-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .stats-columns {
        grid-template-columns: 1fr;
    }
}

.stats-panel {
    background: var(--stats-card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.stats-panel > .panel-title {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-header .panel-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.panel-title span {
    color: var(--primary-gold);
}

.panel-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-gold);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.panel-action:hover {
    color: #ffc83b;
    text-decoration: none;
    transform: translateX(3px);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 14, 22, 0.6);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.stats-table th {
    background: var(--table-header);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.stats-table th a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stats-table th a:hover {
    color: var(--primary-gold);
}

.stats-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.stats-table tbody tr {
    transition: background 0.15s ease;
}

.stats-table tbody tr:nth-child(even) {
    background: var(--table-row-even);
}

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

.stats-table tbody tr:hover {
    background: var(--table-row-hover);
}

/* Rank Badges (#1 Gold, #2 Silver, #3 Bronze) */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #b8860b 100%);
    color: #000;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
}

.rank-2 {
    background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
    color: #000;
    box-shadow: 0 0 10px rgba(200, 200, 200, 0.35);
}

.rank-3 {
    background: linear-gradient(135deg, #d97706 0%, #78350f 100%);
    color: #fff;
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.35);
}

/* Commander Badge / Avatar */
.commander-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.commander-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.3) 0%, rgba(13, 17, 26, 0.9) 100%);
    border: 1px solid rgba(255, 170, 0, 0.3);
    color: var(--primary-gold);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.commander-name {
    font-weight: 700;
    color: #fff;
}

.commander-tag {
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 6px currentColor;
}

.status-inactive {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #94a3b8;
}

.status-banned {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #e74c3c;
}

/* ELO Badges */
.elo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 170, 0, 0.12);
    border: 1px solid rgba(255, 170, 0, 0.35);
    color: var(--primary-gold);
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Faction Badges */
.faction-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-usa {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

.badge-china {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.badge-gla {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.badge-random, .badge-boss, .badge-unknown {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #c084fc;
}

/* Winner Pill */
.winner-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.25) 0%, rgba(46, 204, 113, 0.1) 100%);
    border: 1px solid rgba(46, 204, 113, 0.6);
    color: #4ade80;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.2);
}

.defeated-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Battle Card */
.battle-card {
    background: var(--stats-card-bg);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.25s ease;
}

.battle-card:hover {
    border-color: rgba(255, 170, 0, 0.35);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 170, 0, 0.1);
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.battle-meta-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.battle-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
}

.battle-name {
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
}

.battle-map-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--cyan-accent);
    font-size: 0.8rem;
    font-weight: 700;
}

.battle-roster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.player-slot-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-slot-card.winner {
    background: rgba(46, 204, 113, 0.06);
    border-color: rgba(46, 204, 113, 0.35);
}

.player-info-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slot-player-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.92rem;
}

.telemetry-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
    font-size: 0.78rem;
    color: var(--text-dim);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.telemetry-item b {
    color: var(--text-main);
}

/* Search & Filters Bar */
.filter-bar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 420px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: rgba(13, 17, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.search-input-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    width: 16px;
    height: 16px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 14px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.pagination-buttons {
    display: flex;
    gap: 6px;
}

.btn-page {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-page:hover {
    color: #fff;
    border-color: var(--primary-gold);
    background: rgba(255, 170, 0, 0.1);
}

.btn-page.active {
    background: var(--primary-gold);
    color: #07090e;
    border-color: var(--primary-gold);
    font-weight: 700;
}

.btn-page.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Top maps progress bar list */
.map-stat-row {
    margin-bottom: 14px;
}

.map-stat-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.map-stat-name {
    font-weight: 700;
    color: #fff;
}

.map-stat-count {
    color: var(--primary-gold);
    font-weight: 700;
}

.progress-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-accent) 0%, var(--primary-gold) 100%);
    border-radius: 3px;
}

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

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    color: var(--text-dim);
    opacity: 0.6;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Replay Download Button */
.btn-download-replay {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.22) 0%, rgba(255, 170, 0, 0.08) 100%);
    border: 1px solid rgba(255, 170, 0, 0.65);
    border-radius: 6px;
    color: var(--primary-gold);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.15);
}

.btn-download-replay:hover {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.4) 0%, rgba(255, 170, 0, 0.2) 100%);
    border-color: #ffc400;
    color: #fff;
    box-shadow: 0 0 16px rgba(255, 170, 0, 0.4);
    transform: translateY(-1px);
}

/* Alert Banner */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 600;
}

.alert-banner.warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.alert-banner.warning i {
    font-size: 1.1rem;
    color: #f59e0b;
}

