/* =========================================
   FORM WIDGETS
   =========================================
   Alle Formular-Styles für base-form-* Klassen.
   Farben ausschließlich aus colors.css (var(--...)).
   Siehe 011-ui-css-forms.mdc, 011-ui-forms.mdc.
   ========================================= */

.base-form-container {
    max-width: 100%;
    width: 100%;
}

.base-form-field-group {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: 0.5rem 1.5rem;
    align-items: start;
    margin-bottom: 1.25rem;
}

.base-form-field-group-hidden {
    display: none;
}

/* Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-compact-forms, @skill-css-rules, @skill-change-provenance | Kompaktes Feld: mehr Luft, premium Rhythmik */
.base-form-field-group-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.125rem;
}

.base-form-field-group-compact:last-child {
    margin-bottom: 0;
}

.base-form-container-compact {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-width: 100%;
    width: 100%;
}

.base-form-container-compact .base-form-error {
    grid-column: auto;
    margin-top: 0.15rem;
}

@media (max-width: 575px) {
    .base-form-field-group {
        grid-template-columns: 1fr;
        gap: 0.35rem 0;
        margin-bottom: 1rem;
    }
}

/* .base-form-label | Änderungsprotokoll: 2026-10-12 | parent-agent | @skill-css-rules, @skill-change-provenance | Label hell auf dunklem Grund */
.base-form-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    font-family: var(--font-family-primary);
    line-height: 1.35;
    letter-spacing: 0.01em;
    padding-top: 0;
    white-space: nowrap;
}

