/* ================================================================
   Component Library — atoms → molecules → organisms
   All values reference tokens.css. No raw hex or px except
   where tokens have no equivalent (border-radius 8/12px etc.).
   ================================================================ */

/* ──────────────────────────────────────────
   ATOMS
   ────────────────────────────────────────── */

/* ConfidenceDot */
.confidence-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.confidence-dot__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.confidence-dot--confident .confidence-dot__dot { background: var(--color-success); }
.confidence-dot--likely    .confidence-dot__dot { background: var(--color-warning); }
.confidence-dot--uncertain .confidence-dot__dot { background: var(--color-danger); }

.confidence-dot__label {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  text-transform: capitalize;
  color: var(--color-text-secondary);
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  padding: var(--space-1) var(--space-3);
}

.chip__label {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

/* Buttons — shared base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 100px;
  padding: var(--space-2) var(--space-6);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
  border: 1.5px solid transparent;
}
.btn--primary:hover  { background: var(--color-accent-hover); }
.btn--primary:active { background: var(--color-accent-active); }

.btn--secondary {
  background: none;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
}
.btn--secondary:hover  { background: var(--color-subtle); }
.btn--secondary:active { background: var(--color-border); }

.btn--danger {
  background: var(--color-danger);
  color: #fff;
  border: 1.5px solid transparent;
}
.btn--danger:hover { opacity: 0.88; }

.btn--ghost {
  background: none;
  color: currentColor;
  border: 1.5px solid transparent;
  opacity: 0.7;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}
.btn--ghost:hover { opacity: 1; }

/* ProgressBar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 100px;
  transition: width 0.4s ease;
}

/* CountdownText */
.countdown-text {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: #fff;
}

.countdown-text__count {
  font-weight: var(--weight-bold);
}


/* ──────────────────────────────────────────
   MOLECULES
   ────────────────────────────────────────── */

/* InputWithGhost */
.input-ghost-frame {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 14px;
  position: relative;
  overflow: hidden;
}

.input-ghost-frame:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-subtle);
}

.input-ghost-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  pointer-events: none;
  display: flex;
  align-items: center;
  white-space: pre;
  line-height: 1;
}

.input-ghost-overlay__typed {
  color: transparent; /* hides under real input text */
}

.input-ghost-overlay__ghost {
  color: var(--color-text-muted);
}

.input-ghost-input {
  position: relative;
  z-index: 1;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: 0;
  margin: 0;
  line-height: 1;
}

/* MatchResult */
.match-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.match-result__text { flex: 1; }

.match-result__match {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

.match-result__original {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* DropdownList */
.dropdown-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.dropdown-list__item {
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.dropdown-list__item:last-child  { border-bottom: none; }
.dropdown-list__item:hover       { background: var(--color-bg); }
.dropdown-list__item--highlight  { background: var(--color-bg); font-weight: var(--weight-bold); }

/* ChatBubble */
.chat-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
  max-width: 500px;
}

.chat-bubble--user {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  align-self: flex-end;
}

.chat-bubble--system {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.chat-bubble__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
}

/* NumberDisplay */
.number-display { text-align: center; }

.number-display__number {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

.number-display__subtitle {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  line-height: var(--leading-loose);
}

/* BaselineComparison */
.baseline-comparison {
  display: flex;
  gap: var(--space-4);
}

.baseline-comparison__box {
  flex: 1;
  padding: var(--space-4);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.baseline-comparison__box--danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
}

.baseline-comparison__label {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.baseline-comparison__value {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

.baseline-comparison__value--danger { color: var(--color-danger); }

.baseline-comparison__spike {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* ExplanationCard */
.explanation-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-6);
}

.explanation-card__persona {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.explanation-card__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: var(--leading-normal);
}

.explanation-card__content {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-loose);
}


/* ──────────────────────────────────────────
   ORGANISMS
   ────────────────────────────────────────── */

/* ProposalCard */
.proposal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-6);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 2px 12px rgba(58, 135, 251, 0.06);
}

.proposal-card__heading {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.proposal-card__section-title {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.proposal-card__steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.proposal-card__step {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-loose);
}

.proposal-card__step-num {
  flex-shrink: 0;
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  color: var(--color-text-muted);
  margin-top: 4px;
  min-width: 18px;
}

.proposal-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.proposal-card__actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  margin-top: var(--space-2);
}

.proposal-card__actions .btn--danger {
  margin-right: auto;
}

/* HighImpactModal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.high-impact-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-warning-border);
  border-radius: 12px;
  width: 480px;
  max-width: 90vw;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.high-impact-modal__header {
  background: var(--color-warning-bg);
  border-bottom: 1px solid var(--color-warning-border);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.high-impact-modal__icon { font-size: 18px; }

.high-impact-modal__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

.high-impact-modal__body {
  padding: var(--space-6);
}

.high-impact-modal__desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-loose);
  margin-bottom: var(--space-6);
}

.high-impact-modal__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* SharingBar */
.sharing-bar {
  background: var(--grey-160);
  color: #fff;
  padding: var(--space-4) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  border-radius: 8px;
}

/* CreateFallback */
.create-fallback {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.create-fallback__message {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-loose);
}

.create-fallback__term {
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

/* ChartContainer */
.chart-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-6);
  width: 100%;
}

.chart-container__title {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-on-bg);
  margin-bottom: var(--space-6);
}

/* ExpertisePanel */
.expertise-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
}

.expertise-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  overflow: hidden;
  background: var(--color-surface);
  padding: var(--space-1);
  gap: var(--space-1);
}

.expertise-toggle__btn {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-4);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: 100px;
  transition: all 0.15s;
}

.expertise-toggle__btn--active {
  background: var(--color-accent);
  color: #fff;
}

/* ──────────────────────────────────────────
   DEMO PAGE SHELL
   ────────────────────────────────────────── */

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.demo-header__title {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
}

.demo-header__badge {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-on-bg);
  background: none;
  border: 1px solid var(--color-text-on-bg);
  border-radius: 100px;
  padding: var(--space-1) var(--space-3);
}

.demo-header__back {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-on-bg);
  text-decoration: none;
}
.demo-header__back:hover { text-decoration: underline; }

.demo-main {
  min-height: calc(100vh - 57px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-16) var(--space-8);
  gap: var(--space-12);
}

.demo-description {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-on-bg);
  text-align: center;
  max-width: 520px;
  line-height: var(--leading-loose);
}

.demo-stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  width: 100%;
  max-width: 560px;
}

/* Progress row for guardrails demo */
.progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
}

.progress-row__label {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  color: var(--color-text-secondary);
  white-space: nowrap;
  min-width: 80px;
}
