/*!
 * powermailenhancer26 – form layouts and styles
 * Loaded on every page with the PowermailEnhancer26 set: label positions (.form-label-*) and field styles (.form-style-*).
 * © 2026 Atelier 26 AG – part of digiscapes®. All rights reserved. digiscapes® and brandscapes® are registered trademarks.
 */

/* === Basics === */

.tx-powermail > .container-fluid {
  padding: 0;
}
.powermail_field {
    margin-bottom: calc(var(--bs-gutter-y) * 1);
}
.powermail_field:has([data-size*="invisible"]) {
        margin-bottom: 0;
}

.powermail_description,
.powermail_fieldwrap_type_text .form_text {
  font-size: var(--bs-font-size-small);
  line-height: var(--bs-line-height-small);
  color: var(--bs-muted);    
}
.mandatory {
  opacity: .25;
}
.powermail_group_checkwrap,
.powermail_group_radiowrap {
    column-count: 1;
    column-gap: var(--bs-gutter-x);
}
.powermail_fieldwrap_reset .powermail_field {
    border: none !important;
    display: inline-block;
}

.powermail_fieldwrap_type_text label {
    font-weight: var(--bs-font-weight-bold);
}
.powermail_fieldwrap_type_text .form_text {
    padding-top: calc(var(--bs-gutter-y) * .25);
}

.powermail_fieldwrap_type_text .powermail_field,
.form-label-left .powermail_fieldwrap_type_text .powermail_field  {
    padding-top: 2rem;
}

/* === Layouts === */

.powermail_fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--bs-gutter-y) ;
}

.powermail_fieldwrap {
    width: 100%; /* default: full width */
}

/* Layout 1: two fields side by side */
.powermail_fieldwrap.layout1 {
    width: calc(50% - calc(var(--bs-gutter-x) * .5));
}

@media (max-width: 767px) {
    .powermail_fieldwrap.layout1 {
        width: 100%;
    }
}


/* Layouts 2 and 3: options in columns */
.powermail_fieldwrap_type_check.layout2 .powermail_group_checkwrap,
.powermail_fieldwrap_type_radio.layout2 .powermail_group_radiowrap {
    column-count: 2;
}
.powermail_fieldwrap_type_check.layout3 .powermail_group_checkwrap,
.powermail_fieldwrap_type_radio.layout3 .powermail_group_radiowrap {
    column-count: 3;
}


/* === Errors === */
.powermail_field_error {
    border-color: var(--bs-danger-base);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='red' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3e%3cpath d='M12 9v4'/%3e%3cpath d='M12 17h.01'/%3e%3c/svg%3e");  background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}
.powermail_field_error:focus-visible,
:user-invalid:focus-visible {
  border-color: var(--bs-danger-base);
  box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--bs-danger-base), transparent 80%);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='red' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3e%3cpath d='M12 9v4'/%3e%3cpath d='M12 17h.01'/%3e%3c/svg%3e");  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.powermail-errors-list {
  color: var(--bs-danger-base);
  list-style-type: "";
  padding: 0;
  margin-bottom: 0 !important;
  font-size: var(--bs-font-size-small);
  line-height: var(--bs-line-height-small);
}

.powermail-errors-list:not(.filled) {
  display: none;
}



/* === Labels Top === */
.form-label-top .powermail_field { 
    padding-top: calc(var(--bs-gutter-y) * 0);
    margin-bottom: calc(var(--bs-gutter-y) * .5);
    border-top: 0px solid var(--bs-border-hr); 
}

/* === Labels Left === */

/* Below md: label above the field */
.form-label-left .powermail_field {
    padding-top: calc(var(--bs-gutter-y) * .5);
    margin-bottom: calc(var(--bs-gutter-y) * .5);
    border-top: 1px solid var(--bs-border-hr);
}


