/* ── Statistics Dashboard — Redesign ────────────────────────── */

@keyframes stFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body {
    font-family: var(--font-family);
    background: #f1f5f9;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* ── Hero ── */






/* Period filter in hero */
.st-period-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 9px;
    padding: 8px 14px;
}

.st-period-icon {
    color: #94a3b8;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.st-period-wrap select {
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    cursor: pointer;
}

.st-period-wrap select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* ── Page body ── */
.st-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 48px;
    animation: stFadeUp 0.35s ease;
}

/* ── Loading ── */
.st-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.st-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Error ── */
.st-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13.5px;
    color: #991b1b;
    margin-bottom: 16px;
}

/* ── Section ── */
.st-section {
    margin-bottom: 24px;
}

.st-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.st-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.st-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* ── Stat grid ── */
.st-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

/* ── Stat card (generated by JS) ── */
.st-stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.st-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.st-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.st-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.st-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Two-column layout ── */
.st-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Card ── */
.st-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.st-card:last-child { margin-bottom: 0; }

.st-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
}

.st-card-hicon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.st-card-htitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.st-card-body {
    padding: 18px;
}

/* ── Chart ── */
.st-chart-wrap {
    position: relative;
    height: 260px;
}

/* ── Platform list ── */
.st-platform-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.st-platform-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
    transition: border-color 0.15s;
}

.st-platform-item:hover { border-color: var(--primary); }

.st-platform-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.st-platform-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.st-platform-badge {
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Activity list ── */
.st-activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.st-activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.st-activity-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    word-break: break-all;
}

.st-activity-date {
    font-size: 11.5px;
    color: var(--text-muted);
}

.st-activity-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Empty state ── */
.st-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.st-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: var(--text-muted);
}

.st-empty p {
    font-size: 13px;
    margin: 0;
}

/* ── Footer ── */
.st-footer {
    border-top: 1px solid var(--border-soft, #e2e8f0);
    padding-top: 24px;
    margin-top: 32px;
    text-align: center;
}

.st-footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.st-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.st-footer-links a:hover { color: var(--primary); }

.st-footer-copy {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .st-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .st-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .st-page { padding: 20px 16px 40px; }
    .st-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .st-stat-value { font-size: 20px; }
    .st-chart-wrap { height: 200px; }
}
