:root {
    --tooltip-header-offset: 100px;
}

.title-with-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.text-center {
    text-align: center;
}

.spacing-top-md {
    margin-top: 20px;
}

.spacing-bottom-md {
    margin-bottom: 20px;
}

.spacing-bottom-sm {
    padding-bottom: 10px;
}

@media (scripting: none) {
    #multiStepForm {
        display: none;
    }
}

.no-js-contact-fallback {
    width: min(100%, 760px);
    box-sizing: border-box;
    margin: 24px auto 40px;
    padding: 24px;
    color: #212607;
    background: #f4f6ee;
    border: 1px solid #d7dcc5;
    border-radius: 8px;
}

.no-js-contact-fallback h2 {
    margin: 0 0 16px;
}

.no-js-contact-fallback__label {
    display: block;
    margin: 18px 0 8px;
    font-weight: 700;
}

.no-js-contact-fallback__template {
    width: 100%;
    min-height: 620px;
    line-height: 1.5;
    color: #212607;
    background: #fff;
    resize: vertical;
}

.no-js-contact-fallback__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
    margin-top: 20px;
}

.no-js-contact-fallback__mail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    color: #fff;
    background: #556412;
    border-radius: 6px;
    text-decoration: none;
}

.no-js-contact-fallback__mail:hover {
    background: #414d0e;
}

.no-js-contact-fallback a:focus-visible,
.no-js-contact-fallback__template:focus-visible {
    outline: 3px solid #212607;
    outline-offset: 3px;
}

.company-field {
    width: 100%;
    max-width: 350px;
}

.remarks-field {
    width: 100%;
    max-width: 650px;
    min-width: 300px;
    min-height: 80px;
    margin: 0;
}

.info {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.info__btn {
    display: inline-grid;
    place-items: center;
    width: 14px;
    height: 14px;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid #999;
    border-radius: 999px;
    background-color: #ffffff;
    cursor: pointer;
}

.info__box {
    position: absolute;
    top: 50%;
    left: calc(100% + 0.5rem);
    z-index: 5;

    width: 260px;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;

    /*
     * Der Tooltip darf nur den Bereich unterhalb
     * des Headers verwenden.
     */
    max-height: calc(100vh - var(--tooltip-header-offset) - 24px);
    max-height: calc(100dvh - var(--tooltip-header-offset) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
    line-height: 1.4;

    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;

    color: #aecc24;
    background-color: #454c20;
    border-radius: 0.5rem;

    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.15s ease,
        transform 0.15s ease;
}

/* Anzeigen bei Hover oder Tastaturfokus */
.info:hover .info__box,
.info:focus-within .info__box {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Kleiner Pfeil */
.info__box::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent #454c20 transparent transparent;
}

/* Viewport-gesteuerte Positionierung; ohne JS bleibt die bisherige Positionierung aktiv */
.info.info--viewport .info__box {
    position: fixed;
    top: 0;
    right: auto;
    bottom: auto;
    left: 0;
    box-sizing: border-box;
    transform: none;
}

.info.info--viewport .info__box::before {
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
}

.info.info--viewport .info__box[data-placement="right"]::before {
    top: var(--tooltip-arrow-position, 50%);
    left: -6px;
    transform: translateY(-50%);
    border-color: transparent #454c20 transparent transparent;
}

.info.info--viewport .info__box[data-placement="left"]::before {
    top: var(--tooltip-arrow-position, 50%);
    right: -6px;
    transform: translateY(-50%);
    border-color: transparent transparent transparent #454c20;
}

.info.info--viewport .info__box[data-placement="bottom"]::before {
    top: -12px;
    left: var(--tooltip-arrow-position, 50%);
    transform: translateX(-50%);
    border-color: transparent transparent #454c20 transparent;
}

.info.info--viewport .info__box[data-placement="top"]::before {
    bottom: -12px;
    left: var(--tooltip-arrow-position, 50%);
    transform: translateX(-50%);
    border-color: #454c20 transparent transparent transparent;
}

.wrapper {
    width: 90%;
    min-height: 400px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f4f5f6;
}

.contact-page-title {
    margin: 0 0 24px;
    color: #212607;
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.2;
}

#multiStepForm {
    width: 100%;
    max-width: 1000px;
    min-height: 400px;
    margin: 0 auto;
    align-content: center;
    background-color: #eff0e8;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.form-message {
    max-width: 1000px;
    margin: 0 auto 20px;
    padding: 12px 16px;
    text-align: center;
    overflow-wrap: break-word;
    border-radius: 3px;
}

.form-message:empty {
    display: none;
}

.form-message.success {
    color: #333;
    background-color: #aecc24;
}

.form-message.error {
    color: #fff;
    background-color: #dc3545;
}

/* Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

.hidden {
    display: none;
}

.visually-hidden-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Layout boxes */
.center-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
}

