/* ==========================================================
   TypingTutor.Online — Complete Statistics Dashboard v17.4.1
========================================================== */

.statistics-dashboard-header-complete {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
}

.statistics-filter-panel {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex: 0 0 auto;
}

.statistics-type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
}

.statistics-type-filters button {
    min-height: 34px;
    padding: 7px 11px;
    color: var(--text-light);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.statistics-type-filters button:hover,
.statistics-type-filters button:focus-visible {
    color: var(--text);
    background: var(--surface);
}

.statistics-type-filters button.is-active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 5px 13px rgba(37, 99, 235, .24);
}

.statistics-range-filter {
    display: grid;
    gap: 5px;
}

.statistics-range-filter span {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.statistics-range-filter select,
.coach-action-controls select {
    min-height: 44px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
}

.statistics-active-filter-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-light);
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    font-size: 11px;
}

.statistics-active-filter-note strong {
    color: var(--primary);
}

.course-progress-card.tests::before {
    background: #0891b2;
}

.statistics-summary-grid-complete {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.statistics-trend-grid,
.statistics-ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.trend-card {
    min-width: 0;
}

.trend-chart-wrap {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-radius: 13px;
    background: var(--surface-alt);
}

.trend-chart {
    display: block;
    width: 100%;
    height: auto;
    min-height: 210px;
}

.trend-grid-line {
    stroke: var(--border-soft);
    stroke-width: 1;
}

.trend-axis-label {
    fill: var(--text-muted);
    font: 10px Inter, sans-serif;
}

.trend-line {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.trend-line-wpm {
    stroke: #2563eb;
}

.trend-line-accuracy {
    stroke: #16a34a;
}

.trend-point {
    fill: var(--surface);
    stroke: #2563eb;
    stroke-width: 3;
}

.trend-empty {
    display: grid;
    place-items: center;
    min-height: 210px;
    margin: 0;
    text-align: center;
}

.key-ranking-list {
    display: grid;
    gap: 8px;
}

.key-ranking-item {
    display: grid;
    grid-template-columns: 28px 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
}

.key-ranking-item > span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 800;
}

.key-ranking-item > strong {
    color: var(--primary);
    font-family: "JetBrains Mono", monospace;
    font-size: 20px;
}

.key-ranking-item div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.key-ranking-item b {
    color: var(--text);
    font-size: 12px;
}

.key-ranking-item small {
    color: var(--text-muted);
    font-size: 10px;
}

.key-ranking-errors .key-ranking-item > strong {
    color: #e11d48;
}

.unified-activity-list {
    display: grid;
    gap: 8px;
}

.unified-activity-item {
    display: grid;
    grid-template-columns: 92px minmax(180px, 1fr) auto auto minmax(120px, auto);
    gap: 12px;
    align-items: center;
    padding: 11px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
}

.activity-type-badge {
    display: inline-flex;
    justify-content: center;
    padding: 5px 8px;
    color: #1d4ed8;
    background: rgba(59, 130, 246, .12);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.activity-test .activity-type-badge {
    color: #0e7490;
    background: rgba(6, 182, 212, .12);
}

.activity-review .activity-type-badge {
    color: #7e22ce;
    background: rgba(168, 85, 247, .12);
}

.activity-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.activity-main strong,
.activity-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-main strong {
    color: var(--text);
    font-size: 12px;
}

.activity-main small,
.activity-detail {
    color: var(--text-muted);
    font-size: 10px;
}

.unified-activity-item > b {
    color: var(--primary);
    font-size: 12px;
}

.unified-activity-item > em {
    color: var(--success);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

html[data-theme="dark"] .statistics-type-filters button.is-active,
html[data-theme="dark"] .activity-type-badge,
html[data-theme="dark"] .activity-test .activity-type-badge,
html[data-theme="dark"] .activity-review .activity-type-badge {
    color: #fff;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .statistics-type-filters button.is-active,
    html[data-theme="system"] .activity-type-badge,
    html[data-theme="system"] .activity-test .activity-type-badge,
    html[data-theme="system"] .activity-review .activity-type-badge {
        color: #fff;
    }
}

@media (max-width: 980px) {
    .statistics-dashboard-header-complete,
    .statistics-filter-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .statistics-filter-panel {
        width: 100%;
    }

    .statistics-range-filter select {
        width: 100%;
    }

    .statistics-trend-grid,
    .statistics-ranking-grid {
        grid-template-columns: 1fr;
    }

    .unified-activity-item {
        grid-template-columns: 90px minmax(0, 1fr) auto auto;
    }

    .activity-detail {
        grid-column: 2 / -1;
    }
}

@media (max-width: 680px) {
    .statistics-summary-grid-complete {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .statistics-type-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .statistics-active-filter-note {
        align-items: flex-start;
        flex-direction: column;
    }

    .unified-activity-item {
        grid-template-columns: 1fr auto auto;
    }

    .activity-type-badge,
    .activity-main,
    .activity-detail {
        grid-column: 1 / -1;
    }

    .activity-type-badge {
        width: fit-content;
    }
}

@media (max-width: 430px) {
    .statistics-summary-grid-complete {
        grid-template-columns: 1fr;
    }
}
