/* ============================================================
   RAD Form Builder — Public Survey Styles
   Standalone page, no theme dependency.
   ============================================================ */

/* ── Reset ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Page ────────────────────────────────────────────────────── */
.rfb-survey-body {
  background: #f4f5f7;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  min-height: 100vh;
  padding: 40px 20px 80px;
}

/* ── Container ───────────────────────────────────────────────── */
.rfb-survey-container {
  max-width: 680px;
  margin: 0 auto;
}

/* ── Survey logo (above form header) ─────────────────────────── */
.rfb-survey-logo-wrap {
  background: #fff;
  border: 1px solid #dde1e7;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 20px 36px;
  text-align: center;
}
.rfb-survey-logo {
  display: inline-block;
  max-height: 90px;
  width: auto;
  height: auto;
  object-fit: contain;
}
/* When logo is present, strip the top border-radius off the header */
.rfb-survey-header--has-logo {
  border-radius: 0;
}

/* ── Header ──────────────────────────────────────────────────── */
.rfb-survey-header {
  background: #2271b1;
  color: #fff;
  padding: 32px 36px;
  border-radius: 8px 8px 0 0;
}
.rfb-survey-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.rfb-survey-desc {
  font-size: 15px;
  opacity: .88;
  white-space: pre-line;
}

/* ── Form card ───────────────────────────────────────────────── */
.rfb-survey-form {
  background: #fff;
  border: 1px solid #dde1e7;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 28px 36px 36px;
}

/* ── Field groups ────────────────────────────────────────────── */
.rfb-field-group {
  margin-bottom: 22px;
}
.rfb-field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #444;
  margin-bottom: 6px;
}
.rfb-req-star {
  color: #d63638;
  margin-left: 3px;
}

/* ── Inputs ──────────────────────────────────────────────────── */
.rfb-input,
.rfb-textarea,
.rfb-select {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #c3c4c7;
  border-radius: 5px;
  font-size: 15px;
  color: #333;
  background: #fafafa;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: auto;
}
.rfb-input:focus,
.rfb-textarea:focus,
.rfb-select:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 3px rgba(34,113,177,.15);
  background: #fff;
}
.rfb-textarea { resize: vertical; min-height: 100px; }

/* Computed (read-only) */
.rfb-computed-input {
  background: #f0f4fa;
  color: #2271b1;
  font-weight: 600;
  cursor: not-allowed;
  border-style: dashed;
  border-color: #b8cde8;
  user-select: none;
}
.rfb-computed-input:focus {
  box-shadow: none;
  border-color: #b8cde8;
  outline: none;
}

