/* ------------------------------------
 * 1. Grundfarben, Typografie & Reset
 * ----------------------------------*/

:root {
    --bg-main: #050818;
    --bg-elevated: #080c1e;
    --bg-card: #090e22;
    --bg-card-soft: #0d1028;

    --accent: #8b5cf6;
    --accent-soft: rgba(139, 92, 246, 0.2);
    --accent-strong: #a855f7;
    --accent-green: #4ade80;
    --accent-red: #fb7185;

    --border-subtle: #161a33;

    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-experimental: #e0e0e0;

    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-pill: 999px;

    --shadow-soft: 0 22px 55px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.45);

    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background:
        radial-gradient(circle at top left, #111827 0, #020617 45%),
        radial-gradient(circle at bottom right, #0b1120 0, #020617 55%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
}


/* ------------------------------------
 * 2. App-Shell & Sidebar
 * ----------------------------------*/

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    width: 100%;
    height: 100vh;
}

.sidebar {
    background: radial-gradient(circle at top left, #111827 0, #020617 55%);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: radial-gradient(circle at 20% 0%, #22d3ee 0, #4f46e5 40%, #020617 100%);
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.brand-title {
    display: flex;
    flex-direction: column;
}

.brand-title span:first-child {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.brand-title span:last-child {
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar-section-title {
    margin-top: 18px;
    margin-bottom: 10px;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-main);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(56, 189, 248, 0.12));
    color: var(--text-main);
}

.sidebar-link-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.sidebar-card {
    margin-top: auto;
    padding: 12px 12px 10px;
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.4), rgba(15, 23, 42, 0.95));
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    font-size: 0.8rem;
}

.sidebar-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sidebar-pill {
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.4);
    font-size: 0.7rem;
}

.sidebar-card-metric {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.sidebar-card-metric span:last-child {
    font-weight: 600;
}


/* ------------------------------------
 * 3. Hauptbereich, Topbar & Content
 * ----------------------------------*/

.main {
    padding: 18px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.topbar-search {
    position: relative;
    min-width: 220px;
}

.topbar-search input {
    width: 100%;
    padding: 8px 12px 8px 30px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
}

.topbar-search span {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-filter {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.9);
}

.time-chip {
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: transparent;
    transition: 0.15s ease;
}

.time-chip.active {
    background: radial-gradient(circle at top left, rgba(139, 92, 246, 0.9), rgba(56, 189, 248, 0.6));
    color: #0b1020;
    font-weight: 600;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-subtle);
    font-size: 0.8rem;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, #22d3ee, #a855f7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    min-height: 0;
}


/* ------------------------------------
 * 4. Highlight-Karten & Tabellen
 * ----------------------------------*/

.top-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.highlight-card {
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.28), rgba(15, 23, 42, 0.96));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.highlight-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.highlight-rank {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.highlight-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.highlight-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.highlight-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    font-size: 0.75rem;
}

.highlight-metrics div span:first-child {
    display: block;
    color: var(--text-muted);
}

.highlight-metrics div span:last-child {
    font-weight: 600;
}

.highlight-metrics .positive span:last-child {
    color: var(--accent-green);
}

.highlight-metrics .negative span:last-child {
    color: var(--accent-red);
}

.table-card {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.98));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.table-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.table-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.table-scroll {
    overflow: auto;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.9);
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.98));
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

thead {
    background: linear-gradient(to right, rgba(15, 23, 42, 0.98), rgba(30, 64, 175, 0.5));
}

th,
td {
    padding: 7px 10px;
    text-align: left;
    white-space: nowrap;
}

th {
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(30, 64, 175, 0.4);
}

tbody tr {
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
    transition: 0.12s ease;
}

tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.55);
}

tbody tr:hover {
    background: radial-gradient(circle at left, rgba(79, 70, 229, 0.45), rgba(15, 23, 42, 0.95));
}

.cell-rank {
    color: var(--text-muted);
    font-weight: 500;
}

