/**
 * Career Discovery Form v4 — Styles
 *
 * Clean, calm, conversational. Collapsible brief sections,
 * transition text, pitch section, synthesis loading.
 */

/* ============================================
   Variables
   ============================================ */

:root {
  --ci-bg: #fafafa;
  --ci-surface: #ffffff;
  --ci-text: #1a1a1a;
  --ci-text-muted: #666666;
  --ci-border: #e0e0e0;
  --ci-accent: #2c5282;
  --ci-accent-light: #ebf4ff;
  --ci-reaction-bg: #f7f7f5;
  --ci-reaction-border: #d4d0c8;
  --ci-error-bg: #fff5f5;
  --ci-error-border: #c53030;
  --ci-student-bg: #eef2ff;
  --ci-student-border: #c7d2fe;
  --ci-radius: 8px;
  --ci-max-width: 680px;
  --ci-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ============================================
   Base
   ============================================ */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--ci-font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ci-text);
  background: var(--ci-bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Layout
   ============================================ */

.ci-header {
  text-align: center;
  padding: 20px 24px 12px;
  max-width: var(--ci-max-width);
  margin: 0 auto;
}

.ci-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ci-text);
}

.ci-header p {
  font-size: 15px;
  color: var(--ci-text-muted);
  margin: 0;
}

/* Intro meta: time + stages */

.ci-intro-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}

.ci-intro-meta__time,
.ci-intro-meta__stages {
  font-size: 14px;
  font-weight: 600;
  color: var(--ci-accent);
  background: var(--ci-accent-light);
  padding: 4px 12px;
  border-radius: 12px;
}

/* Intro value proposition */

.ci-intro-value {
  margin-top: 14px;
  padding: 14px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--ci-radius);
  text-align: left;
}

.ci-intro-value__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ci-text);
  margin: 0 0 6px;
}

.ci-intro-value__text {
  font-size: 15px;
  line-height: 1.55;
  color: #475569;
  margin: 0;
}

.ci-logo {
  display: block;
  max-height: 48px;
  margin: 0 auto 8px;
}

#ci-form {
  max-width: var(--ci-max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ============================================
   Progress Bar (sticky)
   ============================================ */

.ci-progress {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--ci-surface);
  border-bottom: 1px solid var(--ci-border);
  padding: 16px 24px 12px;
}

.ci-progress__label-top {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ci-text-muted);
  margin-bottom: 8px;
}

.ci-progress__track {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  max-width: var(--ci-max-width);
  margin: 0 auto;
}

.ci-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ci-progress__dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ddd;
  background: var(--ci-surface);
  color: #ccc;
  transition: all 0.3s ease;
}

.ci-progress__icon,
.ci-progress__check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ci-progress__check {
  display: none;
}

.ci-progress__label {
  font-size: 11px;
  font-weight: 500;
  color: #bbb;
  text-align: center;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.ci-progress__connector {
  flex: 1;
  height: 2px;
  background: #e0e0e0;
  margin: 18px 6px 0;
  transition: background 0.4s ease;
  min-width: 24px;
  max-width: 80px;
}

/* Progress states */

.ci-progress__step--active .ci-progress__dot {
  border-color: var(--step-color);
  background: var(--step-color);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
  animation: ci-dot-pulse 2s ease-in-out infinite;
}

.ci-progress__step--active .ci-progress__label {
  color: var(--step-color);
  font-weight: 600;
}

.ci-progress__step--done .ci-progress__dot {
  border-color: var(--step-color);
  background: var(--step-color);
  color: #fff;
}

.ci-progress__step--done .ci-progress__icon {
  display: none;
}

.ci-progress__step--done .ci-progress__check {
  display: flex;
}

.ci-progress__step--done .ci-progress__label {
  color: var(--step-color);
}

.ci-progress__connector--done {
  background: var(--ci-accent);
}

@keyframes ci-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06); }
  50% { box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.03); }
}

/* ============================================
   Stages
   ============================================ */

.ci-stage {
  margin-bottom: 24px;
  transition: opacity 0.4s ease;
}

