/**
 * 100x Life Planning System - People Module Styles
 * Relationship categories, person cards, ecosystem mapping
 */

/* ===== Container ===== */
.people-container,
.people-edit-container,
.people-chat-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.people-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.people-title h1,
.people-title h2 {
  font-family: var(--font-heading);
  font-size: calc(2rem + var(--text-bump));
  color: var(--navy-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.people-title h2 {
  font-size: calc(1.5rem + var(--text-bump));
}

.people-title p {
  color: var(--text-secondary);
  margin: 0;
}

/* ===== Scripture Quote ===== */
.people-scripture {
  background: linear-gradient(135deg, var(--teal-light), #f0fdf4);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
  border-left: 4px solid var(--teal-accent);
}

.people-scripture i {
  font-size: calc(2rem + var(--text-bump));
  color: var(--teal-accent);
  opacity: 0.5;
}

.people-scripture p {
  font-size: calc(1.1rem + var(--text-bump));
  font-style: italic;
  color: var(--navy-primary);
  margin: 0.5rem 0;
  line-height: 1.5;
}

.people-scripture cite {
  color: var(--text-muted);
  font-size: calc(0.9rem + var(--text-bump));
}

/* ===== Stats ===== */
.people-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.people-stat {
  text-align: center;
}

.people-stat-number {
  display: block;
  font-size: calc(2.5rem + var(--text-bump));
  font-weight: 700;
  color: var(--teal-accent);
}

.people-stat-label {
  font-size: calc(0.85rem + var(--text-bump));
  color: var(--text-muted);
}

/* ===== Category Cards ===== */
.people-categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.people-category-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.people-category-card:hover {
  border-color: var(--teal-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.people-category-card:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 155, 181, 0.3);
}

.people-category-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.people-category-icon i {
  font-size: calc(1.25rem + var(--text-bump));
  color: var(--teal-accent);
}

.people-category-content {
  flex: 1;
  min-width: 0;
}

.people-category-content h3 {
  font-size: calc(1rem + var(--text-bump));
  font-weight: 600;
  color: var(--navy-primary);
  margin: 0 0 0.25rem 0;
}

.people-category-desc {
  font-size: calc(0.85rem + var(--text-bump));
  color: var(--text-secondary);
  margin: 0;
}

.people-category-preview {
  font-size: calc(0.8rem + var(--text-bump));
  color: var(--text-muted);
  margin: 0.25rem 0 0 0;
  font-style: italic;
}

.people-category-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.people-category-count {
  background: var(--teal-light);
  color: var(--teal-accent);
  font-weight: 600;
  font-size: calc(0.9rem + var(--text-bump));
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
}

.people-category-meta i {
  color: var(--text-muted);
}

/* ===== Section ===== */
.people-section {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-light);
}

.people-section-header {
  margin-bottom: 0.75rem;
}

.people-section-header h2 {
  font-family: var(--font-heading);
  font-size: calc(1.25rem + var(--text-bump));
  color: var(--navy-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.people-section-header h2 i {
  color: var(--teal-accent);
}

.people-section-description {
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  font-size: calc(0.9rem + var(--text-bump));
}

/* ===== Cross References ===== */
.people-cross-ref {
  background: var(--bg-secondary);
}

.people-cross-ref-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.people-cross-ref-item {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 1rem;
}

.people-cross-ref-section {
  font-size: calc(0.75rem + var(--text-bump));
  font-weight: 600;
  color: var(--teal-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.people-cross-ref-item p {
  margin: 0.5rem 0 0 0;
  color: var(--text-secondary);
  font-size: calc(0.9rem + var(--text-bump));
}

/* ===== Entry List ===== */
.people-entries-list {
  margin-bottom: 1rem;
}

.people-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 12px;
}

.people-empty i {
  font-size: calc(3rem + var(--text-bump));
  margin-bottom: 1rem;
  display: block;
  opacity: 0.5;
}

/* ===== Entry Card ===== */
.people-entry-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.people-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.people-entry-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: calc(0.85rem + var(--text-bump));
}

.people-entry-delete {
  color: var(--text-muted);
}

.people-entry-delete:hover {
  color: #dc2626;
}

.people-entry-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.people-field label {
  display: block;
  font-size: calc(0.8rem + var(--text-bump));
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.people-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: calc(0.9rem + var(--text-bump));
  background: var(--bg-primary);
  color: var(--text-dark);
  transition: border-color 0.2s ease;
}

.people-input:focus {
  outline: none;
  border-color: var(--teal-accent);
  box-shadow: 0 0 0 3px rgba(74, 155, 181, 0.1);
}

textarea.people-input {
  resize: vertical;
  min-height: 60px;
}

.people-checkbox {
  margin-right: 0.5rem;
}

.people-field label:has(.people-checkbox) {
  display: flex;
  align-items: center;
  text-transform: none;
  font-weight: normal;
  font-size: calc(0.9rem + var(--text-bump));
  color: var(--text-secondary);
}

/* ===== Add Person Button ===== */
.add-person-btn {
  width: 100%;
  padding: 1rem;
  border-style: dashed;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .people-container,
  .people-edit-container,
  .people-chat-container {
    padding: 0.75rem;
  }

  .people-stats {
    gap: 1.5rem;
  }

  .people-stat-number {
    font-size: calc(2rem + var(--text-bump));
  }

  .people-category-card {
    flex-wrap: wrap;
  }

  .people-category-meta {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.5rem;
  }
}

/* ===== Dark Theme ===== */
[data-theme="dark"] .people-title h1,
[data-theme="dark"] .people-title h2 {
  color: var(--text-light);
}

[data-theme="dark"] .people-scripture {
  background: linear-gradient(135deg, var(--teal-light), var(--bg-tertiary));
}

[data-theme="dark"] .people-category-card {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

[data-theme="dark"] .people-category-content h3 {
  color: var(--text-light);
}

[data-theme="dark"] .people-section {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

[data-theme="dark"] .people-entry-card {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

[data-theme="dark"] .people-cross-ref-item {
  background: var(--bg-tertiary);
}

/* ===== Category Reflection (Rails parity) =====
   The original people.js renders these classes but relies on shared interview
   styling for the wrapper/textarea. These rules style the Rails-side helper
   markup (label, help text, status line) so the reflection block matches. */
.people-category-reflection {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.people-category-reflection > label {
  display: block;
  font-family: var(--font-heading);
  font-size: calc(1.1rem + var(--text-bump));
  color: var(--navy-primary);
  margin-bottom: 0.25rem;
}

.people-help-text {
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  font-size: calc(0.9rem + var(--text-bump));
}

/* The reflection textarea is styled by `.interview-textarea-wrapper textarea`
   in interview.css; these add the compact sizing the original trix-compact
   variant implied so the field doesn't tower over the block. */
.people-reflection-textarea {
  min-height: 80px;
}

.people-reflection-status {
  font-size: calc(0.8rem + var(--text-bump));
  color: var(--text-muted);
  margin-top: 0.5rem;
  min-height: 1rem;
}

/* ===== Module Chat (Rails parity) =====
   The Rails chat surface wraps the shared streaming interview-chat component.
   The seeded opener renders as the first `.message.ai` bubble inside the chat
   (via messages/_opener), identical to a streamed reply; this just supplies the
   flow. */
.people-chat-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.people-synth-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: calc(0.9rem + var(--text-bump));
}

.people-synth-error i {
  color: #dc2626;
}

[data-theme="dark"] .people-category-reflection {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

[data-theme="dark"] .people-category-reflection > label {
  color: var(--text-light);
}
