/* ── Roamalot Form Public Styles ────────────────────────────────────────────── */

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

.rlf-form-wrap {
	--rlf-accent:   #4F46E5;
	--rlf-accent-h: #4338ca;
	--rlf-text:     #111827;
	--rlf-muted:    #6b7280;
	--rlf-border:   #d1d5db;
	--rlf-bg:       #f9fafb;
	--rlf-radius:   10px;
	--rlf-trans:    .35s cubic-bezier(.4,0,.2,1);

	max-width: 720px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--rlf-text);
	position: relative;
}

.rlf-hidden { display: none !important; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.rlf-progress-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 32px;
}
.rlf-progress-bar {
	flex: 1;
	height: 4px;
	background: #e5e7eb;
	border-radius: 2px;
	overflow: hidden;
}
.rlf-progress-fill {
	height: 100%;
	background: var(--rlf-accent);
	border-radius: 2px;
	transition: width var(--rlf-trans);
}
.rlf-progress-label { font-size: 13px; color: var(--rlf-muted); white-space: nowrap; }

/* ── Form header ─────────────────────────────────────────────────────────── */
.rlf-form-header { text-align: center; padding: 48px 24px; }
.rlf-form-title { font-size: clamp(22px, 4vw, 34px); font-weight: 700; margin: 0 0 12px; }
.rlf-form-desc  { font-size: 16px; color: var(--rlf-muted); margin: 0 0 28px; max-width: 480px; margin-inline: auto; }
.rlf-start-btn {
	background: var(--rlf-accent);
	color: #fff;
	border: none;
	padding: 14px 32px;
	border-radius: 6px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--rlf-trans), transform .1s;
}
.rlf-start-btn:hover  { background: var(--rlf-accent-h); }
.rlf-start-btn:active { transform: scale(.97); }

/* ── Slides (one-at-a-time) ──────────────────────────────────────────────── */
.rlf-q-slide {
	display: none;
	animation: rlfSlideIn .35s ease forwards;
}
.rlf-q-slide.rlf-q-active { display: block; }
.rlf-q-slide.rlf-q-exit   { animation: rlfSlideOut .3s ease forwards; }