.center-boxacht {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.kontaktdaten,
.vorinstalliert,
.Bem {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.same-address-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Radio groups */
.center-box .radio-group {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.center-box .radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* Optional: falls Labels + File-Inputs links kleben */
.center-box label,
.center-box input[type="file"] {
    align-self: center;
}

.radio-group label {
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* Progressbar */
.form-progress {
    display: flex;
    width: calc(100% - 120px);
    max-width: 860px;
    height: 18px;
    margin: 30px auto 10px;
    padding: 3px;
    gap: 3px;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #3f471d;
    border: 2px solid #454c20;
    border-radius: 999px;
}

.form-progress__segment {
    flex: 1;
    min-width: 0;
    background-color: transparent;
    border-radius: 999px;
    transition: background-color 0.25s ease;
}

.form-progress__segment.is-active {
    background-color: #aecc24;
}

/* Navigation */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin: 20px 60px;
}

.back-btn,
.next-btn,
.submit-btn {
    padding: 10px 20px;
    color: #fff;
    background-color: #aecc24;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

.next-btn.disabled {
    cursor: not-allowed;
    filter: grayscale(40%);
}

.back-btn {
    background-color: #556412;
}

/* First step alignment */
.form-step:first-of-type .nav-buttons {
    justify-content: flex-end;
}

/* Inputs */
input,
textarea {
    box-sizing: border-box;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus {
    border-color: #007bff;
}

input.error,
textarea.error {
    border-color: #dc3545;
    box-shadow: 0 0 3px #dc3545;
}

.field-error-message {
    width: 100%;
    max-width: 350px;
    margin: -4px auto 4px;
    color: #b00020;
    font-size: 0.9rem;
    line-height: 1.35;
    text-align: left;
}

textarea + .field-error-message,
.center-box > label + .field-error-message {
    max-width: 650px;
}

input[type="file"] {
    width: 100%;
    max-width: 380px;
}

.upload-file-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    margin: 0 0 8px;
    padding: 0;
    gap: 6px;
    list-style: none;
}

.upload-file-list[hidden] {
    display: none;
}

.upload-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    text-align: left;
    background-color: #fff;
    border: 1px solid #d7dcc5;
    border-radius: 6px;
}

.upload-file-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.3;
    color: #333;
    overflow-wrap: anywhere;
}

.upload-file-remove {
    display: inline-grid;
    flex: 0 0 28px;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    color: #fff;
    background-color: #dc3545;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.upload-file-remove:focus-visible {
    outline: 2px solid #454c20;
    outline-offset: 2px;
}

/* Field widths */
.prename,
.surename,
.kwh,
.tel,
.mail {
    width: 100%;
    max-width: 350px;
}

/* Address rows */
.adresse,
.town {
    display: flex;
    justify-content: center;
    width: 350px;
    max-width: 350px;
    gap: 10px;
}

.adresse input,
.town input {
    min-width: 0; /* wichtig bei flex */
}

.form-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.adresse .form-field,
.town .form-field {
    align-self: flex-start;
}

.form-field .field-error-message {
    max-width: none;
    margin: 6px 0 0;
}

.form-field--street {
    flex: 0 0 270px;
    width: 270px;
}

.form-field--number {
    flex: 0 0 70px;
    width: 70px;
}

.form-field--postcode,
.form-field--town {
    flex: 0 0 170px;
    width: 170px;
}

.street,
.nbr,
.plz,
.twn {
    width: 100%;
}

.batundwal {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 80px;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.title-label {
    display: inline-block;
}

.req-star {
    font-size: .9em;
    position: relative;
    top: -0.2em;
    line-height: 1;
}

.option-block {
    flex: 0 0 260px;
    max-width: 260px;
    text-align: center;
}

.privacy-hint {
    max-width: 650px;
    margin: 0 auto;
    overflow-wrap: break-word;
}

/* Summary */
#summaryBox {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    overflow-wrap: break-word;
    background-color: #f4f5f6;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

.summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 20px;
}

.summary-left,
.summary-right {
    flex: 1;
    min-width: 250px;
}

.summary-left h4,
.summary-right h4 {
    margin-bottom: 5px;
    color: #333;
    text-decoration: underline;
}

.summary-left p,
.summary-right p {
    margin-bottom: 12px;
    color: #555;
    line-height: 1.4;
}

.summary-remarks {
    margin-bottom: 20px;
    text-align: center;
}

.summary-remarks h4 {
    margin-bottom: 5px;
    text-decoration: underline;
}

.summary-images {
    font-style: italic;
    color: #666;
    text-align: center;
}

.summary-images h4 {
    color: #000;
    text-decoration: underline;
}

/* Loading state */
.submit-btn.is-loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn.is-loading::after {
    content: " …";
}

/* =========================
   Tablet: 768px bis 1024px
   ========================= */
@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --tooltip-header-offset: 85px;
    }

    .wrapper {
        width: 94%;
        padding: 16px;
        box-sizing: border-box;
    }

        .contact-page-title {
        font-size: 1.9rem;
    }

    #multiStepForm {
        min-height: auto;
        box-sizing: border-box;
    }

    .form-progress {
        width: calc(100% - 60px);
        max-width: 760px;
        height: 16px;
        margin: 24px auto 10px;
        padding: 3px;
        gap: 3px;
    }

    .center-box,
    .center-boxacht,
    .form-message {
        box-sizing: border-box;
    }

    .nav-buttons {
        margin: 20px 30px;
        gap: 12px;
    }

    .batundwal {
        width: 100%;
        gap: 20px;
    }

    .option-block {
        max-width: 100%;
    }

    .remarks-field {
        min-width: 0;
        max-width: 100%;
    }

    .info__box {
        left: 50%;
        top: calc(100% + 10px);
        transform: translateX(-50%);
        width: min(260px, calc(100vw - 40px));
        max-width: calc(100vw - 40px);
    }

    .info__box::before {
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        border-color: transparent transparent #454c20 transparent;
    }

    #summaryBox {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .summary-left,
    .summary-right {
        min-width: 0;
    }
}

