/* ChatPage — dark theme matching existing Chrysopedia styles */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}

.title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 1.5rem;
}

/* ── Input area ───────────────────────────────────────────── */

.inputRow {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.input {
  flex: 1;
  padding: 0.625rem 0.75rem;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-primary);
  font-size: 0.9375rem;
  transition: border-color 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-focus);
}

.input::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.7;
}

.submitBtn {
  padding: 0.625rem 1.25rem;
  background: var(--color-accent);
  color: #0f0f14;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.submitBtn:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

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

/* ── Response area ────────────────────────────────────────── */

.responseArea {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  min-height: 100px;
}

.responseText {
  color: var(--color-text-primary);
  font-size: 0.9375rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--color-accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Loading state ────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Error state ──────────────────────────────────────────── */

.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ── Citations / Sources ──────────────────────────────────── */

.sourcesSection {
  margin-top: 0.5rem;
}

.sourcesTitle {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem;
}

.sourceList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sourceItem {
  display: flex;
  gap: 0.625rem;
  align-items: baseline;
  font-size: 0.875rem;
}

.sourceNumber {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #0f0f14;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.sourceLink {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.sourceLink:hover {
  text-decoration: underline;
}

.sourceMeta {
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
}

/* ── Citation superscript links in text ───────────────────── */

.citationGroup {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
}

.citationLink {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.citationLink:hover {
  text-decoration: underline;
}

/* ── Empty / placeholder state ────────────────────────────── */

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  text-align: center;
  gap: 0.5rem;
}

.placeholderIcon {
  font-size: 2rem;
  opacity: 0.5;
}

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

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

  .inputRow {
    flex-direction: column;
  }

  .submitBtn {
    width: 100%;
  }
}
