/* ================================================================
   HC Family Tree — Human Chronicles  v1.1.0
================================================================ */

#hc-family-tree-root,
.hc-ft-root {
  /* Font intentionally not set here — inherits from Elementor / theme */
  color: #2B2116;
  padding: 20px;
  background: linear-gradient(160deg, #F8F3E9 0%, #EDE4D1 100%);
  border-radius: 14px;
  border: 1px solid #E2D9C5;
  box-sizing: border-box;
}

/* UI elements that need explicit Noto Sans */
.hc-ft-btn,
.hc-ft-field label,
.hc-ft-field input[type="text"],
.hc-ft-field textarea,
.hc-ft-legend-item,
.hc-ft-status,
.hc-ft-optional,
.hc-ft-col-label,
.hc-ft-modal-header h3,
.hc-ft-add-heading {
  font-family: 'Noto Sans', sans-serif;
  font-weight: 500;
}

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

.hc-ft-loading {
  display: none;
  padding: 28px;
  text-align: center;
  font-size: 1rem;
  color: #9A8E7C;
  font-family: 'Noto Sans', sans-serif;
  font-weight: 500;
}

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

.hc-ft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.hc-ft-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hc-ft-icon {
  font-size: 24px;
  line-height: 1;
}

.hc-ft-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #2B2116;
  margin: 0;
}

.hc-ft-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Legend ─────────────────────────────────────────────────── */

.hc-ft-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.hc-ft-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1rem;
  color: #7A6E5C;
}

.hc-ft-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Cross-line connections (info overlay) ───────────────────── */

.hc-ft-io-links-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #F0EAE0;
}