/* From md: label 1/3, field 2/3 */
@container (min-width: 768px) {
    .form-label-left .powermail_field {
        align-items: flex-start;
    }

    .form-label-left .powermail_label {
        width: 33.3333%;
        margin-bottom: 0;
        margin-right: calc(var(--bs-gutter-x) * .5);
        text-align: left;
        float: left;
        min-height: 2.375rem;
        align-content: center;
    }

    .form-label-left .powermail_input,
    .form-label-left .powermail_field .form-control{
        width: calc(66.6667% - calc(var(--bs-gutter-x) * .5));
    }
    .form-label-left .powermail_description,
    .form-label-left .powermail-errors-list,
    .form-label-left .powermail_fieldwrap_type_html .powermail_field,
    .form-label-left .powermail_fieldwrap_type_text .form_text,
    .form-label-left .powermail_fieldwrap_type_submit .powermail_field,
    .form-label-left .powermail_fieldwrap_type_reset .powermail_field {
        padding-left: calc(33.3333% + calc(var(--bs-gutter-x) * .5));
    }
    .form-label-left .choices__inner .powermail-errors-list {
        padding-left: 0;
    }

    .form-label-left .powermail_field .choices {
        width: calc(66.6667% - calc(var(--bs-gutter-x) * .5));
        margin-left: calc(33.3333% + calc(var(--bs-gutter-x) * .5))
    }

}


/* === Labels Floating === */

.form-label-floating .powermail_field {
    position: relative;
}

.form-label-floating .powermail_field > .powermail_label {
    position: absolute;
    top: .875rem;
    left: 0.5rem;
    z-index: 2;
    max-width: 100%;
    padding: 0 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.65;

    transform-origin: 0 0;
    transition: all 0.15s ease-in-out;
}

.form-label-floating .powermail_field > .form-control {
    padding: 1.5rem 0.75rem 0.25rem 0.75rem;
}

.form-label-floating .powermail_field > .form-control::placeholder {
    color: transparent;
}

.form-label-floating .powermail_field:has(> .form-control:focus) > .powermail_label,
.form-label-floating .powermail_field:has(> .form-control:not(:placeholder-shown)) > .powermail_label {
    top: 0.25rem;
    font-size: var(--bs-font-size-extra-small);
    opacity: 1;
    transform: translateY(0);
    font-weight: var(--bs-font-weight-bold);
    color: var(--settings-form-focus-color);
  }

.form-label-floating .powermail_field:has(> .form-control:disabled) > .powermail_label {
    opacity: 0.5;
}

/* Radio and checkbox groups have no field to float in: the label stays above */
.form-label-floating .powermail_field:not(:has(> .form-control, > .form-select, > .choices)) > .powermail_label {
    position: static;
    padding: 0;
    opacity: 1;
    white-space: normal;
    pointer-events: auto;
}

/* === Sentence (Madlibs, form-label-madlibs; 1.7.6): the form reads as a sentence with gaps to fill in ===
   The sentence is set in the lead size; each label is the text before its gap. A field takes the type of the
   sentence (size, family, line height), is as wide as its content (field-sizing, else a width in ch) and shows the
   entered value in the primary ink, the placeholder as secondary text. Underline and Flat make the field a pure gap
   with a line below, Bordered a frame as high as the line of text. Selects and Choices look the same. The button
   stands on a line of its own below the sentence. */