@keyframes rlfSlideIn  { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes rlfSlideOut { from { opacity: 1; transform: none; }             to { opacity: 0; transform: translateY(-28px); } }

/* ── Question inner ──────────────────────────────────────────────────────── */
.rlf-q-inner { padding: 40px 24px 48px; }

.rlf-q-label {
	display: block;
	font-size: clamp(18px, 3vw, 24px);
	font-weight: 600;
	margin-bottom: 20px;
	line-height: 1.4;
}
.rlf-q-number { color: var(--rlf-accent); margin-right: 8px; font-size: .85em; }
.rlf-asterisk { color: var(--rlf-accent); margin-left: 4px; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.rlf-input {
	width: 100%;
	border: 0;
	border-bottom: 2px solid var(--rlf-border);
	background: transparent;
	padding: 10px 2px;
	font-size: 18px;
	color: var(--rlf-text);
	outline: none;
	transition: border-color var(--rlf-trans);
	font-family: inherit;
}
.rlf-input:focus { border-bottom-color: var(--rlf-accent); }
.rlf-textarea { resize: vertical; min-height: 80px; }

/* ── Multiple choice ─────────────────────────────────────────────────────── */
.rlf-choices { display: flex; flex-direction: column; gap: 12px; }
.rlf-choice-label {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border: 2px solid var(--rlf-border);
	border-radius: var(--rlf-radius);
	cursor: pointer;
	transition: border-color var(--rlf-trans), background var(--rlf-trans);
	user-select: none;
}
.rlf-choice-label:hover { border-color: var(--rlf-accent); background: #eef2ff; }
.rlf-choice-input { position: absolute; opacity: 0; width: 0; height: 0; }
.rlf-choice-input:checked + .rlf-choice-key { background: var(--rlf-accent); color: #fff; border-color: var(--rlf-accent); }
.rlf-choice-label:has(.rlf-choice-input:checked) { border-color: var(--rlf-accent); background: #eef2ff; }
.rlf-choice-key {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border: 1px solid var(--rlf-border);
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	transition: background var(--rlf-trans), color var(--rlf-trans);
}
.rlf-choice-text { font-size: 16px; }

/* ── Rating ──────────────────────────────────────────────────────────────── */
.rlf-rating { display: flex; align-items: center; gap: 6px; }
.rlf-star-label { cursor: pointer; }
.rlf-star-input { position: absolute; opacity: 0; width: 0; height: 0; }
.rlf-star {
	font-size: 36px;
	color: #d1d5db;
	transition: color .15s, transform .15s;
	display: block;
}
.rlf-rating:hover .rlf-star-label .rlf-star,
.rlf-star-input:checked ~ * .rlf-star { color: #f59e0b; }

/* Hover highlight trick using sibling */
.rlf-star-label:hover .rlf-star,
.rlf-star-label:hover ~ .rlf-star-label .rlf-star { color: #fcd34d; }
.rlf-star-label:hover .rlf-star { transform: scale(1.15); }

.rlf-rating-val { font-size: 14px; color: var(--rlf-muted); margin-left: 8px; }

/* ── Navigation buttons ──────────────────────────────────────────────────── */
.rlf-q-nav { display: flex; align-items: center; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

.rlf-btn-next, .rlf-btn-submit, .rlf-btn-submit-all {
	background: var(--rlf-accent);
	color: #fff;
	border: none;
	padding: 12px 26px;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--rlf-trans), transform .1s;
}
.rlf-btn-next:hover, .rlf-btn-submit:hover, .rlf-btn-submit-all:hover { background: var(--rlf-accent-h); }
.rlf-btn-next:active, .rlf-btn-submit:active { transform: scale(.97); }
.rlf-btn-next:disabled, .rlf-btn-submit:disabled { opacity: .6; cursor: not-allowed; }

.rlf-btn-back {
	background: transparent;
	color: var(--rlf-muted);
	border: 1px solid var(--rlf-border);
	padding: 11px 20px;
	border-radius: 6px;
	font-size: 15px;
	cursor: pointer;
	transition: border-color .2s, color .2s;
}
.rlf-btn-back:hover { border-color: var(--rlf-accent); color: var(--rlf-accent); }

.rlf-enter-hint { font-size: 12px; color: var(--rlf-muted); }

/* ── All-at-once submit ──────────────────────────────────────────────────── */
.rlf-all-submit { margin-top: 32px; }
.rlf-btn-submit-all { padding: 14px 36px; font-size: 16px; }

/* ── Errors ──────────────────────────────────────────────────────────────── */
.rlf-q-error {
	color: #dc2626;
	font-size: 13px;
	margin-top: 8px;
	min-height: 18px;
}
.rlf-global-error {
	background: #fef2f2;
	border: 1px solid #fca5a5;
	color: #dc2626;
	border-radius: 6px;
	padding: 12px 16px;
	margin-top: 16px;
	font-size: 14px;
}

/* ── Success ─────────────────────────────────────────────────────────────── */
.rlf-success-screen {
	text-align: center;
	padding: 64px 24px;
	animation: rlfSlideIn .4s ease;
}
.rlf-success-icon {
	width: 72px;
	height: 72px;
	background: var(--rlf-accent);
	color: #fff;
	border-radius: 50%;
	font-size: 36px;
	line-height: 72px;
	margin: 0 auto 20px;
	animation: rlfPop .4s .1s ease both;
}
@keyframes rlfPop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rlf-success-msg { font-size: 20px; font-weight: 600; color: var(--rlf-text); }

/* ── All mode spacing ────────────────────────────────────────────────────── */
.rlf-q-all .rlf-q-inner { padding: 28px 0; border-bottom: 1px solid #f3f4f6; }
.rlf-q-all:last-of-type .rlf-q-inner { border-bottom: none; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
	.rlf-q-inner { padding: 28px 16px 36px; }
	.rlf-form-header { padding: 32px 16px; }
}

/* ── NEW QUESTION TYPE STYLES ─────────────────────────────────────────────── */

/* Phone */
.rlf-phone-wrap { position: relative; display: flex; align-items: center; }
.rlf-phone-icon { font-size: 22px; margin-right: 12px; flex-shrink: 0; }
.rlf-input-phone { flex: 1; }

/* Number */
.rlf-input-number { max-width: 220px; }
.rlf-input-number::-webkit-inner-spin-button,
.rlf-input-number::-webkit-outer-spin-button { opacity: 1; }

/* Date / Time / DateTime */
.rlf-input-date {
  cursor: pointer;
  max-width: 320px;
  color-scheme: light;
}
.rlf-input-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(30%) sepia(80%) saturate(600%) hue-rotate(210deg);
  transform: scale(1.2);
}

/* Checkboxes */
.rlf-checkboxes { display: flex; flex-direction: column; gap: 12px; }
.rlf-checkbox-label { cursor: pointer; }
.rlf-checkbox-input { position: absolute; opacity: 0; width: 0; height: 0; }
.rlf-checkbox-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--rlf-border);
  border-radius: 5px;
  flex-shrink: 0;
  transition: background var(--rlf-trans), border-color var(--rlf-trans);
  font-size: 13px;
  color: #fff;
}
.rlf-checkbox-input:checked + .rlf-checkbox-box {
  background: var(--rlf-accent);
  border-color: var(--rlf-accent);
}
.rlf-checkbox-input:checked + .rlf-checkbox-box::after { content: '✓'; }
.rlf-checkbox-label:has(.rlf-checkbox-input:checked) {
  border-color: var(--rlf-accent);
  background: #eef2ff;
}

/* Dropdown / Select */
.rlf-select-wrap { position: relative; max-width: 420px; }
.rlf-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--rlf-border);
  padding: 10px 36px 10px 2px;
  font-size: 18px;
  color: var(--rlf-text);
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--rlf-trans);
}
.rlf-select:focus { border-bottom-color: var(--rlf-accent); }
.rlf-select-arrow {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--rlf-muted);
  pointer-events: none;
}

/* Yes / No */
.rlf-yes-no { display: flex; gap: 16px; flex-wrap: wrap; }
.rlf-yn-label { cursor: pointer; }
.rlf-yn-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: 2px solid var(--rlf-border);
  border-radius: var(--rlf-radius);
  font-size: 18px;
  font-weight: 600;
  transition: border-color var(--rlf-trans), background var(--rlf-trans), color var(--rlf-trans);
  user-select: none;
}
.rlf-yn-icon { font-size: 22px; }
.rlf-yn-yes:hover { border-color: #16a34a; background: #f0fdf4; color: #16a34a; }
.rlf-yn-no:hover  { border-color: #dc2626; background: #fef2f2; color: #dc2626; }
.rlf-yn-label:has(.rlf-choice-input:checked) .rlf-yn-yes { border-color: #16a34a; background: #f0fdf4; color: #16a34a; }
.rlf-yn-label:has(.rlf-choice-input:checked) .rlf-yn-no  { border-color: #dc2626; background: #fef2f2; color: #dc2626; }

/* Opinion Scale */
.rlf-scale { margin-top: 8px; }
.rlf-scale-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rlf-scale-label { cursor: pointer; }
.rlf-scale-input { position: absolute; opacity: 0; width: 0; height: 0; }
.rlf-scale-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--rlf-border);
  border-radius: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--rlf-muted);
  transition: border-color var(--rlf-trans), background var(--rlf-trans), color var(--rlf-trans);
}
.rlf-scale-label:hover .rlf-scale-btn { border-color: var(--rlf-accent); color: var(--rlf-accent); }
.rlf-scale-label:has(.rlf-scale-input:checked) .rlf-scale-btn {
  background: var(--rlf-accent);
  border-color: var(--rlf-accent);
  color: #fff;
}
.rlf-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--rlf-muted);
}

