/**
 * TobiDu-Formularsystem — eigenständiges CSS, theme-unabhängig.
 * Liest, wo vorhanden, die bestehenden TobiDu-Design-Tokens (CSS-
 * Custom-Properties aus tokens.css) mit sinnvollen Fallback-Werten,
 * damit das Plugin auch ohne das Theme funktionsfähig und lesbar bleibt.
 *
 * Update Bericht Nr. 132 — Formulardesign an die Figma-/Custom-Theme-
 * Optik angeglichen (Nunito-Mikrolabels wie .tobidu-kk-info__label,
 * Gradient-Button wie .btn--primary, Badge-Pill-Optik wie .tobidu-pv2-
 * badge, Karten-Schatten aus tokens.css) — bewusst OHNE die dekorativen
 * Shimmer-/Glow-Hover-Effekte des großen .btn--primary (keine
 * unnötigen Animationen im Formular, nur der ohnehin site-weite
 * dezente Hover-Lift).
 */

.tfs [hidden] {
    display: none !important;
}

.tfs {
    --tfs-primary: var(--color-primary, #ff6b35);
    --tfs-primary-dark: var(--color-primary-dark, #e2551f);
    --tfs-text: var(--color-text, #1a1a2e);
    --tfs-text-muted: var(--color-text-muted, #4b5563);
    --tfs-border: var(--color-border, #e2e8f0);
    --tfs-danger: var(--color-danger, #dc2626);
    --tfs-success: var(--color-success, #16a34a);
    --tfs-radius-sm: var(--radius-sm, 6px);
    --tfs-radius-md: var(--radius-md, 12px);
    --tfs-radius-lg: var(--radius-lg, 20px);
    --tfs-radius-full: var(--radius-full, 999px);
    --tfs-shadow-sm: var(--shadow-sm, 0 1px 3px rgba(26, 26, 46, 0.08));
    --tfs-shadow-md: var(--shadow-md, 0 4px 16px rgba(26, 26, 46, 0.1));
    --tfs-transition: var(--transition-fast, 150ms ease);
    max-width: 640px;
    font-family: var(--font-base, inherit);
    color: var(--tfs-text);
}

.tfs__success {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #eafaf0;
    border: 1px solid #b7ebc8;
    border-radius: var(--tfs-radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--tfs-shadow-sm);
}

.tfs__success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--tfs-radius-full);
    background: var(--tfs-success);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
}

.tfs__success-text {
    margin: 0;
    font-family: var(--font-heading, inherit);
    font-weight: 700;
    color: #14532d;
}

.tfs__error-banner {
    background: #fdecec;
    border: 1px solid #f3b8b8;
    color: var(--tfs-danger);
    border-radius: var(--tfs-radius-md);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-weight: 600;
}

.tfs__type-switch {
    border: 0;
    padding: 0;
    margin: 0 0 20px;
}

.tfs__type-switch legend {
    font-family: var(--font-heading, inherit);
    font-weight: 800;
    padding: 0 0 10px;
    font-size: 0.95rem;
    color: var(--tfs-text);
}

.tfs__type-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tfs__type-option {
    position: relative;
}

.tfs__type-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.tfs__type-option span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--tfs-radius-full);
    border: 2px solid var(--tfs-border);
    background: #fff;
    font-family: var(--font-heading, inherit);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color var(--tfs-transition), background var(--tfs-transition), color var(--tfs-transition);
}

.tfs__type-option input:checked + span {
    border-color: var(--tfs-primary);
    background: linear-gradient(135deg, var(--tfs-primary), #ff9a55);
    color: #fff;
    box-shadow: var(--tfs-shadow-sm);
}

.tfs__type-option input:focus-visible + span {
    outline: 2px solid var(--tfs-primary-dark);
    outline-offset: 2px;
}

.tfs__group {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 18px;
}

.tfs__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .tfs__row {
        grid-template-columns: 1fr 1fr;
    }
}

.tfs__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tfs__field label {
    display: block;
    font-family: var(--font-heading, inherit);
    font-weight: 800;
    font-size: 0.72rem;
    color: var(--tfs-primary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.tfs__req {
    color: var(--tfs-primary-dark);
    text-transform: none;
}

.tfs__field input,
.tfs__field select,
.tfs__field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--tfs-border);
    border-radius: var(--tfs-radius-md);
    font-size: 1rem;
    font-family: var(--font-base, inherit);
    font-weight: 500;
    color: var(--tfs-text);
    background: #fff;
    box-shadow: var(--tfs-shadow-sm);
    box-sizing: border-box;
    transition: border-color var(--tfs-transition), box-shadow var(--tfs-transition);
}

.tfs__field input:focus,
.tfs__field select:focus,
.tfs__field textarea:focus {
    outline: none;
    border-color: var(--tfs-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, .18);
}

.tfs__field input:focus-visible,
.tfs__field select:focus-visible,
.tfs__field textarea:focus-visible {
    outline: 2px solid var(--tfs-primary-dark);
    outline-offset: 1px;
}

.tfs__field textarea {
    resize: vertical;
    min-height: 100px;
}

.tfs__field input.tfs__field--invalid,
.tfs__field select.tfs__field--invalid,
.tfs__field textarea.tfs__field--invalid {
    border-color: var(--tfs-danger);
    background: rgba(220, 38, 38, 0.04);
}

.tfs__field-error {
    display: block;
    min-height: 1em;
    color: var(--tfs-danger);
    font-size: 0.82rem;
    font-weight: 600;
}

.tfs__field-hint {
    display: block;
    color: var(--tfs-text-muted, #6b7280);
    font-size: 0.78rem;
    margin-top: 2px;
}

.tfs--dark .tfs__field-hint {
    color: #9a8a70;
}

.tfs__hint {
    background: var(--color-bg-warm, #fff1de);
    border: 1px solid var(--color-bg-warm-deep, #ffdcae);
    border-radius: var(--tfs-radius-md);
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--tfs-text);
    margin: 0;
}

.tfs__cta-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--color-bg-cream, #fdfaf3);
    border: 1px solid var(--tfs-border);
    border-radius: var(--tfs-radius-lg);
    padding: 16px 20px;
}

.tfs__cta-box p {
    margin: 0;
    flex: 1 1 240px;
    font-size: 0.92rem;
}

.tfs__cta-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 10px 18px;
    border-radius: var(--tfs-radius-full);
    background: var(--tfs-primary);
    color: #fff !important;
    font-family: var(--font-heading, inherit);
    font-weight: 700;
    text-decoration: none;
    transition: background var(--tfs-transition);
}

.tfs__cta-button:hover,
.tfs__cta-button:focus-visible {
    background: var(--tfs-primary-dark);
}

.tfs__privacy {
    font-size: 0.82rem;
    color: var(--tfs-text-muted);
    margin: 4px 0 20px;
}

.tfs__privacy a {
    color: inherit;
    text-decoration: underline;
}

.tfs__consent-wrap {
    margin: 4px 0 20px;
}

.tfs__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

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

.tfs__consent input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--tfs-primary-dark);
    outline-offset: 2px;
}

.tfs__consent input[type="checkbox"].tfs__field--invalid {
    outline: 2px solid var(--tfs-danger);
    outline-offset: 2px;
}

.tfs__consent label {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--tfs-text);
    cursor: pointer;
}

