/* Layout für die eigenständige Single-Form-Anwendung (MitNetForms). */

html, body {
    min-height: 100%;
    background-color: var(--color-background, #f9fafb);
}

.mnf-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem 3rem 1rem;
    box-sizing: border-box;
    /* Mandanten-Branding: der Seitenhintergrund nimmt die Primärfarbe des über
       die Form-ID ermittelten Mandanten an (Default = MitNet-Grün, falls kein
       Theme geladen). Die Wurzelseite nutzt diesen Shell bewusst nicht. */
    background-color: var(--primary-background-color, #ffffff);
}

.mnf-container {
    width: 100%;
    max-width: 900px;
    background-color: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: var(--default-border-radius, 0.3rem);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
    padding: 2rem 2rem 2.5rem 2rem;
    box-sizing: border-box;
}

.mnf-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.mnf-logo img {
    max-height: 72px;
    max-width: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Das Logo liegt auf der Mandanten-Primärfarbe – dezenter Schlagschatten
       sorgt für Kontrast (analog zur Design-Vorgabe). */
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

.mnf-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 2rem;
    color: var(--primary-background-color, #229D5C);
}

.mnf-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text, #3D3B3B);
}

.mnf-message-icon {
    display: block;
    font-size: 2.5rem;
    color: var(--error-color, #b91c1c);
    margin-bottom: 1rem;
}

/* ===== Formular-Kopf (Titel / Untertitel) ===== */
.mnf-form-title {
    color: var(--primary-background-color, #229D5C);
    text-transform: uppercase;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
}

.mnf-form-subtitle {
    margin-top: 0.5rem;
    text-align: center;
    color: var(--color-text, #3D3B3B);
    font-size: 1rem;
}

/* Dezente Trennlinie unter dem Formular-Kopf (Design-Vorgabe: 3px, stark
   transparent) – überschreibt die kräftige globale .form-separator nur hier. */
.mnf-container .form-separator,
.mnf-embed-inner .form-separator {
    height: 3px;
    opacity: 0.15;
    border-radius: 2px;
}

/* ===== Nackte Einbettungs-Schiene (/embed) =====
   Kein farbiger Hintergrund, kein Logo, keine Karte/kein Schatten – nur der
   Inhalt zentriert. Bewusst kein min-height/Hintergrund, damit sich die Höhe
   nach dem Inhalt richtet und der transparente Body die Gastseite durchscheinen
   lässt (vgl. <HeadContent> in FormView/SuccessView). Erlaubtes Branding sind
   ausschließlich die Theme-Farben (Buttons/Linien/Schriften). */
.mnf-embed {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.mnf-embed-inner {
    width: 100%;
    max-width: 900px;
}

@media (max-width: 576px) {
    .mnf-shell {
        padding: 1.25rem 0.75rem 2rem 0.75rem;
    }

    .mnf-container {
        padding: 1.25rem 1rem 2rem 1rem;
    }

    .mnf-logo img {
        max-height: 56px;
    }

    .mnf-embed {
        padding: 0.75rem;
    }
}

/* ===== Root-Splashscreen ===== */
.mnf-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    box-sizing: border-box;
    text-align: center;
    background:
        radial-gradient(circle at 50% 30%,
            color-mix(in srgb, var(--primary-light-color, #BFE6D2) 55%, transparent),
            transparent 60%),
        var(--color-background, #f9fafb);
}

.mnf-splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: mnf-splash-in 0.5s ease-out both;
}

.mnf-splash-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background-color: var(--primary-background-color, #229D5C);
    box-shadow: 0 12px 30px color-mix(in srgb, var(--primary-background-color, #229D5C) 35%, transparent);
    animation: mnf-splash-pulse 2.2s ease-in-out infinite;
}

.mnf-splash-badge img {
    width: 58px;
    height: 58px;
}

.mnf-splash-title {
    margin: 1.5rem 0 0 0;
    font-family: var(--title-fontfamily, sans-serif);
    font-size: 2rem;
    font-weight: var(--font-weight-bold, bold);
    color: var(--primary-dark-color, #1A7A49);
    letter-spacing: 0.02em;
}

.mnf-splash-sub {
    margin: 0.75rem 0 0 0;
    max-width: 420px;
    font-family: var(--text-fontfamily, sans-serif);
    font-size: var(--font-size-base, 1rem);
    line-height: var(--line-height-base, 1.6);
    color: var(--color-text-light, #828282);
}

.mnf-splash-dots {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
}

.mnf-splash-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary-background-color, #229D5C);
    opacity: 0.35;
    animation: mnf-splash-dot 1.4s ease-in-out infinite;
}

.mnf-splash-dots span:nth-child(2) { animation-delay: 0.2s; }
.mnf-splash-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mnf-splash-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mnf-splash-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 12px 30px color-mix(in srgb, var(--primary-background-color, #229D5C) 35%, transparent); }
    50%      { transform: scale(1.05); box-shadow: 0 16px 40px color-mix(in srgb, var(--primary-background-color, #229D5C) 45%, transparent); }
}

@keyframes mnf-splash-dot {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50%      { opacity: 1; transform: translateY(-5px); }
}

@media (prefers-reduced-motion: reduce) {
    .mnf-splash-inner,
    .mnf-splash-badge,
    .mnf-splash-dots span {
        animation: none;
    }
}

/* ===== Branding-Lade-Overlay (verhindert das Farb-Flackern) =====
   Deckt die Formularseite ab, bis das mandantenspezifische Branding
   (BrandingHead) geladen und auf die :root-Variablen angewandt ist. Erst dann
   (Klasse --ready) wird es sanft ausgeblendet. Bewusst brand-NEUTRAL gehalten
   (feste Farben bzw. die nicht gebrandete --color-background), damit das Overlay
   nicht selbst mitflackert. */
.mnf-branding-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-background, #f9fafb);
    color: #9ca3af;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.mnf-branding-overlay-spinner {
    font-size: 2.5rem;
    line-height: 1;
}

/* Geladen: ausblenden und für Interaktion/Screenreader vollständig entfernen. */
.mnf-branding-overlay--ready {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .mnf-branding-overlay {
        transition: none;
    }
}

/* ============================================================
   Formular-Flow-Styles (GLOBAL)
   Vormals component-scoped in Formular.razor.css / Success.razor.css.
   Das Markup (Preview-Modal, Loader, Buttons, Erfolgsseite) liegt jetzt in
   den gemeinsamen Komponenten FormView/SuccessView und wird von BEIDEN
   Schienen (/forms und /embed) genutzt. Scoped CSS würde nur an die jeweilige
   Seite binden und hier nicht mehr greifen – daher global. Zugleich erhält
   damit die Erfolgs-Schaltfläche endlich das volle .btn-flow-Styling (wie im
   ursprünglichen Kommentar beabsichtigt: "Preview/Success-Aktionen identisch").
   ============================================================ */

/* --- Loader-Overlay --- */
.submit-loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    backdrop-filter: blur(2px);
}

.submit-loader-icon {
    font-size: 3rem;
    color: var(--primary-background-color, #3b82f6);
    line-height: 1;
}

.submit-loader-text {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    text-align: center;
    padding: 0 1rem;
}

/* --- PDF-Preview-Modal --- */
.preview-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1900;
}

.preview-modal {
    position: fixed;
    inset: 2.5vh 5vw;
    background: #fff;
    border-radius: var(--default-border-radius, 8px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 1950;
    overflow: hidden;
}

.preview-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-text, #1f2937);
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-modal-header i {
    color: var(--primary-background-color, #3b82f6);
}

.preview-modal-body {
    flex: 1;
    min-height: 0;
    background: #f4f4f5;
}

.preview-modal-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.preview-modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
    background: #fafafa;
}

/* --- Buttons (Preview/Success-Aktionen) --- */
.btn-flow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: var(--default-border-radius, 6px);
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-flow:hover {
    filter: brightness(0.95);
}

.btn-flow-primary {
    background: var(--primary-background-color, #3b82f6);
    color: var(--primary-font-color, #fff);
}

.btn-flow-primary:hover {
    background: var(--primary-background-color-hover, var(--primary-background-color, #3b82f6));
    color: var(--primary-font-color-hover, #fff);
    filter: brightness(0.95);
}

.btn-flow-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-flow-secondary:hover {
    background: #e5e7eb;
    color: #111827;
}

/* --- Submit-Error-Banner --- */
.submit-error-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--default-border-radius, 6px);
    background: var(--error-background-color, #fee2e2);
    color: var(--error-color, #b91c1c);
    font-weight: 500;
}

/* --- Erfolgsseite --- */
.success-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.success-icon {
    font-size: 4rem;
    color: var(--success-color, #16a34a);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.success-title {
    color: var(--primary-background-color, #1f2937);
    text-transform: uppercase;
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.success-message {
    color: var(--color-text, #374151);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

.success-email-hint {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0 auto;
}

.success-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* --- Embed: weißen Eigen-Hintergrund des FormRenderers entfernen, damit der
   transparente Body durchscheint. Die gebrandete Schiene bleibt unberührt
   (dort liegt das Formular ohnehin auf der weißen Karte). !important schlägt
   die component-scoped Regel .form-renderer{background:white} aus FormRenderer.razor.css. --- */
.mnf-embed .form-renderer {
    background-color: transparent !important;
}

/* --- Responsive (Formular-Flow) --- */
@media (max-width: 576px) {
    .preview-modal {
        inset: 0;
        border-radius: 0;
    }

    .preview-modal-footer {
        justify-content: stretch;
    }

    .preview-modal-footer .btn-flow {
        flex: 1;
        justify-content: center;
    }

    .success-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .success-actions .btn-flow {
        justify-content: center;
    }
}
