/* =============================================================================
   DESIGN SYSTEM
   ============================================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #2d3748;
  background: #f5f3f0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =============================================================================
   HEADER
   ============================================================================= */

.site-header {
  padding: 1rem 1.5rem;
  background: #f5f3f0;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 36px;
  width: auto;
}

.tagline {
  font-size: 0.875rem;
  color: #718096;
}

.header-nav a {
  font-size: 0.9rem;
  color: #5d8a8e;
  text-decoration: none;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: #4a7275;
  text-decoration: underline;
}

/* =============================================================================
   MAIN CONTENT AREA
   ============================================================================= */

.work-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.step {
  position: relative;
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.05);
}

#step-container {
  display: flex;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.site-footer {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: #718096;
}

.privacy-note {
  margin-bottom: 0.75rem;
}

.footer-links {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: #718096;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #5d8a8e;
  text-decoration: underline;
}

.footer-links .separator {
  margin: 0 0.5rem;
  color: #a0aec0;
}

.copyright {
  color: #a0aec0;
}

/* =============================================================================
   PROGRESS BAR
   ============================================================================= */

.progress-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.progress-label {
  font-size: 0.8rem;
  color: #718096;
  white-space: nowrap;
}

.progress-bar-container {
  flex: 1;
  height: 6px;
  background: #e2e2e2;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #5d8a8e;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* =============================================================================
   TOOLBAR (Reset / Fill Test Data)
   ============================================================================= */

.step-toolbar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
}

.step-toolbar a.reset-link {
  color: #718096;
  text-decoration: none;
  transition: color 0.2s;
}

.step-toolbar a.reset-link:hover {
  color: #5d8a8e;
  text-decoration: underline;
}

/* TODO: Remove before production */
.step-toolbar a.test-data-link {
  font-size: 0.7rem;
  color: #999;
  text-decoration: none;
}

.step-toolbar a.test-data-link:hover {
  color: #718096;
}

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */

h1 {
  font-size: 1.5rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.step-intro {
  font-size: 0.95rem;
  color: #718096;
  margin-bottom: 1.5rem;
}

.field-hint {
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 0.5rem;
}

/* =============================================================================
   FORM ELEMENTS
   ============================================================================= */

.form-group {
  margin-bottom: 1.5rem;
}

.form-group > label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

textarea,
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  color: #2d3748;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: #5d8a8e;
  box-shadow: 0 0 0 3px rgba(93, 138, 142, 0.1);
}

textarea.error,
input.error,
select.error {
  border-color: #c53030;
}

/* =============================================================================
   RADIO GROUPS
   ============================================================================= */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.radio-group label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.5;
}

.radio-group input[type="radio"] {
  margin-top: 0.25rem;
  accent-color: #5d8a8e;
}

.radio-group.error {
  outline: 2px solid #c53030;
  outline-offset: 8px;
  border-radius: 4px;
}

/* =============================================================================
   VALUE GRID (Checkbox Grid)
   ============================================================================= */

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.value-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
}

.value-checkbox:hover {
  border-color: #5d8a8e;
}

.value-checkbox:has(input:checked) {
  border-color: #5d8a8e;
  background: rgba(93, 138, 142, 0.08);
}

.value-checkbox input {
  accent-color: #5d8a8e;
}

.value-count {
  text-align: center;
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 1.5rem;
}

.value-grid.error {
  outline: 2px solid #c53030;
  outline-offset: 4px;
  border-radius: 4px;
}

/* =============================================================================
   VALUE SCORES (Sliders)
   ============================================================================= */

