/* ══════════════════════════════════════════════
   stat.css  —  Premium Character Statistics Panel
   Only touch this file for Stats-tab iterations
   (cards, charts, rings, records, insights).
   Reuses app-wide vars (--gold, --surface2, --border,
   --text-muted, --font-mono, --xp-bar-bg, etc.)
   ══════════════════════════════════════════════ */

.stat-page-header {
    margin-bottom: var(--space-0);
}

.stat-page-sub {
    font-size: var(--text-base);
    color: var(--text-muted);
    margin-top: var(--space-0);
}

/* ── Hero Overview ── */
.stat-hero-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.stat-hero-top {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.stat-level-badge {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: radial-gradient(circle, rgba(226,176,74,0.12) 0%, transparent 70%);
    box-shadow: 0 0 20px rgba(226,176,74,0.15), inset 0 0 14px rgba(226,176,74,0.06);
}

.stat-level-num {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--gold);
    line-height: 1;
}

.stat-level-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: var(--space-0);
}

.stat-hero-info {
    flex: 1;
    min-width: 0;
}

.stat-hero-rank {
    font-weight: 800;
    font-size: var(--text-xl);
    color: var(--gold);
    margin-bottom: var(--space-1);
}

.stat-hero-xp-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    gap: var(--space-2);
}

.stat-hero-xp-row strong {
    color: var(--gold);
    font-family: var(--font-mono);
}

.stat-xp-track {
    height: 10px;
    background: var(--xp-bar-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border);
}

.stat-xp-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #7d5c20, var(--gold), var(--gold-glow));
    transition: width var(--progress-duration) var(--progress-easing);
}

.stat-xp-remaining {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.stat-pill-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

@media (min-width: 420px) {
    .stat-pill-row { grid-template-columns: repeat(4, 1fr); }
}

.stat-pill {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-2);
    text-align: center;
}

.stat-pill-icon { font-size: 1rem; margin-bottom: var(--space-1); }

.stat-pill-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-2xl);
    color: var(--gold);
}

.stat-pill-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: var(--space-0);
}

/* ── Chart containers ── */
.stat-chart-box {
    position: relative;
    width: 100%;
    margin: var(--space-2) 0 var(--space-1);
}

/* ── Attribute grid ── */
.stat-attr-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.stat-attr-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    text-align: center;
    position: relative;
}

.stat-attr-icon { font-size: 1.2rem; margin-bottom: var(--space-1); }

.stat-attr-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-2xl);
    color: var(--gold);
}

.stat-attr-name {
    font-size: var(--text-sm);
    color: var(--text);
    margin-top: var(--space-0);
}

.stat-attr-highest {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.05em;
    margin-top: var(--space-1);
}

/* ── Section row (title + toggles) ── */
.stat-section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-1);
}

.stat-toggle-row {
    display: flex;
    gap: var(--space-2);
}

.stat-toggle-btn,
.stat-sort-btn {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}

.stat-toggle-btn:hover,
.stat-sort-btn:hover {
    color: var(--text);
    border-color: var(--gold);
}

.stat-toggle-btn.active,
.stat-sort-btn.active {
    background: rgba(226, 176, 74, 0.12);
    color: var(--gold);
    border-color: var(--gold);
}

/* ── Activity summary row ── */
.stat-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.stat-summary-item {
    text-align: center;
}

.stat-summary-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-xl);
    color: var(--gold);
}

.stat-summary-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: var(--space-0);
}

/* ── Habit performance list ── */
.stat-habit-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-height: 420px;
    overflow-y: auto;
}

.stat-habit-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
}

.stat-habit-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.stat-habit-icon { font-size: 1rem; }

.stat-habit-name {
    flex: 1;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-bright);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-habit-streak {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--gold);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.stat-habit-track {
    height: 6px;
    background: var(--xp-bar-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.stat-habit-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--progress-duration) var(--progress-easing);
}

.stat-habit-meta {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ── XP Analytics cards ── */
.stat-xp-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-1);
}

@media (min-width: 420px) {
    .stat-xp-cards { grid-template-columns: repeat(4, 1fr); }
}

.stat-xp-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-2);
    text-align: center;
}

.stat-xp-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-2xl);
}

.stat-xp-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: var(--space-0);
}

/* ── Area Progress rings ── */
.stat-area-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.stat-area-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4) var(--space-3);
}

.stat-area-ring {
    position: relative;
    width: 76px;
    height: 76px;
}

.stat-area-ring svg { width: 100%; height: 100%; }

.stat-area-circle {
    transition: stroke-dashoffset var(--progress-duration) var(--progress-easing);
}

.stat-area-ring-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-area-icon { font-size: 1rem; margin-bottom: var(--space-0); }

.stat-area-level {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-sm);
    color: var(--gold);
}

.stat-area-name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-bright);
    margin-top: var(--space-2);
}

.stat-area-pct {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.stat-area-xp {
    font-size: var(--text-xs);
    color: var(--gold);
    font-family: var(--font-mono);
    margin-top: 1px;
}

/* ── Quest Statistics ── */
.stat-quest-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.stat-quest-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
}

.stat-quest-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-quest-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-2xl);
}

.stat-quest-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

/* ── Monthly Summary ── */
.stat-monthly-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4) var(--space-3);
}

.stat-monthly-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stat-monthly-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.stat-monthly-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.stat-monthly-value {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-bright);
}

/* ── Personal Records ── */
.stat-records-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.stat-record-card {
    text-align: center;
    background: linear-gradient(180deg, rgba(226,176,74,0.08) 0%, rgba(226,176,74,0.01) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4) var(--space-3);
}

.stat-record-icon {
    font-size: 1.4rem;
    margin-bottom: var(--space-2);
    filter: drop-shadow(0 0 10px rgba(226,176,74,0.4));
}

.stat-record-value {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: var(--text-xl);
    color: var(--gold);
}

.stat-record-title {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── Insights ── */
.stat-insights-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stat-insight-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    border-left: 3px solid var(--gold);
    background: var(--surface2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: var(--space-3) var(--space-4);
}

.stat-insight-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.stat-insight-text {
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text);
}