/* === GENERAL STYLES === */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8fcfb; /* Latar belakang hijau sangat pucat */
    color: #333;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
}

h2 {
    text-align: center;
    color: #004d40; /* Hijau tua */
}

/* === NAVIGATION & FORM === */
nav {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

nav a, button {
    padding: 12px 20px;
    text-decoration: none;
    background-color: #00897b; /* Hijau (teal) */
    color: white;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

nav a:hover, button:hover {
    background-color: #00695c; /* Hijau lebih tua */
    box-shadow: 0 4px 12px rgba(0, 137, 123, 0.3);
}

button#clearData {
    background-color: #d84315; /* Oranye/Merah untuk hapus */
}
button#clearData:hover {
    background-color: #bf360c;
    box-shadow: 0 4px 12px rgba(216, 67, 21, 0.3);
}

/* Style untuk Form Input */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
form div {
    display: flex;
    flex-direction: column;
}
form label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #004d40;
}
form input[type="text"], form input[type="number"] {
    padding: 12px;
    border: 1px solid #b2dfdb; /* Border hijau muda */
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
form input:focus {
    outline: none;
    border-color: #00897b;
    box-shadow: 0 0 0 3px rgba(0, 137, 123, 0.2);
}

/* === HORIZONTAL TREE STYLES === */
.tree {
    text-align: center;
    /* Aktifkan horizontal scrolling jika pohonnya lebar */
    overflow-x: auto;
    padding: 20px 0;
}

/* Sembunyikan bullet default */
.tree ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    position: relative;
    
    /* Mengatur anak (li) secara horizontal */
    display: flex;
    justify-content: center;
}

/* Garis vertikal dari <ul> ke <li> di bawahnya */
.tree ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 25px; /* Panjang garis */
    background-color: #90a4ae; /* Abu-abu netral */
}

.tree li {
    /* Mengatur <span> dan <ul> di dalam <li> secara vertikal */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 15px; /* Jarak antar saudara */
    margin-top: 45px; /* Ruang untuk garis dari atas */
}

/* Garis horizontal yang menghubungkan saudara (li) */
.tree li::before {
    content: '';
    position: absolute;
    top: -25px; /* Posisikan di atas, sejajar dgn ul::before */
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #90a4ae;
}

/* Garis vertikal dari garis horizontal ke <span> */
.tree li::after {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    width: 1px;
    height: 25px;
    background-color: #90a4ae;
}

/* Penyesuaian garis untuk anak pertama, terakhir, dan tunggal */
.tree li:first-child::before { left: 50%; width: 50%; }
.tree li:last-child::before { width: 50%; }
.tree li:only-child::before { display: none; } /* Tak perlu garis horizontal jika cuma 1 */
.tree li:only-child { margin-top: 25px; } /* Kurangi margin jika cuma 1 */


/* Penyesuaian untuk ROOT (paling atas) */
.tree > ul {
    padding-top: 0;
}
.tree > ul::before,
.tree > ul > li::after {
    display: none; /* Hilangkan garis di atas root */
}
.tree > ul > li {
    margin-top: 0; /* Root tidak perlu margin atas */
}


/* === KARTU NAMA (SPAN) === */
.tree li span {
    display: inline-block;
    padding: 15px 25px;
    border: 1px solid #b2dfdb; /* Border hijau muda */
    border-radius: 10px;
    background-image: linear-gradient(135deg, #e0f7fa 0%, #ffffff 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 150px;
    text-align: center;
    position: relative; /* Agar di atas garis */
    z-index: 1;
    font-weight: 600;
}

.tree li span .id-text {
    font-size: 0.8em;
    font-weight: 400;
    color: #00695c;
    display: block;
    margin-top: 5px;
}
/* === CSS BARU UNTUK PASANGAN === */

/* Pembungkus untuk 1 orang + pasangan */
.node-cluster {
    display: flex; /* Membuat orang & pasangan berdampingan */
    align-items: center;
    justify-content: center;
    position: relative;
}

/* * Kartu untuk pasangan. 
 * Kita salin SEMUA style dari .tree li span 
 * dan tambahkan beberapa penyesuaian.
*/
.partner-span {
    /* Salin style dari .tree li span */
    display: inline-block;
    padding: 15px 25px;
    border: 1px solid #b2dfdb;
    border-radius: 10px;
    background-image: linear-gradient(135deg, #e0f7fa 0%, #ffffff 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 150px;
    text-align: center;
    font-weight: 600;
    
    /* Penyesuaian khusus partner */
    margin-left: 20px; /* Jarak dari orang utama */
    position: relative; /* Untuk garis penghubung */
}

/* Garis penghubung horizontal antara pasangan */
.partner-span::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -20px; /* Mulai dari luar kotak */
    width: 20px; /* Panjang garis */
    height: 1px;
    background: #90a4ae;
    transform: translateY(-50%); /* Pusatkan garis secara vertikal */
}

/* Salin style untuk teks (ID: ...) */
.partner-span .id-text {
    font-size: 0.8em;
    font-weight: 400;
    color: #00695c;
    display: block;
    margin-top: 5px;
}