.ci-stage--done {
  opacity: 0.55;
}

.ci-stage--active {
  opacity: 1;
}

/* Stage header */

.ci-stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--step-color, var(--ci-accent));
}

.ci-stage-header__icon {
  display: flex;
  align-items: center;
  color: var(--step-color, var(--ci-accent));
}

.ci-stage-header__num {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--step-color, var(--ci-accent));
  opacity: 0.6;
}

.ci-stage-header__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--step-color, var(--ci-accent));
}

/* Stage frame text */

.ci-stage-frame {
  margin-bottom: 8px;
}

.ci-stage-frame p {
  margin: 0;
  font-size: 15px;
  color: var(--ci-text-muted);
  font-style: italic;
}

/* Transition text between stages */

.ci-transition {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--step-color, var(--ci-accent));
  background: #f8fafc;
  border-radius: 0 var(--ci-radius) var(--ci-radius) 0;
}

.ci-transition p {
  margin: 0;
  font-size: 15px;
  font-style: italic;
  color: var(--ci-text-muted);
  line-height: 1.55;
}

/* ============================================
   Question Card
   ============================================ */

.ci-question {
  background: var(--ci-surface);
  border: 1px solid var(--ci-border);
  border-radius: var(--ci-radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.ci-question p {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
}

/* ============================================
   Student Response Bubble
   ============================================ */

.ci-student-response {
  background: var(--ci-student-bg);
  border: 1px solid var(--ci-student-border);
  border-radius: var(--ci-radius);
  padding: 16px 20px;
  margin: 12px 0 12px 24px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.ci-student-response--visible {
  opacity: 1;
  transform: translateY(0);
}

.ci-student-response p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
}

/* ============================================
   AI Reaction
   ============================================ */

.ci-reaction {
  background: var(--ci-reaction-bg);
  border: 1px solid var(--ci-reaction-border);
  border-radius: var(--ci-radius);
  padding: 20px 24px;
  margin: 12px 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ci-reaction--visible {
  opacity: 1;
  transform: translateY(0);
}

.ci-reaction p {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.65;
}

.ci-reaction p:last-child {
  margin-bottom: 0;
}

.ci-follow-up {
  font-style: italic;
  color: var(--ci-accent);
}

/* ============================================
   Textarea
   ============================================ */

.ci-textarea {
  width: 100%;
  padding: 16px;
  font-family: var(--ci-font);
  font-size: 16px;
  line-height: 1.6;
  border: 1px solid var(--ci-border);
  border-radius: var(--ci-radius);
  background: var(--ci-surface);
  color: var(--ci-text);
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s;
  outline: none;
}

.ci-textarea:focus {
  border-color: var(--ci-accent);
  box-shadow: 0 0 0 3px var(--ci-accent-light);
}

.ci-textarea::placeholder {
  color: #999;
  font-style: italic;
}

.ci-textarea:disabled {
  background: #f5f5f5;
  color: var(--ci-text-muted);
}

/* ============================================
   Buttons
   ============================================ */

.ci-btn-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.ci-submit {
  padding: 12px 32px;
  font-family: var(--ci-font);
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: var(--ci-radius);
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
  background: var(--ci-accent);
  color: #fff;
}

.ci-submit:hover:not(:disabled) {
  background: #1e3a5f;
}

.ci-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ci-skip {
  padding: 12px 24px;
  font-family: var(--ci-font);
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--ci-border);
  border-radius: var(--ci-radius);
  cursor: pointer;
  transition: background-color 0.2s;
  background: transparent;
  color: var(--ci-text-muted);
}

.ci-skip:hover:not(:disabled) {
  background: #f0f0f0;
  color: var(--ci-text);
}

.ci-skip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   Loading Indicator
   ============================================ */

.ci-loading {
  display: flex;
  gap: 6px;
  padding: 20px 24px;
  align-items: center;
  flex-wrap: wrap;
}

.ci-loading__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ci-text-muted);
  animation: ci-pulse 1.4s infinite both;
}

