/* Rent+ Conversational Survey — Chat-style, mobile-first */

:root {
  --rose-bg: #f8faf8;
  --rose-bubble: #ffffff;
  --rose-border: #e5e7eb;
  --rose-green: #00bf63;
  --rose-green-hover: #00a050;
  --rose-text: #111111;
  --rose-muted: #6b7280;
  --rose-shadow: 0 2px 12px rgba(17, 17, 17, 0.06);
  --rose-radius: 16px;
  --rose-radius-sm: 12px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--rose-bg);
  color: var(--rose-text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
}

/* Header — Lerato identity */
.survey-header {
  flex-shrink: 0;
  background: var(--rose-bubble);
  border-bottom: 1px solid var(--rose-border);
  padding: 0.75rem 1rem 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--rose-shadow);
}

.survey-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-green) 0%, #1a7a4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.survey-header .identity {
  flex: 1;
  min-width: 0;
}

.survey-header .identity .name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--rose-text);
  margin: 0;
}

.survey-header .identity .role {
  font-size: 0.8125rem;
  color: var(--rose-muted);
  margin: 0.125rem 0 0;
}

/* Progress bar */
.progress-wrap {
  flex-shrink: 0;
  padding: 0 1rem;
  margin-top: 0.5rem;
}

.progress-bar {
  height: 4px;
  background: var(--rose-border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: var(--progress-pct, 0%);
  background: var(--rose-green);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Main — one message + one input */
.survey-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.assistant-message {
  background: var(--rose-bubble);
  border-radius: var(--rose-radius);
  padding: 1.25rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--rose-shadow);
  border: 1px solid var(--rose-border);
}

.assistant-message .text {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--rose-text);
  white-space: pre-line;
  margin: 0;
}

/* Input area */
.input-area {
  margin-top: auto;
  padding-bottom: 0.5rem;
}

.input-area .input-wrap {
  margin-bottom: 1rem;
}

.input-area input[type="text"],
.input-area input[type="email"],
.input-area input[type="number"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--rose-border);
  border-radius: var(--rose-radius-sm);
  background: var(--rose-bubble);
  color: var(--rose-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.input-area input:focus {
  outline: none;
  border-color: var(--rose-green);
  box-shadow: 0 0 0 3px rgba(0, 191, 99, 0.15);
}

/* Single / multi options */
.options-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-item {
  display: block;
}

.option-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-item label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--rose-bubble);
  border: 1px solid var(--rose-border);
  border-radius: var(--rose-radius-sm);
  font-size: 1rem;
  color: var(--rose-text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.option-item label:hover {
  border-color: var(--rose-green);
  background: rgba(0, 191, 99, 0.04);
}

.option-item input:checked + label,
.option-item input:focus-visible + label {
  border-color: var(--rose-green);
  background: rgba(0, 191, 99, 0.08);
  font-weight: 600;
}

/* Consent (marketing opt-in) */
.consent-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 0;
  font-size: 1rem;
  color: var(--rose-text);
  cursor: pointer;
}
.consent-checkbox {
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.option-item .check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--rose-border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.option-item input:checked + label .check {
  border-color: var(--rose-green);
  background: var(--rose-green);
}

.option-item input:checked + label .check::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 3px;
}

/* Multi-select: checkbox style */
.option-item.multi .check {
  border-radius: 6px;
}

.option-item.multi input:checked + label .check::after {
  width: 6px;
  height: 10px;
  margin-bottom: 2px;
}

.option-item.multi input:checked + label {
  font-weight: 500;
}

.option-item .multi-hint {
  font-size: 0.8125rem;
  color: var(--rose-muted);
  margin-top: 0.25rem;
}

/* Scale 1–5 */
.scale-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.scale-options {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.scale-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale-options label {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rose-bubble);
  border: 1px solid var(--rose-border);
  border-radius: var(--rose-radius-sm);
  font-weight: 600;
  font-size: 1rem;
  color: var(--rose-text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.scale-options label:hover {
  border-color: var(--rose-green);
  background: rgba(0, 191, 99, 0.06);
}

.scale-options input:checked + label {
  border-color: var(--rose-green);
  background: var(--rose-green);
  color: white;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--rose-muted);
  margin-top: 0.5rem;
  width: 100%;
}

/* CTA */
.cta-wrap {
  margin-top: 1rem;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: white;
  background: var(--rose-green);
  border: none;
  border-radius: var(--rose-radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.cta-btn:hover:not(:disabled) {
  background: var(--rose-green-hover);
}

.cta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cta-btn:focus-visible {
  outline: 2px solid var(--rose-green);
  outline-offset: 2px;
}

/* Thank you / done */
.thank-you {
  text-align: center;
  padding: 2rem 1rem;
}

.thank-you .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.thank-you h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--rose-text);
}

.thank-you p {
  font-size: 1rem;
  color: var(--rose-muted);
  margin: 0;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* Responsive: larger screens */
@media (min-width: 480px) {
  .survey-main {
    padding: 1.5rem;
  }
  .assistant-message {
    padding: 1.5rem;
  }
  .assistant-message .text {
    font-size: 1.125rem;
  }
}

@media (min-width: 768px) {
  .survey-main {
    padding: 2rem 1.5rem;
  }
  .progress-wrap {
    padding: 0 1.5rem;
  }
  .survey-header {
    padding: 0.875rem 1.5rem;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .progress-fill {
    transition: none;
  }
}
