/* Stats Cards */
.stats-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stats-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin: 0.5rem 0;
}

.stats-card .stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Player Cards */
.player-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.player-card .card-body {
    padding: 1.5rem;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: -40px auto 1rem;
    border: 3px solid var(--bs-primary);
    background: #1a1e23;
    position: relative;
    overflow: hidden;
}

.player-role {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    margin-bottom: var(--space-sm);
}

/* Chart Styles */
.chart-wrapper {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 0.375rem;
    padding: 1rem;
}

.chart-title {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.vis-block {
    transition: all 0.2s ease;
}

.vis-block.is-active {
    border-color: var(--bs-primary);
}

.selected-metric-badge {
    display: inline-flex;
    align-items: center;
    margin: 0.25rem;
    padding: 0.25rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.375rem;
}

.selected-metric-badge .badge {
    margin-right: 0.5rem;
}

.chart-type-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: rgba(226, 232, 240, 0.8) !important;
    transition: all 0.2s ease !important;
    margin: 0 2px !important;
}

.chart-type-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: rgba(226, 232, 240, 0.95) !important;
    transform: translateY(-1px);
}

.chart-type-btn.active {
    background: linear-gradient(135deg, rgba(255, 159, 28, 0.9), rgba(255, 159, 28, 0.7)) !important;
    border-color: rgba(255, 159, 28, 0.5) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(255, 159, 28, 0.3) !important;
}

.chart-type-btn i {
    font-size: 0.9rem !important;
}

/* Stats Section */
.team-stats-section-modern {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
}

.stats-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    max-width: 400px;
}