/* ── Checkbox & Radio groups ─────────────────────────────────── */
.rfb-checkbox-group,
.rfb-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}
.rfb-checkbox-label,
.rfb-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: background .1s;
}
.rfb-checkbox-label:hover,
.rfb-radio-label:hover {
  background: #f0f4fa;
  border-color: #d0d8e8;
}
.rfb-checkbox-label input,
.rfb-radio-label input {
  width: 16px;
  height: 16px;
  accent-color: #2271b1;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Errors ──────────────────────────────────────────────────── */
.rfb-field-error {
  display: block;
  color: #d63638;
  font-size: 13px;
  margin-top: 5px;
  font-weight: 500;
}
.rfb-field-group.rfb-has-error .rfb-input,
.rfb-field-group.rfb-has-error .rfb-textarea,
.rfb-field-group.rfb-has-error .rfb-select {
  border-color: #d63638;
  box-shadow: 0 0 0 3px rgba(214,54,56,.12);
}

/* ── Confirmation dialog ─────────────────────────────────────── */
.rfb-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: rfb-fadein .15s ease;
}
@keyframes rfb-fadein { from { opacity: 0; } to { opacity: 1; } }
.rfb-confirm-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  padding: 40px 36px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: rfb-slidein .18s ease;
}
@keyframes rfb-slidein { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.rfb-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #d7f7c2;
  color: #1a5c00;
  font-size: 28px;
  line-height: 56px;
  margin: 0 auto 18px;
}
/* Logo inside the pre-submit confirmation dialog */
.rfb-confirm-logo {
  display: block;
  max-height: 60px;
  max-width: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto 16px;
}
.rfb-confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: #1d2327;
  margin: 0 0 10px;
}
.rfb-confirm-body {
  font-size: 14px;
  color: #555;
  margin: 0 0 28px;
  line-height: 1.55;
}
.rfb-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.rfb-confirm-btn {
  border: none;
  border-radius: 6px;
  padding: 11px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.rfb-confirm-btn--cancel {
  background: #f0f0f1;
  color: #1d2327;
}
.rfb-confirm-btn--cancel:hover { background: #dcdcde; }
.rfb-confirm-btn--ok {
  background: #2271b1;
  color: #fff;
}
.rfb-confirm-btn--ok:hover { background: #135e96; }
.rfb-confirm-btn:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }

/* ── Submit ──────────────────────────────────────────────────── */
.rfb-submit-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}
.rfb-submit-btn {
  background: #2271b1;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.rfb-submit-btn:hover { background: #135e96; }
.rfb-submit-btn:disabled { background: #aaa; cursor: not-allowed; }
.rfb-submit-status { font-size: 14px; font-style: italic; }

/* ── Phone prefix + number combo ────────────────────────────── */
.rfb-phone-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.rfb-phone-prefix {
  flex: 0 0 auto;
  min-width: 130px;
  max-width: 180px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 15px;
  background: #fff;
  cursor: pointer;
}
.rfb-phone-digits {
  flex: 1;
  min-width: 0;
}

/* ── Success message ─────────────────────────────────────────── */
.rfb-success-message {
  background: #d7f7c2;
  border: 1px solid #66c74c;
  color: #1a5c00;
  border-radius: 8px;
  padding: 28px 36px;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  margin-top: 0;
}
/* Logo inside the post-submit success message */
.rfb-success-logo {
  display: block;
  max-height: 70px;
  max-width: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto 18px;
}

/* ── PDF download section ────────────────────────────────────── */
.rfb-pdf-download-wrap {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
  margin-bottom: 16px;
}
.rfb-pdf-banner {
  background: linear-gradient(135deg, #2271b1 0%, #1a5a8a 100%);
  color: #fff;
  padding: 20px 28px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.rfb-pdf-banner-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.rfb-pdf-banner-msg {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
}
.rfb-pdf-btn-wrap {
  background: #f0f4fa;
  padding: 18px 28px;
  text-align: center;
  border-top: 1px solid rgba(34, 113, 177, .15);
}
.rfb-pdf-btn {
  display: inline-block;
  background: #2271b1;
  color: #fff;
  text-decoration: none;
  padding: 13px 32px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background .15s;
}
.rfb-pdf-btn:hover {
  background: #135e96;
  color: #fff;
}

/* ── Closed page ─────────────────────────────────────────────── */
.rfb-closed-message {
  background: #fff;
  border: 1px solid #dde1e7;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 48px 36px;
  text-align: center;
  color: #555;
}
.rfb-closed-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.rfb-closed-message p {
  font-size: 17px;
  margin-bottom: 8px;
}
.rfb-closed-detail {
  font-size: 14px;
  color: #777;
}

/* Powered by footer */
.rfb-powered-by {
  max-width: 680px;
  margin: 22px auto 0;
  text-align: center;
}
.rfb-powered-by-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.rfb-powered-by-link:hover,
.rfb-powered-by-link:focus {
  color: #135e96;
  text-decoration: none;
}
.rfb-powered-by-link:focus-visible {
  outline: 3px solid rgba(34, 113, 177, .25);
  outline-offset: 4px;
  border-radius: 6px;
}
.rfb-powered-by-logo {
  display: block;
  width: auto;
  height: 28px;
  object-fit: contain;
}
.rfb-powered-by-name {
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 600px) {
  .rfb-survey-body { padding: 16px 10px 60px; }
  .rfb-survey-header,
  .rfb-survey-form,
  .rfb-closed-message { padding-left: 18px; padding-right: 18px; }
  .rfb-survey-title { font-size: 20px; }
  .rfb-powered-by-link { flex-wrap: wrap; row-gap: 4px; }
  .rfb-powered-by-logo { height: 24px; }
}
