@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

* {
    box-sizing: border-box;
}

html,
body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    padding: 0;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #172033;
    background: #f3f6fb;
    height: 100%;
    --control-gray: #f1f5f9;
    --header-tile-size: 1.35rem;
    --surface-border: #dbe3ef;
    --surface-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    --text-muted: #526075;
    --brand-strong: #0f172a;
    --brand-accent: #0f6cbd;
    --success-bg: #e8f5e9;
    --success-text: #1b5e20;
    --warning-bg: #fff4e5;
    --warning-text: #9a5b00;
    --danger-bg: #ffebee;
    --danger-text: #b71c1c;
    --neutral-bg: #eef2f7;
    --neutral-text: #334155;
    --sidenav-width: 220px;
    --sidenav-bg: #0f172a;
}

body {
    min-height: 100vh;
}

#app {
    min-height: 100vh;
}

body,
button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin: 0;
}

a {
    color: inherit;
}

/* ─── App Shell ─────────────────────────────────────────────────── */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidenav-width) 1fr;
}

/* ─── Side Navigation ────────────────────────────────────────────── */

.app-sidenav {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--sidenav-bg);
    display: flex;
    flex-direction: column;
    gap: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    z-index: 100;
}

.app-brand-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 16px;
    text-decoration: none;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.app-brand-icon {
    font-size: 1.5rem;
    color: #60a5fa;
    flex-shrink: 0;
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.app-brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.app-brand-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.2;
}

.app-sidenav-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    gap: 2px;
    overflow-y: auto;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
    font-size: 0.925rem;
    transition: background 0.14s ease, color 0.14s ease;
    line-height: 1.3;
}

.app-nav-link i {
    width: 17px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.app-nav-link:hover {
    background: rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.92);
}

.app-nav-link.active {
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
    font-weight: 600;
}

.app-nav-link.active i {
    opacity: 1;
    color: #60a5fa;
}

.app-sidenav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.28);
    padding: 14px 12px 4px;
    user-select: none;
}

.app-user-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.75);
}

.app-user-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user-logout {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font: inherit;
    padding: 2px 8px;
    text-decoration: none;
}

.app-user-logout:hover,
.app-user-logout:focus-visible {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.app-sidenav-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

/* ─── Main Content ───────────────────────────────────────────────── */

.app-main {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-page {
    padding: 24px;
    flex: 1;
}

/* ─── Page Layout ────────────────────────────────────────────────── */

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.surface-panel,
.summary-card,
.empty-state {
    background: white;
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
}

.surface-panel {
    padding: 20px;
}

/* ─── Page Intro ─────────────────────────────────────────────────── */

.page-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
}

.page-intro-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--brand-accent);
}

.page-title {
    font-size: 1.45rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--brand-strong);
}

.page-title:focus,
.page-title:focus-visible {
    /*
     * FocusOnNavigate fokussiert die Seitenüberschrift nach Routenwechseln
     * für Screenreader. Die Überschrift selbst ist kein interaktives Element,
     * daher wirkt ein sichtbarer Ring hier wie eine versehentliche Auswahl.
     */
    outline: none;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 68ch;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ─── CTA Links ──────────────────────────────────────────────────── */

.cta-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 4px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: filter 0.1s ease, background-color 0.1s ease;
    white-space: nowrap;
    cursor: pointer;
    line-height: 1;
}

.cta-link:hover {
    filter: brightness(0.95);
}

.cta-link-primary {
    background: var(--brand-accent);
    color: white;
}

.cta-link-primary:hover {
    filter: brightness(1.08);
    color: white;
}

.cta-link-secondary {
    background: transparent;
    color: var(--brand-strong);
    border-color: var(--surface-border);
}

.cta-link-secondary:hover {
    background: var(--neutral-bg);
    filter: none;
}

/* ─── Summary Grid & Cards ───────────────────────────────────────── */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.summary-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-card-link {
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.summary-card-link:hover,
.summary-card-link:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.11);
    border-color: #bfd3ea;
    outline: none;
}

.summary-card-badge {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.summary-card-badge-info {
    background: rgba(15, 108, 189, 0.1);
    color: var(--brand-accent);
}

.summary-card-badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.summary-card-badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.summary-card-badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.summary-card-badge-neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.summary-value {
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 700;
    color: var(--brand-strong);
}

.summary-hint {
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.4;
}

.summary-value-danger {
    color: var(--danger-text);
}

/* ─── Toolbar Panel ──────────────────────────────────────────────── */

.toolbar-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
}

.toolbar-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.results-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.toolbar-panel-stacked {
    flex-direction: column;
    align-items: stretch;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ─── Filter Tabs ────────────────────────────────────────────────── */

.filter-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--surface-border);
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: white;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.filter-tab:hover {
    background: #f5f8fd;
    color: var(--brand-strong);
}

.filter-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--neutral-bg);
    color: var(--neutral-text);
    font-size: 0.78rem;
    font-weight: 700;
}

.filter-tab-active,
.filter-tab-active:hover {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: white;
}

.filter-tab-active .filter-tab-count {
    background: rgba(255, 255, 255, 0.22);
    color: white;
}

/* ─── Section Header ─────────────────────────────────────────────── */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--surface-border);
}

.section-title-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-strong);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ─── Inline State Messages ──────────────────────────────────────── */

.inline-state-message {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.inline-state-message-info {
    background: #eef4fb;
    color: #174a7c;
    border-color: #cfe1f5;
}

.inline-state-message-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: #ef9a9a;
}

/* ─── Empty State ────────────────────────────────────────────────── */

.empty-state {
    padding: 36px 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
}

.empty-state-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-strong);
}

.empty-state-description {
    color: var(--text-muted);
    max-width: 52ch;
}

.empty-state-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}

