/* PrimeDoctor — native embed form (rendered by the WP plugin without iframe).
 * Standalone stylesheet, no resets stronger than necessary so it can live
 * inside themes/Elementor without breaking layout.
 * Templates: card | inline | compact | split | quiz
 */
.pd-native { box-sizing: border-box; max-width: 100%; font-family: inherit; color: inherit; position: relative; }
.pd-native *, .pd-native *::before, .pd-native *::after { box-sizing: border-box; }
.pd-native .pd-card { background: var(--pd-surface, #ffffff); color: var(--pd-text, #0f172a);
  border: 1px solid rgba(0,0,0,.08); border-radius: 14px; padding: 24px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.pd-native h2.pd-title, .pd-native h1.pd-title { font-size: 1.5rem; line-height: 1.2; margin: 0 0 6px; font-weight: 700; }
.pd-native p.pd-sub { margin: 0 0 18px; opacity: .75; font-size: .95rem; }
.pd-native .pd-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pd-native .pd-field > label { font-size: .85rem; font-weight: 600; opacity: .85; }
.pd-native input, .pd-native textarea, .pd-native select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  font: inherit;
  background: color-mix(in srgb, var(--pd-surface, #ffffff) 80%, transparent);
  color: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.pd-native textarea { min-height: 90px; resize: vertical; }
.pd-native input:focus, .pd-native textarea:focus, .pd-native select:focus {
  border-color: var(--pd-accent, #2563eb); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pd-accent, #2563eb) 25%, transparent);
}
.pd-native .pd-honeypot { position: absolute !important; left: -9999px !important; height: 0; width: 0; opacity: 0; pointer-events: none; }
.pd-native button.pd-submit, .pd-native .pd-quiz-actions button:not(.pd-btn-ghost):not(.pd-quiz-back) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 20px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--pd-accent, #2563eb); color: #fff; font: inherit; font-weight: 600;
  transition: filter .15s, transform .05s;
}
.pd-native button.pd-submit:hover, .pd-native .pd-quiz-actions button:not(.pd-btn-ghost):not(.pd-quiz-back):hover { filter: brightness(1.07); }
.pd-native button.pd-submit:active { transform: translateY(1px); }
.pd-native button.pd-submit[disabled] { opacity: .7; cursor: not-allowed; }
.pd-native .pd-error, .pd-native .pd-quiz-error { font-size: .8rem; color: #dc2626; min-height: 1em; }
.pd-native .pd-success { padding: 14px; border-radius: 10px; background: #ecfdf5; color: #065f46;
  border: 1px solid #a7f3d0; font-weight: 500; }
.pd-native .pd-fail { padding: 12px; border-radius: 10px; background: #fef2f2; color: #991b1b;
  border: 1px solid #fecaca; font-size: .9rem; }
.pd-native .pd-preview-msg { padding: 10px 12px; border-radius: 8px; background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a; font-size: .85rem; margin-top: 8px; }

/* Preview badge (Elementor edit mode) */
.pd-native[data-preview="1"] { outline: 2px dashed rgba(59,130,246,.5); outline-offset: 4px; }
.pd-native .pd-preview-badge {
  position: absolute; top: -10px; right: 8px; padding: 3px 10px; border-radius: 999px;
  background: #2563eb; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; box-shadow: 0 2px 8px rgba(37,99,235,.35); z-index: 5;
}

/* Loading / error overlay used while config hydrates (especially in Elementor editor) */
.pd-native .pd-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 32px 16px; min-height: 160px; text-align: center;
  color: var(--pd-text, #475569); opacity: .8;
}
.pd-native .pd-loading-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--pd-accent, #2563eb) 25%, transparent);
  border-top-color: var(--pd-accent, #2563eb);
  animation: pd-spin .8s linear infinite;
}
@keyframes pd-spin { to { transform: rotate(360deg); } }
.pd-native .pd-loading-text { font-size: .85rem; font-weight: 500; }
.pd-native .pd-error-box {
  padding: 16px; border-radius: 10px; background: #fef2f2; color: #991b1b;
  border: 1px solid #fecaca; font-size: .9rem; line-height: 1.4;
}
.pd-native .pd-error-box strong { display: block; margin-bottom: 4px; }
.pd-native .pd-error-box button {
  margin-top: 10px; padding: 6px 14px; border-radius: 8px; border: 1px solid #fca5a5;
  background: #fff; color: #991b1b; cursor: pointer; font: inherit; font-weight: 600;
}

/* Template variations */
.pd-native.pd-tpl-inline .pd-card { border: 0; box-shadow: none; padding: 0; background: transparent; }
.pd-native.pd-tpl-compact .pd-card { padding: 16px; border-radius: 10px; }
.pd-native.pd-tpl-compact h2.pd-title { font-size: 1.15rem; }
.pd-native.pd-tpl-compact p.pd-sub { font-size: .85rem; margin-bottom: 12px; }
.pd-native.pd-tpl-split .pd-card { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.pd-native.pd-tpl-split .pd-split-left { padding-top: 8px; }
@media (max-width: 640px) { .pd-native.pd-tpl-split .pd-card { grid-template-columns: 1fr; } }

/* Quiz template */
.pd-native.pd-tpl-quiz .pd-card { padding: 24px; min-height: 360px; display: flex; flex-direction: column; gap: 12px; }
.pd-native .pd-quiz-progress { display: flex; gap: 4px; margin-bottom: 4px; }
.pd-native .pd-quiz-progress span { flex: 1; height: 3px; border-radius: 2px; background: rgba(0,0,0,.1); }
.pd-native .pd-quiz-progress span.done { background: var(--pd-accent, #2563eb); }
.pd-native .pd-quiz-body { display: flex; flex-direction: column; flex: 1; }
.pd-native .pd-quiz-step { display: flex; flex-direction: column; gap: 14px; flex: 1; animation: pd-fade .25s ease both; }
.pd-native .pd-quiz-q { font-size: 1.2rem; font-weight: 700; line-height: 1.3; margin: 4px 0 0; }
.pd-native .pd-quiz-hint { opacity: .7; font-size: .85rem; margin: -6px 0 0; }
.pd-native .pd-quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.pd-native .pd-quiz-choice {
  display: block; width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  background: color-mix(in srgb, var(--pd-surface, #ffffff) 60%, transparent);
  color: inherit;
  font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .05s;
}
.pd-native .pd-quiz-choice:hover { border-color: var(--pd-accent, #2563eb); background: color-mix(in srgb, var(--pd-accent, #2563eb) 12%, var(--pd-surface, #ffffff)); }
.pd-native .pd-quiz-choice:active { transform: scale(.99); }
.pd-native .pd-quiz-choice.is-selected { border-color: var(--pd-accent, #2563eb); background: color-mix(in srgb, var(--pd-accent, #2563eb) 20%, var(--pd-surface, #ffffff)); }
.pd-native .pd-quiz-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.pd-native .pd-quiz-actions button { flex: 1; min-width: 120px; }
.pd-native .pd-quiz-actions .pd-btn-ghost {
  background: transparent !important; color: inherit !important;
  border: 1px solid rgba(0,0,0,.15) !important; flex: 0 0 auto; min-width: 84px;
}
.pd-native .pd-quiz-back {
  background: transparent !important; color: inherit !important; opacity: .6;
  border: 0 !important; padding: 6px 0 !important; width: auto !important; margin: 0 !important;
  font-size: 12px !important; font-weight: 500 !important; text-align: left; cursor: pointer;
}
.pd-native .pd-quiz-back:hover { opacity: 1; }
.pd-native .pd-quiz-thanks { align-items: center; text-align: center; padding: 16px 0; }
.pd-native .pd-quiz-thanks-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: color-mix(in srgb, var(--pd-accent, #2563eb) 15%, #fff);
  color: var(--pd-accent, #2563eb);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
}

@keyframes pd-fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none;} }

/* Loading shell shown before JS hydrates the form */
.pd-native[data-state="loading"] .pd-shell::after {
  content: ""; display: block; height: 220px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04));
  background-size: 200% 100%; animation: pd-skel 1.4s linear infinite;
}
@keyframes pd-skel { 0%{background-position: 200% 0;} 100%{background-position: -200% 0;} }