.stat-card-modern {
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card-modern:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-card-modern:hover::before {
    opacity: 1;
}

.stat-icon-modern {
    width: 24px;
    height: 24px;
    margin: 0 auto 0.4rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.stat-card-modern.winrate .stat-icon-modern {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.stat-card-modern.members .stat-icon-modern {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.stat-number-modern {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.15rem;
    line-height: 1;
}

.stat-label-modern {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Performance Stats Grid */
.performance-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.performance-stat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.performance-stat:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.performance-stat .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.performance-stat.wins .stat-icon {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.performance-stat.losses .stat-icon {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
    color: white;
}

.performance-stat.draws .stat-icon {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
}

.performance-stat .stat-content h3 {
    margin: 0 0 0.5rem;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}

.performance-stat .stat-content p {
    margin: 0;
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Win Rate Display */
.overall-winrate,
.recent-winrate {
    text-align: center;
    margin-top: 1rem;
}

.winrate-display {
    display: inline-block;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid;
    transition: all 0.3s ease;
}

.winrate-display.excellent {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.winrate-display.good {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.winrate-display.needs-improvement {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.winrate-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.winrate-label {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

/* Recent Matches Visual */
.recent-matches-visual {
    margin-top: 1.5rem;
}

.matches-label {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.matches-badges {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.match-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    transition: all 0.2s ease;
}

.match-badge.win {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.match-badge.loss {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
}

.match-badge:hover {
    transform: scale(1.1);
}

/* Modern Recent Matches Visual */
.recent-matches-visual-modern {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.matches-label-modern {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-weight: 500;
    text-align: center;
}

.matches-badges-modern {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.matches-badges-modern .match-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.matches-badges-modern .match-badge.win {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.matches-badges-modern .match-badge.loss {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.matches-badges-modern .match-badge.draw {
    background: linear-gradient(135deg, #eab308, #ca8a04);
}

.matches-badges-modern .match-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Performance Badge */
.performance-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    text-align: center;
}

.performance-badge.excellent {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.performance-badge.good {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.performance-badge.needs-improvement {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
}

/* Enhanced Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card-modern {
    background: rgba(30, 30, 30, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff9f1c, #ffb347);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card-modern:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 159, 28, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-card-modern:hover::before {
    opacity: 1;
}

.stat-card-modern .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-card-modern.personnel .stat-icon {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.stat-card-modern.matches .stat-icon {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.stat-card-modern.performance .stat-icon {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.stat-card-modern.strategies .stat-icon {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.stat-card-modern.vods .stat-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.stat-card-modern .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card-modern .stat-label {
    font-size: 1rem;
    color: #fff;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-card-modern .stat-sublabel {
    font-size: 0.875rem;
    color: #6c757d;
}

.stat-card-modern .stat-action {
    flex-shrink: 0;
}

.stat-card-modern .stat-action .btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(255, 159, 28, 0.1);
    border-color: rgba(255, 159, 28, 0.3);
    color: #ff9f1c;
    transition: all 0.3s ease;
}

.stat-card-modern .stat-action .btn:hover {
    background: rgba(255, 159, 28, 0.2);
    border-color: #ff9f1c;
    transform: scale(1.1);
}

/* Stats Panel */
#statsPanel .card-header {
    background: linear-gradient(135deg, rgba(46, 196, 182, 0.1), rgba(255, 159, 28, 0.1));
    border-bottom: 1px solid var(--border-color);
}

#teamStats .row .col-6 {
    text-align: center;
    padding: 16px 8px;
}

#teamStats h4 {
    font-weight: 700;
    margin-bottom: 4px;
}

#teamStats .text-primary {
    color: var(--accent-primary) !important;
}

#teamStats .text-success {
    color: var(--accent-secondary) !important;
}

#teamStats .text-danger {
    color: #dc3545 !important;
}

/* Stats page filter widths - make them longer */
#statsFilterRow #statsMatchTypeFilter {
    min-width: 130px !important;
    width: auto !important;
}

#statsFilterRow .faceit-season-filter-buttons {
    min-width: 180px !important;
    width: auto !important;
}

#statsFilterRow #statsDateFilter {
    min-width: 150px !important;
    width: auto !important;
}

/* Compact filter columns - auto width based on content + 10px padding */
#statsFilterRow .col-auto {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Make labels inline with filters for compact layout */
#statsFilterRow .form-label {
    display: block;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

/* Compact filter inputs - only as wide as content + 10px */
.compact-filter {
    width: auto !important;
    min-width: -webkit-fill-available;

    padding-left: 0.5rem;
    padding-right: 0.5rem;
    display: inline-block;
}

.faceit-season-filter .form-check-input {
    width: 1.1em;
    height: 1.1em;
    margin: 0;
    cursor: pointer;
    background-color: var(--bg-glass-card);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.25rem;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.faceit-season-filter .form-check-input:hover {
    border-color: rgba(255, 159, 28, 0.5);
    background-color: var(--bg-glass-card);
}

.faceit-season-filter .form-check-input:checked {
    background-color: rgba(255, 159, 28, 0.9);
    border-color: rgba(255, 159, 28, 1);
    box-shadow: 0 0 0 2px rgba(255, 159, 28, 0.2);
}

/* Match form-select-sm sizing for stats page */
#statsFilterRow .faceit-season-filter,
#statsFilterRow .start-date-filter {
    min-height: calc(1.5em + 0.5rem + 2px);
    height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
}

.start-date-filter .form-control-sm,
.start-date-filter input[type="date"].form-control-sm {
    height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Ensure proper alignment in filter rows */
.row.align-items-end .faceit-season-filter,
.row.align-items-end .start-date-filter {
    display: flex;
    align-items: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .stat-card-modern {
        padding: 0.6rem;
    }

    .performance-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .performance-stat {
        padding: 1rem;
    }

    .performance-stat .stat-content h3 {
        font-size: 1.5rem;
    }

    .matches-badges {
        gap: 0.25rem;
    }

    .match-badge {
        width: 28px;
        height: 28px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card-modern .stat-number {
        font-size: 1.5rem;
    }
}

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

    .stat-card-modern {
        padding: 0.5rem;
    }

    .stat-icon-modern {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
}

/* --- DEEP STATS & PREMIUM GLASSMORPHISM V2 --- */

/* AI Summary Card Glow Effects */
.ai-summary-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.ai-summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(13, 110, 253, 0.25) !important;
    border-color: rgba(13, 110, 253, 0.6) !important;
}

.ai-summary-list li {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.ai-summary-list li:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.ai-summary-list li:nth-child(1) {
    border-left-color: #2ecc71;
}

.ai-summary-list li:nth-child(2) {
    border-left-color: #e74c3c;
}

.ai-summary-list li:nth-child(3) {
    border-left-color: #f1c40f;
}

/* Enhanced Vis Block (Performance Board) */
.performance-board__main {
    background: transparent;
}

.vis-block {
    background: rgba(16, 22, 34, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.vis-block__header {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.vis-block__body {
    padding: 1.5rem;
}

.vis-block.is-active {
    border: 1px solid rgba(13, 110, 253, 0.5);
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Modern Chart Wrapper Glassmorphism */
.modern-chart-wrapper {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modern-chart-wrapper:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.chart-title {
    color: #f8f9fa;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Value specific highlights */
.chart-value-highest {
    color: #2ecc71;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
}

.chart-value-lowest {
    color: #e74c3c;
    text-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
}

.chart-label-item {
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin: 4px;
    display: inline-block;
}

/* Summary Cards (Overview) Neon */
.pc-summary-card {
    background: linear-gradient(145deg, rgba(30, 35, 45, 0.8), rgba(20, 25, 30, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pc-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.pc-summary-card strong {
    font-size: 1.8rem;
    display: block;
    margin-top: 5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.pc-summary-card span {
    font-size: 0.8rem;
    color: #adb5bd;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =========================================
   STATS.JS OVERHAUL CUSTOM STYLES
   ========================================= */

/* Contextual Insights */
.insights-card {
    position: relative;
    overflow: hidden;
}
.insights-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0d6efd, #0dcaf0, #2ecc71);
}
.ai-summary-list li {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid #6c757d; /* dynamic border set inline */
    padding: 12px 16px;
    border-radius: 4px 8px 8px 4px;
    margin-bottom: 12px !important;
    transition: background 0.2s ease;
}
.ai-summary-list li:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Win Rate by Map - Visual Data Table */
.map-data-table-container {
    max-height: 420px;
    overflow-y: auto;
    border-radius: 8px;
    background: #1a1e26;
    border: 1px solid #2a313e;
}
.map-data-table {
    width: 100%;
    color: #e2e8f0;
    table-layout: fixed;
}
.map-data-table th {
    background: #202632;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #2a313e;
    position: sticky;
    top: 0;
    z-index: 10;
}
.map-data-table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    background: transparent;
}
.map-data-table tr:hover td {
    background: rgba(255,255,255,0.02);
}
.map-micro-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255,255,255,0.1);
}
.map-name-text {
    font-weight: 600;
    font-size: 0.95rem;
}
.mode-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
}
.winrate-cell {
    position: relative;
    z-index: 1;
}
.wr-progress-bg {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 16px;
    border-radius: 4px;
    z-index: -1;
}
.wr-text {
    position: relative;
    z-index: 2;
    padding-left: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Overall Win Rate Chart Header & Controls */
.winrate-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.winrate-chart-controls {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
}
.time-range-controls {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}
.time-range-controls button {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.time-range-controls button:hover {
    color: #fff;
}
.time-range-controls button.active {
    background: #389e94;
    color: #fff;
    box-shadow: 0 0 10px rgba(16, 97, 97, 0.774);
}

/* Custom Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Hero Chart Scroll */
.hero-bar-chart-scroll {
    width: 100%;
}


/* =========================================
   STATS.JS D3 DASHBOARD & GRID
   ========================================= */

.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.stats-widget {
    background: linear-gradient(135deg, rgba(20, 25, 30, 0.7), rgba(15, 20, 25, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.stats-widget--full {
    grid-column: 1 / -1;
}

.stats-widget__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.stats-widget__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
    display: flex;
    align-items: center;
}

.stats-widget__title i {
    color: #2ec4b6;
    margin-right: 0.75rem;
}

.stats-widget__body {
    flex-grow: 1;
    position: relative;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center; /* Center SVG */
}

/* D3 Tooltip Styles */
.d3-tooltip {
    position: absolute;
    text-align: left;
    padding: 12px;
    font: 13px 'Inter', sans-serif;
    background: rgba(15, 20, 30, 0.95);
    color: #e2e8f0;
    border: 1px solid rgba(13, 110, 253, 0.5);
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 1000;
}

.d3-tooltip strong {
    color: #f8f9fa;
    display: block;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* D3 Area Chart */
.d3-axis path,
.d3-axis line {
    stroke: rgba(255, 255, 255, 0.1);
}

.d3-axis text {
    fill: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
}

.d3-area-gradient {
    fill: url(#area-gradient);
}

.d3-line {
    fill: none;
    stroke: #2ecc71;
    stroke-width: 3px;
}

.d3-line-loss {
    stroke: #e74c3c;
}

.d3-line-ma {
    fill: none;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2px;
    stroke-dasharray: 4,4;
}

/* D3 Hero Bars */
.d3-bar {
    rx: 4;
    ry: 4;
}

.d3-bar-text {
    fill: #fff;
    font-weight: 600;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
}

.d3-donut-text-center {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 32px;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: central;
}
.d3-donut-text-sub {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 12px;
    fill: #94a3b8;
    text-anchor: middle;
    dominant-baseline: text-before-edge;
}

.stats-widget__header h5,
.stats-widget__header h4 {
    margin: 0;
    color: #e2e8f0;
}

.stats-widget__subtitle {
    color: #94a3b8;
    font-size: 0.85rem;
}

.d3-value {
    fill: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
}

.split-bar {
    width: 100%;
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 70px;
    margin-bottom: 1rem;
}

.split-bar__segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
}

.split-bar__segment--attack {
    font-size: 0.82rem;
    background: rgba(155, 93, 229, 0.8);
}

.split-bar__segment--defense {
    font-size: 0.82rem;
    background: rgba(59, 130, 246, 0.8);
}

.donut-center-value {
    fill: #fff;
    font-size: 28px;
    font-weight: 800;
}

.donut-center-label {
    fill: #94a3b8;
    font-size: 12px;
}

.mode-metrics-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.mode-metric-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 14, 22, 0.7);
    border-radius: 10px;
    padding: 0.9rem;
}

.mode-metric-card__title {
    color: #94a3b8;
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.mode-metric-card__value {
    color: #f8f9fa;
    font-size: 1.1rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .mode-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   STATS TOP SECTION (COMPACT PREMIUM)
   ========================================= */
.stats-top-shell {
    margin-bottom: 0.35rem;
}

/* Stats page now uses .page-header-universal from style.css for design parity */
.stats-top-shell {
    margin-bottom: 2.5rem;
}

.stats-top-header__title-wrap h1 {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.15;
    font-weight: 700;
    color: #f8fafc;
}

.stats-top-header__title-wrap p {
    margin: 0.2rem 0 0;
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.92rem;
}

.stats-record-btn {
    border-radius: 10px;
    padding: 0.48rem 1rem;
    font-weight: 600;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.stats-overview-compact {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.65rem;
}

.stats-overview-compact .pc-summary-card {
    border-radius: 10px;
    padding: 0.72rem;
    min-height: 86px;
    background: linear-gradient(145deg, rgba(14, 20, 32, 0.92), rgba(12, 18, 28, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-overview-compact .pc-summary-card strong {
    font-size: 1.55rem;
}

.stats-overview-compact .pc-summary-card span {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.stats-filter-bar {
    margin-top: 0.1rem;
    padding: 0.7rem 0.65rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 13, 22, 0.72);
    backdrop-filter: blur(8px);
}

.stats-filter-bar .form-label {
    color: #b8c5d8;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stats-filter-bar .compact-filter,
.stats-filter-bar .form-select,
.stats-filter-bar .form-control {
    border-radius: 9px;
    border-color: rgba(255, 255, 255, 0.14);
    background-color: rgba(17, 25, 40, 0.86);
    color: #e2e8f0;
}

.stats-filter-bar .faceit-season-btn {
    border-radius: 8px;
    min-width: 42px;
    border-color: rgba(255, 255, 255, 0.18);
}

.stats-filter-bar .faceit-season-btn.active {
    background:     #2ec4b6;
    border-color: #2ec4b6;
}

.stats-clear-btn {
    border-radius: 9px;
}

#statsTab.performance-tabs {
    padding: 0.22rem;
    border-radius: 12px;
    background: rgba(8, 13, 22, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#statsTab.performance-tabs .nav-link {
    border-radius: 9px;
    color: #b6c2d4;
    border: 1px solid transparent;
    padding: 0.55rem 0.8rem;
}

#statsTab.performance-tabs .nav-link.active {
    background: rgba(13, 110, 253, 0.2);
    color: #f8fafc;
    border-color: rgba(13, 110, 253, 0.4);
}

@media (max-width: 1200px) {
    .stats-overview-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .stats-top-header .performance-header__content {
        flex-direction: column;
        align-items: flex-start;
    }
    .stats-overview-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .stats-overview-compact {
        grid-template-columns: 1fr;
    }
    .stats-top-header__title-wrap h1 {
        font-size: 1.5rem;
    }
}

/* =============================================
   D3 CHART TOOLTIP SYSTEM
   ============================================= */

#d3-global-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: rgba(10, 14, 26, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 140px;
    max-width: 240px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(13, 110, 253, 0.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    transition: opacity 0.12s ease;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.82rem;
    line-height: 1.5;
}

.d3-tip-label {
    font-weight: 700;
    font-size: 0.88rem;
    color: #e2e8f0;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.d3-tip-value {
    font-size: 1.12rem;
    font-weight: 700;
    color: #f0f4ff;
    margin-top: 3px;
}

.d3-tip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    margin-top: 3px;
}

.d3-tip-row b {
    color: #e2e8f0;
    font-weight: 600;
}

.d3-tip-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Win Rate Timeline Crosshair */
.wr-focus-line {
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    pointer-events: none;
}

/* D3 Bar hover state */
.d3-bar {
    opacity: 0.92;
}

/* =============================================
   SIDE PERFORMANCE WIDGET ENHANCEMENTS
   ============================================= */

.side-perf-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.side-perf-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.side-perf-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 8px 15px;
    flex: 1;
    min-width: 180px;
}

.side-perf-stat i {
    opacity: 0.8;
    font-size: 0.78rem;
}

.side-perf-stat span {
    margin-left: auto;
    color: #e2e8f0;
    font-size: 0.7rem;
}

.side-perf-rate {
    font-weight: 700;
    font-size: 0.75rem;
    color: inherit !important;
    margin-left: 4px;
}

/* Split bar segments tooltip enhancement */
.split-bar__segment {
    position: relative;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.split-bar__segment:hover {
    filter: brightness(1.15);
}

/* =============================================
   MAP WIN RATE TABLE ROW HOVERS
   ============================================= */

.map-wr-row {
    transition: background 0.12s ease;
}

.map-wr-row:hover td {
    background: rgba(255, 255, 255, 0.035) !important;
}

/* =============================================
   FIRST FIGHT DONUT CHART
   ============================================= */

/* Smooth arc hover handled in JS with d3.attr('d', arcHover) */