.form-label-madlibs .powermail_fieldset {
    display: block;
    font-family: var(--settings-lead-font-family, inherit);
    font-size: var(--bs-font-size-large);
    line-height: 2.2;
}
.form-label-madlibs .powermail_legend {
    display: block;
    font-size: var(--bs-font-size-normal, 1rem);
    line-height: var(--bs-body-line-height);
}
.form-label-madlibs .powermail_fieldwrap {
    display: inline;
    width: auto !important;
    margin: 0;
    padding: 0;
}
.form-label-madlibs .powermail_field {
    display: inline;
}
.form-label-madlibs .powermail_label {
    display: inline;
    margin: 0 .3em 0 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    white-space: normal;
}
.form-label-madlibs :is(input.form-control, select.form-control, .form-select, .choices__inner) {
    display: inline-block;
    width: auto;
    min-width: 6ch;
    max-width: 100%;
    min-height: 0;
    height: auto;
    field-sizing: content;
    margin: 0 .3em 0 0;
    padding: .1em .45em;
    font: inherit;
    line-height: 1.35;
    color: var(--bs-primary-ink, var(--bs-body-color));
    vertical-align: baseline;
}
@supports not (field-sizing: content) {
    .form-label-madlibs :is(input.form-control, select.form-control, .form-select) {
        width: 16ch;
    }
}
.form-label-madlibs :is(input.form-control, textarea.form-control)::placeholder,
.form-label-madlibs .choices__placeholder {
    color: var(--bs-body-secondary-color, var(--bs-text-muted));
    opacity: 1;
}
/* Native select: a small chevron that scales with the text */
.form-label-madlibs :is(select.form-control, .form-select) {
    padding-inline-end: 1.6em;
    background-position: right .5em center;
    background-size: .7em .55em;
}
/* Choices: the box is the gap, the chevron sits in it like the one of a native select */
.form-label-madlibs .choices {
    display: inline-block;
    width: auto;
    max-width: 100%;
    margin: 0;
    vertical-align: baseline;
    line-height: 1.35;
}
.form-label-madlibs .choices[data-type*='select-one'] .choices__inner {
    display: inline-flex;
    padding-inline-end: 1.6em;
}
.form-label-madlibs :is(.choices, .choices__list--single, .choices__list--single .choices__item) {
    font-size: inherit;
    font-family: inherit;
}
.form-label-madlibs .choices__list--single {
    padding: 0;
}
.form-label-madlibs .choices__list--single .choices__item {
    color: inherit;
}
.form-label-madlibs .choices__list--single .choices__placeholder {
    color: var(--bs-body-secondary-color, var(--bs-text-muted));
}
.form-label-madlibs .choices[data-type*='select-one'] .choices-icon {
    right: .5em;
}
.form-label-madlibs .choices[data-type*='select-one'] .choices-icon svg {
    width: .7em;
    height: .7em;
}
.form-label-madlibs .choices__list--dropdown {
    font-size: var(--bs-font-size-normal, 1rem);
    line-height: var(--bs-body-line-height);
}
/* Underline and Flat: a pure gap with a line below, no fill, no box */
.form-label-madlibs:is(.form-style-underline, .form-style-flat) :is(input.form-control, select.form-control, .form-select, .choices__inner) {
    padding-inline-start: .1em;
    padding-block: 0;
    border-width: 0 0 var(--bs-border-width, 1px);
    border-radius: 0;
    background-color: transparent;
}
.form-label-madlibs.form-style-underline :is(input.form-control, select.form-control, .form-select, .choices__inner) {
    border-bottom-style: solid;
    border-bottom-color: currentColor;
}
.form-label-madlibs.form-style-flat :is(input.form-control, select.form-control, .form-select, .choices__inner) {
    border-bottom-style: dotted;
    border-bottom-color: var(--bs-body-secondary-color, currentColor);
}
/* A long answer gets a line of its own */
.form-label-madlibs textarea.form-control {
    display: block;
    width: 100%;
    margin: .25rem 0 .5rem;
    font: inherit;
    line-height: var(--bs-body-line-height);
    color: var(--bs-primary-ink, var(--bs-body-color));
}
.form-label-madlibs .powermail_description {
    display: inline;
    margin: 0 .5em 0 0;
    font-size: var(--bs-font-size-small);
    color: var(--bs-body-secondary-color, inherit);
}
.form-label-madlibs :is(.powermail_group_checkwrap, .powermail_group_radiowrap) {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0 1em;
    margin-inline-end: .5em;
    vertical-align: baseline;
    line-height: var(--bs-body-line-height);
}
.form-label-madlibs .form-check {
    display: inline-flex;
    align-items: center;
    gap: .375em;
    margin: 0;
    padding: 0;
}
.form-label-madlibs .form-check-input {
    float: none;
    margin: 0;
}
.form-label-madlibs :is([class*="errors-list"], .powermail_field_error_container):empty {
    display: none;
}
.form-label-madlibs [class*="errors-list"] {
    display: block;
    font-size: var(--bs-font-size-small);
    line-height: var(--bs-body-line-height);
}
/* The button on a line of its own below the sentence, in its own size */
.form-label-madlibs .powermail_fieldwrap_type_submit,
.form-label-madlibs .powermail_fieldwrap_type_reset {
    display: block;
    margin-top: 1rem;
    font-size: var(--bs-font-size-normal, 1rem);
    line-height: var(--bs-body-line-height);
}

