/* Respondent survey layout — source: specs/001-survey-platform/branding.md, mockup system.css */

body {
  background: var(--rsp-page-bg, #fff);
}

.rsp-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--rsp-page-bg, #fff);
}

.rsp-body {
  width: 100%;
  max-width: var(--respondent-w);
  flex: 1;
  padding: 32px 24px 48px;
}

.rsp-form-card {
  background: #fff;
  border-radius: var(--radius-sm, 8px);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--fg, #111) 6%, transparent);
}

.rsp-form-card-body {
  padding: 24px;
}

.rsp-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rsp-header-banner {
  width: 100%;
  max-height: 160px;
  overflow: hidden;
  margin-bottom: 0;
}

.rsp-header-banner img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.rsp-header-identity {
  padding: 20px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rsp-header .rsp-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
}

.rsp-header .rsp-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.rsp-header .rsp-logo-fallback {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.rsp-header .rsp-survey-name {
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
}

.rsp-header .rsp-survey-title {
  font-size: 14px;
  color: var(--muted);
}

.rsp-progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.rsp-progress-row .p-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.rsp-progress-row .progress-bar {
  flex: 1;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: color-mix(in srgb, var(--border) 60%, var(--surface));
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width var(--motion-duration) var(--motion-ease);
}

.rsp-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px 20px;
}

.rsp-footer-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rsp-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.rsp-footer-nav {
    justify-content: flex-end;
}

.rsp-footer-nav .btn:first-child:not(:only-child) {
    margin-right: auto;
}

.rsp-footer-text {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.rsp-footer-text-only .rsp-footer-inner {
  align-items: center;
}

/* Shared respondent buttons (preview + take; do not depend on admin-components.css) */
.rsp-layout .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
}

.rsp-layout .btn-sm {
  padding: 6px 14px;
  min-height: 32px;
  font-size: 13px;
}

.rsp-layout .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.rsp-layout .btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.rsp-layout .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.rsp-layout .btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

.rsp-layout .btn-secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--border) 35%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar .fill {
    transition: none;
  }
}

.rsp-entry-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 400px;
  margin: 48px auto;
  padding: 0 24px;
}

.rsp-entry-loading h1,
.rsp-entry-error h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
}

.rsp-entry-loading p,
.rsp-entry-error p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.rsp-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: rsp-spin 0.8s linear infinite;
}

@keyframes rsp-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rsp-spinner {
    animation: none;
    border-top-color: var(--primary);
    opacity: 0.85;
  }
}

.rsp-entry-error-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fde8e6;
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  font-weight: 700;
}

.rsp-lang-layout {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
}

.rsp-lang-logo {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 12px;
}

.rsp-lang-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--primary);
}

.rsp-lang-sub {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 32px;
}

.lang-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.lang-card {
  width: 200px;
  padding: 28px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--motion-duration) var(--motion-ease),
    box-shadow var(--motion-duration) var(--motion-ease),
    background-color var(--motion-duration) var(--motion-ease);
  text-align: center;
  position: relative;
  font: inherit;
  color: inherit;
}

.lang-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.lang-card.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, #fff);
}

.lang-card .check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.lang-card.selected .check {
  display: flex;
}

.lang-card .flag {
  display: block;
  font-size: 32px;
  margin-bottom: 12px;
  line-height: 1;
}

.lang-card .native-name {
  display: block;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.lang-card .eng-name {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.lang-cta {
  display: flex;
  justify-content: flex-end;
}

.rsp-lang-layout .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.rsp-lang-layout .btn-primary {
  background: var(--accent);
  color: #fff;
}

.rsp-lang-layout .btn-primary:hover {
  filter: brightness(1.05);
}

@media (prefers-reduced-motion: reduce) {
  .lang-card {
    transition: none;
  }
}

/* RSP-03 Take */
.autosave-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin: 0 0 8px;
}

.rsp-page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 16px;
}