@media (max-width: 575px) {
    .base-form-label {
        padding-top: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

.base-form-required {
    color: var(--color-error);
    font-weight: 700;
    margin-left: 0.15em;
}

/* .base-form-input | Änderungsprotokoll: 2026-10-12 | parent-agent | @skill-css-rules, @skill-change-provenance | Helle Schrift auf dunklem Feld */
.base-form-input {
    font-size: 16px;
    font-family: var(--font-family-primary);
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--color-text);
    background-color: var(--color-form-field-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 13px 16px;
    min-height: 52px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: var(--shadow-form-field);
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

/* .base-form-textarea | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Textarea 1:1 Input-Niveau */
.base-form-textarea {
    font-size: 16px;
    font-family: var(--font-family-primary);
    font-weight: 500;
    line-height: 1.55;
    letter-spacing: -0.01em;
    color: var(--color-text);
    background-color: var(--color-form-field-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 14px 16px;
    min-height: 140px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: var(--shadow-form-field);
    resize: vertical;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

/* .base-form-input-error | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Fehlerbasis gleiches Mass wie Input */
.base-form-input-error,
.base-form-input[aria-invalid="true"] {
    font-size: 16px;
    font-family: var(--font-family-primary);
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--color-text);
    background-color: var(--color-error-soft-bg);
    border: 1px solid var(--color-error);
    border-radius: 12px;
    padding: 13px 16px;
    min-height: 52px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 1px var(--color-error);
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.base-form-textarea-error,
.base-form-textarea[aria-invalid="true"] {
    font-size: 16px;
    font-family: var(--font-family-primary);
    font-weight: 500;
    line-height: 1.55;
    letter-spacing: -0.01em;
    color: var(--color-text);
    background-color: var(--color-error-soft-bg);
    border: 1px solid var(--color-error);
    border-radius: 12px;
    padding: 14px 16px;
    min-height: 140px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 1px var(--color-error);
    resize: vertical;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.base-form-input::placeholder,
.base-form-textarea::placeholder,
.base-form-input-error::placeholder,
.base-form-textarea-error::placeholder {
    color: var(--color-text-muted);
    font-weight: 400;
    opacity: 0.92;
}

/* .base-form-input:hover | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Hover hebt Feld aus Soft-BG */
.base-form-input:hover {
    border-color: var(--color-border-highlight);
    background-color: var(--color-form-field-bg-hover);
}

.base-form-textarea:hover {
    border-color: var(--color-border-highlight);
    background-color: var(--color-form-field-bg-hover);
}

.base-form-input-error:hover,
.base-form-textarea-error:hover {
    border-color: var(--color-error-hover);
}

/* .base-form-input:focus | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Weicher Primary Focus-Ring */
.base-form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-form-field-focus);
}

.base-form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-form-field-focus);
}

.base-form-input-error:focus,
.base-form-input[aria-invalid="true"]:focus {
    outline: none;
    border-color: var(--color-error);
    background-color: var(--color-error-soft-bg);
    box-shadow: 0 0 0 4px var(--color-error-focus-shadow), inset 0 0 0 1px var(--color-error);
}

.base-form-textarea-error:focus,
.base-form-textarea[aria-invalid="true"]:focus {
    outline: none;
    border-color: var(--color-error);
    background-color: var(--color-error-soft-bg);
    box-shadow: 0 0 0 4px var(--color-error-focus-shadow), inset 0 0 0 1px var(--color-error);
}

/* .base-form-input:not(:placeholder-shown) | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-compact-forms, @skill-css-rules, @skill-change-provenance | Befuellte Felder Amber */
.base-form-input:not(.base-form-input-error):not(.base-form-input-success):not(:placeholder-shown),
.base-form-textarea:not(.base-form-input-error):not(.base-form-input-success):not(:placeholder-shown) {
    border-color: var(--color-logo-orange);
    background-color: var(--color-logo-orange-surface);
    box-shadow: inset 0 0 0 1px var(--color-logo-orange);
}

.base-form-input:not(.base-form-input-error):not(.base-form-input-success):not(:placeholder-shown):hover,
.base-form-textarea:not(.base-form-input-error):not(.base-form-input-success):not(:placeholder-shown):hover {
    border-color: var(--color-logo-orange);
    background-color: var(--color-logo-orange-surface);
    box-shadow: inset 0 0 0 1px var(--color-logo-orange);
}

.base-form-input:not(.base-form-input-error):not(.base-form-input-success):not(:placeholder-shown):focus,
.base-form-textarea:not(.base-form-input-error):not(.base-form-input-success):not(:placeholder-shown):focus {
    border-color: var(--color-logo-orange);
    background-color: var(--color-logo-orange-surface);
    box-shadow: 0 0 0 4px var(--color-logo-orange-focus-shadow), inset 0 0 0 1px var(--color-logo-orange);
}

.base-form-input[type="password"]::-ms-reveal {
    display: none;
}

.base-form-input[type="password"]::-ms-clear {
    display: none;
}

.base-form-input-error[type="password"]::-ms-reveal {
    display: none;
}

.base-form-input-error[type="password"]::-ms-clear {
    display: none;
}

.base-form-input[type="password"]::-webkit-password-toggle-button {
    display: none;
    visibility: hidden;
}

.base-form-input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none;
    visibility: hidden;
}

.base-form-input-error[type="password"]::-webkit-password-toggle-button {
    display: none;
    visibility: hidden;
}

.base-form-input-error[type="password"]::-webkit-credentials-auto-fill-button {
    display: none;
    visibility: hidden;
}

/* VERBOTEN: ::-webkit-textfield-decoration-container ausblenden — kollabiert Passwort-Inputs (Höhe/Eingabe) in WebKit/Blink */
/* Änderungsprotokoll: 2026-08-26 | parent-agent | @skill-css-rules, @skill-change-provenance | Mobile Passwortfelder Höhe/Eingabe: textfield-decoration-container nicht mehr verstecken */

.base-form-input[type="password"]::-webkit-caps-lock-indicator {
    display: none;
    visibility: hidden;
    pointer-events: none;
}

.base-form-input-error[type="password"]::-webkit-caps-lock-indicator {
    display: none;
    visibility: hidden;
    pointer-events: none;
}

.base-form-input[type="password"]::-webkit-contacts-auto-fill-button {
    display: none;
    visibility: hidden;
    pointer-events: none;
}

.base-form-input-error[type="password"]::-webkit-contacts-auto-fill-button {
    display: none;
    visibility: hidden;
    pointer-events: none;
}

.base-form-password-toggle-button {
    justify-self: end;
    margin-top: 0.5rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 0;
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-family: var(--font-family-primary);
    line-height: var(--line-height-normal);
    cursor: pointer;
}

.base-form-password-toggle-button:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: none;
}

.base-form-password-field {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: 0.5rem 1.5rem;
    align-items: start;
    margin-bottom: 1.25rem;
}

@media (max-width: 575px) {
    .base-form-password-field {
        grid-template-columns: 1fr;
        gap: 0.35rem 0;
        margin-bottom: 1rem;
    }
}

.base-form-password-row {
    position: relative;
    display: block;
    grid-column: 2;
    min-width: 0;
}

@media (max-width: 575px) {
    .base-form-password-row {
        grid-column: 1;
    }
}

/* .base-form-password-row > .base-form-input | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Passwort-Hoehe 52px + Toggle-Raum */
.base-form-password-row > .base-form-input,
.base-form-password-row > .base-form-input-error {
    min-height: 52px;
    padding-right: 3rem;
    box-sizing: border-box;
}