/* ─── Entity Row ─────────────────────────────────────────────────── */

.entity-row-title,
.grid-row-title {
    font-weight: 700;
    color: var(--brand-strong);
}

.entity-row-title a,
.entity-row-title a:visited,
.grid-row-title a,
.grid-row-title a:visited {
    color: inherit;
    text-decoration: none;
}

.entity-row-title a:hover,
.grid-row-title a:hover {
    color: var(--brand-accent);
}

.entity-row-subtitle,
.grid-row-subtitle,
.entity-row-hint,
.grid-row-description {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.entity-row-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.entity-row-metric {
    font-weight: 600;
    color: var(--brand-strong);
}

/* ─── Pill Cluster ───────────────────────────────────────────────── */

.pill-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--neutral-bg);
    color: var(--neutral-text);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ─── Status Pills ───────────────────────────────────────────────── */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.status-pill::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pill-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-pill-success::before {
    background: var(--success-text);
}

.status-pill-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.status-pill-warning::before {
    background: var(--warning-text);
}

.status-pill-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.status-pill-danger::before {
    background: var(--danger-text);
}

.status-pill-neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.status-pill-neutral::before {
    background: var(--neutral-text);
    opacity: 0.5;
}

/* ─── Entity / Detail Header ─────────────────────────────────────── */

.detail-header-main,
.entity-header,
.entity-title-row,
.entity-meta-row {
    display: flex;
    gap: 10px;
}

.entity-header {
    flex-direction: column;
    gap: 5px;
}

.entity-title-row {
    align-items: center;
    flex-wrap: wrap;
}

.entity-meta-row {
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.88rem;
    gap: 10px;
}

.surface-panel .fa-solid,
.surface-panel .fa-regular {
    color: var(--brand-accent);
}

/* ─── Flat Button ────────────────────────────────────────────────── */

.button-flat {
    border: none;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.button-flat:hover {
    border: 1px solid lightgray;
}

/* ─── Diagram inline actions ─────────────────────────────────────── */

.diagram-inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* ─── Validation ─────────────────────────────────────────────────── */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* ─── Blazor Error UI ────────────────────────────────────────────── */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczcGVjLzIwMDAvc3ZnIiBvdmVyZmxvdz0iaGlkZGVuIj48cGF0aCBkPSJNMjguNTA2IDBDMjkuNzE3IDAgMzAuODEzLjQ4MzcgMzEuNjA2IDEuMjY1OEwzMi4wNTIgMS43OTg3IDMyLjUzOSAyLjYyODMgNTUuMTg1IDQxLjE4MzEgNTUuNTQ1IDQxLjc5NSA1NS42NTYgNDEuOTk2QzU1Ljg3NyA0Mi41MTMgNTYgNDMuMDgxNSA1NiA0My42NzgyQzU2IDQ2LjA2NTEgNTQuMDM4IDQ4IDUxLjYxNyA0OEw0LjM4MyA0OEMxLjk2MyA0OCAwIDQ2LjA2NTEgMCA0My42NzgyQzAgNDMuMzc5OS4wMzEgNDMuMDg4Ni4wODkgNDIuODA3MkwuMzM4IDQyLjAxNjIgLjg1OCA0MS4xMzE0IDIzLjQ3MyAyLjYyOTQgMjMuOTYxIDEuNzk4NSAyNC40MDcgMS4yNjU4QzI1LjIgLjQ4MzcgMjYuMjk2IDAgMjcuNTA2IDBaIiBmaWxsPSIjRkZFNTAwIi8+PC9zdmc+) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: 'An error has occurred.'
}

/* ─── Loading Progress ───────────────────────────────────────────── */

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, 'Loading');
}

code {
    color: #c02d76;
}

/* ─── Fluent Dialog Overrides ────────────────────────────────────── */

fluent-dialog::part(dialog) {
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
    border: 1px solid var(--surface-border);
}

fluent-dialog .fluent-dialog-header,
fluent-dialog [slot="header"] {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--surface-border);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-strong);
}

fluent-dialog .fluent-dialog-body,
fluent-dialog [slot="body"] {
    padding: 20px 24px;
}

fluent-dialog .fluent-dialog-footer,
fluent-dialog [slot="footer"] {
    padding: 16px 24px;
    border-top: 1px solid var(--surface-border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ─── Fluent DataGrid Overrides ──────────────────────────────────── */

.fluent-data-grid {
    --fluent-data-grid-header-opacity: 1;
}

.fluent-data-grid thead tr th {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted) !important;
    background: #f8fafc !important;
    border-bottom: 2px solid var(--surface-border) !important;
    padding: 10px 12px !important;
}

.fluent-data-grid tbody tr td {
    /* FluentDataGrid setzt inline height:32px pro Zelle — mehrzeilige
       Zellinhalte (entity-row-stack) überlappen sonst. */
    height: auto !important;
    padding: 12px !important;
    vertical-align: top !important;
    border-bottom: 1px solid var(--surface-border) !important;
}

.fluent-data-grid tbody tr:last-child td {
    border-bottom: none !important;
}

.fluent-data-grid tbody tr:hover td {
    background: #f5f8fd !important;
}

/* ─── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .app-sidenav {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
    }

    .app-brand-link {
        padding: 12px 16px;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }

    .app-brand-subtitle {
        display: none;
    }

    .app-sidenav-items {
        flex-direction: row;
        flex: 1;
        padding: 6px 8px;
        gap: 2px;
        overflow-x: auto;
    }

    .app-sidenav-section-label {
        display: none;
    }

    .app-sidenav-footer {
        display: none;
    }

    .app-main {
        min-height: calc(100vh - 56px);
    }

    .app-page {
        padding: 16px;
    }

    .page-intro,
    .toolbar-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions {
        justify-content: flex-start;
    }
}
