.form-qr-page {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  padding-bottom: 3rem;
  overflow-x: hidden;
}

/* ── Header (shared: solid theme base fixes transparent PNG compositing) ─ */

.form-qr-header {
  position: relative;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  background-color: var(--form-qr-theme-color, #797ef6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

/* ── With image ─────────────────────────────────────────────────────────── */

.form-qr-header--with-image {
  align-items: center;
}

.form-qr-header--with-image .form-qr-header-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 220px;
}

.form-qr-header--with-image .form-qr-header-media::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.32) 0%, rgba(0, 0, 0, 0.08) 42%, transparent 68%);
}

.form-qr-header-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ── No image (layered gradient + soft decorative shapes) ──────────────── */

.form-qr-header--no-image {
  min-height: 180px;
  align-items: stretch;
}

.form-qr-header-banner {
  position: absolute;
  inset: 0;
  background-color: var(--form-qr-theme-color, #797ef6);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 52%),
    radial-gradient(ellipse 90% 70% at 0% 100%, rgba(0, 0, 0, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 18% 35%, rgba(255, 255, 255, 0.12) 0%, transparent 35%),
    radial-gradient(circle at 82% 65%, rgba(255, 255, 255, 0.08) 0%, transparent 32%),
    linear-gradient(145deg, var(--form-qr-theme-color, #797ef6) 0%, rgba(60, 70, 180, 0.92) 48%, rgba(40, 50, 140, 0.88) 100%);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 52%),
    radial-gradient(ellipse 90% 70% at 0% 100%, rgba(0, 0, 0, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 18% 35%, rgba(255, 255, 255, 0.12) 0%, transparent 35%),
    radial-gradient(circle at 82% 65%, rgba(255, 255, 255, 0.08) 0%, transparent 32%),
    linear-gradient(
      145deg,
      var(--form-qr-theme-color, #797ef6) 0%,
      color-mix(in srgb, var(--form-qr-theme-color, #797ef6) 55%, #1e1b4b) 52%,
      color-mix(in srgb, var(--form-qr-theme-color, #797ef6) 40%, #0f172a) 100%
    );
}

/* ── Card ─────────────────────────────────────────────────────────────── */

.form-qr-card {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 12px 40px rgba(0, 0, 0, 0.06);
  margin: -26px auto 0;
  padding: 28px 22px 32px;
  width: 92%;
  max-width: 440px;
  box-sizing: border-box;
  z-index: 1;
}

.form-qr-title {
  margin: 0 0 20px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
}

.form-qr-title + .form-qr-subtitle {
  margin-top: -16px;
}

.form-qr-subtitle {
  margin: 0 0 24px;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Fields ────────────────────────────────────────────────────────────── */

.form-qr-field-group {
  margin-bottom: 18px;
}

.form-qr-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  line-height: 1.4;
}

.form-qr-required-mark {
  color: #ef4444;
  margin-left: 2px;
}

.form-qr-input,
.form-qr-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  box-sizing: border-box;
  font-size: 0.9375rem;
  font-family: inherit;
  color: #1a1a1a;
  background-color: #fafafa;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-qr-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.form-qr-input:focus,
.form-qr-textarea:focus {
  outline: none;
  border-color: var(--form-qr-theme-color, #797ef6);
  box-shadow: 0 0 0 3px rgba(121, 126, 246, 0.15);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--form-qr-theme-color, #797ef6) 15%, transparent);
  background-color: #fff;
}

.form-qr-input::placeholder,
.form-qr-textarea::placeholder {
  color: #9ca3af;
}

.form-qr-input.form-qr-field-error,
.form-qr-textarea.form-qr-field-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-qr-error-text {
  display: none;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #ef4444;
  line-height: 1.4;
}

.form-qr-field-group.form-qr-has-error .form-qr-error-text {
  display: block;
}

/* ── Submit Button ─────────────────────────────────────────────────────── */

.form-qr-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  margin-top: 24px;
  border: none;
  border-radius: 10px;
  background: var(--form-qr-theme-color, #797ef6);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
}

.form-qr-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(121, 126, 246, 0.4);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--form-qr-theme-color, #797ef6) 40%, transparent);
}

.form-qr-submit-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.form-qr-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-qr-submit-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: form-qr-spin 0.6s linear infinite;
}

.form-qr-submit-btn.form-qr-loading .form-qr-submit-spinner {
  display: inline-block;
}

.form-qr-submit-btn.form-qr-loading .form-qr-submit-label {
  opacity: 0.8;
}

@keyframes form-qr-spin {
  to { transform: rotate(360deg); }
}

/* ── Thank-You State ───────────────────────────────────────────────────── */

.form-qr-thankyou {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  animation: form-qr-fade-in 0.4s ease;
}

.form-qr-thankyou-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
}

.form-qr-thankyou-icon circle {
  fill: var(--form-qr-theme-color, #797ef6);
}

.form-qr-thankyou-icon path {
  stroke: #ffffff;
}

.form-qr-thankyou-msg {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.5;
  margin: 0 0 8px;
}

.form-qr-redirect-msg {
  font-size: 0.8125rem;
  color: #9ca3af;
  margin: 0;
}

@keyframes form-qr-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Checkmark draw animation */
.form-qr-thankyou-icon .form-qr-check-path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: form-qr-draw-check 0.4s ease 0.2s forwards;
}

@keyframes form-qr-draw-check {
  to { stroke-dashoffset: 0; }
}

/* ── Preview badge ─────────────────────────────────────────────────────── */

.form-qr-preview-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 20px;
  text-align: center;
}

/* ── Desktop constraint ────────────────────────────────────────────────── */

@media screen and (min-width: 476px) {
  .form-qr-page {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }

  .form-qr-card {
    width: 100%;
    max-width: 440px;
    padding: 32px 28px 36px;
  }
}

/* ── Mobile refinements ────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .form-qr-header {
    border-radius: 0 0 20px 20px;
  }

  .form-qr-header--with-image .form-qr-header-media {
    max-height: 200px;
  }

  .form-qr-header--no-image {
    min-height: 160px;
  }

  .form-qr-card {
    margin-top: -22px;
    padding: 22px 18px 28px;
    width: 94%;
    border-radius: 14px;
  }

  .form-qr-title {
    font-size: 1.3rem;
  }

  .form-qr-input,
  .form-qr-textarea {
    padding: 10px 12px;
    font-size: 0.875rem;
  }

  .form-qr-submit-btn {
    padding: 13px 20px;
    font-size: 0.9375rem;
  }
}
