/* ==========================================================================
   Formular Plugin - Haupt-Styles
   ========================================================================== */

/* Allgemeine Formular-Block Styles
   ========================================================================== */
.formular-block {
    margin: 2em 0;
    padding: 0;
}

.formular-block-placeholder,
.formular-block-error {
    padding: 2em;
    background: #f0f0f1;
    border: 2px dashed #ccc;
    border-radius: 4px;
    text-align: center;
    color: #666;
}

/* Titel und Beschreibung
   ========================================================================== */
.formular-titel {
    margin: 0 0 1em;
    font-size: 2em;
    font-weight: 700;
    line-height: 1.2;
}

.formular-beschreibung {
    margin: 0 0 2em;
    color: #666;
}

.formular-beschreibung p:last-child {
    margin-bottom: 0;
}

/* Formular-Container
   ========================================================================== */
.formular-form {
    width: 100%;
}

/* Felder-Grid
   ========================================================================== */
.formular-felder {
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    margin-bottom: 1.5em;
}

/* ==========================================================================
   Floating Label Styles
   ========================================================================== */

/* Floating Label Container */
body .floating-label-group {
    position: relative;
    margin-bottom: 1.5em;
}

/* Input/Textarea/Select Styles */
body .floating-input {
    width: 100%;
    padding: 1.25em 0.75em 0.5em;
    font-size: 1em;
    line-height: 1.5;
    color: var(--wp--preset--color--foreground, #212529);
    background-color: #fff;
    border: none;
    border-bottom: 3px solid #dee2e6;
    border-radius: 0;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

body .floating-input:focus {
    border-bottom-color: var(--wp--preset--color--primary);
    box-shadow: 0 1px 0 0 var(--wp--preset--color--primary);
}

body .floating-input:hover {
    border-bottom-color: #adb5bd;
}

/* Number Input: Pfeiltasten/Spinner verstecken */
body input[type="number"].floating-input::-webkit-inner-spin-button,
body input[type="number"].floating-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

body input[type="number"].floating-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Floating Label - WICHTIG: + Selektor für Input VOR Label */
body .floating-label {
    position: absolute;
    top: 1em;
    left: 0.75em;
    font-size: 1em;
    color: #6c757d;
    pointer-events: none;
    transition: all 0.2s ease;
    transform-origin: left top;
}

/* Label schwebt wenn: Input fokussiert ODER Input hat Wert */
body .floating-input:focus + .floating-label,
body .floating-input:not(:placeholder-shown) + .floating-label {
    top: 0.05em;
    font-size: 0.75em;
    color: var(--wp--preset--color--primary);
    font-weight: 600;
}

/* Select hat immer einen Wert, also Label immer oben */
body select.floating-input + .floating-label {
    top: 0.25em;
    font-size: 0.75em;
    color: #6c757d;
    font-weight: 600;
}

body select.floating-input:focus + .floating-label {
    color: var(--wp--preset--color--primary);
}

/* Textarea spezifisch */
body textarea.floating-input {
    resize: vertical;
    min-height: 100px;
}

/* Required Mark */
.required-mark {
    color: #e74c3c;
    margin-left: 0.25em;
}

/* Options Group (Radio/Checkbox) */
.options-group {
    margin-bottom: 1.5em;
}

.options-label {
    margin-bottom: 0.75em;
    font-size: 0.875em;
    font-weight: 600;
    color: var(--wp--preset--color--foreground, #212529);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.5em;
}

.option-item input {
   transition: all 0.5s ease;
   transform: rotateY(180deg);
}

.option-item input:checked {
   transform: rotateY(0deg);
}

/* Option Item Control Wrapper (für Input und optionales Bild) */
.option-item-control {
    display: flex;
    align-items: center;
    gap: 0;
    margin-right: 0.5em;
    position: relative;
    transition: all 0.7s ease;
    flex-direction: row;
    justify-content: flex-end;
}

.option-item:hover .option-item-control {
   transform: scale(1.05);
}

/* Option Item Image */
.option-item-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-item-image {
   aspect-ratio: 1;
   width: 3.94em;
   height: 3.94em;
   position: relative;
   cursor: pointer;
}

.options-items.has-images .option-item-control .radio-input-wrapper, 
.options-items.has-images .option-item-control .checkbox-input-wrapper {
  position: absolute;
  top: calc(50% - 1.25em);
  left: calc(100% - 0.75em);
}

@media (max-width: 781px) {
  .options-items.has-images .option-item-control .radio-input-wrapper, 
  .options-items.has-images .option-item-control .checkbox-input-wrapper {
    position: absolute;
    top: calc(50% - 1.75em);
    left: calc(100% - 1.25em);
  }
}

.options-items.has-images .option-item-control .option-item-image + .radio-input-wrapper,
.options-items.has-images .option-item-control .option-item-image + .checkbox-input-wrapper {
  position: absolute;
  top: calc(100% - 1.5em);
  left: calc(100% - 0.7em);
}

@media (max-width: 781px) {
  .options-items.has-images .option-item-control .option-item-image + .radio-input-wrapper,
  .options-items.has-images .option-item-control .option-item-image + .checkbox-input-wrapper {
    top: calc(100% - 2em);
    left: calc(100% - 1.2em);
  }
}

.option-item-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.option-item {
  --item-size: 1em;
}

.option-item .radio-input-wrapper,
.option-item .checkbox-input-wrapper {
  display: flex;
   margin: 0;
   cursor: pointer;
   font-size: 1em;
   width: var(--item-size);
   height: var(--item-size);
   border: none;
   -webkit-appearance: none;
   appearance: none;
   flex-shrink: 0;
   position: relative;
   
   --svg-checkbox-checked: url("data:image/svg+xml,%3Csvg viewBox='0 0 55 55' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m27.5 55c-15.19 0-27.5-12.31-27.5-27.5s12.31-27.5 27.5-27.5 27.5 12.31 27.5 27.5-12.31 27.5-27.5 27.5zm12.68-39.35c-1.15-.84-2.76-.58-3.6.57l-12.83 17.64-5.6-5.6c-1.04-.97-2.67-.91-3.64.13-.92.99-.92 2.53 0 3.52l7.73 7.73c.53.53 1.27.81 2.02.75.75-.05 1.44-.44 1.88-1.05l14.6-20.09c.83-1.15.58-2.76-.57-3.59z' fill='%23afca15'/%3E%3C/svg%3E");
   
  > div {
     transform: rotateY(-180deg);
     transition: transform 0.6s ease;
      border-radius: var(--item-size);
    background-color: rgba(0, 0, 0, 0.15);
     position: absolute;
     inset: 0;
     pointer-events: none;
     
     &:before {
       content:'';
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-image: var(--svg-checkbox-checked);
       opacity: 0;
       transition: opacity 0.7s ease;
       position: absolute;
       inset: 0;
     }
  }
}

.option-item .radio-input-wrapper input[type="radio"],
.option-item .checkbox-input-wrapper input[type="checkbox"] {
   font-size: 1em;
   width: var(--item-size);
   height: var(--item-size);
   opacity: 0;
}

@media (max-width: 781px) {
  .option-item {
    --item-size: 1.5em;
  }
}

.option-item input[type="radio"]:checked + div,
.option-item input[type="checkbox"]:checked + div {
  transform: rotateY(0deg);
  animation: bgchange 0.6s forwards;
  
  &:before {
    opacity: 1;
  }
}

@keyframes bgchange {
  0% {
    background-color: rgba(0, 0, 0, 0.2);
  }
  49% {
    background-color: var(--wp--preset--color--primary);
  }
  50% {
    background-color: var(--wp--preset--color--primary);
  }
  100% {
    background-color: var(--wp--preset--color--background);
  }
}

.option-item label {
    margin: 0;
    font-size: 1em;
    color: inherit; /* Erbt Farbe vom Elternelement */
    cursor: pointer;
    flex: 1;
}

/* Spezielle Styles wenn Bilder vorhanden */
.options-items.has-images .option-item {
    align-items: flex-start;
}

.options-items.has-images .option-item-control {
    flex-direction: column;
    align-items: center;
    width: 3.94em;
    height: 3.94em;
    aspect-ratio: 1;
}

.options-items.has-images .option-item-image {
    margin-bottom: 0.25em;
}

.options-items.has-images .option-item-control {
    display: flex;
    align-items: center;
}

/* Horizontale Anordnung */
.options-group.layout-horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 1em !important;
  align-items: flex-start;
  flex-direction: row !important;
}

.options-group.layout-horizontal .options-label {
    width: 100%;
    margin-bottom: 0.5em;
}

.options-group.layout-horizontal .option-item {
    margin-bottom: 0;
    margin-right: 0;
}

/* Vertikale Anordnung (Standard) */
.options-group.layout-vertical {
    display: flex;
    flex-direction: column;
}

/* Responsive: Bei kleinen Bildschirmen immer vertikal */
@media (max-width: 767px) {
    .options-group.layout-horizontal {
        flex-direction: column;
        gap: 0.5em;
    }
    
    .options-group.layout-horizontal .option-item {
        margin-bottom: 0.5em;
    }
}

/* Error States */
body .floating-input.error {
    border-bottom-color: #e74c3c;
}

body .floating-input.error + .floating-label {
    color: #e74c3c;
}

/* ==========================================================================
   Core Block Support (Spalten, Gruppe)
   ========================================================================== */
.wp-block-columns {
    display: flex;
    gap: 2em;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
}

@media (max-width: 781px) {
    .wp-block-columns {
        flex-direction: column;
    }
}

.wp-block-column {
    flex: 1;
    min-width: 0;
}

.wp-block-group {
    margin-bottom: 1.5em;
}

/* Formular-Seite Styles */
.formular-page {
    margin-bottom: 2em;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

/* Verstecke initial alle Seiten außer der ersten */
.formular-page {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.formular-page.active {
    display: block;
    opacity: 1;
    animation: none;
}

/* Slide Animationen - Horizontal */
@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.formular-page.slide-out-left {
    animation: slideOutLeft 0.4s ease forwards;
}

.formular-page.slide-out-right {
    animation: slideOutRight 0.4s ease forwards;
}

.formular-page.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

.formular-page.slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

.formular-page-title {
    margin: 0 0 0.5em;
    font-size: 1.5em;
    font-weight: 600;
    color: #2c3e50;
}

.formular-page-description {
    margin: 0 0 1em;
    color: #7f8c8d;
}

.formular-page-content {
    margin-top: 1em;
}

/* ==========================================================================
   Formular-Steuerung / Navigation Block
   ========================================================================== */

.formular-navigation-block {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 2em !important;
    gap: 1em;
}

/* Navigation Buttons - Theme-Style */
.formular-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    background-color: var(--wp--preset--color--primary);
    border-width: 2px;
    border-style: solid;
    border-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--background, #fff);
    font-family: inherit;
    font-size: inherit;
    line-height: 1.2;
    font-weight: 700;
    padding: 0.25em 2em;
    border-radius: 3em;
    cursor: pointer;
    transition: all ease 0.3s;
    box-shadow: none;
    text-decoration: none;
}

.formular-nav-btn:hover:not(:disabled) {
    color: var(--wp--preset--color--background, #fff);
    border-color: var(--wp--preset--color--foreground, #2c3e50);
    background-color: var(--wp--preset--color--foreground, #2c3e50);
}

.formular-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.formular-nav-btn svg {
    width: 10px;
    height: 17px;
    flex-shrink: 0;
}

/* Verstecke Buttons wenn nicht benötigt */
.formular-nav-btn.hidden {
   display: none;
}

/* Rückwärtskompatibilität - Old Navigation Styles */
.formular-page-navigation {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 2em;
    gap: 1em;
}

.formular-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    background-color: var(--wp--preset--color--primary, var(--wp--preset--color--primary));
    border-width: 2px;
    border-style: solid;
    border-color: var(--wp--preset--color--primary, var(--wp--preset--color--primary));
    color: var(--wp--preset--color--background, #fff);
    font-family: inherit;
    font-size: inherit;
    line-height: 1.2;
    font-weight: 700;
    padding: 0.25em 2em;
    border-radius: 3em;
    cursor: pointer;
    transition: all ease 0.3s;
    box-shadow: none;
    text-decoration: none;
}

.formular-page-btn:hover:not(:disabled) {
    color: var(--wp--preset--color--background, #fff);
    border-color: var(--wp--preset--color--foreground, #2c3e50);
    background-color: var(--wp--preset--color--foreground, #2c3e50);
}

.formular-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.formular-page-btn svg {
    width: 10px;
    height: 17px;
    flex-shrink: 0;
}

.formular-page-btn.hidden {
   display: none;
}


/* Altes formular-label und formular-input (für Rückwärtskompatibilität) */
.formular-label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    font-size: 0.9em;
    color: #2c3e50;
}

.formular-erforderlich {
    color: #e74c3c;
    margin-left: 0.25em;
}

.formular-input,
.formular-input[type="text"],
.formular-input[type="email"],
.formular-input[type="tel"],
.formular-input[type="number"],
.formular-input[type="date"],
textarea.formular-input,
select.formular-input {
    width: 100%;
    padding: 0.75em 1em;
    font-size: 1em;
    line-height: 1.5;
    color: #2c3e50;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.formular-input:focus,
textarea.formular-input:focus,
select.formular-input:focus {
    outline: 0;
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.formular-input::placeholder {
    color: #95a5a6;
}

/* Textarea
   ========================================================================== */
textarea.formular-input {
    resize: vertical;
    min-height: 120px;
}

/* Select
   ========================================================================== */
select.formular-input {
    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='%232c3e50' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1em center;
    background-size: 12px;
    padding-right: 2.5em;
}

/* Radio & Checkbox
   ========================================================================== */
.formular-optionen {
    display: flex;
    flex-direction: column;
    gap: 0.75em;
}

.formular-option-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
}

.formular-option-label input[type="radio"],
.formular-option-label input[type="checkbox"] {
    margin-right: 0.5em;
    cursor: pointer;
}

/* File Input
   ========================================================================== */
input[type="file"].formular-input {
    padding: 0.5em 1em;
}

/* Fehler-Anzeige
   ========================================================================== */
.formular-fehler {
    display: none;
    margin-top: 0.5em;
    padding: 0.5em;
    font-size: 0.875em;
    color: #e74c3c;
    background-color: #fef5f4;
    border-left: 3px solid #e74c3c;
    border-radius: 2px;
}

.formular-fehler.show {
    display: block;
}

.formular-feld.has-error .formular-input,
.formular-feld.has-error textarea.formular-input,
.formular-feld.has-error select.formular-input {
    border-color: #e74c3c;
}

/* Nachrichten (Erfolg/Fehler)
   ========================================================================== */
.formular-nachricht {
    display: none;
    margin: 1.5em 0;
    padding: 1em 1.25em;
    border-radius: 4px;
    font-size: 0.95em;
}

.formular-nachricht.show {
    display: block;
}

.formular-nachricht.success {
    color: #27ae60;
    background-color: #eafaf1;
    border-left: 4px solid #27ae60;
}

.formular-nachricht.error {
    color: #e74c3c;
    background-color: #fef5f4;
    border-left: 4px solid #e74c3c;
}

/* Submit-Button
   ========================================================================== */
.formular-submit {
    display: flex;
    justify-content: flex-start;
}

.formular-button {
    display: inline-block;
    padding: 0.875em 2em;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    background-color: var(--wp--preset--color--primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;
}

.formular-button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.formular-button:active {
    transform: translateY(0);
}

.formular-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading-State
   ========================================================================== */
.formular-form.is-loading .formular-button {
    position: relative;
    color: transparent;
}

.formular-form.is-loading .formular-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: formular-spinner 0.6s linear infinite;
}

@keyframes formular-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Anpassungen
   ========================================================================== */
@media (max-width: 767px) {
    .formular-block {
        margin: 1.5em 0;
    }
    
    .formular-titel {
        font-size: 1.5em;
    }
    
    .formular-felder {
        gap: 1em;
    }
    
    .formular-button {
        width: 100%;
        justify-content: center;
    }
}

/* Alignment-Klassen für Block-Editor
   ========================================================================== */
.alignwide .formular-block {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.alignfull .formular-block {
    max-width: 100%;
}

/* ==========================================================================
   Prefix und Suffix Styles
   ========================================================================== */

/* Container für Input mit Prefix/Suffix */
body .input-with-affix {
    display: flex;
    align-items: stretch;
    width: 100%;
    border-bottom: 2px solid #dee2e6;
    transition: border-color 0.2s ease;
}

body .input-with-affix:hover {
    border-bottom-color: #adb5bd;
}

body .input-with-affix:focus-within {
    border-bottom-color: var(--wp--preset--color--primary);
    box-shadow: 0 1px 0 0 var(--wp--preset--color--primary);
}

/* Prefix/Suffix Styling */
body .input-prefix,
body .input-suffix {
    display: flex;
    align-items: center;
    padding: 1.25em 0.5em 0.5em;
    font-size: 1em;
    color: #6c757d;
    background-color: transparent;
    white-space: nowrap;
    user-select: none;
}

body .input-prefix {
    padding-right: 0.25em;
}

body .input-suffix {
    padding-left: 0.25em;
}

/* Input innerhalb von Affix-Container */
body .input-with-affix .floating-input.has-affix {
    flex: 1;
    border-bottom: none;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

body .input-with-affix .floating-input.has-affix:focus {
    border-bottom: none;
    box-shadow: none;
}

/* Label Positioning für Inputs mit Prefix */
body .input-with-affix + .floating-label {
    left: 0;
}

/* Prefix/Suffix Farbe bei Fokus */
body .input-with-affix:focus-within .input-prefix,
body .input-with-affix:focus-within .input-suffix {
    color: var(--wp--preset--color--primary);
    font-weight: 600;
}

/* Textarea mit Prefix/Suffix */
body .input-with-affix textarea.floating-input.has-affix {
    resize: vertical;
    min-height: 100px;
}

/* Select mit Prefix/Suffix */
body .input-with-affix select.floating-input.has-affix {
    padding-right: 2.5em;
    background-position: right 1em center;
}

/* ==========================================================================
   Submit-Button Icons (Spinner & Checkmark)
   ========================================================================== */

/* Spinner Icon */
.formular-nav-btn .spinner-icon {
    width: 1.2em;
    height: 1.2em;
    margin-left: 0.5em;
    flex-shrink: 0;
}

/* Checkmark Icon */
.formular-nav-btn .checkmark-icon {
    width: 1.2em;
    height: 1.2em;
    margin-left: 0.5em;
    flex-shrink: 0;
}

/* ==========================================================================
   Fortschrittsbalken (Progressbar)
   ========================================================================== */

.formular-progressbar-block {
    width: 100%;
    margin: 2em 0;
}

.progressbar-container {
    width: 100%;
    height: 20px;
    background-color: transparent;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progressbar-fill {
    height: 100%;
    background-color: var(--wp--preset--color--primary, var(--wp--preset--color--primary));
    transition: width 0.4s ease;
    border-radius: 10px;
}

/* ==========================================================================
   Verbesserte Feld-Fehleranzeige
   ========================================================================== */

/* Fehler-Anzeige für einzelne Felder */


body .formular-feld,
body .floating-label-group,
body .options-group {
  transition: all 0.5s ease;
}

body .formular-feld.has-error,
body .floating-label-group.has-error,
body .options-group.has-error {
    position: relative;
    padding: 15px;
}

body .formular-feld.has-error::before,
body .floating-label-group.has-error::before,
body .options-group.has-error::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--wp--preset--color--tertiary, #B10000);
    opacity: 0.08;
    border-radius: var(--radius-large, 12px);
    pointer-events: none;
    z-index: 0;
}

body .formular-feld.has-error > *,
body .floating-label-group.has-error > *,
body .options-group.has-error > * {
    position: relative;
    z-index: 1;
}

/* Input-Felder im Fehler-State */
body .formular-feld.has-error .floating-input,
body .floating-label-group.has-error .floating-input {
    border-bottom-color: var(--wp--preset--color--tertiary, #B10000);
    color: var(--wp--preset--color--tertiary, #B10000);
}

body .formular-feld.has-error .floating-label,
body .floating-label-group.has-error .floating-label {
    color: var(--wp--preset--color--tertiary, #B10000);
}

body .formular-field-wrapper input, body .formular-block .floating-label-group {
    transition: all 0.5s ease;
    position: relative;
}

body .formular-field-wrapper.has-error input {
    background-color: rgba(177, 0, 0, 0.1) !important;
    color: var(--wp--preset--color--tertiary, #B10000);
}

body .formular-block .formular-field-wrapper.has-error .floating-label-group {
    background-color: rgba(177, 0, 0, 0) !important;
}

/* Fehler-Nachricht für Felder */
body .formular-fehler {
    display: none;
    position: relative;
    z-index: 1;
    margin-top: 0.5em;
    padding: 0.2em 0.75em;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 500;
    color: var(--wp--preset--color--tertiary, #B10000);
    background-color: rgba(177, 0, 0, 0.1);
    border-left: 3px solid var(--wp--preset--color--tertiary, #B10000);
    border-radius: 4px;
    line-height: 1.1;
}

body .formular-fehler.show {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* Options-Group Fehler-State */
body .options-group.has-error .options-label {
    color: var(--wp--preset--color--tertiary, #B10000);
    font-weight: 600;
}

/* ==========================================================================
   Required Field Group Fehler-Anzeige
   ========================================================================== */

/* Required Group Fehler-State */
body .formular-required-group {
    transition: all 0.5s ease;
}
body .formular-required-group.has-error {
    position: relative;
    padding: 15px;
    border-radius: var(--radius-large, 12px);
}

body .formular-required-group.has-error::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--wp--preset--color--tertiary, #B10000);
    opacity: 0.05;
    border-radius: var(--radius-large, 12px);
    pointer-events: none;
    z-index: 0;
}

body .formular-required-group.has-error > * {
    position: relative;
    z-index: 1;
}

/* Fehler-Nachricht für Required Group */
.required-group-error {
    display: none;
    position: relative;
    z-index: 1;
    margin-top: 0.5em;
    padding: 0.5em 0.75em;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 500;
    color: var(--wp--preset--color--tertiary, #B10000);
    background-color: rgba(177, 0, 0, 0.1);
    border-left: 3px solid var(--wp--preset--color--tertiary, #B10000);
    border-radius: 4px;
}

.required-group-error.show {
    display: block;
}

/* Nested Fields innerhalb einer Required Group mit Fehler */
body .formular-required-group.has-error .formular-feld,
body .formular-required-group.has-error .floating-label-group,
body .formular-required-group.has-error .options-group {
    opacity: 0.95;
}

.option-item-label {
  > *:first-child {
    margin-top: 0;
  }
  > *:last-child {
    margin-bottom: 0;
  }
}

.formular-required-group {
  transition: padding: 0.5s ease;
}

/* iOS Compatibility Wrappers - V6.4 */
.checkbox-input-wrapper,
.radio-input-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Verhindert iOS-spezifische Rendering-Probleme mit Hintergrundbildern */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.checkbox-group-wrapper,
.radio-group-wrapper {
    /* Zusätzlicher Container-Wrapper für bessere iOS-Kompatibilität */
    display: contents;
}