/* =====================================================
   WP Form Builder — Frontend Styles
   ===================================================== */

.wpfb-form-wrap {
    max-width: 680px;
    margin: 0 auto;
}

.wpfb-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
}

/* ---- Fields ---- */
.wpfb-field {
    margin-bottom: 18px;
    grid-column: 1 / -1; /* full width by default */
}

/* Half-width: two fields sit side-by-side */
.wpfb-field--half {
    grid-column: span 1;
}

.wpfb-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.wpfb-required {
    color: #c0392b;
    margin-left: 2px;
}

.wpfb-field input[type="text"],
.wpfb-field input[type="email"],
.wpfb-field input[type="tel"],
.wpfb-field input[type="number"],
.wpfb-field input[type="url"],
.wpfb-field input[type="date"],
.wpfb-field input[type="file"],
.wpfb-field textarea,
.wpfb-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
}

.wpfb-field input:focus,
.wpfb-field textarea:focus,
.wpfb-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,.15);
}

.wpfb-field input.wpfb-error,
.wpfb-field textarea.wpfb-error,
.wpfb-field select.wpfb-error {
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,.1);
}

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

.wpfb-field select {
    cursor: pointer;
    appearance: none;
    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 d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ---- Radio & Checkbox groups ---- */
.wpfb-radio-group,
.wpfb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpfb-radio-group--horizontal,
.wpfb-checkbox-group--horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.wpfb-radio-label,
.wpfb-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    font-size: 14px;
}

/* Image-option layout: image above input+label */
.wpfb-option-img-label {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 6px;
    transition: border-color .15s;
}
.wpfb-option-img-label:has(input:checked) {
    border-color: #0073aa;
    background: #f0f7ff;
}

.wpfb-option-image {
    display: block;
    object-fit: contain;
    border-radius: 4px;
}

/* Wrapper for input + text below the image */
.wpfb-option-choice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
}

.wpfb-radio-label input,
.wpfb-checkbox-label input {
    width: auto;
    margin: 0;
    cursor: pointer;
    accent-color: #0073aa;
}

/* ---- Help text ---- */
.wpfb-help-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #777;
}

/* ---- Divider / section ---- */
.wpfb-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 24px 0 16px;
    grid-column: 1 / -1;
}

/* ---- CAPTCHA field ---- */
.wpfb-captcha-question {
    display: inline-block;
    background: #f0f4f8;
    border: 2px solid #0073aa;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #003f6b;
    margin-bottom: 8px;
    user-select: none;
}
.wpfb-captcha-input {
    max-width: 120px !important;
    text-align: center;
    font-size: 16px !important;
}

/* ---- Text block (non-field, display only) ---- */
.wpfb-text-block {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 0 4px 4px 0;
    padding: 14px 18px;
    color: #444;
    font-size: 14px;
    line-height: 1.7;
}
.wpfb-text-block p  { margin: 0 0 8px; }
.wpfb-text-block p:last-child { margin-bottom: 0; }
.wpfb-text-block h3 { font-size: 16px; margin: 0 0 6px; color: #222; }
.wpfb-text-block h4 { font-size: 14px; margin: 0 0 5px; color: #222; }
.wpfb-text-block ul,
.wpfb-text-block ol { margin: 6px 0; padding-left: 20px; }
.wpfb-text-block li { margin-bottom: 3px; }
.wpfb-text-block strong { color: #222; }

/* ---- Text block: Accordion ---- */
.wpfb-text-block--accordion {
    padding: 0;
    overflow: hidden;
}

.wpfb-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 18px;
    background: #f0f4f8;
    border: none;
    border-bottom: 1px solid #d0d8e0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: left;
    font-family: inherit;
    transition: background .15s;
}

.wpfb-accordion-toggle:hover {
    background: #e3eaf3;
}

.wpfb-accordion-label {
    flex: 1;
}

.wpfb-accordion-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-left: 10px;
    position: relative;
    display: inline-block;
}

.wpfb-accordion-icon::before,
.wpfb-accordion-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 2px;
    background: #555;
    border-radius: 1px;
    transition: transform .25s;
}

.wpfb-accordion-icon::before { transform: translate(-50%, -50%) rotate(45deg) translateX(-3px); }
.wpfb-accordion-icon::after  { transform: translate(-50%, -50%) rotate(-45deg) translateX(3px); }

.wpfb-accordion--open .wpfb-accordion-icon::before { transform: translate(-50%, -50%) rotate(-45deg) translateX(-3px); }
.wpfb-accordion--open .wpfb-accordion-icon::after  { transform: translate(-50%, -50%) rotate(45deg) translateX(3px); }

.wpfb-accordion-body {
    padding: 14px 18px;
}

/* ---- Text block: Seitentitel ---- */
.wpfb-text-block--has-side-title {
    display: flex;
    padding: 0;
    align-items: stretch;
    gap: 0;
}

.wpfb-text-block--side-left  { flex-direction: row; }
.wpfb-text-block--side-right { flex-direction: row-reverse; }

.wpfb-text-block-side-title {
    background: #0073aa;
    color: #fff;
    padding: 14px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 36px;
}

.wpfb-text-block--side-left  .wpfb-text-block-side-title { writing-mode: vertical-rl; transform: rotate(180deg); }
.wpfb-text-block--side-right .wpfb-text-block-side-title { writing-mode: vertical-rl; }

.wpfb-text-block-content {
    padding: 14px 18px;
    flex: 1;
}

.wpfb-section-title {
    margin: 0 0 12px;
    font-size: 15px;
    color: #333;
    font-weight: 600;
    grid-column: 1 / -1;
}

/* ---- Submit button ---- */
.wpfb-submit-wrap {
    margin-top: 24px;
}

.wpfb-submit-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 11px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: inherit;
}

.wpfb-submit-btn:hover { background: #006799; }
.wpfb-submit-btn:active { transform: scale(.98); }
.wpfb-submit-btn:disabled { background: #aaa; cursor: default; }

/* ---- Messages ---- */
.wpfb-messages {
    margin-top: 16px;
    grid-column: 1 / -1;
}

.wpfb-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 0;
}

.wpfb-error-msg {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 0;
    line-height: 1.6;
}

.wpfb-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 14px;
}

.wpfb-error {
    color: #c0392b;
    font-style: italic;
}

/* ---- Loading state ---- */
.wpfb-form.wpfb-loading .wpfb-submit-btn {
    position: relative;
    padding-left: 42px;
}
.wpfb-form.wpfb-loading .wpfb-submit-btn::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpfb-spin .7s linear infinite;
}
@keyframes wpfb-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ---- Multi-Checkbox (cascading levels) ---- */
.wpfb-mc-main-label {
    display: block;
    margin-bottom: 10px;
}

.wpfb-mc-level {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.wpfb-mc-level--hidden {
    display: none;
}

.wpfb-mc-level--active {
    display: block;
    animation: wpfb-mc-reveal .2s ease;
}

@keyframes wpfb-mc-reveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wpfb-mc-level-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f6f7f7;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 12px;
}

.wpfb-mc-step-nr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.wpfb-mc-level-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.wpfb-mc-options {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wpfb-mc-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

.wpfb-mc-option-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #0073aa;
    cursor: pointer;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .wpfb-form { padding: 20px 16px; grid-template-columns: 1fr; }
    .wpfb-field--half { grid-column: 1 / -1; }
    .wpfb-radio-group--horizontal,
    .wpfb-checkbox-group--horizontal { flex-direction: column; }
}
