/* ============================================================
   CRM — app-specific styles on top of the shared Just.UI design
   system (_content/Just.UI/app.css), plus TRANSITIONAL shims that
   keep Bootstrap-era pages working during the UI migration.
   Delete the shim section together with bootstrap.css (Welle 3d).
   ============================================================ */

/* German UI text for the framework error boundary */
.blazor-error-boundary::after { content: "Ein Fehler ist aufgetreten."; }

/* Bootstrap-era alias used by Components/Alert.razor — same look as .alert-error */
.alert-danger { background: var(--red-soft); border-color: #f0d2d3; color: #9f2b30; }

/* ── Admin shell specifics ────────────────────────────────────── */

/* CRM is list/grid-heavy — stretch the content column (ERP/Vision keep
   a 1160px article; deliberate CRM deviation). */
.main > article { max-width: none; }

/* footer strip inside a .table-card (summary left, paginator right) */
.grid-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-soft);
}

/* row-level destructive icon buttons: quiet until hovered */
.row-action-danger { color: var(--text-muted); }
.row-action-danger:hover:not(:disabled) { background: var(--red-soft); border-color: #ecc8c9; color: var(--red); }

/* the colored Bildner logo needs a light plate, not the shared gradient */
.brand-mark { background: var(--surface); border: 1px solid var(--border); }
.brand-mark img { width: 14px; height: 14px; object-fit: contain; }

/* sub-items (Abmelden, E-Mail Review): no icon — the text aligns with
   the parent's label column, slightly quieter than top-level items */
.nav-item-child { padding-left: 34px; font-size: 12.5px; color: var(--text-muted); }
.nav-item-child:hover { color: var(--text); }
.nav-item-child.active { color: var(--text); }

/* scrim is toggled via the hidden attribute (SSR layout, JS toggle);
   keep it hidden even where the shared mobile CSS sets display:block */
.sidebar-scrim[hidden] { display: none; }

/* footer buttons reuse .nav-item; give the button variant proper reset */
.sidebar-footer button.nav-item { width: 100%; border: 0; background: none; cursor: pointer; font-family: var(--font); text-align: left; }

/* ── TRANSITIONAL legacy page headers (SectionOutlet) ─────────── */
/* Pages still project <h3> + actions into the old topbar section.
   Style the outlet like a page header until every page uses <PageHeader>. */
.legacy-topbar { display: flex; align-items: center; gap: 12px; min-width: 0; }
.legacy-topbar:not(:has(*)) { display: none; }
.legacy-topbar > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.legacy-topbar h3 { font-size: 20px; margin: 0; }
.legacy-topbar .ms-auto { margin-left: auto; flex-shrink: 0; }
.legacy-topbar:has(*) { margin-bottom: 20px; }

/* ── Auswertungen (Features/Analytics) ────────────────────────── */

.analytics-page { display: grid; gap: 20px; }
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .analytics-grid { grid-template-columns: 1fr; } }

/* Highcharts an Just.UI anbinden: die Schrift wird per !important
   erzwungen, weil Highcharts Inline-Styles auf jedes Textelement setzt */
.chart-container > div { width: 100%; }
.chart-container .highcharts-root text { font-family: var(--font) !important; }

/* Zusatzzeile unter .stat-value (z.B. "1.234 Öffnungen") */
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* KPI-Delta-Badges (Vergleich zur Vorperiode, Übersicht) */
.stat-delta { display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 500; width: fit-content; }
.stat-delta--up { color: var(--green); background: var(--green-soft); }
.stat-delta--down { color: var(--red); background: var(--red-soft); }
.stat-delta--flat { color: var(--text-muted); background: var(--bg); }

/* Handlungsbedarf-Liste (Übersicht) */
.attn-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); color: var(--text); text-decoration: none; font-size: 13.5px; }
.attn-row:last-child { border-bottom: 0; }
.attn-row:hover { background: var(--bg); }
.attn-row svg { width: 15px; height: 15px; flex-shrink: 0; }
.attn-row--warnung svg { color: var(--amber); }
.attn-row--kritisch svg { color: var(--red); }
.attn-row .badge { margin-left: auto; }

/* Bereichs-Karten (Übersicht) */
.area-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.area-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); transition: background 0.15s ease; }
.area-card:hover { background: var(--bg); }
.area-card-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.area-card-head svg { width: 14px; height: 14px; color: var(--text-muted); }
.area-card-value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.area-card-sub { font-size: 12px; color: var(--text-muted); }

/* Segmented Control (Zeitraum-Umschalter) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; background: none; padding: 5px 12px; font-family: var(--font); font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border-soft); }
.seg-btn:hover { background: var(--bg); color: var(--text); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* ── TRANSITIONAL Bootstrap-shim support ──────────────────────── */

/* The legacy pages (Newsletters/Tags) still use bootstrap-shim.css's
   row/col-* grid. Just.UI also defines .row (flex + gap) and loads
   between the shim and this file — restore grid semantics here.
   New pages use .toolbar / .stack instead of .row. */
.row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
}

/* ── Sticky Listen-Chrome ─────────────────────────────────────── */
/* Suchleiste als flacher Streifen ohne Karte; pinnt beim Scrollen
   oben, der Tabellenkopf direkt darunter. Nur Desktop — mobil
   brauchen die Tabellen overflow-x, und ein Scroll-Container
   schluckt position:sticky. */
.list-toolbar { display: flex; align-items: center; gap: 10px; }
.list-toolbar .list-search { flex: 1; max-width: 440px; }

@media (min-width: 901px) {
    .list-toolbar {
        position: sticky;
        top: 0;
        z-index: 30;
        background: var(--bg);
        border-bottom: 1px solid var(--border-soft);
        padding: 10px 0 12px;
    }

    /* Just.UIs overflow hidden/auto macht die Karte zum Scroll-Container
       und würde das sticky thead einfangen; clip schneidet nur ab */
    .list-sticky-table { overflow: clip; }

    .list-sticky-table thead th,
    .list-sticky-table table.fluent-data-grid th.column-header {
        position: sticky;
        /* 4px unter die Suchleiste geschoben: kleine Höhenabweichungen
           verschwinden unter deren opakem Hintergrund */
        top: calc(var(--list-toolbar-h, 55px) - 4px);
        z-index: 20;
        background: var(--surface);
        /* border-collapse lässt th-Borders beim Kleben zurück */
        box-shadow: 0 1px 0 var(--border);
    }

    /* die Creator-Suchleiste ist zweizeilig (Checkbox-Reihe) */
    .creators-index-page { --list-toolbar-h: 84px; }
}
