/* ─── PressBook Forms - Public Form Styles ──────────────────────── */
.pbf-form {
    max-width: 720px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pbf-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

/* Width grid */
.pbf-field            { box-sizing: border-box; }
.pbf-width-100        { width: 100%; }
.pbf-width-50         { width: calc(50% - 8px); }
.pbf-width-33         { width: calc(33.333% - 11px); }
.pbf-width-25         { width: calc(25% - 12px); }

@media (max-width: 600px) {
    .pbf-width-50,
    .pbf-width-33,
    .pbf-width-25 { width: 100%; }
}

/* Labels */
.pbf-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.pbf-required {
    color: #dc2626;
    margin-left: 2px;
}

/* Inputs */
.pbf-form input[type="text"],
.pbf-form input[type="email"],
.pbf-form input[type="phone"],
.pbf-form input[type="tel"],
.pbf-form input[type="number"],
.pbf-form input[type="url"],
.pbf-form input[type="date"],
.pbf-form textarea,
.pbf-form select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 15px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    color: #111827;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

.pbf-form input[type="date"] { cursor: pointer; }
.pbf-form textarea { resize: vertical; min-height: 100px; }

.pbf-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.pbf-form input:focus,
.pbf-form textarea:focus,
.pbf-form select:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30,58,95,.12);
}

/* File input */
.pbf-form input[type="file"] {
    padding: 8px;
    border: 1.5px dashed #d1d5db;
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    background: #fafafa;
}

/* Radio / Checkbox */
.pbf-form .pbf-fieldset {
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    padding: 12px 14px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}
.pbf-form .pbf-fieldset legend {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    padding: 0 4px;
}
.pbf-form .pbf-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 15px;
    font-weight: 400;
    color: #374151;
}
.pbf-form .pbf-choice input { width: auto; margin: 0; cursor: pointer; }

/* Help text */
.pbf-form .pbf-help {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Heading & Divider */
.pbf-form .pbf-heading {
    margin: 8px 0 4px;
    color: #1e3a5f;
    font-size: 1.2em;
}
.pbf-form .pbf-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    width: 100%;
    margin: 4px 0;
}

/* Submit */
.pbf-submit-wrap { margin-top: 4px; }

.pbf-submit-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 700;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: inherit;
}
.pbf-submit-btn:hover   { background: #16304f; }
.pbf-submit-btn:active  { transform: scale(.98); }
.pbf-submit-btn:disabled { opacity: .65; cursor: not-allowed; }

/* Notices */
.pbf-notice {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 15px;
}
.pbf-notice.pbf-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.pbf-notice.pbf-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Field error states */
.pbf-form .pbf-field-error input,
.pbf-form .pbf-field-error textarea,
.pbf-form .pbf-field-error select {
    border-color: #dc2626;
}
.pbf-form .pbf-error-msg {
    display: block;
    font-size: 12px;
    color: #dc2626;
    margin-top: 4px;
}

/* ─── Name field ─────────────────────────────────────────────────────────── */
.pbf-form .pbf-name-fieldset {
    border: none; padding: 0; margin: 0;
}
.pbf-form .pbf-name-fieldset legend {
    font-size: 14px; font-weight: 600; color: #374151;
    padding: 0; margin-bottom: 8px; display: block; width: 100%;
}
.pbf-name-row {
    display: flex; gap: 12px;
}
.pbf-name-col {
    flex: 1; display: flex; flex-direction: column;
}
.pbf-name-col-mid { flex: 0 0 120px; }
.pbf-sublabel {
    font-size: 11px; color: #9ca3af; margin-top: 4px; text-align: center;
    font-weight: 500; letter-spacing: .03em;
}
@media (max-width: 500px) {
    .pbf-name-row { flex-direction: column; }
    .pbf-name-col-mid { flex: 1; }
}

/* ─── Number Slider ──────────────────────────────────────────────────────── */
.pbf-slider-wrap { display: flex; flex-direction: column; gap: 6px; }

.pbf-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px;
    border: none !important;
    border-radius: 3px;
    background: linear-gradient(to right, #1e3a5f 0%, #1e3a5f var(--pct,50%), #d1d5db var(--pct,50%), #d1d5db 100%);
    cursor: pointer; padding: 0 !important; outline: none;
}
.pbf-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: #1e3a5f; border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    cursor: pointer; transition: transform .15s;
}
.pbf-slider::-webkit-slider-thumb:hover  { transform: scale(1.15); }
.pbf-slider::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: #1e3a5f; border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer;
}
.pbf-slider-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #6b7280;
}
.pbf-slider-val {
    background: #1e3a5f; color: #fff;
    padding: 2px 10px; border-radius: 12px;
    font-size: 13px; font-weight: 700; min-width: 40px; text-align: center;
}
.pbf-slider-min, .pbf-slider-max { font-size: 11px; }

