/* ═══════════════════════════════════════════════════════════════════
   TypeWave Public Form – Typeform-style renderer
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ── Container ──────────────────────────────────────────────────────── */
.typewave-embed {
  position: relative;
  overflow: hidden;
  font-family: 'Outfit', system-ui, sans-serif;
  border-radius: 12px;
  min-height: 500px;
}
.typewave-embed * { box-sizing: border-box; }

.tw-form-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Progress Bar ───────────────────────────────────────────────────── */
.tw-progress-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,0.15);
  z-index: 50;
}
.tw-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Screens ────────────────────────────────────────────────────────── */
.tw-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(30px);
}
.tw-screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.tw-screen.exiting {
  opacity: 0;
  transform: translateY(-30px);
  pointer-events: none;
}
.tw-screen.entering-from-bottom {
  transform: translateY(40px);
}
.tw-screen.entering-from-top {
  transform: translateY(-40px);
}

/* ── Welcome Screen ─────────────────────────────────────────────────── */
.tw-welcome {
  text-align: center;
  max-width: 600px;
}
.tw-welcome-title {
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin: 0 0 16px;
}
.tw-welcome-desc {
  font-size: clamp(15px, 2.5vw, 18px);
  opacity: 0.8;
  line-height: 1.6;
  margin: 0 0 36px;
  font-weight: 300;
}

/* ── Question Screen ─────────────────────────────────────────────────── */
.tw-question-wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}
.tw-q-meta {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.6;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.tw-q-text {
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
}
.tw-q-hint {
  font-size: 14px;
  opacity: 0.65;
  margin: 0 0 28px;
  font-weight: 400;
  line-height: 1.5;
}
.tw-required-mark { color: #ff6584; margin-left: 3px; }

/* ── Inputs ─────────────────────────────────────────────────────────── */
.tw-answer-area { width: 100%; }

.tw-text-input,
.tw-textarea-input,
.tw-email-input,
.tw-number-input,
.tw-phone-input,
.tw-date-input,
.tw-dropdown-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255,255,255,0.3);
  border-radius: 0;
  padding: 12px 0;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.tw-text-input:focus,
.tw-textarea-input:focus,
.tw-email-input:focus,
.tw-number-input:focus,
.tw-phone-input:focus,
.tw-date-input:focus,
.tw-dropdown-input:focus {
  border-bottom-width: 2px;
}
.tw-textarea-input {
  resize: none;
  min-height: 80px;
  display: block;
  line-height: 1.6;
}
.tw-dropdown-input option { background: #1a1d27; color: #fff; }

/* ── Yes / No ───────────────────────────────────────────────────────── */
.tw-yesno-wrap { display: flex; gap: 16px; flex-wrap: wrap; }
.tw-yesno-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.3);
  background: transparent;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}
.tw-yesno-btn:hover { border-color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.1); }
.tw-yesno-btn.selected { border-color: currentColor; background: rgba(255,255,255,0.15); }
.tw-yesno-key {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  font-family: monospace;
}

/* ── Multiple Choice / Checkboxes ────────────────────────────────────── */
.tw-choices { display: flex; flex-direction: column; gap: 10px; }
.tw-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 16px;
  font-weight: 400;
}
.tw-choice:hover { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.08); }
.tw-choice.selected { border-color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.12); }
.tw-choice-key {
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.tw-choice.selected .tw-choice-key { background: rgba(255,255,255,0.3); }
.tw-choice-label { flex: 1; }

/* ── Star Rating ─────────────────────────────────────────────────────── */
.tw-stars { display: flex; gap: 8px; flex-wrap: wrap; }
.tw-star {
  font-size: clamp(28px, 5vw, 38px);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  filter: grayscale(1) brightness(0.6);
  user-select: none;
  line-height: 1;
}
.tw-star:hover,
.tw-star.lit { filter: grayscale(0) brightness(1); transform: scale(1.15); }
.tw-star.lit + .tw-star { filter: grayscale(1) brightness(0.5); }

/* ── Scale ───────────────────────────────────────────────────────────── */
.tw-scale { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-scale-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.25);
  background: transparent;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tw-scale-btn:hover { border-color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.1); }
.tw-scale-btn.selected { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,1); }
.tw-scale-labels { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.5; margin-top: 8px; }

/* ── Action Row (OK button + hint) ───────────────────────────────────── */
.tw-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.tw-ok-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 8px;
  border: none;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
  letter-spacing: 0.2px;
}
.tw-ok-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.tw-ok-btn:active { transform: translateY(0); }
.tw-ok-btn .tw-check { font-size: 12px; }
.tw-enter-hint {
  font-size: 12px;
  opacity: 0.5;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}
.tw-key-badge {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
}

/* ── Validation error ────────────────────────────────────────────────── */
.tw-error-msg {
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: tw-shake 0.4s ease;
}
@keyframes tw-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* ── Navigation Arrows ──────────────────────────────────────────────── */
.tw-nav {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 40;
}
.tw-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}
.tw-nav-btn:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); }
.tw-nav-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* ── Thank You Screen ────────────────────────────────────────────────── */
.tw-thankyou {
  text-align: center;
  max-width: 480px;
}
.tw-thankyou-icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
  animation: tw-bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tw-bounce-in {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.tw-thankyou-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin: 0 0 14px;
}
.tw-thankyou-body {
  font-size: 16px;
  opacity: 0.8;
  line-height: 1.6;
  font-weight: 300;
  margin: 0;
}

/* ── Loading State ───────────────────────────────────────────────────── */
.tw-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  font-size: 15px;
  opacity: 0.6;
}
.tw-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.8);
  border-radius: 50%;
  animation: tw-spin 0.8s linear infinite;
}
@keyframes tw-spin { to { transform: rotate(360deg); } }

/* ── Error State ────────────────────────────────────────────────────── */
.tw-load-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0.6;
  padding: 24px;
  text-align: center;
}

/* ── Powered by ─────────────────────────────────────────────────────── */
.tw-powered-by {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  opacity: 0.3;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .tw-screen { padding: 32px 20px; }
  .tw-scale-btn { width: 40px; height: 40px; font-size: 14px; }
  .tw-action-row { flex-direction: column; align-items: flex-start; }
}
