/* ─────────────────────────────────────────────────────────────────
   ProForm Builder — Frontend Form CSS
   Mobile-first, RTL-compatible, accessible
   ───────────────────────────────────────────────────────────────── */

/* ── Reset ────────────────────────────────────────────────────── */
.proform-form-container * { box-sizing: border-box; }
.proform-form { width: 100%; max-width: 700px; margin: 0 auto; }

/* ── Fields ───────────────────────────────────────────────────── */
.proform-field { margin-bottom: 20px; position: relative; }
.proform-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
}
.proform-required { color: #dc3232; margin-left: 2px; }
.proform-tooltip { cursor: help; color: #888; font-size: 12px; margin-left: 4px; }
.proform-field-description { font-size: 12px; color: #666; margin: 4px 0 0; }
.proform-field-error {
  display: block;
  font-size: 12px;
  color: #dc3232;
  margin-top: 4px;
  min-height: 16px;
}

/* ── Inputs ───────────────────────────────────────────────────── */
.proform-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.proform-input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0,115,170,.15);
}
.proform-input.proform-input-error { border-color: #dc3232; }
.proform-textarea { min-height: 120px; resize: vertical; }
.proform-select { padding-right: 32px; 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' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

/* ── Radio & Checkbox ─────────────────────────────────────────── */
.proform-radio-group,
.proform-checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.proform-radio-label,
.proform-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}
.proform-radio,
.proform-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #0073aa;
  flex-shrink: 0;
}

/* ── File Upload ──────────────────────────────────────────────── */
.proform-file-drop-zone {
  border: 2px dashed #ccc;
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.proform-file-drop-zone.drag-over { border-color: #0073aa; background: #f0f8ff; }
.proform-file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.proform-file-drop-label { color: #666; font-size: 14px; pointer-events: none; }
.proform-file-drop-label .dashicons { font-size: 24px; display: block; margin-bottom: 6px; }
.proform-file-preview { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.proform-file-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
}
.proform-file-preview-item button { background: none; border: none; cursor: pointer; color: #dc3232; }

/* ── Rating ───────────────────────────────────────────────────── */
.proform-rating { display: flex; gap: 4px; }
.proform-rating-label { cursor: pointer; }
.proform-rating-icon { font-size: 28px; transition: transform .1s; display: block; }
.proform-rating-label:hover .proform-rating-icon,
.proform-rating-label.selected .proform-rating-icon { transform: scale(1.15); }
.proform-rating-input { position: absolute; opacity: 0; width: 0; height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Signature ────────────────────────────────────────────────── */
.proform-signature-wrap {
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  max-width: 100%;
}
.proform-signature-canvas {
  display: block;
  background: #fff;
  touch-action: none;
  max-width: 100%;
  cursor: crosshair;
}
.proform-signature-actions { padding: 6px; background: #f9f9f9; border-top: 1px solid #eee; }

/* ── Range Slider ─────────────────────────────────────────────── */
.proform-range-wrap { display: flex; align-items: center; gap: 12px; }
.proform-range-slider { flex: 1; accent-color: #0073aa; }
.proform-range-output {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: #0073aa;
}

/* ── Phone ────────────────────────────────────────────────────── */
.proform-phone-wrap { position: relative; }

/* ── Address group ────────────────────────────────────────────── */
.proform-address-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proform-address-street,
.proform-address-country { grid-column: 1 / -1; }
.proform-address-part label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
@media (max-width: 600px) { .proform-address-group { grid-template-columns: 1fr; } }

/* ── Name group ───────────────────────────────────────────────── */
.proform-name-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proform-name-part label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
@media (max-width: 500px) { .proform-name-group { grid-template-columns: 1fr; } }

/* ── Section heading ──────────────────────────────────────────── */
.proform-field-section .proform-section-title { font-size: 18px; margin: 0 0 6px; color: #333; }
.proform-field-section .proform-section-description { font-size: 14px; color: #666; margin: 0 0 10px; }
.proform-section-divider { border: none; border-top: 2px solid #e0e0e0; margin: 0; }

/* ── HTML field ───────────────────────────────────────────────── */
.proform-field-html { margin-bottom: 20px; }

/* ── Submit Button ────────────────────────────────────────────── */
.proform-submit-wrap { margin-top: 24px; }
.proform-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: #0073aa;
  color: #fff;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.proform-submit-btn:hover { background: #005f8c; }
.proform-submit-btn:active { transform: scale(.98); }
.proform-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Spinner ──────────────────────────────────────────────────── */
.proform-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: proform-spin .8s linear infinite;
}
@keyframes proform-spin { to { transform: rotate(360deg); } }

/* ── Response area ────────────────────────────────────────────── */
.proform-response { margin-top: 16px; font-size: 14px; }
.proform-response-success {
  background: #d7f5dc;
  color: #2e6b35;
  border: 1px solid #b5debb;
  border-radius: 4px;
  padding: 14px 18px;
  border-left: 4px solid #46b450;
}
.proform-response-error {
  background: #fce8e8;
  color: #7d2020;
  border: 1px solid #f5c6c6;
  border-radius: 4px;
  padding: 14px 18px;
  border-left: 4px solid #dc3232;
}

/* ── Closed form notice ───────────────────────────────────────── */
.proform-closed-notice {
  background: #fff3cd;
  border: 1px solid #ffd966;
  border-radius: 4px;
  padding: 14px 18px;
  color: #664d03;
}

/* ── Multi-step ───────────────────────────────────────────────── */
.proform-multistep .proform-page { display: none; }
.proform-multistep .proform-page.proform-page-active { display: block; }
.proform-page-break { margin-top: 20px; }
.proform-page-break-nav { display: flex; gap: 10px; }
.proform-prev-btn { background: #f0f0f0; color: #333; border: 1px solid #ccc; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 600; }
.proform-next-btn { background: #0073aa; color: #fff; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 600; }
.proform-prev-btn:hover { background: #e0e0e0; }
.proform-next-btn:hover { background: #005f8c; }

/* ── Progress Bar ─────────────────────────────────────────────── */
.proform-progress-bar-wrap { margin-bottom: 20px; }
.proform-progress-bar { background: #e0e0e0; border-radius: 10px; height: 8px; overflow: hidden; }
.proform-progress-fill { height: 100%; background: #0073aa; border-radius: 10px; transition: width .35s ease; }
.proform-progress-text { font-size: 13px; color: #666; margin-top: 6px; text-align: right; }

/* ── CAPTCHA ──────────────────────────────────────────────────── */
.proform-field-captcha { margin-bottom: 20px; }
.proform-field-captcha .g-recaptcha,
.proform-field-captcha .h-captcha { margin-top: 4px; }

/* ── Style Presets ────────────────────────────────────────────── */
/* Rounded preset */
.proform-form-rounded .proform-input { border-radius: 24px; padding-left: 16px; }
.proform-form-rounded .proform-submit-btn { border-radius: 24px; }

/* Material preset */
.proform-form-material .proform-input {
  border: none;
  border-bottom: 2px solid #ccc;
  border-radius: 0;
  background: transparent;
  padding-left: 0;
}
.proform-form-material .proform-input:focus {
  border-bottom-color: #0073aa;
  box-shadow: none;
}

/* ── Floating labels ──────────────────────────────────────────── */
.proform-label-floating .proform-field { position: relative; }
.proform-label-floating .proform-label {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 15px;
  pointer-events: none;
  transition: top .15s, font-size .15s, color .15s;
  color: #999;
  font-weight: 400;
  margin: 0;
}
.proform-label-floating .proform-input:focus ~ .proform-label,
.proform-label-floating .proform-input.has-value ~ .proform-label {
  top: -8px;
  font-size: 11px;
  color: #0073aa;
  font-weight: 600;
}

/* ── Left-aligned labels ──────────────────────────────────────── */
.proform-label-left .proform-field { display: grid; grid-template-columns: 140px 1fr; align-items: start; gap: 12px; }
.proform-label-left .proform-field-error { grid-column: 2; }
@media (max-width: 500px) { .proform-label-left .proform-field { grid-template-columns: 1fr; } }

/* ── RTL ──────────────────────────────────────────────────────── */
[dir="rtl"] .proform-select { padding-right: 12px; padding-left: 32px; background-position: left 10px center; }
[dir="rtl"] .proform-file-drop-label { direction: rtl; }

/* ── Repeater ─────────────────────────────────────────────────── */
.proform-repeater-row {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}
.proform-repeater-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #dc3232;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.proform-repeater-add { margin-top: 6px; }

/* ── Honeypot ─────────────────────────────────────────────────── */
.proform-hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Payment section ──────────────────────────────────────────── */
.proform-payment-section {
  margin: 24px 0 0;
  padding: 20px;
  border: 1px solid #d0dae8;
  border-radius: 6px;
  background: #f8fafc;
}
.proform-payment-heading {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 14px;
  color: #23282d;
}
.proform-payment-amount {
  font-size: 15px;
  margin: 0 0 16px;
  color: #333;
}
.proform-payment-amount strong { font-size: 18px; color: #0073aa; }
.proform-payment-error { color: #dc3232; font-weight: 600; }

/* ── Stripe card element ──────────────────────────────────────── */
.proform-stripe-card-element {
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.proform-stripe-card-element.StripeElement--focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0,115,170,.15);
}
.proform-stripe-card-element.StripeElement--invalid { border-color: #dc3232; }
.proform-stripe-card-errors {
  color: #dc3232;
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
}

/* ── PayPal buttons ───────────────────────────────────────────── */
.proform-paypal-buttons { margin-top: 10px; min-height: 44px; }
.proform-paypal-status  { font-size: 13px; color: #46b450; margin-top: 8px; }

/* ── Payment complete badge ───────────────────────────────────── */
.proform-payment-complete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #d7f5dc;
  color: #2e6b35;
  border: 1px solid #b5debb;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 10px;
}
