/* ==========================================================================
   Konfigurator-Modal — Terrassendachfabrik
   Fügt diese Datei per <link> ein ODER hängt den Inhalt an deine
   bestehende style.css an. Nutzt eure vorhandenen CSS-Variablen
   (glass-panel, btn, btn-primary etc.) weiter, wo möglich.
   ========================================================================== */

/* Overlay hinter dem Modal */
.kf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 26, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.kf-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* Das Modal-Fenster selbst */
.kf-modal {
    position: fixed;
    top: 4vh;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    width: min(720px, 94vw);
    max-height: 92vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    overflow: hidden;
}

.kf-modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Kopfzeile mit Titel + Steuerungsbuttons (verkleinern / schließen) */
.kf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #2B3038;
    color: #fff;
    flex-shrink: 0;
    cursor: default;
}

.kf-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
}

/* Titel + Schritt-Badge ("Schritt 2/4") in der Kopfzeile */
.kf-modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1 1 auto;
}

.kf-modal-title-group h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kf-step-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.kf-modal-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.kf-modal-controls button {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
    padding: 0;
}

.kf-modal-controls button:hover,
.kf-modal-controls button:focus-visible {
    background: rgba(255, 255, 255, 0.25);
}

.kf-modal-controls svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* ---- Fortschrittsanzeige: welcher der 4 Schritte ist gerade aktiv ---- */
.kf-modal-progress {
    padding: 0.9rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.kf-modal.is-minimized .kf-modal-progress {
    display: none;
}

.kf-steps {
    list-style: none;
    display: flex;
    margin: 0 0 0.5rem;
    padding: 0;
}

.kf-step {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
}

.kf-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 13px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #E2E4E8;
    z-index: 0;
}

.kf-step.is-done:not(:last-child)::after {
    background: var(--color-accent-green, #10B981);
}

.kf-step-dot {
    position: relative;
    z-index: 1;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #E2E4E8;
    color: #8A8F98;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.kf-step.is-active .kf-step-dot {
    background: var(--color-accent-gradient, #0077E5);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 119, 229, 0.15);
}

.kf-step.is-done .kf-step-dot {
    background: var(--color-accent-green, #10B981);
    color: #fff;
}

.kf-step-check {
    display: none;
    width: 13px;
    height: 10px;
}

.kf-step.is-done .kf-step-num {
    display: none;
}

.kf-step.is-done .kf-step-check {
    display: block;
}

.kf-step-name {
    font-size: 0.7rem;
    line-height: 1.2;
    color: #8A8F98;
    max-width: 100px;
}

.kf-step.is-active .kf-step-name {
    color: var(--color-anthracite, #333);
    font-weight: 600;
}

.kf-progress-label {
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    color: #8A8F98;
}

.kf-progress-current {
    font-weight: 600;
    color: var(--color-anthracite, #333);
}

/* Body — hier lebt das bestehende Formular (#quote-form) */
.kf-modal-body {
    padding: 1.25rem 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

/* ---- Verkleinerter Zustand (minimiert, bleibt sticky sichtbar) ---- */
.kf-modal.is-minimized {
    top: auto;
    bottom: 20px;
    left: auto;
    right: 20px;
    transform: none;
    width: 280px;
    max-height: 56px;
    border-radius: 12px;
}

.kf-modal.is-minimized .kf-modal-body {
    display: none;
}

.kf-modal.is-minimized .kf-modal-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.kf-modal.is-minimized .kf-modal-header h3::after {
    content: " (fortsetzen)";
    font-weight: 400;
    opacity: 0.75;
    font-size: 0.85em;
}

/* Icon-Wechsel: im minimierten Zustand zeigt der Verkleinern-Button ein "Erweitern"-Icon */
.kf-modal:not(.is-minimized) .kf-icon-expand,
.kf-modal.is-minimized .kf-icon-collapse {
    display: none;
}

.kf-modal.is-minimized .kf-icon-expand {
    display: inline-flex;
}

/* Platzhalter-Teaser, der an der alten Konfigurator-Stelle im Seitenfluss bleibt */
.kf-inline-teaser {
    text-align: center;
    padding: 3rem 1.5rem;
}

.kf-inline-teaser h2 {
    margin-bottom: 0.75rem;
}

.kf-inline-teaser p {
    max-width: 560px;
    margin: 0 auto 1.75rem;
    opacity: 0.85;
}

/* Body-Scroll sperren, während Modal offen (nicht minimiert) ist */
body.kf-modal-locked {
    overflow: hidden;
}

/* Mobile Feinschliff */
@media (max-width: 600px) {
    .kf-modal {
        top: auto;
        bottom: 0;
        left: 0;
        transform: translateY(100%);
        width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }

    .kf-modal.is-open {
        transform: translateY(0);
    }

    .kf-modal.is-minimized {
        bottom: 84px;
        /* über der mobilen Actionbar */
        right: 12px;
        left: auto;
        width: 240px;
        border-radius: 12px;
    }

    .kf-modal-title-group h3 {
        font-size: 0.95rem;
    }

    .kf-step-name {
        display: none;
    }

    .kf-step-dot {
        width: 22px;
        height: 22px;
        font-size: 0.68rem;
    }

    .kf-step:not(:last-child)::after {
        top: 11px;
    }
}