/* .base-form-password-row > .base-form-password-toggle-icon | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Premium Toggle-Hitarea */
.base-form-password-row > .base-form-password-toggle-icon,
.base-form-password-row > .base-form-password-toggle-icon-visible {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    transform: translateY(-50%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: var(--color-text-muted);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.base-form-password-row > .base-form-password-toggle-icon:hover,
.base-form-password-row > .base-form-password-toggle-icon-visible:hover {
    background: var(--color-primary-soft-bg);
    color: var(--color-primary);
}

.base-form-password-row > .base-form-password-toggle-icon:focus,
.base-form-password-row > .base-form-password-toggle-icon-visible:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-focus-shadow);
}

.base-form-password-toggle-icon {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
}

/* Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Toggle Icon currentColor */
.base-form-password-toggle-icon::before {
    content: '';
    display: block;
    width: 1.125rem;
    height: 1.125rem;
    background-color: currentColor;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M1 12s4-8 11-8 11 8 4 8-1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}

.base-form-password-toggle-icon-visible {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
}

.base-form-password-toggle-icon-visible::before {
    content: '';
    display: block;
    width: 1.125rem;
    height: 1.125rem;
    background-color: currentColor;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.24a10.94 10.94 0 0 1-1.71-2.05'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}

.base-form-help-text {
    grid-column: 1 / -1;
    margin-top: 0.35rem;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-family: var(--font-family-primary);
}

/* .base-form-error | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Kompakte Fehlerzeile Premium */
.base-form-error {
    font-size: 13px;
    font-family: var(--font-family-primary);
    font-weight: 600;
    color: var(--color-error);
    margin-top: 0.2rem;
    line-height: 1.4;
    grid-column: 1 / -1;
}

@media (max-width: 575px) {
    .base-form-error {
        margin-top: 0.15rem;
    }
}

.base-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.base-form-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* .base-form-submit-container | Änderungsprotokoll: 2026-10-01 | parent-agent | @skill-css-rules, @skill-change-provenance | Submit Abstand premium */
.base-form-submit-container {
    margin-top: 1.75rem;
    padding-top: 0.25rem;
}

@media (max-width: 575px) {
    .base-form-submit-container {
        margin-top: 1.25rem;
    }
}

.base-form-submit-container + .base-form-links-inline {
    margin-top: 1rem;
    margin-bottom: 0;
}

@media (max-width: 575px) {
    .base-form-submit-container + .base-form-links-inline {
        margin-top: 0.75rem;
    }
}

.base-form-links-inline {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 575px) {
    .base-form-links-inline {
        justify-content: flex-start;
        align-items: center;
        text-align: left;
        margin-bottom: 1.25rem;
    }

    .base-form-submit-container .base-button-primary {
        width: 100%;
        box-sizing: border-box;
    }
}

.base-honeypot {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Spam-Schutz Mathe-Anzeige (SVG) – kompakte Darstellung, wiederverwendbar für Registrierung/Kontakt */
.base-form-label-spam {
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.base-form-spam-formula-line {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.base-form-label-spam .base-form-spam-svg-wrapper {
    margin-left: 0;
}

.base-form-spam-svg-wrapper {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.25rem;
    position: relative;
}

/* Änderungsprotokoll: 2026-09-20 | parent-agent | @skill-css-rules, @skill-contact-form-captcha, @skill-change-provenance | Leichte Scanlines gegen naive OCR, Ziffern bleiben klar */
.base-form-spam-svg-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        -22deg,
        transparent 0,
        transparent 2px,
        rgba(26, 26, 26, 0.07) 2px,
        rgba(26, 26, 26, 0.07) 3px
    );
}

/* Änderungsprotokoll: 2026-09-20 | parent-agent | @skill-css-rules, @skill-contact-form-captcha, @skill-change-provenance | Spam-SVG mind. 2.75rem, Ziffern lesbar */
.base-form-spam-svg {
    display: inline-block;
    vertical-align: middle;
    width: 7.5rem;
    height: 2.75rem;
    overflow: visible;
}

/* Änderungsprotokoll: 2026-09-20 | parent-agent | @skill-css-rules, @skill-contact-form-captcha, @skill-change-provenance | Ziffern dominant, Ornamente Akzent gegen OCR */
.base-form-spam-glyph-path {
    fill: currentColor;
}

.base-form-spam-digit .base-form-spam-glyph-path {
    fill: currentColor;
    opacity: 1;
    stroke: currentColor;
    stroke-width: 0.45;
    paint-order: stroke fill;
}

.base-form-spam-ornament-wrap {
    opacity: 0.72;
}

.base-form-spam-ornament {
    fill: currentColor;
    opacity: 0.85;
}

.base-form-spam-decoy {
    fill: currentColor;
}

.base-form-spam-text {
    font-size: var(--font-size-sm);
    font-family: var(--font-family-primary);
}
