/**
 * CS Forms Core — Frontend Basis-Styles
 *
 * Wird IMMER geladen wenn ein Theme != "none" aktiv ist.
 * Enthält: Reset, Multi-Step, Accessibility, Spinner.
 * Theme-spezifische Styles liegen in assets/css/themes/.
 */

/* ═══════════════════════════════════════════════════════════════════════
   1. BASIS-RESET — Konsistentes Verhalten unabhängig vom Theme
   ═══════════════════════════════════════════════════════════════════ */

.cs-forms-wrap {
    position: relative;
}

.cs-forms-form {
    margin: 0;
    padding: 0;
}

.cs-forms-form *,
.cs-forms-form *::before,
.cs-forms-form *::after {
    box-sizing: border-box;
}

/* Honeypot — unsichtbar, aber nicht display:none (Bots könnten das erkennen) */
.cs-forms-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

/* Fehlermeldungen — initial unsichtbar */
.cs-forms-field-error:empty {
    display: none;
}

/* Response-Region */
.cs-forms-response[hidden] {
    display: none;
}

/* Standalone Opt-In-Status (vom Shortcode [cs_form_optin_status])
   — wird ohne Formular-Wrapper gerendert, braucht etwas Eigenleben.
   Die Erfolgs-/Fehler-Farben kommen aus dem aktiven Theme. */
.cs-forms-response--optin {
    margin: 16px 0;
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
}
.cs-forms-response--optin p {
    margin: 0;
}

/* Info-Variante fuer den Vorschau-Platzhalter im Page-Builder */
.cs-forms-response-info {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    color: #1e3a8a;
}

/* ═══════════════════════════════════════════════════════════════════════
   2. MULTI-STEP
   ═══════════════════════════════════════════════════════════════════ */

/* Progress Bar */
.cs-forms-progress {
    margin-bottom: 1.5em;
}

.cs-forms-progress-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
    counter-reset: step;
}

.cs-forms-progress-item {
    flex: 1;
    text-align: center;
    position: relative;
    padding-bottom: 0.75em;
    font-size: 0.8125em;
    color: #9ca3af;
}

.cs-forms-progress-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
}

.cs-forms-progress-active::after,
.cs-forms-progress-completed::after {
    background: #3b82f6;
}

.cs-forms-progress-active {
    color: #1d4ed8;
    font-weight: 600;
}

.cs-forms-progress-completed {
    color: #166534;
}

.cs-forms-progress-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75em;
    height: 1.75em;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.875em;
    margin-bottom: 0.25em;
}

.cs-forms-progress-active .cs-forms-progress-num {
    background: #1d4ed8;
    color: #fff;
}

.cs-forms-progress-completed .cs-forms-progress-num {
    background: #166534;
    color: #fff;
}

.cs-forms-progress-label {
    display: block;
}

/* Steps */
.cs-forms-step[hidden] {
    display: none;
}

.cs-forms-step {
    border: none;
    padding: 0;
    margin: 0;
}

.cs-forms-step legend.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Step Navigation */
.cs-forms-step-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5em;
    gap: 1em;
}

.cs-forms-step-prev,
.cs-forms-step-next {
    padding: 0.6em 1.5em;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 0.9375em;
    cursor: pointer;
    transition: background 0.15s;
}
.cs-forms-step-prev:hover,
.cs-forms-step-next:hover {
    background: #f3f4f6;
}

.cs-forms-step-next {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
    margin-left: auto;
}
.cs-forms-step-next:hover {
    background: #1e40af;
}

/* ═══════════════════════════════════════════════════════════════════════
   3. ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════ */

/* Pflichtfeld-Marker (nicht nur Farbe!) */
.cs-forms-required-marker::after {
    content: ' *';
    color: #dc2626;
}

/* Focus-Visible (Tastatur-Navigation deutlich sichtbar) */
.cs-forms-form :focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduzierte Bewegung */
@media (prefers-reduced-motion: reduce) {
    .cs-forms-form *,
    .cs-forms-form *::before,
    .cs-forms-form *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Spinner während Submit */
.cs-forms-submitting .cs-forms-submit {
    position: relative;
    color: transparent;
}
.cs-forms-submitting .cs-forms-submit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25em;
    height: 1.25em;
    margin: -0.625em 0 0 -0.625em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cs-forms-spin 0.6s linear infinite;
}

@keyframes cs-forms-spin {
    to { transform: rotate(360deg); }
}
