/* ============================================================
   Statistik — stat-* prefix
   NEXUS-7 Dark Theme — Strafakten-Statistik
   ============================================================ */

/* --- Variables (scoped) --- */
.stat {
    --stat-bg: #0a0a0c;
    --stat-surface: #12100f;
    --stat-surface-2: #1a1614;
    --stat-surface-3: #201c1a;
    --stat-border: rgba(220, 38, 38, 0.15);
    --stat-border-strong: rgba(220, 38, 38, 0.3);
    --stat-text: #f0eeeb;
    --stat-text-sec: #8a8698;
    --stat-text-muted: #5a5768;
    --stat-red: #dc2626;
    --stat-red-dim: rgba(220, 38, 38, 0.1);
    position: relative;
    min-height: 100vh;
    color: var(--stat-text);
    padding-bottom: 3rem;
}

/* --- Page Background --- */
.stat-page-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: var(--stat-bg);
}
.stat-page-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(220, 38, 38, 0.06) 0%, transparent 60%);
}

/* --- Hero --- */
.stat-hero {
    position: relative;
    padding: 2.5rem 2rem 2rem;
    overflow: hidden;
}
.stat-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.stat-hero__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(220, 38, 38, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(220, 38, 38, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}
.stat-hero__glow {
    position: absolute;
    top: -60%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(220, 38, 38, 0.12) 0%, transparent 70%);
    pointer-events: none;
}
.stat-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}
.stat-hero__icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--stat-red-dim);
    border: 1px solid var(--stat-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--stat-red);
    flex-shrink: 0;
}
.stat-hero__title {
    font-family: 'Oxanium', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--stat-text);
    margin: 0;
}
.stat-hero__subtitle {
    font-size: 0.9rem;
    color: var(--stat-text-sec);
    margin: 0.2rem 0 0;
}

/* --- Loading --- */
.stat-loading {
    text-align: center;
    padding: 3rem;
    color: var(--stat-text-muted);
    font-size: 1rem;
}

/* --- Content --- */
.stat-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Summary Cards --- */
.stat-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.stat-summary__card {
    background: var(--stat-surface);
    border: 1px solid var(--stat-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}
.stat-summary__card:hover {
    border-color: var(--stat-border-strong);
    transform: translateY(-2px);
}
.stat-summary__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.stat-summary__value {
    font-family: 'Oxanium', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-summary__label {
    font-size: 0.75rem;
    color: var(--stat-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Charts Grid --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

/* --- Chart Card --- */
.stat-card {
    background: var(--stat-surface);
    border: 1px solid var(--stat-border);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.stat-card:hover {
    border-color: var(--stat-border-strong);
}
.stat-card--wide {
    grid-column: span 2;
}
.stat-card__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem 0.75rem;
    color: var(--stat-text);
    font-size: 0.85rem;
    overflow: hidden;
}
.stat-card__header i {
    color: var(--stat-red);
    font-size: 0.9rem;
    flex-shrink: 0;
}
.stat-card__title {
    font-family: 'Oxanium', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--stat-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-card__badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--stat-red-dim);
    color: var(--stat-red);
    border: 1px solid var(--stat-border-strong);
    font-weight: 600;
}
.stat-card__body {
    padding: 0.75rem 1.25rem 1.25rem;
}
.stat-card__body--chart {
    position: relative;
    height: 320px;
    overflow: hidden;
}
/* Wider charts need more height */
.stat-card--wide .stat-card__body--chart {
    height: 400px;
}

/* --- Section Title --- */
.stat-section-title {
    font-family: 'Oxanium', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--stat-text);
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stat-section-title i {
    color: var(--stat-red);
}

/* --- Unit Detail Cards Grid --- */
.stat-unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* --- Unit Detail Card --- */
.stat-unit-card {
    background: var(--stat-surface);
    border: 1px solid var(--stat-border);
    border-radius: 14px;
    overflow: hidden;
    border-top: 3px solid var(--unit-color, var(--stat-red));
    transition: border-color 0.2s, transform 0.2s;
}
.stat-unit-card:hover {
    transform: translateY(-2px);
    border-color: var(--stat-border-strong);
    border-top-color: var(--unit-color, var(--stat-red));
}
.stat-unit-card__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
}
.stat-unit-card__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stat-unit-card__name {
    font-family: 'Oxanium', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--stat-text);
}
.stat-unit-card__count {
    margin-left: auto;
    font-family: 'Oxanium', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--unit-color, var(--stat-text));
}
.stat-unit-card__chart {
    height: 180px;
    padding: 0 1rem;
    position: relative;
}
.stat-unit-card__list {
    padding: 0.75rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.stat-unit-card__row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
}
.stat-unit-card__row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stat-unit-card__row-name {
    color: var(--stat-text-sec);
    min-width: 100px;
    max-width: 160px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-unit-card__row-bar {
    flex: 1;
    height: 6px;
    background: var(--stat-surface-3);
    border-radius: 3px;
    overflow: hidden;
}
.stat-unit-card__row-bar > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.stat-unit-card__row-val {
    color: var(--stat-text);
    font-weight: 600;
    min-width: 70px;
    text-align: right;
    font-size: 0.8rem;
}

/* --- Empty state --- */
.stat-empty {
    text-align: center;
    color: var(--stat-text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
    .stat-card--wide {
        grid-column: span 1;
    }
}
@media (max-width: 640px) {
    .stat-hero { padding: 1.5rem 1rem; }
    .stat-hero__title { font-size: 1.3rem; }
    .stat-hero__icon { width: 44px; height: 44px; font-size: 1.2rem; }
    .stat-content { padding: 0 1rem; }
    .stat-summary { grid-template-columns: repeat(2, 1fr); }
    .stat-unit-grid { grid-template-columns: 1fr; }
    .stat-card__body--chart { height: 260px; }
    .stat-card--wide .stat-card__body--chart { height: 280px; }
}
