/* ═══════════════════════════════════════════════
   Fahrzeug Ankauf Formular – Styles
   Autowelt Tom Branding: #e52029 (Rot), #1a1a1a (Schwarz)
   ═══════════════════════════════════════════════ */

:root {
    --fz-primary: #e52029;
    --fz-primary-dark: #c41a22;
    --fz-primary-light: #fef2f2;
    --fz-text: #1a1a1a;
    --fz-text-light: #6b7280;
    --fz-border: #d1d5db;
    --fz-border-focus: #e52029;
    --fz-bg: #ffffff;
    --fz-bg-section: #f9fafb;
    --fz-error: #dc2626;
    --fz-success: #059669;
    --fz-radius: 8px;
}

/* ─── Layout ───────────────────────────────── */
.fz-formular-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Reset Divi form/fieldset spacing */
.fz-form,
.fz-form fieldset,
.fz-form .fz-fieldset {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    min-inline-size: 0;
}

.fz-form .fz-grid {
    margin: 0;
    padding: 0;
}

.fz-form .fz-field {
    margin: 0;
    padding: 0;
}

/* ─── Step Indicator ─────────────────────────── */
.fz-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 0 20px;
}

.fz-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fz-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fz-border);
    color: var(--fz-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.fz-step--active .fz-step-number,
.fz-step--done .fz-step-number {
    background: var(--fz-primary);
    color: #fff;
}

.fz-step-label {
    font-size: 0.75rem;
    color: var(--fz-text-light);
    font-weight: 500;
    transition: color 0.3s ease;
}

.fz-step--active .fz-step-label {
    color: var(--fz-primary);
    font-weight: 600;
}

.fz-step--done .fz-step-label {
    color: var(--fz-text);
}

.fz-step-line {
    flex: 1;
    height: 2px;
    background: var(--fz-border);
    margin: 0 12px;
    margin-bottom: 22px;
    transition: background 0.3s ease;
}

.fz-step-line.fz-step-line--done {
    background: var(--fz-primary);
}

/* ─── Panels (Multi-Step) ────────────────────── */
.fz-panel {
    display: none;
    animation: fzFadeIn 0.3s ease;
}

.fz-panel--active {
    display: block;
}

@keyframes fzFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Fieldset / Legend ────────────────────── */
.fz-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.fz-legend {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--fz-text);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--fz-primary);
    width: 100%;
    display: block;
}

/* ─── Grid ─────────────────────────────────── */
.fz-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.fz-field--full          { grid-column: 1 / -1; }
.fz-field--half          { grid-column: span 1; }
.fz-field--third         { grid-column: span 1; }
.fz-field--quarter       { grid-column: span 1; }
.fz-field--three-quarter { grid-column: span 1; }

@media (min-width: 640px) {
    .fz-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .fz-field--full          { grid-column: 1 / -1; }
    .fz-field--half          { grid-column: span 3; }
    .fz-field--third         { grid-column: span 2; }
    .fz-field--quarter       { grid-column: span 1; }
    .fz-field--three-quarter { grid-column: span 5; }
}

/* ─── Labels ───────────────────────────────── */
.fz-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.fz-required {
    color: var(--fz-error);
}

/* ─── Inputs ───────────────────────────────── */
.fz-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    border: 1px solid var(--fz-border);
    border-radius: var(--fz-radius);
    background: var(--fz-bg);
    color: var(--fz-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.fz-input:focus {
    outline: none;
    border-color: var(--fz-border-focus);
    box-shadow: 0 0 0 3px rgba(229, 32, 41, 0.1);
}

.fz-input::placeholder {
    color: #9ca3af;
}

.fz-input.fz-input--error {
    border-color: var(--fz-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Input Group (prefix/suffix) */
.fz-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.fz-input-group .fz-input {
    flex: 1;
    min-width: 0;
}

.fz-input-suffix,
.fz-input-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--fz-bg-section);
    border: 1px solid var(--fz-border);
    color: var(--fz-text-light);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.fz-input-prefix {
    border-radius: var(--fz-radius) 0 0 var(--fz-radius);
    border-right: none;
}

.fz-input-prefix + .fz-input,
.fz-input.fz-input--with-prefix {
    border-radius: 0 var(--fz-radius) var(--fz-radius) 0;
}

.fz-input-suffix {
    border-radius: 0 var(--fz-radius) var(--fz-radius) 0;
    border-left: none;
}

.fz-input-group .fz-input:not(.fz-input--with-prefix) {
    border-radius: var(--fz-radius) 0 0 var(--fz-radius);
}

/* Select */
.fz-select {
    cursor: pointer;
    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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Textarea */
.fz-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Number inputs - hide spinners */
.fz-input[type="number"]::-webkit-outer-spin-button,
.fz-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.fz-input[type="number"] {
    -moz-appearance: textfield;
}

/* ─── Checkbox ────────────────────────────── */
.fz-checkbox-field {
    margin-top: 20px;
}

.fz-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    line-height: 1.5;
}

.fz-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--fz-primary);
    cursor: pointer;
}

