/* LohiBW Form Builder – Frontend Styles */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.lbf-form-wrapper {
    width: 100%;
}

.lbf-form {
    width: 100%;
}

/* ── Field Grid ──────────────────────────────────────────────────────────── */
.lbf-fields-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0 4%;
}

.lbf-field-wrap {
    width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.lbf-col-full {
    width: 100%;
}

.lbf-col-half {
    width: 48%;
}

@media (max-width: 600px) {
    .lbf-col-half {
        width: 100%;
    }
}

/* ── Hidden (Conditional) ────────────────────────────────────────────────── */
.lbf-hidden {
    display: none !important;
}

/* ── Labels ──────────────────────────────────────────────────────────────── */
.lbf-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.lbf-required-star {
    color: #c00;
    margin-left: 2px;
}

.lbf-field-description {
    margin: 4px 0 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.lbf-input,
.lbf-textarea,
.lbf-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
    background: #fff;
    color: #333;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}

.lbf-input:focus,
.lbf-textarea:focus,
.lbf-select:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .12);
}

.lbf-textarea {
    resize: vertical;
    min-height: 120px;
}

.lbf-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ── Char Counter ────────────────────────────────────────────────────────── */
.lbf-char-count {
    font-size: 12px;
    color: #888;
    text-align: right;
    margin-top: 4px;
}

.lbf-char-count.lbf-char-warn {
    color: #c00;
    font-weight: 600;
}

/* ── Consent-Felder: Schriftgröße vererben ───────────────────────────────── */
.lbf-consent-field {
    font-size: var(--lbf-consent-size, 12px);
}

.lbf-consent-field .lbf-label,
.lbf-consent-field .lbf-legend,
.lbf-consent-field .lbf-checkbox-text,
.lbf-consent-field .lbf-radio-label,
.lbf-consent-field .lbf-text-content {
    font-size: inherit;
}

/* ── Fieldsets / Radio / Checkbox ────────────────────────────────────────── */
.lbf-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.lbf-legend {
    font-weight: 600;
    margin-bottom: 8px;
    padding: 0;
}

/* Checkbox-Option: Checkbox + Text getrennt, damit Links im Text klickbar bleiben */
.lbf-checkbox-option,
.lbf-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 6px;
}

.lbf-checkbox,
.lbf-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 2px 8px 0 0;
    accent-color: #1a1a1a;
    cursor: pointer;
}

/* Das Label umfasst nur die Checkbox – kein Text darin */
.lbf-checkbox-tick {
    display: inline-flex;
    cursor: pointer;
    flex-shrink: 0;
}

/* Der Textinhalt ist ein eigenständiges span – Klick öffnet Links, nicht die Checkbox */
.lbf-checkbox-text {
    font-size: 15px;
    line-height: 1.4;
    cursor: default;
}

.lbf-checkbox-text a {
    color: #1a1a1a;
    text-decoration: underline;
    cursor: pointer;
}

.lbf-radio-label {
    font-size: 15px;
    cursor: pointer;
    line-height: 1.4;
}

/* Radio-Gruppe: untereinander (Standard) */
.lbf-radio-group.lbf-radio-vertical .lbf-radio-option {
    margin-bottom: 6px;
}

/* Radio-Gruppe: nebeneinander – Optionen brechen als Ganzes um,
   Button und Text bleiben dabei immer zusammen */
.lbf-radio-group.lbf-radio-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
}

.lbf-radio-group.lbf-radio-horizontal .lbf-radio-option {
    margin-bottom: 0;
    flex: 0 0 auto;
    max-width: 100%;
}

.lbf-other-text {
    margin-top: 8px;
    width: 100%;
}

/* ── File Input ──────────────────────────────────────────────────────────── */
.lbf-file-input {
    display: block;
    width: 100%;
    padding: 8px 0;
    font-size: 14px;
    cursor: pointer;
}

.lbf-file-hint {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* ── Typography Fields ───────────────────────────────────────────────────── */
.lbf-heading {
    margin: 0 0 12px;
}

.lbf-subheading {
    margin: 0 0 10px;
}

.lbf-separator {
    border: none;
    border-top: 1px solid #ddd;
    margin: 8px 0;
    width: 100%;
}

.lbf-text-content {
    margin-bottom: 4px;
    line-height: 1.6;
}

.lbf-text-content a {
    color: #1a1a1a;
    text-decoration: underline;
}

/* ── Submit Button ───────────────────────────────────────────────────────── */
.lbf-submit-row {
    margin-top: 8px;
}

.lbf-submit-btn {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 0;
    padding: 13px 32px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .02em;
    transition: background .15s;
    -webkit-appearance: none;
    appearance: none;
}

.lbf-submit-btn:hover {
    background: #000000;
}

.lbf-submit-btn:focus {
    outline: 3px solid rgba(0, 0, 0, .35);
    outline-offset: 2px;
}

.lbf-submit-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* ── Messages ────────────────────────────────────────────────────────────── */
.lbf-form-messages {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 0;
    font-size: 15px;
}

.lbf-form-messages.lbf-success {
    background: #edfaf0;
    border-left: 4px solid #2e7d32;
    color: #1b5e20;
}

.lbf-form-messages.lbf-error {
    background: #fef0f0;
    border-left: 4px solid #c62828;
    color: #b71c1c;
}

.lbf-success-message {
    font-weight: 600;
}

/* ── Field Error State ───────────────────────────────────────────────────── */
.lbf-field-error .lbf-input,
.lbf-field-error .lbf-textarea,
.lbf-field-error .lbf-select {
    border-color: #c62828;
    box-shadow: 0 0 0 2px rgba(198, 40, 40, .15);
}

.lbf-error-msg {
    display: block;
    font-size: 12px;
    color: #c62828;
    margin-top: 4px;
}

/* ── Ladeindikator ───────────────────────────────────────────────────────── */
.lbf-progress-wrap {
    margin-top: 14px;
}

.lbf-progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.lbf-progress-fill {
    height: 100%;
    width: 30%;
    background: #1a1a1a;
    border-radius: 2px;
    animation: lbf-progress-slide 1.6s ease-in-out infinite;
}

@keyframes lbf-progress-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.lbf-progress-msg {
    margin: 8px 0 0;
    font-size: 14px;
    color: #555;
    transition: opacity .3s;
}

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