.ci-loading__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ci-loading__dot:nth-child(3) {
  animation-delay: 0.4s;
}

.ci-loading__message {
  display: block;
  width: 100%;
  margin-top: 8px;
  font-size: 15px;
  color: #475569;
  line-height: 1.5;
}

@keyframes ci-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ============================================
   Synthesis Section
   ============================================ */

.ci-synthesis-section {
  margin-top: 32px;
}

.ci-synth-header {
  text-align: center;
  margin-bottom: 24px;
}

.ci-synth-header__title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ci-text);
}

.ci-synth-header__subtitle {
  font-size: 15px;
  color: var(--ci-text-muted);
  margin: 0;
}

/* ============================================
   Collapsible Brief Card
   ============================================ */

.ci-brief-card {
  background: var(--ci-surface);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin: 24px 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ci-brief-card--visible {
  opacity: 1;
  transform: translateY(0);
}

.ci-brief-section {
  border-bottom: 1px solid #f1f5f9;
}

.ci-brief-section:last-child {
  border-bottom: none;
}

.ci-brief-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.ci-brief-section__header:hover {
  background: #f8fafc;
}

.ci-brief-section__title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ci-brief-section__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.ci-brief-section__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ci-text);
  margin: 0;
}

.ci-brief-section__preview {
  font-size: 14px;
  color: var(--ci-text-muted);
  margin: 4px 0 0;
  display: block;
  line-height: 1.4;
}

.ci-brief-section__toggle {
  font-size: 18px;
  color: #999;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.ci-brief-section--expanded .ci-brief-section__toggle {
  transform: rotate(180deg);
}

.ci-brief-section--expanded .ci-brief-section__preview {
  display: none;
}

.ci-brief-section__content {
  padding: 0 20px 16px;
  display: none;
  color: #333;
  line-height: 1.65;
  font-size: 16px;
}

.ci-brief-section--expanded .ci-brief-section__content {
  display: block;
}

.ci-brief-section__content p {
  margin: 0 0 10px;
}

.ci-brief-section__content p:last-child {
  margin-bottom: 0;
}

.ci-brief-section__content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ci-brief-section__content li {
  margin-bottom: 4px;
  color: var(--ci-text-muted);
}

.ci-brief-section__content strong {
  color: var(--ci-text);
}

.ci-brief-section__content h3 {
  display: none; /* section title is already in the header */
}

/* ============================================
   Synthesis Reaction Area
   ============================================ */

.ci-synthesis-reaction {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--ci-surface);
  border: 1px solid var(--ci-border);
  border-radius: var(--ci-radius);
}

.ci-synthesis-reaction__prompt {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ci-text);
}

.ci-synthesis-reaction .ci-textarea {
  min-height: 80px;
}

/* ============================================
   Synthesis Adjustment
   ============================================ */

.ci-adjustment {
  background: var(--ci-reaction-bg);
  border: 1px solid var(--ci-reaction-border);
  border-left: 3px solid var(--ci-accent);
  border-radius: var(--ci-radius);
  padding: 16px 20px;
  margin-top: 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ci-adjustment--visible {
  opacity: 1;
  transform: translateY(0);
}

.ci-adjustment p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
}

/* ============================================
   Action Buttons
   ============================================ */

.ci-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ============================================
   AI Pitch Text (auto-shown after reaction)
   ============================================ */

.ci-pitch-text {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--ci-radius);
  padding: 20px 24px;
  margin-top: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ci-pitch-text--visible {
  opacity: 1;
  transform: translateY(0);
}

.ci-pitch-text p {
  font-size: 16px;
  line-height: 1.65;
  color: #475569;
  margin: 0 0 8px;
}

.ci-pitch-text p:last-child {
  margin-bottom: 0;
}

/* ============================================
   Bridge Text (connects synthesis to program)
   ============================================ */

.ci-bridge-text {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ci-text-muted);
  margin: 20px 0 0;
}

/* ============================================
   Copy Brief Button
   ============================================ */