/* ─── Choice layouts ─────────────────────────────────────────────────────── */
.pbf-form .pbf-choices {
    border: 1.5px solid #d1d5db; border-radius: 6px;
    padding: 12px 14px; margin: 0; width: 100%; box-sizing: border-box;
}
.pbf-form .pbf-choices legend {
    font-size: 14px; font-weight: 600; color: #374151; padding: 0 4px;
}
.pbf-form .pbf-choices.pbf-choices-horizontal {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 20px;
}
.pbf-form .pbf-choices.pbf-choices-horizontal legend {
    flex: 0 0 100%; margin-bottom: 4px;
}
.pbf-form .pbf-choice {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0; cursor: pointer;
    font-size: 15px; font-weight: 400; color: #374151;
}
.pbf-form .pbf-choice input[type="radio"],
.pbf-form .pbf-choice input[type="checkbox"] {
    width: 16px; height: 16px; margin: 0;
    accent-color: #1e3a5f; cursor: pointer; flex-shrink: 0;
    border: none !important; padding: 0 !important;
}
.pbf-form .pbf-single-check { margin: 4px 0; }

/* ─── CAPTCHA ────────────────────────────────────────────────────────────── */
.pbf-captcha label {
    display: block; font-size: 14px; font-weight: 600;
    color: #374151; margin-bottom: 8px;
}
.pbf-captcha-row {
    display: flex; align-items: center; gap: 12px;
    background: #f8fafc;
    border: 1.5px solid #d1d5db;
    border-radius: 8px; padding: 12px 16px;
}
.pbf-captcha-math {
    font-size: 22px; font-weight: 800; color: #1e3a5f;
    font-family: 'Courier New', monospace; white-space: nowrap;
    letter-spacing: .05em;
}
.pbf-captcha-input {
    width: 80px !important; font-size: 18px !important;
    font-weight: 700 !important; text-align: center;
    border: 1.5px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 8px !important; flex-shrink: 0;
}

/* ─── Phone field ─────────────────────────────────────────────────────────── */
.pbf-phone-wrap { display: flex; gap: 8px; }
.pbf-phone-code {
    flex: 0 0 120px; font-size: 13px;
    border: 1.5px solid #d1d5db; border-radius: 6px;
    padding: 10px 8px; background: #fff; cursor: pointer;
}
.pbf-phone-wrap input { flex: 1; }

/* ─── Date/Time row ───────────────────────────────────────────────────────── */
.pbf-datetime-row { display: flex; gap: 10px; }
.pbf-datetime-row input { flex: 1; }

/* ─── Address field ───────────────────────────────────────────────────────── */
.pbf-form .pbf-address-fieldset { border: none; padding: 0; margin: 0; }
.pbf-form .pbf-address-fieldset legend {
    font-size: 14px; font-weight: 600; color: #374151;
    display: block; width: 100%; margin-bottom: 10px; padding: 0;
}
.pbf-address-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.pbf-address-street, .pbf-address-street2 { grid-column: 1 / -1; }
.pbf-address-row { display: flex; flex-direction: column; }
.pbf-address-row input, .pbf-address-row select { width: 100%; }
@media (max-width: 540px) { .pbf-address-grid { grid-template-columns: 1fr; } }