/* New admin type badges */
.rlf-type-long_text  { background: #ede9fe; color: #5b21b6; }
.rlf-type-phone      { background: #d1fae5; color: #065f46; }
.rlf-type-number     { background: #dbeafe; color: #1e40af; }
.rlf-type-url        { background: #fce7f3; color: #831843; }
.rlf-type-date       { background: #ffedd5; color: #c2410c; }
.rlf-type-time       { background: #fef9c3; color: #92400e; }
.rlf-type-datetime   { background: #fef3c7; color: #b45309; }
.rlf-type-checkbox   { background: #ecfdf5; color: #065f46; }
.rlf-type-dropdown   { background: #e0f2fe; color: #0c4a6e; }
.rlf-type-yes_no     { background: #fdf4ff; color: #7e22ce; }
.rlf-type-scale      { background: #fff1f2; color: #9f1239; }

@media (max-width: 480px) {
  .rlf-scale-btn { width: 40px; height: 40px; font-size: 15px; }
  .rlf-yn-btn   { padding: 12px 20px; font-size: 16px; }
}

/* ── Searchable Choice Dropdown ───────────────────────────────────────────── */

/* Outer wrapper - matches other field widths */
.rlf-searchable-wrap {
	position: relative;
	width: 100%;
}

/* The visible "input" row - identical bottom-border style to .rlf-input */
.rlf-search-input-wrap {
	display: flex;
	align-items: center;
	border: 0;
	border-bottom: 2px solid var(--rlf-border);
	background: transparent;
	padding: 10px 2px;
	transition: border-color var(--rlf-trans);
	gap: 8px;
}
.rlf-searchable-wrap.rlf-search-open .rlf-search-input-wrap,
.rlf-search-input-wrap:focus-within {
	border-bottom-color: var(--rlf-accent);
}

/* Search icon - subtle, same muted colour as placeholder */
.rlf-search-icon {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	color: var(--rlf-muted);
	opacity: .7;
}

/* The text input itself - no border, no background, inherits form font */
.rlf-search-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 0;
	font-size: 18px;
	color: var(--rlf-text);
	font-family: inherit;
	outline: none;
	min-width: 0;
}
.rlf-search-input::placeholder { color: var(--rlf-muted); }

/* Small ×  clear button - only visible after selection */
.rlf-search-clear {
	flex-shrink: 0;
	font-size: 18px;
	line-height: 1;
	color: var(--rlf-muted);
	cursor: pointer;
	padding: 0 2px;
	transition: color .15s;
}
.rlf-search-clear:hover { color: var(--rlf-text); }

/* Selected value pill */
.rlf-search-selected-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #eef2ff;
	color: var(--rlf-accent);
	border: 1px solid #c7d2fe;
	border-radius: 20px;
	padding: 3px 10px 3px 12px;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	flex-shrink: 0;
}
.rlf-pill-remove {
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	opacity: .7;
}
.rlf-pill-remove:hover { opacity: 1; }

/* Dropdown panel - floats below the input row */
.rlf-search-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--rlf-border);
	border-radius: 8px;
	box-shadow: 0 8px 28px rgba(0,0,0,.10);
	max-height: 240px;
	overflow-y: auto;
	z-index: 9999;
	padding: 4px 0;
	margin: 0;
	list-style: none;
	animation: rlfDropIn .15s ease;
}
@keyframes rlfDropIn {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: none; }
}

/* Individual option rows */
.rlf-search-option {
	padding: 11px 16px;
	font-size: 16px;
	color: var(--rlf-text);
	cursor: pointer;
	transition: background .1s;
	list-style: none;
}
.rlf-search-option:hover,
.rlf-search-option.rlf-option-focused {
	background: #eef2ff;
	color: var(--rlf-accent);
}
.rlf-search-option.rlf-option-selected {
	background: #eef2ff;
	color: var(--rlf-accent);
	font-weight: 600;
}
.rlf-search-option.rlf-option-selected::after { content: '  ✓'; font-size: 13px; }
.rlf-search-option.rlf-option-hidden { display: none !important; }

/* "No results" row */
.rlf-search-no-results {
	padding: 11px 16px;
	font-size: 15px;
	color: var(--rlf-muted);
	font-style: italic;
}

/* Highlight matched text */
.rlf-search-option mark {
	background: #fef08a;
	color: inherit;
	border-radius: 2px;
	padding: 0 1px;
}

/* Admin badge */
.rlf-type-searchable_choice { background: #f0fdf4; color: #166534; }

/* ── Country field ────────────────────────────────────────────────────────── */
/* Country type reuses .rlf-searchable-wrap styles — just style the globe icon */
.rlf-country-wrap .rlf-search-icon { color: #2563eb; opacity: .8; }

/* Admin badge */
.rlf-type-country { background: #eff6ff; color: #1d4ed8; }