.value-scores {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.score-label {
  min-width: 90px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
}

.score-slider {
  flex: 1;
  accent-color: #5d8a8e;
}

.score-value {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
  color: #5d8a8e;
}

.total-score {
  text-align: center;
  font-size: 1rem;
  padding: 1rem;
  background: rgba(93, 138, 142, 0.08);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.total-score span {
  color: #5d8a8e;
  font-weight: 600;
}

/* =============================================================================
   SCENARIO SECTIONS
   ============================================================================= */

.scenario-section {
  background: #fafaf9;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #e8e6e3;
}

.scenario-section h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.scenario-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.scenario-inputs .form-group {
  margin-bottom: 0;
}

/* =============================================================================
   PRICING OPTIONS
   ============================================================================= */

.pricing-question {
  margin-bottom: 1.5rem;
}

.pricing-question > label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.75rem;
}

.price-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.price-options label {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
}

.price-options label:hover {
  border-color: #5d8a8e;
}

.price-options label:has(input:checked) {
  background: #5d8a8e;
  color: #fff;
  border-color: #5d8a8e;
}

.price-options input {
  display: none;
}

.price-options.error {
  outline: 2px solid #c53030;
  outline-offset: 4px;
  border-radius: 4px;
}

/* =============================================================================
   DEPTH OPTIONS
   ============================================================================= */

.depth-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.depth-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.depth-option:hover {
  border-color: #5d8a8e;
}

.depth-option:has(input:checked) {
  border-color: #5d8a8e;
  background: rgba(93, 138, 142, 0.08);
}

.depth-option input {
  display: none;
}

.depth-label {
  font-weight: 500;
  min-width: 70px;
  color: #2d3748;
}

.depth-desc {
  font-size: 0.9rem;
  color: #718096;
}

.depth-options.error {
  outline: 2px solid #c53030;
  outline-offset: 4px;
  border-radius: 4px;
}

/* =============================================================================
   CONTEXTUAL QUESTIONS
   ============================================================================= */

.contextual-questions {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.contextual-questions.visible {
  display: flex;
}

.contextual-question {
  padding: 1rem;
  background: #fafaf9;
  border-radius: 8px;
  border: 1px solid #e8e6e3;
}

.contextual-question > label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

/* =============================================================================
   TRAITS INSTRUCTIONS
   ============================================================================= */

.traits-instructions {
  font-size: 0.875rem;
  color: #5d8a8e;
  font-style: italic;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(93, 138, 142, 0.08);
  border-radius: 6px;
  border-left: 3px solid #5d8a8e;
}

/* =============================================================================
   LIKERT SCALE
   ============================================================================= */

.likert-statement {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.75rem;
}

.likert-scale {
  display: flex;
  justify-content: space-between;
  gap: 0.375rem;
}

.likert-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.25rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.likert-option:hover {
  border-color: #5d8a8e;
}

.likert-option:has(input:checked) {
  border-color: #5d8a8e;
  background: rgba(93, 138, 142, 0.08);
}

.likert-option input {
  accent-color: #5d8a8e;
}

.likert-label {
  font-size: 0.65rem;
  color: #718096;
  line-height: 1.2;
}

.likert-scale.error {
  outline: 2px solid #c53030;
  outline-offset: 4px;
  border-radius: 4px;
}

/* =============================================================================
   ANALYSIS DISPLAY
   ============================================================================= */

.analysis-display {
  padding: 1.5rem;
  background: #fafaf9;
  border-radius: 8px;
  border: 1px solid #e8e6e3;
  margin-bottom: 1.5rem;
  min-height: 180px;
  max-height: 400px;
  overflow-y: auto;
}

.analysis-display p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.analysis-display p:last-child {
  margin-bottom: 0;
}

.analysis-display .placeholder {
  color: #a0aec0;
  font-style: italic;
}

.analysis-display.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.analysis-display.loading::after {
  content: "Analyzing your decision...";
  color: #718096;
  font-style: italic;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.analysis-display.error {
  border-color: #c53030;
  background: #fff5f5;
}

.analysis-display .error-text {
  color: #c53030;
  margin-bottom: 0.75rem;
}

.analysis-display .retry-btn {
  padding: 0.5rem 1rem;
  background: #5d8a8e;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.analysis-display .retry-btn:hover {
  background: #4a7275;
}

.loading-message {
  text-align: center;
  color: #718096;
  font-style: italic;
  padding: 1rem 0;
  animation: pulse 1.5s ease-in-out infinite;
}

/* =============================================================================
   SEE SUMMARY SECTION
   ============================================================================= */

.see-summary-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #fafaf9;
  border-radius: 8px;
  border: 1px solid #e8e6e3;
  text-align: center;
}

.see-summary-section .btn {
  min-width: 160px;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.step-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding-top: 1rem;
  background: #fff;
  border-top: 1px solid #e8e6e3;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: #5d8a8e;
  color: #fff;
}

.btn-primary:hover {
  background: #4a7275;
}

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(93, 138, 142, 0.3);
}

.btn-secondary {
  background: transparent;
  color: #5d8a8e;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #f5f3f0;
  border-color: #5d8a8e;
}

.btn-secondary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(93, 138, 142, 0.2);
}