.fz-checkbox-label a {
    color: var(--fz-primary);
    text-decoration: underline;
}

.fz-checkbox-label a:hover {
    color: var(--fz-primary-dark);
}

/* ─── Error Messages ──────────────────────── */
.fz-error {
    display: block;
    font-size: 0.8125rem;
    color: var(--fz-error);
    margin-top: 4px;
    min-height: 0;
    transition: all 0.2s;
}

.fz-error:empty {
    display: none;
}

/* ─── Honeypot ─────────────────────────────── */
.fz-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* ─── Upload Area ──────────────────────────── */
.fz-upload-area {
    border: 2px dashed var(--fz-border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    position: relative;
}

.fz-upload-area:hover,
.fz-upload-area.fz-upload-area--dragover {
    border-color: var(--fz-primary);
    background-color: var(--fz-primary-light);
}

.fz-upload-icon {
    color: #9ca3af;
    margin-bottom: 12px;
}

.fz-upload-text {
    font-size: 0.9375rem;
    color: #374151;
    margin: 0;
}

.fz-upload-link {
    color: var(--fz-primary);
    cursor: pointer;
    text-decoration: underline;
}

.fz-upload-hint {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 8px 0 0 0;
}

.fz-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ─── Foto Preview ─────────────────────────── */
.fz-foto-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.fz-foto-preview:empty {
    display: none;
}

.fz-foto-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--fz-radius);
    overflow: hidden;
    background: #f3f4f6;
}

.fz-foto-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fz-foto-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.fz-foto-remove:hover {
    background: rgba(220, 38, 38, 0.9);
}

/* ─── Upload Progress ─────────────────────── */
.fz-upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.fz-progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.fz-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--fz-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.fz-progress-text {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fz-text-light);
    min-width: 36px;
}

/* ─── Navigation Buttons ──────────────────── */
.fz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.fz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--fz-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.fz-btn--next,
.fz-btn--submit {
    color: #fff;
    background: var(--fz-primary);
    min-width: 140px;
}

.fz-btn--next:hover,
.fz-btn--submit:hover {
    background: var(--fz-primary-dark);
}

.fz-btn--next:active,
.fz-btn--submit:active {
    transform: scale(0.98);
}

.fz-btn--back {
    color: var(--fz-text-light);
    background: transparent;
    border: 1px solid var(--fz-border);
}

.fz-btn--back:hover {
    background: var(--fz-bg-section);
    color: var(--fz-text);
}

.fz-btn--outline {
    color: var(--fz-primary);
    background: transparent;
    border: 2px solid var(--fz-primary);
    padding: 12px 28px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--fz-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.fz-btn--outline:hover {
    background: var(--fz-primary);
    color: #fff;
}

.fz-btn--submit:disabled {
    background: #f9a8ab;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.fz-spinner {
    animation: fz-spin 1s linear infinite;
}

@keyframes fz-spin {
    100% { transform: rotate(360deg); }
}

/* ─── Message (Error) ──────────────────────── */
.fz-message {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: var(--fz-radius);
    font-size: 0.9375rem;
    font-weight: 500;
}

.fz-message--success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.fz-message--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ─── Success State ────────────────────────── */
.fz-success {
    text-align: center;
    padding: 48px 24px;
    animation: fzFadeIn 0.4s ease;
}

.fz-success-icon {
    color: var(--fz-success);
    margin-bottom: 16px;
}

.fz-success-icon svg {
    width: 64px;
    height: 64px;
}

.fz-success-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fz-text);
    margin: 0 0 12px 0;
}

