/* ============================================================
   Themgumthottathil Family Network – Frontend Styles
   Works alongside the Poize WordPress theme
   ============================================================ */

:root {
  --thf-primary:    #8B3A2A;   /* deep Kerala red */
  --thf-secondary:  #C4944A;   /* warm gold */
  --thf-accent:     #2E5E4E;   /* Kerala green */
  --thf-light:      #FDF6EE;
  --thf-text:       #1a1a1a;
  --thf-muted:      #666;
  --thf-border:     #ddd;
  --thf-radius:     10px;
  --thf-shadow:     0 2px 12px rgba(0,0,0,.1);
}

/* ── Directory Filters ────────────────────────────────────── */
.thf-directory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
  padding: 16px;
  background: var(--thf-light);
  border-radius: var(--thf-radius);
  border: 1px solid var(--thf-border);
}

.thf-filter-input,
.thf-filter-select {
  padding: 8px 14px;
  border: 1px solid var(--thf-border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: var(--thf-text);
  outline: none;
  transition: border-color .2s;
}
.thf-filter-input:focus,
.thf-filter-select:focus { border-color: var(--thf-primary); }
.thf-filter-input { flex: 1; min-width: 200px; }

.thf-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--thf-muted);
  white-space: nowrap;
}

/* ── Member Grid ──────────────────────────────────────────── */
.thf-member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.thf-member-card {
  border-radius: var(--thf-radius);
  overflow: hidden;
  box-shadow: var(--thf-shadow);
  transition: transform .2s, box-shadow .2s;
  background: #fff;
}
.thf-member-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.thf-card-inner { display: block; color: inherit; text-decoration: none; }

.thf-card-photo {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--thf-light);
}
.thf-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thf-card-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 700;
  color: var(--thf-secondary);
  background: linear-gradient(135deg, var(--thf-light) 0%, #ede4d8 100%);
}

.thf-card-body { padding: 14px; }

.thf-card-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--thf-text);
}
.thf-card-malayalam {
  font-size: 13px;
  color: var(--thf-secondary);
  margin: 0 0 6px;
  font-family: 'Noto Sans Malayalam', sans-serif;
}
.thf-card-profession,
.thf-card-location,
.thf-card-branch {
  font-size: 12px;
  color: var(--thf-muted);
  margin: 3px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.thf-card-role {
  display: inline-block;
  font-size: 10px;
  background: var(--thf-secondary);
  color: #fff;
  border-radius: 20px;
  padding: 2px 8px;
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: .4px;
}

/* Status badges */
.thf-card-status {
  display: inline-block;
  font-size: 10px;
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 600;
  letter-spacing: .4px;
  margin-top: 8px;
}
.thf-status-active   { background: #e8f8ef; color: #27ae60; }
.thf-status-inactive { background: #fef3e2; color: #e67e22; }
.thf-status-deceased { background: #f2f2f2; color: #7f8c8d; }
.thf-status-pending  { background: #e8f4fd; color: #3498db; }

.thf-no-results {
  text-align: center;
  color: var(--thf-muted);
  padding: 40px;
}

/* ── Family Tree ──────────────────────────────────────────── */
.thf-tree-wrap {
  position: relative;
  background: var(--thf-light);
  border-radius: var(--thf-radius);
  border: 1px solid var(--thf-border);
  overflow: hidden;
}

.thf-tree-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--thf-border);
}

#thf-tree-container {
  position: relative;
  cursor: grab;
  background: radial-gradient(ellipse at center, #fdf6ee 0%, #f0e8d8 100%);
}
#thf-tree-container:active { cursor: grabbing; }

/* Node labels */
.thf-node-label  { pointer-events: none; font-family: inherit; }
.thf-node-sublabel { pointer-events: none; font-family: inherit; }

/* Dim/highlight for search */
.thf-node--dim { opacity: .2; }
.thf-node--highlight circle { stroke: var(--thf-secondary) !important; stroke-width: 4px !important; }

/* ── Member Detail Panel ─────────────────────────────────── */
.thf-member-panel {
  position: absolute;
  top: 60px;
  right: 16px;
  width: 280px;
  background: #fff;
  border-radius: var(--thf-radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  z-index: 10;
  padding: 16px;
  max-height: calc(100% - 80px);
  overflow-y: auto;
}
#thf-panel-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--thf-muted);
}
.thf-panel-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.thf-panel-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--thf-secondary);
}
.thf-panel-photo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--thf-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--thf-secondary);
  border: 2px solid var(--thf-secondary);
  flex-shrink: 0;
}
.thf-panel-header h3 { margin: 0; font-size: 15px; }
.thf-panel-ml { font-size: 12px; color: var(--thf-secondary); margin: 2px 0; }
.thf-panel-details { font-size: 13px; }
.thf-panel-details dt { font-weight: 600; color: var(--thf-muted); margin-top: 8px; }
.thf-panel-details dd { margin-left: 0; }
.thf-panel-loading { text-align:center; color: var(--thf-muted); padding: 20px 0; }

/* ── Profile Page Details ─────────────────────────────────── */
.thf-profile-details { margin-top: 36px; }

.thf-detail-section {
  padding: 18px 20px;
  border-radius: var(--thf-radius);
  background: var(--thf-light);
  border: 1px solid var(--thf-border);
  margin-bottom: 16px;
}
.thf-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--thf-primary);
  margin: 0 0 10px;
}
.thf-detail-section ul { margin: 0; padding-left: 18px; }
.thf-detail-section li { margin-bottom: 6px; font-size: 14px; }
.thf-relatives { list-style: none; padding: 0; }
.thf-relatives li { margin-bottom: 6px; font-size: 14px; }
.thf-relatives a {
  color: var(--thf-primary);
  font-weight: 600;
  text-decoration: none;
  margin-right: 6px;
}
.thf-relatives a:hover { text-decoration: underline; }

/* ── Buttons ─────────────────────────────────────────────── */
.thf-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--thf-border);
  background: #fff;
  color: var(--thf-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.thf-btn:hover { background: var(--thf-light); }
.thf-btn--primary {
  background: var(--thf-primary);
  color: #fff;
  border-color: var(--thf-primary);
}
.thf-btn--primary:hover { background: #6d2d1e; }

/* ── Single card variant ─────────────────────────────────── */
.thf-member-card--single { max-width: 260px; }
.thf-card-photo-full { width: 100%; display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .thf-member-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .thf-member-panel { width: calc(100% - 32px); right: 16px; left: 16px; }
  .thf-tree-toolbar { padding: 8px; }
}
