/* ================================
   STATS PAGE - Premium RPG Styling
   ================================ */

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

/* ---- Page Header ---- */
.stats-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.stats-header h2 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.stats-header .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stats-header::after {
    content: '';
    display: block;
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    margin: 15px auto 0;
}

/* ---- Discipline Banner ---- */
.discipline-banner {
    background: linear-gradient(135deg, rgba(212,175,55,0.08) 0%, rgba(139,92,246,0.08) 100%);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 20px;
    padding: 35px 40px;
    margin-bottom: 35px;
    display: flex;
    align-items: center;
    gap: 40px;
    position: relative;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
}

.discipline-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at top left, rgba(212,175,55,0.07) 0%, transparent 60%);
    pointer-events: none;
}

.discipline-icon-wrap {
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(212,175,55,0.12);
    border: 2px solid rgba(212,175,55,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary-color);
    box-shadow: 0 0 30px rgba(212,175,55,0.25), inset 0 0 20px rgba(212,175,55,0.1);
    animation: pulseGlow 3s ease-in-out infinite;
    position: relative;
}

.discipline-text {
    flex: 1;
}

.discipline-text h3 {
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    margin-bottom: 6px;
}

.discipline-score {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary-color) 0%, #fff 60%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.discipline-label {
    color: var(--secondary-color);
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.discipline-meter-wrap {
    flex: 2;
}

.discipline-meter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.discipline-meter-label span:last-child {
    color: var(--primary-color);
    font-weight: 600;
}

.discipline-meter-track {
    height: 18px;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    position: relative;
}

.discipline-meter-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #8b5cf6, var(--primary-color));
    box-shadow: 0 0 20px rgba(212,175,55,0.5);
    position: relative;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}


.discipline-segments {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.disc-segment {
    flex: 1;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 4px 2px;
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    transition: var(--transition-fast);
}

.disc-segment.active {
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.3);
    color: var(--primary-color);
}

/* ---- Primary Stats Grid ---- */
.primary-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 35px;
}

.stat-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    cursor: default;
    animation: statCardIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }
.stat-card:nth-child(6) { animation-delay: 0.30s; }
.stat-card:nth-child(7) { animation-delay: 0.35s; }

@keyframes statCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, linear-gradient(90deg, var(--primary-color), var(--secondary-color)));
    border-radius: 16px 16px 0 0;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -30px; right: -30px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--card-glow, rgba(212,175,55,0.06));
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(212,175,55,0.2);
    border-color: rgba(212,175,55,0.25);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--icon-bg, rgba(212,175,55,0.12));
    color: var(--icon-color, var(--primary-color));
    border: 1px solid var(--icon-border, rgba(212,175,55,0.3));
}

.stat-card-value {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1;
    color: var(--card-value-color, var(--primary-color));
    text-shadow: 0 0 20px var(--card-glow-color, rgba(212,175,55,0.4));
}

.stat-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: auto;
}

