/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --primary-50: #f0fdfa;
  --accent: #6366f1;
  --accent-light: #e0e7ff;
  --danger: #ef4444;
  --warning-bg: #fef3c7;
  --warning-border: #f59e0b;
  --success: #10b981;
  --success-bg: #d1fae5;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --bg: #f0fdfa;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-focus: #0d9488;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 50%, #f0fdfa 100%);
  min-height: 100vh;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0,0,0,0.06);
  z-index: 1000;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 0 2px 2px 0;
  transition: width 0.3s ease;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ============================================
   HEADER
   ============================================ */
.survey-header {
  text-align: center;
  padding: 48px 24px 40px;
  margin-bottom: 8px;
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.3);
}

.survey-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 8px;
}

.survey-header .subtitle {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}

.survey-header .meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================
   SECTION CARDS
   ============================================ */
.survey-section {
  margin-bottom: 20px;
  animation: fadeInUp 0.5s ease both;
}

.section-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.section-card:hover {
  box-shadow: var(--shadow-lg);
}

.section-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.section-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.section-subtitle {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ============================================
   CONSENT TEXT
   ============================================ */
.consent-text {
  background: var(--primary-50);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 24px;
  border-left: 4px solid var(--primary);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
}

.consent-text p { margin-bottom: 12px; }
.consent-text p:last-child { margin-bottom: 0; }
.consent-text a { color: var(--primary); font-weight: 600; }

.contact-info {
  padding: 12px 16px;
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* ============================================
   QUESTION GROUPS
   ============================================ */
.question-group {
  border: none;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.question-group:first-of-type { border-top: none; }

.question-group legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.5;
  display: block;
  width: 100%;
}

.question-group legend em {
  font-style: normal;
  color: var(--text-secondary);
  font-weight: 400;
}

.required-marker {
  color: var(--danger);
  font-weight: 700;
}

/* ============================================
   RADIO BUTTONS (Custom)
   ============================================ */
.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
  background: var(--card-bg);
  flex-wrap: wrap;
}

.radio-label:hover, .checkbox-label:hover {
  border-color: var(--primary);
  background: var(--primary-50);
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
  display: none;
}

.radio-custom {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  transition: all var(--transition);
}

.radio-label input:checked ~ .radio-custom {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px white;
}

.radio-label input:checked ~ .radio-text {
  font-weight: 600;
  color: var(--primary-hover);
}

.radio-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-50);
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 4px;
  border: 2px solid var(--border);
  position: relative;
  transition: all var(--transition);
}

.checkbox-label input:checked ~ .checkbox-custom {
  border-color: var(--primary);
  background: var(--primary);
}

.checkbox-label input:checked ~ .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-50);
}

/* ============================================
   INPUT FIELDS
   ============================================ */
.input-group input[type="email"],
.input-group input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  transition: all var(--transition);
  outline: none;
  background: var(--card-bg);
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.other-input {
  flex: 1;
  min-width: 150px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  background: #f8fafc;
}

.other-input:focus {
  border-color: var(--primary);
  background: white;
}

.other-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   SCALE INSTRUCTIONS & LEGEND
   ============================================ */
.scale-instructions {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.scale-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary-50), var(--accent-light));
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.legend-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ============================================
   LIKERT SCALE ITEMS
   ============================================ */
.likert-item {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.likert-item:first-child { border-top: none; }

.likert-question {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.likert-question-num {
  font-weight: 700;
  color: var(--primary);
  min-width: 28px;
}

.likert-question-text {
  color: var(--text);
}

.likert-options {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.likert-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.likert-option input[type="radio"] {
  display: none;
}

.likert-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  background: var(--card-bg);
}

.likert-option:hover .likert-circle {
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.likert-option input:checked + .likert-circle {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-color: var(--primary);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.35);
}

.likert-edge-label {
  font-size: 0.65rem;
  color: var(--text-light);
  text-align: center;
  max-width: 50px;
  line-height: 1.2;
  min-height: 24px;
}

/* ============================================
   SUBMIT SECTION
   ============================================ */
.submit-section {
  text-align: center;
  padding: 32px 0;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 48px;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
  letter-spacing: 0.02em;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(13, 148, 136, 0.45);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-light);
}

.spinner-svg {
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}

/* ============================================
   MESSAGE CONTAINERS
   ============================================ */
.message-container {
  padding: 40px 0;
  animation: fadeInUp 0.6s ease both;
}

.message-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 48px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.message-icon {
  margin-bottom: 20px;
}

.message-warning .message-icon svg {
  color: var(--warning-border);
}

.message-success .message-icon svg {
  color: var(--success);
}

.message-card h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--text);
}

.message-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.debriefing {
  text-align: left;
  margin-top: 28px;
  padding: 24px;
  background: var(--primary-50);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--success);
}

.debriefing h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--text);
}

.debriefing p {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.debriefing a { color: var(--primary); font-weight: 600; }

/* ============================================
   VALIDATION TOAST
   ============================================ */
.validation-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--danger);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
  z-index: 1001;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.validation-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   ERROR STATE
   ============================================ */
.question-group.error {
  background: #fef2f2;
  border-radius: var(--radius-sm);
  padding-left: 16px;
  padding-right: 16px;
  border-left: 3px solid var(--danger);
}

/* ============================================
   UTILITIES & SECTION NAVIGATION
   ============================================ */
.hidden { display: none !important; }

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

.section-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-50);
  border: 1px solid var(--primary-light);
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-next:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateX(4px);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE: TABLET
   ============================================ */
@media (max-width: 768px) {
  .container { padding: 16px 12px 40px; }

  .survey-header { padding: 32px 16px; }
  .survey-header h1 { font-size: 1.4rem; }

  .section-card { padding: 24px 18px; }

  .likert-circle {
    width: 38px;
    height: 38px;
    font-size: 0.8rem;
  }

  .likert-options { gap: 4px; }

  .scale-legend { gap: 6px; padding: 12px; }
  .legend-item { font-size: 0.75rem; }
}

/* ============================================
   RESPONSIVE: MOBILE
   ============================================ */
@media (max-width: 480px) {
  .survey-header h1 { font-size: 1.2rem; }
  .survey-header .subtitle { font-size: 0.9rem; }
  .header-icon { width: 56px; height: 56px; }
  .header-icon svg { width: 32px; height: 32px; }

  .section-card { padding: 20px 14px; }
  .section-card h2 { font-size: 1.15rem; }

  .consent-text { padding: 14px 16px; font-size: 0.85rem; max-height: 300px; }

  .radio-label, .checkbox-label { padding: 8px 12px; font-size: 0.85rem; }

  .likert-circle {
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
  }

  .likert-options { gap: 3px; }
  .likert-edge-label { font-size: 0.6rem; max-width: 40px; }

  .likert-question { font-size: 0.85rem; }

  .btn-submit { padding: 14px 36px; font-size: 0.95rem; }

  .scale-legend {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Very small screens - vertical likert for 7-point */
@media (max-width: 360px) {
  .likert-options-7 {
    flex-wrap: wrap;
    justify-content: center;
  }
  .likert-circle {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
  }
}
