/* =========   Kundenansicht: Startseite (Home.razor) und Space-Ansicht (SpaceView.razor)   ========= */

/* Oben ausrichten statt wie Verwaltungslisten vertikal zu zentrieren. */
.page-content-wrapper.customer-view-page-content {
    justify-content: flex-start;
}

/* width: 100% ist Pflicht: .page-content-wrapper ist eine Flex-Spalte, und margin: auto allein ließe die Ansicht
   auf Inhaltsbreite schrumpfen – das Kachel-Grid bekäme dann nur zwei Spalten. */
.customer-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding-bottom: 24px;
}

.customer-skeleton {
    border-radius: 12px;
}

/* ---------- Willkommen ---------- */

.customer-welcome {
    padding: 24px 0 4px;
}

.customer-welcome-title {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ---------- Abschnitte ---------- */

.customer-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customer-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ---------- Space-Kacheln ---------- */

.customer-space-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.customer-space-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 76px;
    padding: 14px 16px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.customer-space-tile:hover,
.customer-space-tile:focus-visible {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.customer-space-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--mud-palette-action-default-hover);
}

.customer-space-tile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.customer-space-tile-name {
    font-weight: 600;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-space-tile-arrow {
    flex: 0 0 auto;
    color: var(--mud-palette-text-secondary);
    transition: transform 120ms ease, color 120ms ease;
}

.customer-space-tile:hover .customer-space-tile-arrow {
    color: var(--mud-palette-primary);
    transform: translateX(3px);
}

/* ---------- Weiter, wo Sie aufgehört haben / Zuletzt besucht ---------- */

.customer-resume {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: filter 120ms ease, transform 120ms ease;
}

.customer-resume:hover,
.customer-resume:focus-visible {
    filter: brightness(1.08);
    transform: translateY(-1px);
    outline: none;
}

.customer-resume-text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.customer-resume-label {
    font-size: 0.8rem;
    opacity: 0.85;
}

.customer-resume-target {
    font-size: 1.1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-recent {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.customer-recent-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.customer-recent-link:hover,
.customer-recent-link:focus-visible {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
    outline: none;
}

.customer-operations-link {
    display: flex;
    justify-content: flex-end;
}

/* ---------- Leere Zustände ---------- */

.customer-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 24px;
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: 12px;
    text-align: center;
}

.customer-empty-state-compact {
    padding: 32px 24px;
}

/* ---------- Space-Ansicht ---------- */

/* Mit Auswertungen füllt die Ansicht genau den Bildschirm – samt Footer, ohne Scrollen: Kopf oben, die Auswertung nimmt
   die restliche Höhe. Abgezogen werden der Kopfabstand von MudMainContent (7/8 der AppBar-Höhe, auch ohne AppBar) und
   der Footer (AppFooter, eine Zeile mit py-2) samt etwas Luft; die Innenabstände darunter entfallen dann (siehe unten). */
.customer-space-screen {
    --customer-screen-chrome: calc(var(--mud-appbar-height) * 7 / 8 + 48px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - var(--customer-screen-chrome));
    height: calc(100dvh - var(--customer-screen-chrome));
    min-height: 480px;
}

.customer-view:has(> .customer-space-screen:not(.customer-space-screen-auto)) {
    padding-bottom: 0;
}

.page-content-wrapper.customer-view-page-content:has(.customer-space-screen:not(.customer-space-screen-auto)) {
    min-height: 0;
    padding-bottom: 0;
}

.customer-space-screen-auto {
    height: auto;
    min-height: 0;
}

.customer-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    /* Platz für das Menü oben rechts (MudFabMenu). */
    padding-right: 72px;
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
}

.customer-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--mud-palette-text-secondary);
    text-decoration: none;
}

.customer-breadcrumb a:hover {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.customer-breadcrumb [aria-current="page"] {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.customer-breadcrumb-separator {
    opacity: 0.6;
}

/* Untergeordnete Spaces unter dem Pfad (CustomerChildSpacePicker): eine kompakte Zeile, damit die Auswertung darunter
   den Bildschirm füllt. */
.customer-child-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.customer-child-picker-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 4px;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.customer-child-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 240px;
    padding: 2px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.customer-child-link span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-child-link:hover,
.customer-child-link:focus-visible {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}

/* „Alle anzeigen" bei vielen Unter-Spaces: sieht aus wie die Links daneben, öffnet aber den SpacePicker. */
.customer-child-show-all {
    background: none;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--mud-palette-primary);
    cursor: pointer;
}

/* „Space wechseln" am Ende des Pfads. */
.customer-switch-space {
    margin-left: auto;
    text-transform: none;
}

/* ---------- SpacePicker in der Kundenansicht (CustomerSpaceNavigator) ---------- */

/* Als Fläche wie die Kacheln; Zeilen großzügig und gut zu treffen – auch auf dem Tablet. */
.customer-view .customer-space-navigator {
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background: var(--mud-palette-surface);
}

.customer-space-navigator .mud-treeview-item-content {
    min-height: 44px;
    border-radius: 8px;
}

.customer-space-navigator .mud-treeview-item-content .mud-typography {
    font-size: 1rem;
}

.customer-space-navigator .mud-treeview-item-content:hover .mud-typography {
    color: var(--mud-palette-primary);
}

.customer-space-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.customer-space-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--mud-palette-action-default-hover);
}

.customer-space-header-text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.customer-space-header-name {
    font-weight: 600;
    letter-spacing: -0.01em;
    word-break: break-word;
}

/* Chart-Auswahl (CustomerChartPicker): Gruppentitel zwischen den Einträgen. */
.customer-chart-picker .mud-button-label {
    text-transform: none;
}

.customer-chart-picker-group {
    padding: 10px 16px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.customer-chart-picker-item.active {
    font-weight: 600;
    color: var(--mud-palette-primary);
}

/* Die Auswertung füllt die restliche Höhe (EvaluationView mit FillHeight, wie im Dialog). */
.customer-chart-stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

/* Alle Arten (Chart, Tabelle, Kennzahl, Ranking …) mit demselben Innenabstand – sonst klebt der Inhalt an der Rundung. */
.customer-chart-stage .evaluation-chart-panel,
.customer-chart-stage .evaluation-module-panel {
    padding: 16px 20px;
    border-radius: 12px;
}

@media (max-width: 960px) {
    .customer-space-screen {
        min-height: 440px;
    }

    .customer-welcome {
        padding-top: 8px;
    }
}

/* ---------- Kundenmodus: Benutzer ohne Navigations-Einträge (MainLayout) ---------- */

/* Kein Drawer, also auch kein Platz für den vertikalen Seitentitel – die Ansicht bekommt die volle Breite. */
.customer-mode .page-title-vertical {
    display: none;
}

.customer-mode .page-content-wrapper {
    margin-left: 0;
}