/* Card color themes */
.stat-card.gold {
    --card-accent: linear-gradient(90deg, #d4af37, #ffd700);
    --card-glow: rgba(212,175,55,0.07);
    --icon-bg: rgba(212,175,55,0.12);
    --icon-color: #d4af37;
    --icon-border: rgba(212,175,55,0.3);
    --card-value-color: #d4af37;
    --card-glow-color: rgba(212,175,55,0.4);
}

.stat-card.purple {
    --card-accent: linear-gradient(90deg, #8b5cf6, #a78bfa);
    --card-glow: rgba(139,92,246,0.07);
    --icon-bg: rgba(139,92,246,0.12);
    --icon-color: #a78bfa;
    --icon-border: rgba(139,92,246,0.3);
    --card-value-color: #a78bfa;
    --card-glow-color: rgba(139,92,246,0.4);
}

.stat-card.red {
    --card-accent: linear-gradient(90deg, #ef4444, #f97316);
    --card-glow: rgba(239,68,68,0.07);
    --icon-bg: rgba(239,68,68,0.12);
    --icon-color: #ef4444;
    --icon-border: rgba(239,68,68,0.3);
    --card-value-color: #ef4444;
    --card-glow-color: rgba(239,68,68,0.4);
}

.stat-card.green {
    --card-accent: linear-gradient(90deg, #10b981, #34d399);
    --card-glow: rgba(16,185,129,0.07);
    --icon-bg: rgba(16,185,129,0.12);
    --icon-color: #10b981;
    --icon-border: rgba(16,185,129,0.3);
    --card-value-color: #10b981;
    --card-glow-color: rgba(16,185,129,0.4);
}

.stat-card.blue {
    --card-accent: linear-gradient(90deg, #3b82f6, #60a5fa);
    --card-glow: rgba(59,130,246,0.07);
    --icon-bg: rgba(59,130,246,0.12);
    --icon-color: #60a5fa;
    --icon-border: rgba(59,130,246,0.3);
    --card-value-color: #60a5fa;
    --card-glow-color: rgba(59,130,246,0.4);
}

.stat-card.orange {
    --card-accent: linear-gradient(90deg, #f97316, #fbbf24);
    --card-glow: rgba(249,115,22,0.07);
    --icon-bg: rgba(249,115,22,0.12);
    --icon-color: #f97316;
    --icon-border: rgba(249,115,22,0.3);
    --card-value-color: #f97316;
    --card-glow-color: rgba(249,115,22,0.4);
}

/* ---- Bottom Row ---- */
.stats-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 35px;
}

/* ---- Streak Section ---- */
.streak-panel {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.streak-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ef4444, #f97316, #fbbf24);
}

.streak-panel-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.streak-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.streak-item {
    text-align: center;
    padding: 18px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    transition: var(--transition-normal);
}

.streak-item:hover {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.25);
}

.streak-flames {
    font-size: 2rem;
    margin-bottom: 8px;
}

.streak-number {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    color: #f97316;
    text-shadow: 0 0 20px rgba(249,115,22,0.5);
}

.streak-sublabel {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 6px;
}

.streak-item.best .streak-number {
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251,191,36,0.5);
}

/* ---- Goals Radar / Achievement Panel ---- */
.achievement-panel {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.achievement-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-color), #06b6d4);
}

.achievement-panel-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.goal-progress-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.goal-progress-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.goal-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-progress-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
}

.goal-progress-pct {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
}

.goal-track {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    overflow: hidden;
}

.goal-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    box-shadow: 0 0 8px rgba(212,175,55,0.4);
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Activity Heatmap / History ---- */
.history-panel {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 35px;
}

.history-panel-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-panel-title span:last-child {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.heatmap-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.heatmap-day {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform var(--transition-fast);
    position: relative;
    cursor: default;
}

.heatmap-day:hover {
    transform: scale(1.4);
    z-index: 10;
}

.heatmap-day.level-1 { background: rgba(212,175,55,0.2); border-color: rgba(212,175,55,0.3); }
.heatmap-day.level-2 { background: rgba(212,175,55,0.4); border-color: rgba(212,175,55,0.5); }
.heatmap-day.level-3 { background: rgba(212,175,55,0.65); border-color: rgba(212,175,55,0.7); }
.heatmap-day.level-4 { background: rgba(212,175,55,0.9); border-color: var(--primary-color); box-shadow: 0 0 6px rgba(212,175,55,0.5); }
.heatmap-day.perfect { background: var(--primary-color); border-color: #ffd700; box-shadow: 0 0 8px rgba(212,175,55,0.7); }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.heatmap-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ---- Badges ---- */
.badges-section {
    margin-bottom: 20px;
}

.badges-section h3 {
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
}

.badge-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 18px 12px;
    text-align: center;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.badge-card.earned {
    background: rgba(212,175,55,0.06);
    border-color: rgba(212,175,55,0.3);
}

.badge-card.earned:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(212,175,55,0.15);
    border-color: rgba(212,175,55,0.5);
}

.badge-card.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.badge-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.badge-name {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.badge-card.earned .badge-name {
    color: var(--primary-color);
}

.badge-desc {
    font-size: 0.67rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 800px) {
    .discipline-banner {
        flex-direction: column;
        text-align: center;
        padding: 25px;
        gap: 20px;
    }

    .discipline-meter-wrap {
        width: 100%;
    }

    .stats-bottom-row {
        grid-template-columns: 1fr;
    }

    .primary-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .discipline-score {
        font-size: 3rem;
    }
}

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

    .stats-header h2 {
        font-size: 1.8rem;
    }
}
