/* ============================================================
   genealogy.css  —  Bagale Thapa Family Trees
   Styles specific to genealogy.html (landing + tree panels)
   ============================================================ */

/* ── LANDING HERO ──────────────────────────────────────────── */
.fg-hero {
    background: linear-gradient(135deg, rgba(183,28,28,.08) 0%, rgba(30,58,138,.08) 100%);
    border: 2px solid #B71C1C;
    border-radius: 14px;
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2.5rem;
}
.fg-hero h1 {
    font-size: 2.4rem;
    color: #B71C1C;
    margin-bottom: .5rem;
    display: flex; align-items: center; justify-content: center; gap: .8rem;
}
.fg-hero-subtitle {
    font-size: 1.1rem; color: #8B0000; font-weight: 600;
    margin-bottom: .6rem; letter-spacing: .3px;
}
.fg-hero-desc {
    color: #555; font-size: .95rem; margin-bottom: 1.6rem;
    max-width: 600px; margin-left: auto; margin-right: auto;
}
.fg-hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── SHARED BUTTONS ────────────────────────────────────────── */
.btn-primary {
    padding: 11px 22px; background: #B71C1C; color: white;
    border: none; border-radius: 8px; font-weight: 700; font-size: .95rem;
    cursor: pointer; transition: background .25s;
    display: inline-flex; align-items: center; gap: .5rem;
}
.btn-primary:hover { background: #8B0000; }

.btn-outline {
    padding: 11px 22px; border: 2px solid #B71C1C; color: #B71C1C;
    background: white; border-radius: 8px; font-weight: 700; font-size: .95rem;
    cursor: pointer; text-decoration: none; transition: all .25s;
    display: inline-flex; align-items: center; gap: .5rem;
}
.btn-outline:hover { background: #B71C1C; color: white; }

/* ── SECTION HEADING ───────────────────────────────────────── */
.section-heading {
    font-size: 1.35rem; color: #333; margin-bottom: 1.4rem;
    display: flex; align-items: center; gap: .6rem;
    padding-bottom: .6rem; border-bottom: 3px solid #B71C1C;
}
.section-heading i { color: #B71C1C; }

/* ── LINEAGE CARDS GRID ────────────────────────────────────── */
.lineage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.lineage-card {
    background: white;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 3px 12px rgba(0,0,0,.07);
    transition: box-shadow .25s, border-color .25s;
    display: flex; flex-direction: column; gap: 1rem;
}
.lineage-card:hover { box-shadow: 0 6px 20px rgba(183,28,28,.12); border-color: #B71C1C; }
.lineage-card.blue-card:hover { border-color: #1E3A8A; box-shadow: 0 6px 20px rgba(30,58,138,.12); }

.lineage-card-top { display: flex; align-items: center; gap: 1rem; }

.lineage-badge {
    width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: white;
}
.lineage-badge.red  { background: linear-gradient(135deg, #B71C1C, #8B0000); }
.lineage-badge.blue { background: linear-gradient(135deg, #1E3A8A, #0F1D5C); }

.lineage-identity { flex: 1; }
.lineage-np { font-size: 1.15rem; color: #1a1a1a; margin: 0 0 .15rem 0; font-weight: 700; }
.lineage-en { font-size: .82rem; color: #888; font-weight: 500; }
.lineage-location { font-size: .78rem; color: #555; white-space: nowrap; }
.lineage-location i         { color: #B71C1C; }
.blue-card .lineage-location i { color: #1E3A8A; }

.lineage-desc          { font-size: .9rem; color: #444; line-height: 1.65; flex: 1; }
.lineage-desc strong   { color: #B71C1C; }
.blue-card .lineage-desc strong { color: #1E3A8A; }

.lineage-stats-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.stat-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .78rem; font-weight: 600; padding: 4px 10px;
    border-radius: 20px;
    background: rgba(183,28,28,.08); color: #8B0000;
    border: 1px solid rgba(183,28,28,.2);
}
.stat-chip.coming {
    background: rgba(30,58,138,.07); color: #1E3A8A;
    border-color: rgba(30,58,138,.2);
}

.lineage-source {
    font-size: .78rem; color: #888; font-style: italic;
    padding: .45rem .7rem; background: #f9f9f9;
    border-radius: 6px; border-left: 3px solid #e8c84a;
}
.lineage-source.blue { border-left-color: #1E3A8A; }

/* ── SHOW TREE BUTTON (on card) ────────────────────────────── */
.show-tree-btn {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    width: 100%; padding: 10px 16px;
    background: white; border: 2px solid #B71C1C; color: #B71C1C;
    border-radius: 8px; font-weight: 700; font-size: .9rem;
    cursor: pointer; transition: all .25s; margin-top: auto;
}
.show-tree-btn:hover,
.show-tree-btn.open      { background: #B71C1C; color: white; }
.show-tree-btn.blue      { border-color: #1E3A8A; color: #1E3A8A; }
.show-tree-btn.blue:hover,
.show-tree-btn.blue.open { background: #1E3A8A; color: white; }

/* ── TREE PANELS ───────────────────────────────────────────── */
.tree-panel {
    display: none;
    background: white; border-radius: 12px;
    border: 2px solid #B71C1C;
    box-shadow: 0 6px 24px rgba(183,28,28,.1);
    margin-bottom: 2rem; overflow: hidden;
    animation: panelSlideIn .3s ease;
}
.tree-panel.blue  { border-color: #1E3A8A; box-shadow: 0 6px 24px rgba(30,58,138,.1); }
.tree-panel.open  { display: block; }

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tree-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #B71C1C, #8B0000);
    color: white; font-weight: 700; font-size: 1.05rem;
}
.tree-panel-header.blue { background: linear-gradient(135deg, #1E3A8A, #0F1D5C); }

.panel-close-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4);
    color: white; border-radius: 6px; padding: 6px 12px;
    cursor: pointer; font-size: .85rem; font-weight: 600; transition: background .2s;
}
.panel-close-btn:hover { background: rgba(255,255,255,.3); }

/* ── SOURCE BANNER (inside panel) ──────────────────────────── */
.panel-source-banner {
    background: #fffbf0; border-bottom: 1px solid #f0e68c;
    padding: .6rem 1.5rem; font-size: .85rem; color: #7a6000;
}
.panel-source-banner i { color: #e8c84a; }

/* ── TREE CONTROLS (inside panel) ──────────────────────────── */
.tree-controls {
    display: flex; gap: .8rem; padding: .9rem 1.5rem;
    flex-wrap: wrap; align-items: center;
    border-bottom: 1px solid #f0f0f0; background: #fafafa;
}
.search-box { position: relative; }
.search-box input {
    padding: 8px 38px 8px 12px;
    border: 2px solid #B71C1C; border-radius: 8px;
    font-size: .9rem; width: 260px;
}
.search-box input:focus {
    outline: none; border-color: #1E3A8A;
    box-shadow: 0 0 0 3px rgba(30,58,138,.1);
}
.search-box button {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    background: #B71C1C; color: white; border: none;
    padding: 5px 9px; border-radius: 6px; cursor: pointer;
}
.search-box button:hover { background: #8B0000; }

.ctrl-btn {
    padding: 7px 13px; border: 2px solid #bbb; background: #fafafa; color: #333;
    border-radius: 7px; cursor: pointer; font-weight: 600;
    font-size: .82rem; transition: all .25s;
    min-width: 80px; /* ensure labels don't collapse */
}
.ctrl-btn:hover  { border-color: #B71C1C; color: #B71C1C; }
.ctrl-btn.active { background: #B71C1C; color: white; border-color: #B71C1C; }

/* ── LEGEND ────────────────────────────────────────────────── */
.legend {
    display: flex; flex-wrap: wrap; gap: 1rem;
    padding: .6rem 1.5rem; font-size: .82rem; color: #555;
    background: #fafafa; border-bottom: 1px solid #f0f0f0;
}
.legend-item { display: flex; align-items: center; gap: .4rem; }
.legend-dot {
    width: 13px; height: 13px; border-radius: 50%;
    border: 2px solid #B71C1C; background: #fdf5f5;
}

/* ── ORG-TREE WRAPPER ──────────────────────────────────────── */
.org-wrap { padding: 2rem 1.5rem; overflow-x: auto; transform-origin: center center; transition: transform .2s ease; }

/* ── THE TREE (CSS org chart) ──────────────────────────────── */
.tree { display: flex; justify-content: center; }

.tree ul {
    padding-top: 22px; position: relative;
    display: flex; justify-content: center;
    list-style: none; margin: 0; padding-left: 0;
}
/* vertical stem from parent node down to the horizontal bar */
.tree ul::before {
    content: ''; position: absolute; top: 0; left: 50%;
    transform: translateX(-50%);
    border-left: 2px solid #B71C1C; height: 22px;
}
.tree li {
    display: flex; flex-direction: column; align-items: center;
    padding: 0 8px; position: relative;
}
/* horizontal bar across sibling group */
.tree li::before, .tree li::after {
    content: ''; position: absolute; top: 0;
    border-top: 2px solid #B71C1C; width: 50%; height: 22px;
}
.tree li::before { right: 50%; }
.tree li::after  { left:  50%; }

/* only-child: no horizontal bar */
.tree li:only-child::before,
.tree li:only-child::after  { display: none; }
.tree li:only-child         { padding-top: 0; }
.tree li:only-child > .tree ul::before { top: -22px; height: 44px; }

/* trim outer edges */
.tree li:first-child::before { border: none; }
.tree li:last-child::after   { border: none; }
.tree li:first-child::after  { border-radius: 5px 0 0 0; }
.tree li:last-child::before  { border-right: 2px solid #B71C1C; border-radius: 0 5px 0 0; }

/* ── PERSON NODE ───────────────────────────────────────────── */
.person-node {
    display: inline-flex; flex-direction: column; align-items: center;
    background: linear-gradient(135deg, #fff 0%, #fdf5f5 100%);
    border: 2px solid #B71C1C; border-radius: 10px;
    padding: 8px 14px; min-width: 120px; max-width: 160px;
    cursor: pointer; transition: all .25s;
    box-shadow: 0 2px 6px rgba(183,28,28,.13);
    position: relative; user-select: none;
}
.person-node:hover {
    background: linear-gradient(135deg, #B71C1C, #8B0000);
    color: white; transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(183,28,28,.3);
}
.person-node .np-name  { font-size: .92rem; font-weight: 700; color: #1a1a1a; line-height: 1.3; }
.person-node .en-name  { font-size: .72rem; color: #888; margin-top: 2px; line-height: 1.2; }
.person-node .node-note{ font-size: .65rem; color: #B71C1C; margin-top: 3px; font-style: italic; }
.person-node:hover .np-name,
.person-node:hover .en-name,
.person-node:hover .node-note { color: rgba(255,255,255,.9); }

/* collapsed / expand indicator */
.person-node.has-children::after {
    content: '▾'; position: absolute; bottom: -2px; right: 5px;
    font-size: .7rem; color: #B71C1C;
}
.person-node.has-children.collapsed::after { content: '▸'; }
.person-node:hover::after { color: rgba(255,255,255,.8) !important; }

/* root node is larger + red */
.tree > li > .person-node {
    background: linear-gradient(135deg, #B71C1C, #8B0000);
    color: white; border-color: #8B0000;
    padding: 12px 20px; min-width: 180px;
    box-shadow: 0 6px 20px rgba(183,28,28,.35);
}
.tree > li > .person-node .np-name  { font-size: 1.05rem; color: white; }
.tree > li > .person-node .en-name  { color: rgba(255,255,255,.8); }
.tree > li > .person-node .node-note{ color: rgba(255,255,255,.75); }

/* search highlight */
.person-node.highlight {
    background: linear-gradient(135deg, #fff3cd, #ffe08a) !important;
    border-color: #d4a017 !important;
    animation: highlightPulse 1s ease-in-out infinite;
    transform: scale(1.05);
}
.person-node.highlight .np-name,
.person-node.highlight .en-name { color: #7a5000 !important; }

@keyframes highlightPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(212,160,23,.4); }
    50%      { box-shadow: 0 0 0 8px rgba(212,160,23,0); }
}

/* hidden subtrees */
.tree ul.hidden { display: none; }

/* ── EMPTY TREE STATE ──────────────────────────────────────── */
.empty-tree-state {
    text-align: center; padding: 3.5rem 2rem;
}
.empty-tree-state i     { font-size: 3rem; color: #1E3A8A; margin-bottom: 1rem; display: block; }
.empty-tree-state h3    { font-size: 1.3rem; color: #1E3A8A; margin-bottom: .7rem; }
.empty-tree-state p     { color: #666; max-width: 500px; margin: 0 auto 1.5rem; font-size: .95rem; line-height: 1.6; }
.btn-submit-link {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: 10px 22px; background: #1E3A8A; color: white;
    border-radius: 8px; text-decoration: none; font-weight: 700;
    transition: background .25s;
}
.btn-submit-link:hover { background: #0F1D5C; }

/* ── CTA SECTION ───────────────────────────────────────────── */
.cta-section {
    text-align: center; margin: 3rem 0; padding: 2rem;
    background: linear-gradient(135deg, rgba(183,28,28,.05), rgba(30,58,138,.05));
    border-radius: 12px;
}
.cta-section a {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: 12px 26px; background: #B71C1C; color: white;
    text-decoration: none; border-radius: 8px; font-weight: 700;
    margin-top: 1rem; transition: background .25s;
}
.cta-section a:hover { background: #8B0000; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .fg-hero h1         { font-size: 1.7rem; }
    .lineage-grid       { grid-template-columns: 1fr; }
    .search-box input   { width: 180px; }
    .tree-controls      { gap: .5rem; }
    .person-node        { min-width: 88px; max-width: 118px; padding: 6px 9px; }
    .person-node .np-name { font-size: .8rem; }
    .person-node .en-name { font-size: .64rem; }
}
