/* ==========================================================================
   Ergänzungen für den Betrieb außerhalb von Divi
   (bisher implizit vom Theme geliefert)
   ========================================================================== */

/* Montserrat – selbst gehostet, Dateien per `npm run fonts` nach /fonts kopieren */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100;
    font-display: swap;
    src: url('/fonts/montserrat-latin-100-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/montserrat-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/montserrat-latin-500-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/montserrat-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/montserrat-latin-700-normal.woff2') format('woff2');
}

/* Divi setzt global border-box – ohne das laufen die Inputs (width:100% + padding) über */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    margin: 0;
    padding: 0;
    background: transparent; /* Seitenhintergrund der WordPress-Seite scheint durch */
    color-scheme: light;
}

/* Nur im iframe: Höhe regelt die Elternseite per postMessage */
html.eingebettet,
html.eingebettet body {
    overflow: hidden;
}

body {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.7;
}

/* An Divi-Grundstyles angleichen – per Vergleich mit der Live-Seite feinjustieren */
h2,
h3,
h4,
p {
    margin-top: 0;
}

[hidden] {
    display: none !important;
}

/* Honeypot – für Menschen unsichtbar, aber nicht display:none (sonst ignorieren Bots es) */
.hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Fehlermeldung statt alert() */
.form-error {
    color: #dc3545;
    font-size: 14px;
    font-weight: 500;
    margin: 15px 0 0;
    text-align: center;
}

/* Turnstile: kompakte Variante auf sehr schmalen Displays wählt script.js */
.turnstile-container {
    margin-top: 20px;
    min-height: 65px;
    max-width: 100%;
}

/* ==========================================================================
   Kalkulator-Layout – Mobile first
   Grundstyles gelten für Smartphones, Media Queries erweitern für
   größere Bildschirme (480px: große Smartphones / quer, 768px: Tablet/Desktop).
   ========================================================================== */

/* === Globale Variablen === */
:root {
    --primary-color: #e09900;
    --secondary-color: #8e6600;
    --text-color: #333;
    --heading-color: #8e6600;
    --background-light: #faf8f5;
    --background-white: #ffffff;
    --border-color: #e5dcc9;
    --border-radius: 8px;
    --shadow: 0 2px 8px rgba(142, 102, 0, 0.1);
    --transition: all 0.3s ease;

    /* Abstände – werden auf größeren Bildschirmen überschrieben */
    --space-container: 12px;
    --space-card: 16px;
    --space-section: 16px;

    /* Mindesthöhe für Touch-Ziele (Apple/Google-Empfehlung: 44–48px) */
    --touch-target: 48px;
}

@media (min-width: 480px) {
    :root {
        --space-container: 20px;
        --space-card: 24px;
        --space-section: 20px;
    }
}

@media (min-width: 768px) {
    :root {
        --space-container: 40px;
        --space-card: 30px;
        --space-section: 25px;
    }
}

/* === Container === */
.maler-kalkulator-container {
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-container);
    background-color: var(--background-light);
    color: var(--text-color);
    overflow-wrap: break-word;
}

@media (min-width: 768px) {
    .maler-kalkulator-container {
        border-radius: var(--border-radius);
    }
}

/* === Header === */
.kalkulator-header {
    text-align: center;
    margin-bottom: 20px;
}

.kalkulator-header h2 {
    color: var(--heading-color);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 16px;
    text-wrap: balance;
}

.selection-indicator {
    background-color: var(--background-white);
    padding: 4px 8px 4px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: 8px;
    box-shadow: var(--shadow);
}

.selection-indicator span {
    color: var(--heading-color);
    font-weight: 600;
    font-size: 16px;
}

.btn-reset {
    background: none;
    border: none;
    color: #767676;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    padding: 0 12px;
    text-decoration: underline;
    font-weight: 400;
    touch-action: manipulation;
}

.btn-reset:hover {
    color: var(--secondary-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    width: 33.33%;
    transition: width 0.4s ease;
}

.step-indicator {
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .kalkulator-header {
        margin-bottom: 30px;
    }

    .kalkulator-header h2 {
        font-size: 28px;
        margin-bottom: 20px;
    }

    .selection-indicator {
        padding: 6px 12px 6px 20px;
        column-gap: 15px;
    }
}

/* === Auswahl Innen / Außen === */
.select-button-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 480px) {
    .select-button-container {
        flex-direction: row;
        gap: 1em;
    }
}