.hc-ft-io-link-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: #FBF6EA;
  border: 1px solid #E2D9C5;
  border-radius: 8px;
  padding: 7px 10px;
  margin-top: 5px;
  cursor: pointer;
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.875rem;
  color: #2B2116;
  transition: background 0.15s;
}
.hc-ft-io-link-btn:hover { background: #F0E9D8; }

.hc-ft-io-link-label { color: #9A8E7C; font-weight: 500; }
.hc-ft-io-link-code  { font-family: 'Courier New', monospace; font-weight: 700; color: #B8873F; }
.hc-ft-io-link-name  { color: #4A3F30; }
.hc-ft-io-link-go    { float: right; color: #B8873F; font-weight: 700; }

/* ── Cross-line connections (edit modal) ─────────────────────── */

.hc-ft-links-list {
  margin-bottom: 8px;
}

.hc-ft-links-empty {
  font-size: 0.875rem;
  color: #C4B89A;
  font-style: italic;
  margin: 4px 0 8px;
}

.hc-ft-link-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #FBF6EA;
  border: 1px solid #E2D9C5;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 5px;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.hc-ft-link-item-label { color: #9A8E7C; font-weight: 500; }
.hc-ft-link-item-code  { font-family: 'Courier New', monospace; font-weight: 700; color: #B8873F; }
.hc-ft-link-item-name  { color: #4A3F30; flex: 1; }

.hc-ft-link-remove {
  background: none;
  border: none;
  color: #B5493C;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  margin-left: auto;
}
.hc-ft-link-remove:hover { color: #712E24; }

.hc-ft-links-add {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.hc-ft-links-add .hc-ft-link-code-input {
  width: 100px;
  flex-shrink: 0;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: #B8873F;
}

.hc-ft-links-add .hc-ft-link-label-input { flex: 1; min-width: 100px; }

/* ── Person info card (inside the .hc-ft-overlay backdrop) ───── */

.hc-ft-info-card {
  max-width: 380px;
}

.hc-ft-io-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.hc-ft-io-code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: #8B3A2F;
  background: #F6F1E7;
  padding: 2px 6px;
  border-radius: 4px;
}

.hc-ft-io-name {
  font-weight: 700;
  font-size: 1rem;
  color: #2B2116;
}
.hc-ft-io-name:hover,
.hc-ft-io-code:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hc-ft-io-years {
  font-size: 0.875rem;
  color: #7A6E5C;
  font-weight: 500;
  margin-bottom: 10px;
  margin-top: 4px;
  min-height: 4px;
}

.hc-ft-io-partner-row,
.hc-ft-io-story-row,
.hc-ft-io-links-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #F0EAE0;
}

.hc-ft-io-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9A8E7C;
  margin-bottom: 4px;
}

.hc-ft-io-partner {
  font-size: 0.9375rem;
  color: #2B2116;
  font-weight: 500;
}

.hc-ft-io-story {
  font-size: 0.9rem;
  color: #4A3F30;
  line-height: 1.5;
  font-style: italic;
  margin: 0;
}

/* ── Search ──────────────────────────────────────────────────── */

.hc-ft-search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.hc-ft-search-input {
  width: 100%;
  padding: 10px 16px;
  border: 1.5px solid #E2D9C5;
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'Noto Sans', sans-serif;
  font-weight: 500;
  color: #2B2116;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.hc-ft-search-input:focus {
  border-color: #8B3A2F;
  box-shadow: 0 0 0 3px rgba(139,58,47,0.1);
}

.hc-ft-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #E2D9C5;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(43,33,22,0.14);
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
}

.hc-ft-sr {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #F6F1E7;
  transition: background 0.1s;
}

.hc-ft-sr:last-child { border-bottom: none; }
.hc-ft-sr:hover      { background: #FBF6EA; }

.hc-ft-sr-code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.875rem;
  color: #8B3A2F;
}

.hc-ft-sr-name {
  font-size: 1rem;
  color: #2B2116;
  font-weight: 500;
  margin-left: 8px;
}

.hc-ft-sr-meta {
  font-size: 0.75rem;
  color: #9A8E7C;
  margin-top: 3px;
}

.hc-ft-sr-empty {
  padding: 14px;
  color: #9A8E7C;
  font-size: 0.9rem;
  text-align: center;
}

/* ── Forest grid ────────────────────────────────────────────── */

.hc-ft-forest {
  display: grid;
  gap: 14px;
}

/* Dynamic column counts set by PHP via class */
.hc-ft-cols-1 { grid-template-columns: 1fr; }
.hc-ft-cols-2 { grid-template-columns: repeat(2, 1fr); }
.hc-ft-cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
  .hc-ft-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hc-ft-cols-2,
  .hc-ft-cols-3 { grid-template-columns: 1fr; }
}

/* Single-line: give the canvas more room vertically */
#hc-family-tree-root.hc-ft-single-line .hc-ft-canvas,
.hc-ft-root.hc-ft-single-line .hc-ft-canvas {
  height: 800px;
}

/* ── Column card ─────────────────────────────────────────────── */

.hc-ft-col {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E2D9C5;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(43,33,22,0.06);
}

.hc-ft-col-label {
  font-size: 1.125rem;
  font-weight: 700;
  color: #8B3A2F;
  margin: 0;
  padding: 10px 14px;
  background: #FBF6EA;
  border-bottom: 1px solid #E2D9C5;
  letter-spacing: 0.3px;
}

.hc-ft-canvas {
  width: 100%;
  height: 620px;
  display: block;
  background: transparent;
}

.hc-ft-toolbar-divider {
  width: 1px;
  height: 22px;
  background: #E2D9C5;
  align-self: center;
}

.hc-ft-btn[title] {
  min-width: 34px;
  padding: 6px 10px;
  font-size: 1.1rem;
  font-weight: 700;
  justify-content: center;
}

a.hc-ft-help-btn {
  text-decoration: none;
}

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

.hc-ft-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid #E2D9C5;
  background: #F6F1E7;
  color: #7A6E5C;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}
.hc-ft-btn:hover { background: #EDE5D4; color: #4A3F30; }

.hc-ft-btn-primary {
  background: #8B3A2F; color: #fff;
  border-color: #8B3A2F; font-weight: 600;
}
.hc-ft-btn-primary:hover { background: #712E24; }

.hc-ft-btn-danger {
  background: transparent; color: #B5493C; border-color: #E8B4AB;
}
.hc-ft-btn-danger:hover { background: #FBE4E1; }

/* ── Status ─────────────────────────────────────────────────── */

.hc-ft-status {
  font-size: 1rem;
  color: transparent;
  transition: color 0.2s;
  min-width: 80px;
}
.hc-ft-s-info { color: #7A6E5C; }
.hc-ft-s-ok   { color: #4E6B4F; font-weight: 600; }
.hc-ft-s-err  { color: #B5493C; }

/* ── Modal overlay ───────────────────────────────────────────── */

.hc-ft-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43,33,22,0.48);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.hc-ft-modal-box {
  background: #FDFAF4;
  border-radius: 16px;
  padding: 26px 24px 22px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22);
  box-sizing: border-box;
}

.hc-ft-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.hc-ft-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2B2116;
  margin: 0;
}

.hc-ft-modal-close {
  background: none; border: none;
  font-size: 22px; color: #9A8E7C;
  cursor: pointer; line-height: 1; padding: 0;
}
.hc-ft-modal-close:hover { color: #2B2116; }

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

.hc-ft-field { margin-bottom: 13px; }

.hc-ft-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #7A6E5C;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  margin-bottom: 5px;
}

.hc-ft-optional {
  font-weight: 400;
  text-transform: none;
  font-size: 0.75rem;
  color: #BFBFB0;
}

.hc-ft-field input[type="text"],
.hc-ft-field textarea {
  width: 100%;
  border: 1px solid #E2D9C5; border-radius: 8px;
  padding: 8px 10px;
  font-size: 1rem; color: #2B2116;
  background: #fff; box-sizing: border-box;
  transition: border-color 0.15s; outline: none;
}
.hc-ft-field input[type="text"]:focus,
.hc-ft-field textarea:focus {
  border-color: #8B3A2F;
  box-shadow: 0 0 0 2px rgba(139,58,47,0.12);
}
.hc-ft-field input[readonly] {
  background: #F6F1E7; color: #8B3A2F;
  font-family: "Courier New", monospace;
  font-weight: 700; font-size: 1rem;
}
.hc-ft-field textarea { resize: vertical; min-height: 70px; }

/* ── Modal footer ────────────────────────────────────────────── */

.hc-ft-modal-footer {
  display: flex; gap: 8px;
  align-items: center; margin-top: 20px; flex-wrap: wrap;
}



/* ================================================================
   Person Lookup — "Find a person" modal
================================================================ */

.hc-ft-lookup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43,33,22,0.52);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hc-ft-lookup-box {
  background: #F8F3E9;
  border-radius: 16px;
  border: 0.5px solid #E2D9C5;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  font-family: 'Noto Sans', sans-serif;
}

.hc-ft-lookup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 0.5px solid #E2D9C5;
}

.hc-ft-lookup-title { font-size: 15px; font-weight: 500; color: #2B2116; }

.hc-ft-lookup-back {
  background: none; border: none;
  font-size: 13px; color: #8B3A2F;
  cursor: pointer; font-family: 'Noto Sans', sans-serif; padding: 0;
}

.hc-ft-lookup-body { padding: 20px 22px 22px; }

.hc-ft-lookup-intro {
  font-size: 13px; color: #7A6E5C;
  margin-bottom: 14px; line-height: 1.5;
}

.hc-ft-lookup-search-wrap { position: relative; }

.hc-ft-lookup-input {
  width: 100%;
  background: #fff;
  border: 1.5px solid #8B3A2F;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: 'Noto Sans', sans-serif;
  color: #2B2116;
  outline: none;
}

.hc-ft-lookup-results {
  background: #fff;
  border: 0.5px solid #E2D9C5;
  border-radius: 10px;
  margin-top: 10px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(43,33,22,0.1);
}

.hc-ft-lk-result {
  padding: 11px 16px;
  border-bottom: 0.5px solid #F0EAE0;
  cursor: pointer;
  transition: background .1s;
}
.hc-ft-lk-result:last-child { border-bottom: none; }
.hc-ft-lk-result:hover { background: #FBF6EA; }

.hc-ft-lk-r-name { font-size: 14px; font-weight: 500; color: #2B2116; }
.hc-ft-lk-r-meta { font-size: 11px; color: #9A8E7C; margin-top: 3px; }
.hc-ft-lk-r-code {
  font-family: 'Courier New', monospace;
  font-size: 10px; font-weight: 700;
  color: #8B3A2F; background: #F5E8E6;
  padding: 1px 5px; border-radius: 3px;
}
.hc-ft-lk-no-results { padding: 14px 16px; font-size: 13px; color: #9A8E7C; }

/* ── Person card inside lookup ── */
.hc-ft-lookup-card-area { padding: 18px 20px; }

.hc-ft-lk-card {
  background: #fff;
  border-radius: 12px;
  border: 0.5px solid #E2D9C5;
  border-top: 3px solid #8B3A2F;
  overflow: hidden;
}

.hc-ft-lk-top {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 0.5px solid #F0EAE0;
}

.hc-ft-lk-avatar {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; flex-shrink: 0;
}

.hc-ft-lk-given  { font-size: 20px; font-weight: 500; color: #2B2116; }
.hc-ft-lk-family { font-size: 13px; color: #7A6E5C; margin-top: 2px; }

.hc-ft-lk-meta {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-bottom: 0.5px solid #F0EAE0;
}

.hc-ft-lk-code {
  font-family: 'Courier New', monospace;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
}

.hc-ft-lk-gen { font-size: 12px; color: #9A8E7C; }

.hc-ft-lk-fields { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }

.hc-ft-lk-field { display: flex; gap: 10px; }

.hc-ft-lk-field-label {
  font-size: 11px; color: #9A8E7C; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
  width: 52px; flex-shrink: 0; padding-top: 1px;
}

.hc-ft-lk-field-val { font-size: 13px; color: #2B2116; }

.hc-ft-lk-note-toggle {
  width: 100%; background: none; border: none;
  border-top: 0.5px solid #F0EAE0;
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; font-size: 13px; color: #7A6E5C;
  font-family: 'Noto Sans', sans-serif;
}
.hc-ft-lk-note-toggle i { transition: transform .2s; }

.hc-ft-lk-note-body {
  padding: 12px 18px; background: #FBF6EA;
  border-top: 0.5px solid #F0EAE0;
  font-size: 13px; color: #4A3F30;
  font-style: italic; line-height: 1.6;
}