.cell-player {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cell-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: linear-gradient(135deg, #22d3ee, #a855f7);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-player-name {
    font-weight: 500;
}

.pill-stat {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(30, 64, 175, 0.7);
    font-size: 0.75rem;
}

.pill-stat.green {
    border-color: rgba(34, 197, 94, 0.9);
    color: var(--accent-green);
}

.pill-stat.red {
    border-color: rgba(248, 113, 113, 0.9);
    color: var(--accent-red);
}

.footer {
    margin-top: 6px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ------------------------------------
 * 5. Dashboard-Karten, Listen & Charts
 * ----------------------------------*/

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.kpi-grid-detail {
    margin-top: 1rem;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    z-index: 1;
}

.kpi-card {
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.22), rgba(15, 23, 42, 0.95));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.25);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);

    position: relative;
    overflow: hidden;

    /* Karte soll sich „anfühlen“ wie ein Display, nicht wie ein Button */
    cursor: default;
    user-select: none;

    transition:
        transform 0.12s ease-out,
        box-shadow 0.12s ease-out,
        background 0.12s ease-out;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.2);
}

.kpi-card.kpi-card-tall {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Textbereiche in KPI-Karten */

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.kpi-value {
    margin-top: 6px;
    font-size: 1.5rem;
    font-weight: 600;
}

.kpi-sub {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Reihen mit zwei kompakten Tabellen (z. B. Toplisten) */

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.list-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.7);
    font-size: 0.8rem;
}

.list-row:nth-child(even) {
    background: rgba(15, 23, 42, 0.9);
}

.list-rank {
    color: var(--text-muted);
    text-align: center;
}

.list-name {
    font-weight: 500;
}

.list-value {
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.78rem;
}

/* horizontale „Mini-Charts“ für Verlaufssichten */

.chart-placeholder {
    min-height: 220px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-subtle);
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
}

.chart-row-item {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
}

.chart-row-label {
    color: var(--text-muted);
}

.chart-bar-wrap {
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 1);
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22d3ee, #6366f1, #a855f7);
}

.chart-row-value {
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--text-muted);
}





/* ------------------------------------
 * 7. Stat-Layout, Deko-Bilder & Sections
 * ----------------------------------*/

.stats-kpi-grid {
    margin-top: 1rem;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* Text-Schichten der Karten bewusst über das Bild legen */

.kpi-card .kpi-label,
.kpi-card .kpi-value,
.kpi-card .kpi-sub {
    position: relative;
    pointer-events: none;
    z-index: 1;
}

/* Deko-Bild am rechten Rand innerhalb der Karte */

.kpi-card-image {
    position: absolute;
    right: -0.5rem;
    bottom: -0.5rem;
    height: 120%;
    max-width: none;
    opacity: var(--kpi-image-opacity, 0.2);
    pointer-events: none;
    z-index: 0;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6));
    object-fit: contain;
    transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}

.kpi-card:hover .kpi-card-image {
    opacity: calc(var(--kpi-image-opacity, 0.2) + 0.4);
    transform: translateY(-2px);
}

/* Überschriftsblöcke für die einzelnen Stat-Gruppen */

.stats-section {
    margin-top: 1rem;
}

.section-block {
    margin-top: 2.5rem;
}

.section-header {
    margin-bottom: 0.25rem;
}

.section-header .page-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.section-header .page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* ------------------------------------
 * 8. Responsive Anpassungen
 * ----------------------------------*/

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .brand-title span:first-child,
    .brand-title span:last-child,
    .sidebar-section-title,
    .sidebar-link span:last-child,
    .sidebar-card {
        display: none;
    }

    .sidebar-link {
        justify-content: center;
    }
}

@media (max-width: 720px) {
    .top-cards {
        grid-template-columns: minmax(0, 1fr);
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .chart-row-item {
        grid-template-columns: 80px minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .chart-row-value {
        justify-self: flex-end;
        grid-column: 1 / 3;
    }

    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-header-right {
        width: 100%;
    }
}
