/* Pace Form Builder Frontend v2 */

.pfb-form-wrapper { max-width: 720px; margin: 0 auto; }
.pfb-fields-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.pfb-field { width: 100%; box-sizing: border-box; transition: opacity 0.2s, max-height 0.3s; }
.pfb-width-full { flex: 0 0 100%; }
.pfb-width-half { flex: 0 0 calc(50% - 8px); }
.pfb-width-third { flex: 0 0 calc(33.333% - 11px); }
@media (max-width: 600px) { .pfb-width-half, .pfb-width-third { flex: 0 0 100%; } }

/* Conditional visibility */
.pfb-conditionally-hidden { display: none !important; }

.pfb-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: #1d2327; }
.pfb-required-marker { color: #d63638; margin-left: 2px; }

.pfb-input { width: 100%; padding: 10px 14px; border: 1px solid #c3c4c7; border-radius: 4px; font-size: 15px; font-family: inherit; line-height: 1.4; box-sizing: border-box; transition: border-color 0.2s, box-shadow 0.2s; background: #fff; color: #1d2327; }
.pfb-input:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; outline: none; }
.pfb-input.pfb-error-input { border-color: #d63638; box-shadow: 0 0 0 1px #d63638; }
.pfb-input.pfb-auto-set { background: #f0f6fc; border-color: #72aee6; }

.pfb-textarea { min-height: 100px; resize: vertical; }
.pfb-select { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.pfb-checkbox-label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; line-height: 1.5; }
.pfb-checkbox { width: auto !important; margin-top: 3px; }

.pfb-section-heading { font-size: 18px; font-weight: 700; color: #1d2327; padding-bottom: 6px; border-bottom: 2px solid #2271b1; margin: 8px 0 4px; }
.pfb-field-hidden { display: none; }
.pfb-field-error { display: block; color: #d63638; font-size: 12px; margin-top: 4px; }

.pfb-submit-wrap { margin-top: 24px; display: flex; align-items: center; gap: 12px; }
.pfb-submit-btn { padding: 12px 32px; background: #2271b1; color: #fff; border: none; border-radius: 4px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; font-family: inherit; }
.pfb-submit-btn:hover { background: #135e96; }
.pfb-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.pfb-spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid #c3c4c7; border-top-color: #2271b1; border-radius: 50%; animation: pfb-spin 0.7s linear infinite; }
@keyframes pfb-spin { to { transform: rotate(360deg); } }

.pfb-messages { margin-top: 16px; }
.pfb-success-msg { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; padding: 14px 18px; border-radius: 4px; }
.pfb-error-msg { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; padding: 14px 18px; border-radius: 4px; }

/* Layouts */
.pfb-layout-compact .pfb-label { font-size: 12px; margin-bottom: 4px; }
.pfb-layout-compact .pfb-input { padding: 7px 10px; font-size: 13px; }
.pfb-layout-compact .pfb-fields-grid { gap: 10px; }

.pfb-layout-inline .pfb-field { display: flex; align-items: center; gap: 12px; }
.pfb-layout-inline .pfb-label { flex: 0 0 140px; margin-bottom: 0; text-align: right; }
.pfb-layout-inline .pfb-input { flex: 1; }
@media (max-width: 600px) { .pfb-layout-inline .pfb-field { flex-direction: column; align-items: stretch; } .pfb-layout-inline .pfb-label { text-align: left; flex: none; } }

.pfb-file { padding: 8px; border-style: dashed; }

/* ── Popup Modal ── */
.pfb-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.pfb-popup-overlay.pfb-popup-visible { opacity: 1; }

.pfb-popup {
    background: #fff;
    border-radius: 12px;
    padding: 36px 32px 28px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}
.pfb-popup-visible .pfb-popup {
    transform: scale(1) translateY(0);
}

.pfb-popup-icon { margin-bottom: 16px; }
.pfb-popup-icon svg { display: inline-block; }

.pfb-popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px;
    line-height: 1.4;
}

.pfb-popup-details {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
    line-height: 1.5;
}

.pfb-popup-btn {
    display: inline-block;
    padding: 10px 32px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    margin-top: 12px;
}

.pfb-popup-btn-success {
    background: #22c55e;
    color: #fff;
}
.pfb-popup-btn-success:hover { background: #16a34a; }

.pfb-popup-btn-error {
    background: #ef4444;
    color: #fff;
}
.pfb-popup-btn-error:hover { background: #dc2626; }

@media (max-width: 480px) {
    .pfb-popup {
        padding: 28px 20px 24px;
        margin: 0 12px;
    }
    .pfb-popup-title { font-size: 16px; }
    .pfb-popup-details { font-size: 13px; }
}