/* ─── Map field ───────────────────────────────────────────────────────────── */
.pbf-map-field { display: flex; flex-direction: column; gap: 8px; }
.pbf-map-search { width: 100%; }
.pbf-map-preview {
    height: 200px; background: #f0f4f8;
    border: 1.5px solid #d1d5db; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.pbf-map-placeholder { text-align: center; color: #9ca3af; font-size: 14px; }
.pbf-map-placeholder .dashicons { font-size: 32px; width: 32px; height: 32px; display: block; margin: 0 auto 6px; }

/* ─── Password field ──────────────────────────────────────────────────────── */
.pbf-password-wrap { position: relative; }
.pbf-password-wrap input { padding-right: 44px !important; }
.pbf-pw-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: #9ca3af; padding: 4px;
    transition: color .15s;
}
.pbf-pw-toggle:hover { color: #1e3a5f; }
.pbf-confirm-label { margin-top: 12px; }

/* ─── File upload drop zone ───────────────────────────────────────────────── */
.pbf-file-drop {
    border: 2px dashed #d1d5db; border-radius: 8px;
    padding: 24px; text-align: center;
    background: #fafafa; cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}
.pbf-file-drop:hover, .pbf-file-drop.drag-over { border-color: #1e3a5f; background: #eef2f8; }
.pbf-file-icon { font-size: 32px !important; width: 32px !important; height: 32px !important; color: #9ca3af; display: block; margin: 0 auto 8px; }
.pbf-file-hint { margin: 0 0 4px; color: #374151; font-size: 14px; }
.pbf-file-browse { color: #1e3a5f; font-weight: 600; cursor: pointer; text-decoration: underline; }
.pbf-file-types { font-size: 12px; color: #9ca3af; margin: 0; }
.pbf-file-input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.pbf-file-list { text-align: left; margin-top: 8px; }
.pbf-file-list-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #374151; padding: 4px 0; }

/* ─── Camera field ────────────────────────────────────────────────────────── */
.pbf-camera-wrap { display: flex; flex-direction: column; gap: 10px; }
.pbf-camera-video, .pbf-camera-canvas, .pbf-camera-preview {
    max-width: 100%; border-radius: 8px; border: 1.5px solid #d1d5db;
}
.pbf-camera-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.pbf-btn-cam {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: 1.5px solid #d1d5db; border-radius: 6px;
    background: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all .15s; color: #374151;
}
.pbf-btn-cam:hover { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

/* ─── Repeater ────────────────────────────────────────────────────────────── */
.pbf-repeater { border: 1.5px solid #d1d5db; border-radius: 8px; overflow: hidden; }
.pbf-repeater-row {
    display: flex; gap: 8px; align-items: flex-end;
    padding: 10px 12px; border-bottom: 1px solid #f0f0f0; background: #fff;
}
.pbf-repeater-row:nth-child(even) { background: #fafafa; }
.pbf-rep-cell { flex: 1; }
.pbf-rep-cell label { font-size: 11px; font-weight: 600; color: #9ca3af; display: block; margin-bottom: 4px; }
.pbf-rep-remove {
    background: none; border: none; cursor: pointer; color: #e53e3e; padding: 6px;
    border-radius: 4px; flex-shrink: 0; font-size: 16px; line-height: 1;
}
.pbf-rep-remove:hover { background: #fee2e2; }
.pbf-rep-add {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 14px; width: 100%;
    background: #f9fafb; border: none;
    border-top: 1px solid #e5e7eb;
    font-size: 13px; font-weight: 600; color: #1e3a5f;
    cursor: pointer; transition: background .15s;
}
.pbf-rep-add:hover { background: #eef2f8; }

/* ─── Rich Text editor ────────────────────────────────────────────────────── */
.pbf-rich-toolbar {
    display: flex; gap: 4px; padding: 6px 8px;
    border: 1.5px solid #d1d5db; border-bottom: none;
    border-radius: 6px 6px 0 0; background: #f9fafb;
}
.pbf-rich-btn {
    padding: 4px 10px; border: 1px solid #d1d5db; border-radius: 4px;
    background: #fff; cursor: pointer; font-size: 13px;
    transition: all .15s;
}
.pbf-rich-btn:hover { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.pbf-rich-editor {
    border: 1.5px solid #d1d5db; border-radius: 0 0 6px 6px;
    padding: 10px 14px; background: #fff; outline: none;
    font-size: 15px; color: #111827; line-height: 1.6;
}
.pbf-rich-editor:focus { border-color: #1e3a5f; box-shadow: 0 0 0 3px rgba(30,58,95,.1); }

/* ─── Content / HTML blocks ───────────────────────────────────────────────── */
.pbf-content-block { padding: 4px 0; color: #374151; line-height: 1.6; }
.pbf-html-block    { padding: 4px 0; }

/* ─── Entry Preview ───────────────────────────────────────────────────────── */
.pbf-entry-preview {
    background: #f8fafc; border: 1.5px solid #d1d5db;
    border-radius: 8px; padding: 16px;
}
.pbf-entry-preview-title { font-size: 14px; font-weight: 700; color: #1e3a5f; margin: 0 0 10px; }
.pbf-entry-preview-body { font-size: 13px; color: #374151; }
.pbf-ep-placeholder { color: #9ca3af; font-style: italic; }

/* ─── Signature pad ───────────────────────────────────────────────────────── */
.pbf-signature-wrap { display: flex; flex-direction: column; gap: 8px; }
.pbf-sig-pad {
    border: 1.5px solid #d1d5db; border-radius: 8px;
    background: #fff; cursor: crosshair;
    touch-action: none; max-width: 100%;
}
.pbf-sig-controls {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: #9ca3af;
}
.pbf-sig-clear {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 1px solid #d1d5db; border-radius: 4px;
    padding: 4px 10px; font-size: 12px; color: #6b7280;
    cursor: pointer; transition: all .15s;
}
.pbf-sig-clear:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.pbf-sig-hint { font-style: italic; }

/* ─── Rating field ────────────────────────────────────────────────────────── */
.pbf-rating {
    display: flex; flex-direction: row-reverse;
    justify-content: flex-end; gap: 4px;
}
.pbf-rating-input { display: none; }
.pbf-rating-star {
    font-size: 32px; color: #d1d5db; cursor: pointer;
    transition: color .1s; line-height: 1;
}
.pbf-rating-input:checked ~ .pbf-rating-star,
.pbf-rating-star:hover,
.pbf-rating-star:hover ~ .pbf-rating-star { color: #f59e0b; }

/* ─── Likert Scale ────────────────────────────────────────────────────────── */
.pbf-likert-title { font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 10px; }
.pbf-likert-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pbf-likert-table th {
    background: #f9fafb; padding: 8px 10px;
    border: 1px solid #e5e7eb; font-weight: 600;
    color: #6b7280; text-align: center; font-size: 12px;
}
.pbf-likert-table th:first-child { text-align: left; }
.pbf-likert-stmt { padding: 8px 10px; border: 1px solid #e5e7eb; color: #374151; font-weight: 500; }
.pbf-likert-cell { padding: 8px 10px; border: 1px solid #e5e7eb; text-align: center; }
.pbf-likert-cell input { accent-color: #1e3a5f; width: 16px; height: 16px; cursor: pointer; }
.pbf-likert-table tr:nth-child(even) { background: #f9fafb; }

/* ─── NPS scale ───────────────────────────────────────────────────────────── */
.pbf-nps-scale { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 4px; }
.pbf-nps-input { display: none; }
.pbf-nps-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid #d1d5db; border-radius: 6px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    color: #374151; transition: all .15s;
}
.pbf-nps-input:checked + .pbf-nps-btn { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.pbf-nps-btn:hover { border-color: #1e3a5f; color: #1e3a5f; }
.pbf-nps-labels { display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; }

/* ─── Payment fields ──────────────────────────────────────────────────────── */
.pbf-payment-item { padding: 14px; background: #f9fafb; border: 1.5px solid #e5e7eb; border-radius: 8px; }
.pbf-payment-item > label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.pbf-pay-price-display {
    font-size: 28px; font-weight: 800; color: #1e3a5f;
    font-family: 'Courier New', monospace; margin: 4px 0;
}
.pbf-pay-choice {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 6px; cursor: pointer;
    font-size: 14px; color: #374151; transition: background .1s;
}
.pbf-pay-choice:hover { background: #eef2f8; }
.pbf-pay-item-price { margin-left: auto; font-weight: 700; color: #1e3a5f; }

/* Gateway placeholders */
.pbf-payment-gateway { border: 1.5px solid #d1d5db; border-radius: 8px; padding: 16px; }
.pbf-gateway-label { font-size: 15px; font-weight: 700; color: #374151; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.pbf-gateway-icon { font-size: 20px; }
.pbf-paypal-buttons-placeholder, .pbf-stripe-element {
    background: #f9fafb; border: 1.5px dashed #d1d5db; border-radius: 6px;
    padding: 20px; text-align: center; font-size: 13px; color: #9ca3af;
}
.pbf-stripe-errors { color: #dc2626; font-size: 13px; margin-top: 6px; }

/* Coupon */
.pbf-coupon-wrap { display: flex; gap: 8px; }
.pbf-coupon-input { flex: 1; }
.pbf-coupon-apply {
    padding: 10px 16px; background: #1e3a5f; color: #fff;
    border: none; border-radius: 6px; font-weight: 600; font-size: 13px;
    cursor: pointer; white-space: nowrap; transition: background .15s;
}
.pbf-coupon-apply:hover { background: #16304f; }
.pbf-coupon-msg { font-size: 12px; margin-top: 6px; }
.pbf-coupon-msg.success { color: #065f46; }
.pbf-coupon-msg.error   { color: #dc2626; }

/* Total */
.pbf-total-field {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: #1e3a5f; border-radius: 8px; color: #fff;
}
.pbf-total-label  { font-size: 15px; font-weight: 700; }
.pbf-total-amount { font-size: 26px; font-weight: 900; font-family: 'Courier New', monospace; }

/* ─── Group color dots in canvas (admin) ──────────────────────────────────── */

/* ─── Server-side error states ────────────────────────────────────────────── */
.pbf-form .pbf-field-error input,
.pbf-form .pbf-field-error textarea,
.pbf-form .pbf-field-error select {
    border-color: #dc2626 !important;
    background: #fff5f5 !important;
}
.pbf-form .pbf-field-error .pbf-choices,
.pbf-form .pbf-field-error .pbf-name-fieldset,
.pbf-form .pbf-field-error .pbf-address-fieldset {
    border-color: #dc2626 !important;
}
.pbf-error-msg {
    display: block; font-size: 12px; color: #dc2626;
    margin-top: 5px; font-weight: 500;
}
.pbf-form-errors {
    margin-bottom: 16px;
}
.pbf-form-errors ul {
    margin: 6px 0 0 18px; padding: 0;
}
.pbf-form-errors li { margin-bottom: 3px; }