.btn-disabled,
.btn-disabled:hover {
  background: #e8e6e3;
  color: #a0aec0;
  border-color: #d1d5db;
  cursor: not-allowed;
}

/* =============================================================================
   HORIZONTAL RULE
   ============================================================================= */

hr {
  border: none;
  border-top: 1px solid #e8e6e3;
  margin: 1.5rem 0;
}

/* =============================================================================
   ERROR MESSAGE
   ============================================================================= */

.error-message {
  display: none;
  color: #c53030;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.error-message.visible {
  display: block;
}

/* =============================================================================
   THANK YOU PAGE
   ============================================================================= */

.thank-you {
  text-align: center;
  padding: 2rem 1rem;
}

.thank-you h1 {
  margin-bottom: 1rem;
}

.thank-you p {
  color: #718096;
  margin-bottom: 2rem;
}

/* =============================================================================
   DECISION SUMMARY (if used)
   ============================================================================= */

.decision-summary {
  background: #fafaf9;
  border-radius: 8px;
  border: 1px solid #e8e6e3;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.decision-summary h3 {
  font-size: 0.8rem;
  font-weight: 500;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.decision-summary > p {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.summary-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: #718096;
}

.summary-meta span {
  display: flex;
  gap: 0.25rem;
}

/* =============================================================================
   HOME PAGE
   ============================================================================= */

.home-page {
  text-align: center;
  padding: 1rem 0;
}

.hero-text {
  font-size: 1.75rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.context-note {
  font-size: 0.95rem;
  color: #718096;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 2.5rem;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.profile-progress-section {
  text-align: left;
  border-top: 1px solid #e8e6e3;
  padding-top: 1.5rem;
}

.profile-progress-section h2 {
  font-size: 0.85rem;
  font-weight: 500;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.profile-card {
  background: #fafaf9;
  border: 1px solid #e8e6e3;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.profile-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3748;
}

.profile-count {
  font-size: 0.85rem;
  color: #718096;
}

.profile-bar-container {
  height: 8px;
  background: #e2e2e2;
  border-radius: 4px;
  overflow: hidden;
}

.profile-bar {
  height: 100%;
  background: #5d8a8e;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.profile-complete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e8e6e3;
}

.complete-badge {
  font-size: 0.8rem;
  font-weight: 500;
  color: #38a169;
  background: rgba(56, 161, 105, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* =============================================================================
   MOBILE RESPONSIVE
   ============================================================================= */

@media (max-width: 640px) {
  .site-header {
    padding: 0.75rem 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .header-brand {
    flex-direction: column;
    gap: 0.25rem;
  }

  .tagline {
    font-size: 0.8rem;
  }

  .work-area {
    padding: 1rem;
    align-items: flex-start;
  }

  .step {
    padding: 1.5rem;
    max-height: calc(100vh - 200px);
    border-radius: 8px;
  }

  h1 {
    font-size: 1.25rem;
  }

  .value-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .price-options {
    flex-direction: column;
  }

  .price-options label {
    justify-content: center;
  }

  .scenario-inputs {
    grid-template-columns: 1fr;
  }

  .score-row {
    flex-wrap: wrap;
  }

  .score-label {
    width: 100%;
    min-width: unset;
    margin-bottom: 0.25rem;
  }

  .likert-scale {
    flex-wrap: wrap;
  }

  .likert-option {
    flex: 0 0 calc(33.333% - 0.25rem);
    margin-bottom: 0.375rem;
  }

  .step-toolbar {
    top: 0.75rem;
    right: 0.75rem;
    gap: 0.75rem;
  }

  .site-footer {
    padding: 1rem;
  }

  .hero-text {
    font-size: 1.4rem;
  }

  .home-actions {
    width: 100%;
  }

  .home-actions .btn {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .value-grid {
    grid-template-columns: 1fr 1fr;
  }

  .likert-option {
    flex: 0 0 calc(50% - 0.25rem);
  }
}
