/* Curriepedia Interview — Stylesheet
 *
 * Colour palette derived from the Curriepedia / MediaWiki Vector skin:
 *   - Primary blue: #3366cc (MediaWiki link blue)
 *   - Background:   #f6f6f6 (Vector page background)
 *   - Border:       #a7d7f9 (Vector content border)
 */

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

:root {
  --color-primary: #3366cc;
  --color-primary-dark: #2a4d8f;
  --color-success: #2d7a2d;
  --color-error: #c33;
  --color-bg: #f6f6f6;
  --color-surface: #fff;
  --color-border: #a7d7f9;
  --color-text: #222;
  --color-text-muted: #555;
  --color-disabled: #999;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

a {
  color: var(--color-primary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  background: var(--color-surface);
  border-bottom: 3px solid var(--color-border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
}

.logo {
  width: 40px;
  height: 40px;
}

.site-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.site-header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ── Container ───────────────────────────────────────────────────────────── */

.container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  position: relative;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */

.step-heading {
  text-align: center;
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}

.step-subheading {
  text-align: center;
  color: var(--color-text-muted);
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
}

/* ── Option Cards ────────────────────────────────────────────────────────── */

.option-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.option-card {
  background: var(--color-surface);
  border: 2px solid #ddd;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.option-card:hover {
  border-color: var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option-icon {
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.option-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.option-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}

.name-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  text-align: center;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.name-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(51, 102, 204, 0.15);
}

.inline-error {
  color: var(--color-error);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.option-card .btn {
  margin-top: auto;
}

/* ── Autocomplete Dropdown ───────────────────────────────────────────────── */

.autocomplete-wrap {
  width: 100%;
  position: relative;
  margin-bottom: 0.75rem;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown li {
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.1s;
}

.autocomplete-dropdown li:hover,
.autocomplete-dropdown li.active {
  background: rgba(51, 102, 204, 0.08);
}

.autocomplete-dropdown li mark {
  background: rgba(51, 102, 204, 0.2);
  color: inherit;
  padding: 0;
}

/* ── Back Button ─────────────────────────────────────────────────────────── */

.btn-back {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-back:hover {
  text-decoration: underline;
}

/* ── Existing Page Summary ───────────────────────────────────────────────── */

.existing-summary {
  background: var(--color-surface);
  border-left: 4px solid var(--color-success);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.existing-summary h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.summary-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ── Voice Generating (post-interview) ───────────────────────────────────── */

.voice-generating {
  background: var(--color-surface);
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.transcript-details {
  margin: 1rem 0;
}

.transcript-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.transcript-display {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.transcript-display .transcript-agent {
  color: var(--color-primary);
  font-weight: 600;
}

.transcript-display .transcript-user {
  color: var(--color-text);
  font-weight: 600;
}

/* ── Voice Session (active) ──────────────────────────────────────────────── */

.voice-session {
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.voice-session-header {
  margin-bottom: 1.5rem;
}

.voice-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
}

.voice-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}

.voice-bars span {
  display: block;
  width: 4px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 2px;
  opacity: 0.4;
  transition: height 0.15s, opacity 0.15s;
}

.voice-bars.voice-active span {
  animation: voiceBar 0.6s ease-in-out infinite alternate;
  opacity: 1;
}

.voice-bars.voice-active span:nth-child(1) { animation-delay: 0s; }
.voice-bars.voice-active span:nth-child(2) { animation-delay: 0.1s; }
.voice-bars.voice-active span:nth-child(3) { animation-delay: 0.2s; }
.voice-bars.voice-active span:nth-child(4) { animation-delay: 0.3s; }
.voice-bars.voice-active span:nth-child(5) { animation-delay: 0.4s; }

@keyframes voiceBar {
  0% { height: 6px; }
  100% { height: 22px; }
}

.voice-transcript-live {
  text-align: left;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.voice-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ── Badge ───────────────────────────────────────────────────────────────── */

.badge-soon {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--color-disabled);
  color: #fff;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  vertical-align: middle;
  margin-bottom: 0.75rem;
}

/* ── Form Sections (accordion) ───────────────────────────────────────────── */

.section {
  border: 1px solid #ddd;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  background: var(--color-surface);
  box-shadow: var(--shadow);
  padding: 0;
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  user-select: none;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  background: none;
  width: 100%;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toggle-icon {
  margin-left: auto;
  font-size: 0.8rem;
  transition: transform 0.2s;
}

.section.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.section.collapsed .section-body {
  display: none;
}

.section-body {
  padding: 0 1.25rem 1.25rem;
}

/* ── Form Fields ─────────────────────────────────────────────────────────── */

label {
  display: block;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.required {
  color: var(--color-error);
}

input[type="text"],
input[type="date"],
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(51, 102, 204, 0.15);
}

textarea {
  resize: vertical;
}

.hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0.25rem 0 0.5rem;
}

/* ── Photo Dropzone ──────────────────────────────────────────────────────── */

.photo-dropzone {
  border: 2px dashed #ccc;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  position: relative;
}

.photo-dropzone.drag-over {
  border-color: var(--color-primary);
  background: rgba(51, 102, 204, 0.04);
}

.photo-placeholder svg {
  color: #bbb;
  margin-bottom: 0.5rem;
}

.photo-placeholder p {
  margin: 0.25rem 0;
}

.link-text {
  color: var(--color-primary);
  text-decoration: underline;
  cursor: pointer;
}

.photo-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
}

.btn-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

/* ── Stories ──────────────────────────────────────────────────────────────── */

.story-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 0.75rem;
}

.story-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(51, 102, 204, 0.15);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
}

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

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: #eee;
  color: var(--color-text);
  border: 1px solid #ccc;
}

.btn-secondary:hover:not(:disabled) {
  background: #ddd;
}

.form-actions {
  text-align: center;
  margin: 2rem 0;
}

.error-text {
  color: var(--color-error);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fce8e8;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius);
}

/* ── Preview Section ─────────────────────────────────────────────────────── */

.preview-section {
  background: var(--color-surface);
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.preview-section h2 {
  margin-top: 0;
}

.preview-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.preview-display {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 1.25rem;
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 500px;
  overflow-y: auto;
}

.preview-editor {
  width: 100%;
  min-height: 300px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  resize: vertical;
}

.preview-meta {
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.preview-meta code {
  background: #eee;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* ── Success Section ─────────────────────────────────────────────────────── */

.success-section {
  text-align: center;
}

.success-card {
  background: var(--color-surface);
  border: 2px solid var(--color-success);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  box-shadow: var(--shadow);
}

.success-card h2 {
  margin: 1rem 0 0.5rem;
  color: var(--color-success);
}

.success-card a {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ── Inline Progress Bar ─────────────────────────────────────────────────── */

.progress-bar-container {
  margin-top: 1rem;
  text-align: center;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width 1s linear;
}

.progress-text {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

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

  .site-header h1 {
    font-size: 1.1rem;
  }

  .container {
    padding: 0 1rem;
  }

  .option-cards {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    flex-direction: column;
  }
}