/* === Form === */
.kalkulator-form {
    background-color: var(--background-white);
    padding: var(--space-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-step {
    display: none !important;
}

.form-step.active {
    display: block !important;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .form-step.active {
        animation: none;
    }

    .progress-fill {
        transition: none;
    }
}

.form-step h3 {
    color: var(--heading-color);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.form-step h4 {
    color: var(--heading-color);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 12px;
    margin-top: 24px;
}

@media (min-width: 768px) {
    .form-step h3 {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .form-step h4 {
        font-size: 18px;
        margin-bottom: 15px;
        margin-top: 30px;
    }
}

/* === Form Groups === */
.form-group {
    margin-bottom: 20px;
    min-width: 0; /* Grid-/Flex-Kinder dürfen schmaler als ihr Inhalt werden (lange Select-Optionen) */
}

/* Vorname/Nachname: auf Smartphones untereinander, ab 480px nebeneinander */
.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 16px;
}

@media (min-width: 480px) {
    .form-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--heading-color);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.45;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: var(--touch-target);
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Montserrat', sans-serif;
    font-size: 16px; /* unter 16px zoomt iOS beim Fokussieren in die Seite */
    line-height: 1.4;
    color: var(--text-color);
    transition: var(--transition);
    background-color: white;
}

.form-group input::placeholder {
    color: #9a9a9a;
    opacity: 1;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(224, 153, 0, 0.1);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e6600' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    /* Lange Optionstexte im geschlossenen Feld abschneiden statt das Layout zu sprengen */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

@media (min-width: 768px) {
    .form-group input[type="number"],
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="tel"],
    .form-group select {
        padding: 12px 15px;
    }

    .form-group select {
        background-position: right 15px center;
        padding-right: 40px;
    }
}

/* === Field Hints === */
.field-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.5;
    color: #666;
    font-style: italic;
}

/* === Checkbox === */
.checkbox-group {
    margin-top: 15px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-weight: 400;
}

.form-group .checkbox-label {
    display: flex; /* sonst gewinnt „.form-group label { display: block }“ */
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.checkbox-label span {
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
}

.checkbox-label a {
    color: var(--secondary-color);
    text-decoration: underline;
}

.checkbox-label a:hover {
    color: var(--primary-color);
}

/* === Buttons === */
/* Smartphone: Buttons volle Breite untereinander, Hauptaktion oben (column-reverse,
   da „Zurück“ im DOM vor „Weiter“ steht). Ab 480px nebeneinander. */
.form-navigation {
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    margin-top: 24px;
}

@media (min-width: 480px) {
    .form-navigation {
        flex-direction: row;
        gap: 15px;
        margin-top: 30px;
    }
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--touch-target);
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-wrap: balance;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 480px) {
    .btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 14px 24px;
    }

    /* „Zurück“ nur so breit wie nötig, die Hauptaktion bekommt den Rest */
    .form-navigation .btn-prev {
        flex: 0 0 auto;
    }
}

.btn-next,
.btn-submit {
    background-color: var(--primary-color);
    color: white;
}

.btn-prev {
    background-color: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

.btn-next:active,
.btn-submit:active {
    background-color: var(--secondary-color);
}

/* Hover-Effekte nur für Geräte mit Maus – auf Touch bleiben sie sonst „hängen“ */
@media (hover: hover) {
    .btn-next:hover,
    .btn-submit:hover {
        background-color: var(--secondary-color);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(142, 102, 0, 0.3);
    }

    .btn-prev:hover {
        background-color: var(--secondary-color);
        color: white;
    }
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === Price Display === */
.price-display {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 24px 16px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 16px;
}

.price-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 10px;
    opacity: 0.95;
}

.price-amount {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1;
}

.price-amount::before {
    content: "ca. ";
    font-size: small;
    font-weight: 100;
}

.price-disclaimer {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .price-display {
        padding: 40px 30px;
        margin-bottom: 20px;
    }

    .price-title {
        margin-bottom: 15px;
    }

    .price-amount {
        font-size: 56px;
    }
}

.price-zusatz {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.price-info-box {
    background-color: var(--background-light);
    padding: 1em;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.price-info-box h4 {
    color: var(--heading-color);
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0;
}

.price-info-box p {
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.price-footnote {
    font-size: 12px;
    line-height: 1.5;
    color: #666;
    font-style: italic;
    text-align: center;
    margin-top: 12px;
}

/* === Contact Section === */
.contact-section {
    background-color: var(--background-light);
    padding: var(--space-section);
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.contact-section h4 {
    margin-top: 0;
}

.contact-section p {
    color: var(--text-color);
    margin-bottom: 16px;
}

.contact-section > .form-group:last-child {
    margin-bottom: 0;
}

/* === Success Message === */
.success-message {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.success-icon {
    width: 64px;
    height: 64px;
    background-color: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
}

.success-message h3 {
    color: var(--heading-color);
    font-size: 21px;
    line-height: 1.3;
    margin-bottom: 15px;
}

.success-message p {
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .success-message {
        padding: 60px 30px;
    }

    .success-icon {
        width: 80px;
        height: 80px;
        font-size: 48px;
    }

    .success-message h3 {
        font-size: 24px;
    }
}