.question-block {
  margin-bottom: 32px;
}

.question-block .q-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.question-block .q-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--primary);
}

.question-block .q-title p,
.section-hdr h3 p,
.section-body img {
  max-width: 100%;
  height: auto;
}

.section-body p {
  margin: 0;
}

.question-block .q-title ul,
.section-hdr ul,
.section-body ul {
  list-style: disc;
  padding-left: 1.25em;
  margin: 0.25em 0;
}

.question-block .q-title ol,
.section-hdr ol,
.section-body ol {
  list-style: decimal;
  padding-left: 1.25em;
  margin: 0.25em 0;
}

.question-block .q-title a,
.section-hdr a,
.section-body a {
  color: var(--primary);
  text-decoration: underline;
}

.question-block .q-title :is(b, strong),
.section-hdr :is(b, strong),
.section-body :is(b, strong) {
  font-weight: 700;
}

.char-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.char-field[hidden] {
  display: none;
}

.char-counter {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #6b7280);
  text-align: right;
}

.question-block .q-title .required {
  color: var(--accent);
  margin-left: 2px;
}

.question-block .q-helper {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.question-block .q-error {
  margin-top: 8px;
  font-size: 13px;
  color: #b02318;
}

.question-block.has-error .rsp-opt,
.question-block.has-error .input {
  border-color: var(--danger, #d93a2b);
}

.rsp-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rsp-options--cols-2,
.rsp-options--cols-3,
.rsp-options--cols-4 {
  display: grid;
  gap: 12px;
}

.rsp-options--cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rsp-options--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rsp-options--cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rating-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

.rating-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 72px;
  width: 72px;
  max-width: 72px;
}

.rating-caption {
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  color: var(--muted);
  word-break: break-word;
  max-width: 100%;
}

@media (max-width: 720px) {
  .rsp-options--cols-2,
  .rsp-options--cols-3,
  .rsp-options--cols-4 {
    grid-template-columns: 1fr;
  }

  .rating-row {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: visible;
    align-items: stretch;
    gap: 10px;
  }

  .rating-item {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
  }

  .rating-caption {
    text-align: left;
    max-width: none;
  }
}

.rsp-other-text {
  margin-top: 12px;
}

.rsp-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--motion-duration) var(--motion-ease),
    background-color var(--motion-duration) var(--motion-ease);
  min-height: 44px;
  font: inherit;
  color: inherit;
}

.rsp-opt:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, #fff);
}

.rsp-opt .rsp-choice-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.rsp-opt .opt-circle {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rsp-opt .opt-circle .inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: none;
}

.rsp-opt .rsp-choice-input.is-checkbox {
  position: static;
  opacity: 1;
  width: 16px;
  height: 16px;
  margin: 0;
  clip: auto;
  clip-path: none;
  overflow: visible;
  white-space: normal;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.rsp-opt.is-checkbox .opt-circle {
  display: none;
}

/* Visible focus on custom radio chrome (native input is visually hidden). */
.rsp-opt.is-radio:has(.rsp-choice-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.rsp-opt.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, #fff);
}

.rsp-opt.selected .opt-circle {
  border-color: var(--accent);
}

.rsp-opt.selected .opt-circle .inner {
  display: block;
  background: var(--accent);
}

.rating-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--motion-duration) var(--motion-ease),
    background-color var(--motion-duration) var(--motion-ease),
    color var(--motion-duration) var(--motion-ease);
  font: inherit;
  color: inherit;
}

.rating-btn:hover {
  border-color: var(--accent);
}

.rating-btn.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.rating-label {
  font-size: 12px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section-hdr {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.section-hdr:focus {
  outline: none;
}

.section-hdr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.section-hdr h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--primary);
}

.section-hdr p {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 0;
}

.rsp-take .input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  /* 16px prevents iOS Safari auto-zoom on focus (html base is 14px below 768px). */
  font-family: inherit;
  font-size: 16px;
  font-weight: inherit;
  line-height: inherit;
  background: var(--surface);
  color: var(--fg);
}

