/* =============================================================
   RCT Survey Page — tourist-facing [rct_survey] wizard.
   Mobile-first: designed to be handed phone-to-phone between
   tourists on one device. --rct-sv-color is set inline by survey.js
   from the admin-configured main color.
============================================================= */

:root { --rct-sv-color: #D3211A; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  background: #f4f4f5;
  color: #1a1a1a;
}

#rct-survey-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* ---------- Loading / error ---------- */
.rct-sv-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px; color: #787c82;
}
.rct-sv-spinner {
  width: 36px; height: 36px;
  border: 3px solid #ddd; border-top-color: var(--rct-sv-color);
  border-radius: 50%; animation: sv-spin .7s linear infinite;
}
@keyframes sv-spin { to { transform: rotate(360deg); } }

.rct-sv-error {
  max-width: 480px; margin: 60px auto; padding: 24px;
  background: #fcf0f1; border-left: 4px solid #d63638;
  color: #d63638; border-radius: 4px;
}

/* ---------- Card shell ---------- */
.rct-sv-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  padding: 24px 20px;
  position: relative;
}

.rct-sv-logo {
  display: flex; justify-content: center; margin-bottom: 12px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.rct-sv-logo img { max-height: 48px; max-width: 200px; }

/* ---------- Language picker ---------- */
.rct-sv-langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 16px; }
.rct-sv-lang {
  border: 1px solid #d5d5d8; background: #fafafa; color: #333;
  border-radius: 16px; padding: 5px 11px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.rct-sv-lang.is-active { background: var(--rct-sv-color); border-color: var(--rct-sv-color); color: #fff; }

.rct-sv-pending {
  margin-top: 16px; text-align: center;
  font-size: 12px; color: #9a6700; background: #fff8e5;
  border: 1px solid #f0dca0; border-radius: 8px; padding: 6px 10px;
}

/* ---------- Progress dots ---------- */
.rct-sv-progress { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.rct-sv-dot { width: 8px; height: 8px; border-radius: 50%; background: #e2e2e5; }
.rct-sv-dot.is-active { background: var(--rct-sv-color); width: 20px; border-radius: 4px; }
.rct-sv-dot.is-done { background: #c7c7cc; }

/* ---------- Question ---------- */
.rct-sv-q { font-size: 20px; font-weight: 700; margin: 0 0 16px; text-align: center; }

.rct-sv-input {
  width: 100%; font-size: 16px; padding: 14px 14px; margin-bottom: 8px;
  border: 1px solid #d5d5d8; border-radius: 10px; background: #fafafa;
}
.rct-sv-input:focus { outline: none; border-color: var(--rct-sv-color); background: #fff; }
.rct-sv-input[readonly] { background: #f0f0f1; color: #666; }

.rct-sv-fielderr { color: #d63638; font-size: 13px; min-height: 18px; margin-bottom: 4px; }
.rct-sv-hint { color: #787c82; font-size: 12px; margin: -4px 0 12px; }
.rct-sv-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #444; }

/* ---------- Chips (presets, channels, choice options) ---------- */
.rct-sv-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; justify-content: center; }
.rct-sv-chip {
  border: 1px solid #d5d5d8; background: #fafafa; border-radius: 20px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; color: #333;
}
.rct-sv-chip--toggle.is-checked { background: var(--rct-sv-color); border-color: var(--rct-sv-color); color: #fff; }

.rct-sv-chips--domains { margin-top: -4px; }
.rct-sv-chip--domain { font-size: 13px; padding: 6px 12px; }

/* ---------- Name autosuggest dropdown ---------- */
.rct-sv-autocomplete { position: relative; }
.rct-sv-suggest {
  display: none;
  position: absolute; left: 0; right: 0; top: calc(100% - 4px);
  background: #fff; border: 1px solid #d5d5d8; border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 5; overflow: hidden;
}
.rct-sv-suggest.is-open { display: block; }
.rct-sv-suggest-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid #eee; padding: 10px 14px; font-size: 15px;
  cursor: pointer; color: #1a1a1a;
}
.rct-sv-suggest-item:last-child { border-bottom: none; }
.rct-sv-suggest-item:hover, .rct-sv-suggest-item:active { background: #f4f4f5; }

/* ---------- Nav buttons ---------- */
.rct-sv-nav { display: flex; gap: 10px; margin-top: 8px; }
.rct-sv-btn {
  flex: 1; padding: 14px; font-size: 16px; font-weight: 700;
  border-radius: 10px; border: none; cursor: pointer;
}
.rct-sv-btn--primary { background: var(--rct-sv-color); color: #fff; }
.rct-sv-btn--ghost { background: #f0f0f1; color: #333; flex: 0 0 auto; padding-left: 20px; padding-right: 20px; }

/* ---------- Thanks screen ---------- */
.rct-sv-thanks { text-align: center; }
.rct-sv-thanks h2 { font-size: 22px; margin-bottom: 8px; }
.rct-sv-thanks p { color: #666; margin-bottom: 24px; }

@media (prefers-color-scheme: dark) {
  body { background: #1c1c1e; color: #f2f2f7; }
  .rct-sv-card { background: #2c2c2e; box-shadow: 0 2px 16px rgba(0,0,0,.4); }
  .rct-sv-input { background: #3a3a3c; border-color: #48484a; color: #f2f2f7; }
  .rct-sv-input:focus { background: #3a3a3c; }
  .rct-sv-chip { background: #3a3a3c; border-color: #48484a; color: #f2f2f7; }
  .rct-sv-btn--ghost { background: #3a3a3c; color: #f2f2f7; }
  .rct-sv-hint, .rct-sv-thanks p { color: #9a9a9e; }
  .rct-sv-suggest { background: #2c2c2e; border-color: #48484a; }
  .rct-sv-suggest-item { color: #f2f2f7; border-bottom-color: #3a3a3c; }
  .rct-sv-suggest-item:hover, .rct-sv-suggest-item:active { background: #3a3a3c; }
}
