/* Verbindungsanzeige (Reconnect-Dialog) – reines CSS, unabhängig von MudBlazor und vom Blazor-Circuit. */

.verbindung-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    border: 0;
    padding: 0;
    max-width: min(26rem, calc(100vw - 2rem));
    width: 100%;
    border-radius: 12px;
    background: #fff;
    color: #17202a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
    font-family: Montserrat, Helvetica, Arial, sans-serif;
}

.verbindung-dialog::backdrop {
    background: rgba(9, 39, 68, .65);
}

html[data-theme="dark"] .verbindung-dialog {
    background: #27272f;
    color: #e6e6ea;
}

.verbindung-inhalt {
    padding: 1.5rem 1.25rem 1.25rem;
    text-align: center;
}

.verbindung-titel {
    margin: 0 0 .5rem;
    font-size: 1.25rem;
    line-height: 1.3;
}

.verbindung-text {
    display: none;
}

.verbindung-text p {
    margin: .4rem 0;
    line-height: 1.45;
}

.verbindung-versuch {
    font-size: .85rem;
    opacity: .75;
}

.verbindung-naechster {
    display: none;
}

.verbindung-dialog.components-reconnect-retrying .verbindung-naechster {
    display: inline;
}

/* Sichtbar ist genau der Zustand, den verbindung.js per data-zustand setzt. */
.verbindung-dialog[data-zustand="verbinden"] [data-zustand-anzeige="verbinden"],
.verbindung-dialog[data-zustand="failed"] [data-zustand-anzeige="failed"],
.verbindung-dialog[data-zustand="rejected"] [data-zustand-anzeige="rejected"],
.verbindung-dialog[data-zustand="paused"] [data-zustand-anzeige="paused"] {
    display: block;
}

.verbindung-aktionen [data-zustand-anzeige] {
    display: none;
}

.verbindung-dialog[data-zustand="failed"] .verbindung-aktionen [data-zustand-anzeige="failed"],
.verbindung-dialog[data-zustand="paused"] .verbindung-aktionen [data-zustand-anzeige="paused"] {
    display: inline-block;
}

.verbindung-dialog:not([data-auto-reload-aktiv]) [data-auto-reload] {
    display: none;
}

.verbindung-spinner {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 1rem;
    border: 4px solid rgba(0, 135, 255, .25);
    border-top-color: #0087ff;
    border-radius: 50%;
    animation: verbindung-dreh 1s linear infinite;
}

.verbindung-dialog:not([data-zustand="verbinden"]) .verbindung-spinner {
    display: none;
}

@keyframes verbindung-dreh {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .verbindung-spinner { animation-duration: 4s; }
}

.verbindung-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
    margin-top: 1rem;
}

.verbindung-dialog[data-zustand="verbinden"] #verbindung-neu-laden {
    display: none;
}

.verbindung-knopf {
    min-height: 44px; /* Touch-Ziel */
    padding: .5rem 1.1rem;
    border: 1px solid #0d5e9c;
    border-radius: 8px;
    background: transparent;
    color: #0d5e9c;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

html[data-theme="dark"] .verbindung-knopf { color: #91c9ec; border-color: #91c9ec; }

.verbindung-knopf-primaer {
    background: #0d5e9c;
    border-color: #0d5e9c;
    color: #fff;
}

.verbindung-knopf-klein {
    min-height: 36px;
    padding: .25rem .75rem;
}

/* Nicht-blockierende Hinweisleiste am unteren Rand */
.verbindung-hinweis {
    position: fixed;
    left: .75rem;
    right: .75rem;
    bottom: .75rem;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    border-radius: 8px;
    color: #fff;
    font-size: .9rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}

.verbindung-hinweis[hidden] { display: none; }

.verbindung-hinweis-warnung { background: #b26a00; }

.verbindung-hinweis-fehler { background: #b3261e; }

.verbindung-hinweis .verbindung-knopf { color: #fff; border-color: #fff; }

/* Interaktive Seite, deren Circuit noch nicht steht: Bedienelemente sind (noch) wirkungslos.
   Klicks werden sofort abgefangen, die optische Abdunklung folgt erst nach einer Sekunde,
   damit schnelle Verbindungen nicht flackern. Links (a[href]) bleiben bewusst benutzbar. */
html:not(.blazor-bereit) body[data-interaktiv="true"] :is(button, input, select, textarea, [role="button"], [role="tab"], [role="menuitem"]):not(.verbindung-knopf):not([data-immer-aktiv]) {
    pointer-events: none;
}

html:not(.blazor-bereit).blazor-wartet body[data-interaktiv="true"] :is(button, input, select, textarea, [role="button"], [role="tab"], [role="menuitem"]):not(.verbindung-knopf):not([data-immer-aktiv]) {
    opacity: .55;
    cursor: progress;
}

/* Dünne Ladeleiste am oberen Rand, solange der Circuit noch nicht steht (html.blazor-bereit wird von verbindung.js gesetzt). */
.start-ladeleiste {
    display: none;
}

html:not(.blazor-bereit) body[data-interaktiv="true"] .start-ladeleiste {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    overflow: hidden;
    z-index: 10000;
    pointer-events: none;
    background-color: rgba(128, 128, 128, 0.2);
}

.start-ladeleiste::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background-color: var(--ligen-blau, #1565c0);
    border-radius: 4px;
    animation: start-ladeleiste-lauf 1.2s ease-in-out infinite;
}

@keyframes start-ladeleiste-lauf {
    from { left: -40%; }
    to { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .start-ladeleiste::before { animation: none; width: 100%; opacity: 0.6; }
}