.tfs__consent label a {
    color: var(--tfs-primary);
    font-weight: 700;
    text-decoration: underline;
}

.tfs__consent-wrap .tfs__field-error {
    margin-top: 4px;
}

.tfs__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: var(--tfs-radius-full);
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--tfs-primary), #ff9a55);
    color: #fff;
    font-family: var(--font-heading, inherit);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--tfs-shadow-md);
    transition: background var(--tfs-transition), transform var(--tfs-transition), box-shadow var(--tfs-transition), opacity var(--tfs-transition);
}

.tfs__submit:hover {
    background: linear-gradient(135deg, var(--tfs-primary-dark), var(--tfs-primary));
    transform: translateY(-2px);
}

.tfs__submit:focus-visible {
    outline: 2px solid var(--tfs-primary-dark);
    outline-offset: 2px;
}

.tfs__submit:disabled,
.tfs__submit--loading {
    opacity: 0.7;
    cursor: default;
    transform: none;
}

.tfs__honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/*
 * Dunkle Variante (theme="dark") — für Einbettung auf dunklem Hintergrund
 * (z. B. gruppenangebote/, vorher .tobidu-gr-form-Glass-Card). Übernimmt
 * dieselbe Optik wie das frühere mailto-Formular dort (helle Schrift,
 * transluzente Eingabefelder), damit die Migration auf das Plugin-System
 * keinen sichtbaren Design-Bruch verursacht.
 */
.tfs--dark {
    --tfs-text: #fff;
    --tfs-danger: #ff8080;
}

.tfs--dark .tfs__field label {
    color: #d5c5a5;
}

.tfs--dark .tfs__field input,
.tfs--dark .tfs__field select,
.tfs--dark .tfs__field textarea {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    box-shadow: none;
}

.tfs--dark .tfs__field select option {
    color: #1a1200;
}

.tfs--dark .tfs__field input::placeholder,
.tfs--dark .tfs__field textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.tfs--dark .tfs__field input:focus,
.tfs--dark .tfs__field select:focus,
.tfs--dark .tfs__field textarea:focus {
    border-color: var(--tfs-primary);
}

.tfs--dark .tfs__field input.tfs__field--invalid,
.tfs--dark .tfs__field select.tfs__field--invalid,
.tfs--dark .tfs__field textarea.tfs__field--invalid {
    background: rgba(255, 128, 128, 0.1);
}

.tfs--dark .tfs__hint {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: #d5c5a5;
}

.tfs--dark .tfs__privacy {
    color: #9a8a70;
}

.tfs--dark .tfs__consent label {
    color: #d5c5a5;
}

.tfs--dark .tfs__privacy a {
    color: var(--tfs-primary);
}

.tfs--dark .tfs__submit {
    width: 100%;
    justify-content: center;
    box-shadow: 0 10px 36px rgba(255, 107, 53, 0.45);
}

.tfs--dark .tfs__submit:hover {
    transform: scale(1.02) translateY(0);
}