.rsp-take .input:focus,
.rsp-take .input:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.rsp-take .rsp-textarea {
  max-width: 100%;
  min-height: 96px;
  resize: vertical;
}

.rsp-take .input.readonly-prepop {
  background: var(--bg, #f7f7f8);
  color: var(--muted);
  cursor: not-allowed;
}

.error-summary {
  background: #fde8e6;
  border: 1px solid var(--danger, #d93a2b);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.error-summary[hidden] {
  display: none;
}

/* Wins over .rsp-take .input { display: block } (Kendo used to force [hidden] with !important). */
.rsp-take .input[hidden] {
  display: none;
}

.error-summary .es-title {
  font-weight: 600;
  color: #b02318;
  margin-bottom: 8px;
  font-size: 14px;
}

.error-summary ul {
  margin: 0;
  padding-left: 20px;
}

.error-summary li {
  font-size: 13px;
  color: #b02318;
  margin-bottom: 4px;
}

.error-summary li a {
  color: #b02318;
  text-decoration: underline;
  cursor: pointer;
}

.rsp-footer .btn[hidden] {
  display: none;
}

/* RSP-06 thank you */
.rsp-thanks {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px;
  text-align: center;
}

.thanks-icon {
  width: 64px;
  height: 64px;
  background: var(--success, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #fff;
  font-size: 32px;
}

.thanks-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--primary);
}

.thanks-body {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 32px;
  white-space: pre-line;
}

.scoring-card {
  text-align: left;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.scoring-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
}

.scoring-overall {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.scoring-overall .score {
  font-size: 32px;
  font-weight: 600;
  color: var(--primary);
}

.scoring-level {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--success-soft, #dcfce7);
  color: var(--success-fg, #166534);
}

.scoring-evaluation-message {
  margin: 0 0 16px;
}

.scoring-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.scoring-sections span {
  color: var(--muted);
}

.scoring-callout {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  margin-bottom: 0;
}

.rsp-thanks .thanks-cta {
  margin-top: 8px;
  text-decoration: none;
}

.rsp-thanks .thanks-cta + .thanks-cta {
  margin-left: 8px;
}

.thanks-footer {
  font-size: 12px;
  color: var(--disabled, #94a3b8);
  margin-top: 48px;
}

@media (prefers-reduced-motion: reduce) {
  .rsp-opt,
  .rating-btn {
    transition: none;
  }
}

@media (max-width: 430px) {
  .rsp-body,
  .rsp-form-card-body,
  .rsp-header-identity {
    padding-left: 16px;
    padding-right: 16px;
  }

  .rsp-mobile .rsp-opt,
  .rsp-opt,
  .rating-btn,
  .lang-card,
  .rsp-nav .btn,
  .rsp-mobile .btn,
  .rsp-take .btn,
  .input,
  .rsp-entry-state .btn {
    min-height: 44px;
  }
}

.rsp-evaluating-banner {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--primary, #5B2D8E);
    color: #ffffff;
    font-weight: 600;
}

.rsp-evaluate-confirm {
    margin-bottom: 16px;
    padding: 20px;
    border: 2px solid var(--primary, #5B2D8E);
    border-radius: 12px;
    background: var(--surface, #ffffff);
}

.rsp-evaluate-confirm-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.rsp-evaluate-confirm-email {
    margin: 0 0 8px;
    color: var(--fg-muted, #666666);
}

.rsp-file-slot {
    margin-top: 16px;
}

.rsp-file-label {
    display: block;
    font-weight: 600;
}

.rsp-file-description,
.rsp-file-hint,
.rsp-file-name {
    margin: 4px 0 8px;
    color: var(--fg-muted, #666666);
}

.rsp-file-error {
    margin: 4px 0 0;
    color: var(--danger, #b42318);
}
