/* =============================================
   Clarum — App Pages CSS
   Dark, premium, cinematic
   ============================================= */

:root {
  --bg-deep: #0b0a08;
  --bg: #111009;
  --bg-surface: #1a1814;
  --bg-elevated: #222019;
  --gold: #c9a84c;
  --gold-dim: #a6883d;
  --gold-subtle: rgba(201, 168, 76, 0.12);
  --text-primary: #f0ead8;
  --text-secondary: #9e9484;
  --text-muted: #6b6358;
  --border: rgba(201, 168, 76, 0.15);
  --border-strong: rgba(201, 168, 76, 0.25);
}

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

html, body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--gold); color: var(--bg); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }

/* ── Typography ── */
.serif { font-family: 'Cormorant Garamond', serif; }

/* ── App Shell ── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ── */
.topbar {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.topbar-wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.topbar-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.topbar-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.topbar-link:hover { color: var(--text-primary); }

.topbar-user {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Room Page ── */
.room-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px;
}

.room-header {
  text-align: center;
  margin-bottom: 48px;
}

.room-header-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 16px;
}

.room-header-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.room-header-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 12px;
}

/* ── Advisor Row ── */
.advisor-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 48px;
}

.advisor-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  min-width: 100px;
  opacity: 0.4;
  transition: all 0.4s ease;
}

.advisor-chip.active {
  opacity: 1;
  border-color: var(--gold-dim);
  background: var(--bg-elevated);
}

.advisor-chip-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.advisor-chip-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.advisor-chipresponding::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Chair Visual ── */
.chair-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
}

.chair-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold-subtle);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: var(--gold);
  margin-bottom: 12px;
}

.chair-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

/* ── Question Input ── */
.question-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 48px;
}

.question-prompt {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--text-secondary);
  text-align: center;
  font-style: italic;
}

.question-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  padding: 18px 20px;
  resize: none;
  min-height: 100px;
  transition: border-color 0.2s;
  outline: none;
}

.question-input::placeholder { color: var(--text-muted); font-style: italic; }
.question-input:focus { border-color: var(--gold-dim); }

.question-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
}

/* ── Buttons ── */
.btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
}

.btn-primary:hover { background: #d4b355; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover { border-color: var(--gold-dim); color: var(--text-primary); }

/* ── File Upload ── */
.file-upload-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-upload-btn {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 0;
  transition: color 0.2s;
}

.file-upload-btn:hover { color: var(--gold); }

.file-upload-input { display: none; }

.file-attached {
  font-size: 12px;
  color: var(--gold-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Board Response Area ── */
.board-responses {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 48px;
}

.response-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 24px 28px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.response-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.response-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-subtle);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--gold);
  font-family: 'Cormorant Garamond', serif;
  flex-shrink: 0;
}

.response-speaker {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.response-content {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
}

/* ── Synthesis ── */
.synthesis-card {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--gold-dim);
  padding: 32px 36px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.synthesis-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.synthesis-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.synthesis-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
}

.synthesis-content p { margin-bottom: 16px; }
.synthesis-content p:last-child { margin-bottom: 0; }

/* ── Qualifying State ── */
.qualifying-state {
  text-align: center;
  padding: 48px 32px;
}

.qualifying-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 20px;
}

.qualifying-question {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 32px;
  line-height: 1.4;
}

.qualifying-input {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  padding: 16px 20px;
  margin: 0 auto 24px;
  display: block;
  outline: none;
  transition: border-color 0.2s;
}

.qualifying-input:focus { border-color: var(--gold-dim); }

/* ── Follow-up Section ── */
.follow-up-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  margin-bottom: 32px;
}

.follow-up-header {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 4px;
}

.follow-up-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.follow-up-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.follow-up-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
}

.follow-up-input:focus { border-color: var(--gold-dim); }
.follow-up-input::placeholder { color: var(--text-muted); }

/* ── Loading State ── */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--gold-dim);
  border-radius: 50%;
  animation: dot-pulse 1.4s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Pause State ── */
.room-paused {
  text-align: center;
  padding: 40px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.room-paused-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.room-paused-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .topbar { padding: 16px 20px; }
  .room-container { padding: 32px 20px; }
  .advisor-row { gap: 12px; }
  .advisor-chip { min-width: 72px; padding: 10px 14px; }
  .room-header-title { font-size: 26px; }
  .synthesis-card { padding: 24px 20px; }
}

/* ── Landing Override (app pages only) ── */
.app-page .site-header,
.app-page .site-footer { display: none; }
.app-page { background: var(--bg-deep); }