.ci-copy-btn {
  padding: 12px 24px;
  font-family: var(--ci-font);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--ci-radius);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  background: var(--ci-surface);
  color: var(--ci-accent);
  border: 1px solid var(--ci-accent);
}

.ci-copy-btn:hover {
  background: var(--ci-accent-light);
}

.ci-copy-btn--success {
  background: #276749;
  color: #fff;
  border-color: #276749;
}

.ci-copy-btn--success:hover {
  background: #276749;
}

/* ============================================
   Sign Up Button (Primary CTA)
   ============================================ */

.ci-signup-btn {
  padding: 12px 24px;
  font-family: var(--ci-font);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--ci-radius);
  cursor: pointer;
  transition: background-color 0.2s;
  background: var(--ci-accent);
  color: #fff;
  border: none;
}

.ci-signup-btn:hover {
  background: #1e3a5f;
}

/* ============================================
   Error
   ============================================ */

.ci-error {
  background: var(--ci-error-bg);
  border: 1px solid var(--ci-error-border);
  border-radius: var(--ci-radius);
  padding: 16px 20px;
  margin-top: 16px;
}

.ci-error p {
  margin: 0 0 12px;
  font-size: 15px;
}

.ci-error__retry {
  padding: 8px 16px;
  font-family: var(--ci-font);
  font-size: 14px;
  background: var(--ci-error-border);
  color: #fff;
  border: none;
  border-radius: var(--ci-radius);
  cursor: pointer;
}

.ci-error__retry:hover {
  opacity: 0.85;
}

.ci-error__download {
  padding: 8px 16px;
  font-family: var(--ci-font);
  font-size: 14px;
  background: var(--ci-accent);
  color: #fff;
  border: none;
  border-radius: var(--ci-radius);
  cursor: pointer;
}

.ci-error__download:hover {
  opacity: 0.85;
}

/* ============================================
   Resume Prompt
   ============================================ */

.ci-resume-prompt {
  background: var(--ci-surface);
  border: 1px solid var(--ci-accent);
  border-radius: var(--ci-radius);
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.ci-resume-prompt p {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ci-text);
}

.ci-resume-prompt .ci-btn-row {
  justify-content: center;
}

/* ============================================
   Input Area
   ============================================ */

.ci-input-area {
  margin-top: 16px;
}

.ci-char-hint {
  font-size: 13px;
  color: var(--ci-text-muted);
  margin-top: 6px;
  display: none;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
  .ci-header {
    padding: 14px 16px 8px;
  }

  .ci-header h1 {
    font-size: 22px;
  }

  .ci-logo {
    max-height: 48px;
  }

  #ci-form {
    padding: 0 16px 60px;
  }

  .ci-progress {
    padding: 12px 12px 8px;
  }

  .ci-progress__dot {
    width: 30px;
    height: 30px;
  }

  .ci-progress__label {
    font-size: 9px;
  }

  .ci-progress__connector {
    margin-top: 15px;
    min-width: 16px;
  }

  .ci-stage-header__title {
    font-size: 18px;
  }

  .ci-question,
  .ci-reaction {
    padding: 16px 18px;
  }

  .ci-student-response {
    margin-left: 12px;
    padding: 12px 16px;
  }

  .ci-textarea {
    padding: 12px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .ci-btn-row {
    flex-direction: column;
  }

  .ci-submit,
  .ci-skip {
    width: 100%;
    text-align: center;
  }

  .ci-actions {
    flex-direction: column;
  }

  .ci-copy-btn,
  .ci-signup-btn {
    width: 100%;
    text-align: center;
  }

  .ci-synthesis-reaction {
    padding: 16px;
  }

  .ci-adjustment {
    padding: 12px 16px;
  }

  .ci-brief-section__header {
    padding: 14px 16px;
  }

  .ci-brief-section__content {
    padding: 0 16px 14px;
  }

  .ci-transition {
    padding: 10px 14px;
  }

  .ci-pitch-text {
    padding: 16px 18px;
  }

  .ci-synth-header__title {
    font-size: 20px;
  }
}