/* === One Row (form-label-one-row, 1.7.5): fields and button on one line, e.g. a newsletter ===
   The field grows, the button keeps the width of its text; in a narrow container the button moves below the field.
   The labels are not shown but read (as .visually-hidden). Checkboxes (consent) and long answers take a line of
   their own below. */
.form-label-one-row .powermail_fieldset {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--bs-padding-3);
}
.form-label-one-row .powermail_legend {
    flex: 0 0 100%;
}
.form-label-one-row .powermail_fieldwrap {
    flex: 1 1 12rem;
    width: auto !important;
    min-width: 0;
    margin: 0;
}
.form-label-one-row :is(.powermail_fieldwrap_type_submit, .powermail_fieldwrap_type_reset) {
    flex: 0 0 auto;
}
.form-label-one-row :is(.powermail_fieldwrap_type_check, .powermail_fieldwrap_type_radio, .powermail_fieldwrap_type_textarea, .powermail_fieldwrap_type_text, .powermail_fieldwrap_type_html, .powermail_fieldwrap_type_content) {
    flex: 0 0 100%;
    order: 1;
}
.form-label-one-row .powermail_fieldwrap:not(.powermail_fieldwrap_type_check, .powermail_fieldwrap_type_radio) .powermail_label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.form-label-one-row .powermail_field {
    margin: 0;
}

/* === Style Underline === */

.form-style-underline .form-control,
.form-style-underline .choices__inner {
    border-width: 0 0 2px 0;
    border-radius: 0;
    padding-left: 0;
}

.form-style-underline .powermail_field_error:focus-visible,
.form-style-underline :user-invalid:focus-visible,
.form-style-filled .powermail_field_error:focus-visible,
.form-style-filled :user-invalid:focus-visible {
  border-width: 0 0 1px 0;
  box-shadow: 0 .25rem 0 0 color-mix(in srgb, var(--bs-danger-base), transparent 80%);
}

.form-style-underline .form-control:focus,
.form-style-underline .form-control:focus-visible,
.form-style-underline .is-focused .choices__inner,
.form-style-underline .is-open .choices__inner,
.form-style-filled .form-control:focus,
.form-style-filled .form-control:focus-visible,
.form-style-filled .is-focused .choices__inner,
.form-style-filled .is-open .choices__inner   {
    box-shadow: 0 0.25rem 0 0  color-mix(in srgb, var(--settings-form-focus-color), transparent 75%);
}

.form-style-underline .powermail_field,
.form-style-filled .powermail_field {
    border-top: none !important;
}

.form-style-underline .choices[data-type*='select-one'] .choices__list--dropdown .choices__input
 {
    padding-left: 0;
}


/* === Style Filled === */


.form-style-filled  .form-control,
.form-style-filled .choices__inner {
    border-width: 0 0 1px 0;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    background-color: hsl(from var(--bs-overlay) h s l / 0.05);
}




/* === Style Flat === */

.form-style-flat .form-control,
.form-style-flat .choices__inner {
    border: none;
    background-color: hsl(from var(--bs-overlay) h s l / 0.05);
}