/* =========================
   Mobile: bis 767px
   ========================= */
@media (max-width: 767px) {
    .wrapper {
        width: 100%;
        padding: 12px;
        box-sizing: border-box;
        overflow-x: hidden;
    }

        .contact-page-title {
        font-size: 1.6rem;
    }

    #multiStepForm {
        min-height: auto;
    }

    .form-progress {
        width: calc(100% - 24px);
        max-width: none;
        height: 14px;
        margin: 22px auto 12px;
        padding: 2px;
        gap: 2px;
        border-width: 2px;
    }

    .title-with-info {
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0 10px;
    }

    .center-box,
    .center-boxacht {
        padding: 16px 12px;
    }

    /*
     * Kontaktadresse zentrieren
     */
    .kontaktdaten {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .kontaktdaten .adresse,
    .kontaktdaten .town {
        width: 100%;
        max-width: 260px;
        margin-inline: auto;
    }

    /*
     * Labels der Bilduploads zentrieren
     */
    .center-box > label[for] {
        align-self: center;
        width: 100%;
        max-width: 320px;
        text-align: center;
    }

    /*
     * Datei-Inputs zentrieren
     */
    .center-box > input[type="file"] {
        align-self: center;
        width: 100%;
        max-width: 460px;
        margin-inline: auto;
        padding: 10px 8px;
        font-size: 0.9rem;
        text-align: center;
    }

    .center-box > input[type="file"]::file-selector-button {
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .upload-file-list {
        max-width: 460px;
    }

    .prename,
    .surename,
    .kwh,
    .tel,
    .mail,
    .company-field {
        width: 100%;
        max-width: 260px;
        min-width: 0;
    }

    .center-box > input + .field-error-message {
        max-width: 260px;
    }

    .remarks-field {
        width: 100%;
        min-width: 0;
        min-height: 120px;
        max-width: 100%;
    }

    .adresse,
    .town {
        width: 100%;
        max-width: 260px;
        gap: 10px;
        margin-inline: auto;
    }

    .form-field--street {
        flex: 0 0 calc((100% - 10px) * 0.794);
        width: calc((100% - 10px) * 0.794);
        min-width: 0;
    }

    .form-field--number {
        flex: 0 0 calc((100% - 10px) * 0.206);
        width: calc((100% - 10px) * 0.206);
        min-width: 0;
    }

    .form-field--postcode,
    .form-field--town {
        flex: 0 0 calc((100% - 10px) / 2);
        width: calc((100% - 10px) / 2);
        min-width: 0;
    }

    .batundwal {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 28px;
    }

    .option-block {
        flex: 0 1 auto;
        width: 100%;
        max-width: 100%;
        margin-bottom: 0;
        text-align: center;
    }

    .option-block .radio-group {
        margin-bottom: 0;
    }

    .nav-buttons {
        flex-direction: column;
        align-items: stretch;
        margin: 20px 12px;
        gap: 10px;
    }

    .back-btn,
    .next-btn,
    .submit-btn {
        width: 100%;
    }

    .same-address-check {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 6px;
        text-align: center;
    }

    .same-address-check input[type="checkbox"] {
        margin: 0;
        transform: translateY(-1px);
    }

    .summary-grid {
        gap: 20px;
    }

    .summary-left,
    .summary-right {
        min-width: 100%;
    }

    #summaryBox {
        padding: 16px 12px;
    }

    .info__box {
        left: 50%;
        top: calc(100% + 10px);
        transform: translateX(-50%);
        width: min(260px, calc(100vw - 32px));
        max-width: calc(100vw - 32px);
    }

    .info__box::before {
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        border-color: transparent transparent #454c20 transparent;
    }

    #multiStepForm,
    .form-message,
    .center-box,
    .center-boxacht,
    #summaryBox,
    input,
    textarea,
    select {
        box-sizing: border-box;
        max-width: 100%;
    }

    .form-step {
        overflow-x: hidden;
    }
}