.fz-success-text {
    font-size: 1rem;
    color: var(--fz-text-light);
    margin: 0 0 28px 0;
    line-height: 1.6;
}

/* ─── Responsive ───────────────────────────── */
@media (max-width: 639px) {
    .fz-grid {
        grid-template-columns: 1fr;
    }

    .fz-field--half,
    .fz-field--third,
    .fz-field--quarter,
    .fz-field--three-quarter {
        grid-column: 1 / -1;
    }

    .fz-formular-wrapper {
        padding: 0 16px;
    }

    .fz-btn--submit {
        width: 100%;
    }

    .fz-upload-area {
        padding: 24px 16px;
    }

    .fz-step-label {
        font-size: 0.6875rem;
    }

    .fz-step-number {
        width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }

    .fz-steps {
        padding: 0;
    }

    .fz-nav {
        gap: 12px;
    }

    .fz-btn {
        padding: 12px 20px;
        font-size: 0.875rem;
    }
}

/* ─── Divi Overrides (aggressive reset) ────── */

/* Reset all Divi spacing on form elements */
.fz-formular-wrapper .fz-form,
.fz-formular-wrapper .fz-form *:not(svg):not(path):not(polyline):not(circle):not(rect) {
    box-sizing: border-box !important;
}

.fz-formular-wrapper .fz-form {
    padding: 0 !important;
    margin: 0 !important;
}

.fz-formular-wrapper .fz-form fieldset,
.fz-formular-wrapper .fz-form .fz-fieldset {
    padding: 0 !important;
    margin: 0 0 24px 0 !important;
    min-inline-size: 0 !important;
    border: none !important;
}

.fz-formular-wrapper .fz-form legend,
.fz-formular-wrapper .fz-form .fz-legend {
    margin-bottom: 20px !important;
    padding: 0 0 10px 0 !important;
}

.fz-formular-wrapper .fz-form .fz-grid {
    margin: 0 !important;
    padding: 0 !important;
}

.fz-formular-wrapper .fz-form .fz-field {
    margin: 0 !important;
    padding: 0 !important;
}

.fz-formular-wrapper .fz-form .fz-label {
    display: block !important;
    padding: 0 !important;
    margin: 0 0 4px 0 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    float: none !important;
    width: auto !important;
    text-align: left !important;
}

.fz-formular-wrapper .fz-form input[type="text"],
.fz-formular-wrapper .fz-form input[type="email"],
.fz-formular-wrapper .fz-form input[type="tel"],
.fz-formular-wrapper .fz-form input[type="date"],
.fz-formular-wrapper .fz-form input[type="number"],
.fz-formular-wrapper .fz-form input[type="file"],
.fz-formular-wrapper .fz-form select,
.fz-formular-wrapper .fz-form textarea {
    border: 1px solid var(--fz-border) !important;
    border-radius: var(--fz-radius) !important;
    padding: 10px 14px !important;
    font-size: 0.9375rem !important;
    box-shadow: none !important;
    background: var(--fz-bg) !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    height: auto !important;
    line-height: 1.5 !important;
}

.fz-formular-wrapper .fz-form input:focus,
.fz-formular-wrapper .fz-form select:focus,
.fz-formular-wrapper .fz-form textarea:focus {
    border-color: var(--fz-border-focus) !important;
    box-shadow: 0 0 0 3px rgba(229, 32, 41, 0.1) !important;
    outline: none !important;
}

.fz-formular-wrapper .fz-form p {
    padding: 0 !important;
    margin: 0 !important;
}

.fz-formular-wrapper .fz-form button,
.fz-formular-wrapper .fz-form .fz-btn {
    letter-spacing: 0 !important;
    text-transform: none !important;
    float: none !important;
}

.fz-formular-wrapper .fz-form .fz-checkbox-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    padding: 0 !important;
    margin: 2px 0 0 0 !important;
}

.fz-formular-wrapper .fz-form .fz-error {
    margin: 4px 0 0 0 !important;
    padding: 0 !important;
}

.fz-formular-wrapper .fz-form .fz-input-group .fz-input {
    width: auto !important;
    flex: 1 !important;
}

.fz-formular-wrapper .fz-form .fz-input-suffix,
.fz-formular-wrapper .fz-form .fz-input-prefix {
    margin: 0 !important;
    padding: 0 12px !important;
}
