/* =========================================
   GOOGLE FONT
========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');


/* =========================================
   RESET
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Inter", sans-serif;
    background: #f7f9f7;
    color: #1d2b24;
    line-height: 1.6;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}


/* =========================================
   VARIABLES
========================================= */
:root {
    --primary: #2f6b4f;
    --primary-dark: #24553e;
    --primary-light: #e8f3ed;

    --heading: #17251e;
    --text: #66736c;
    --white: #ffffff;

    --border: #dfe6e1;
    --background: #f7f9f7;

    --danger: #d9534f;

    --radius: 14px;
    --shadow: 0 8px 30px rgba(24, 50, 37, 0.08);
}


/* =========================================
   GLOBAL
========================================= */
.container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

section {
    padding: 90px 0;
}

h1,
h2,
h3 {
    color: var(--heading);
    line-height: 1.2;
}

.section-label {
    display: inline-block;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 36px;
}


/* =========================================
   BUTTONS
========================================= */
.btn {
    border: 0;
    padding: 13px 22px;
    border-radius: 10px;
    font-weight: 600;
    transition: 0.25s ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #edf1ee;
    color: var(--heading);
}

.btn-secondary:hover {
    background: #dfe6e1;
}


/* =========================================
   HEADER
========================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.navbar {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo {
    color: var(--primary);
    font-size: 24px;
    font-weight: 800;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 35px;
}

.nav-links a {
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}


/* =========================================
   HERO
========================================= */
.hero {
    min-height: 650px;
    display: flex;
    align-items: center;
    background:
        radial-gradient(circle at 80% 30%, #dceee3 0%, transparent 30%),
        linear-gradient(135deg, #f7faf8, #edf5f0);
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 70px;
}

.hero-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 30px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-content h1 {
    max-width: 650px;
    font-size: clamp(42px, 5vw, 68px);
    margin-bottom: 22px;
}

.hero-content p {
    max-width: 560px;
    color: var(--text);
    font-size: 18px;
    margin-bottom: 30px;
}

.hero-image {
    display: flex;
    justify-content: center;
}

.hero-placeholder {
    width: 100%;
    max-width: 500px;
    min-height: 400px;
    border-radius: 30px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
}


/* =========================================
   FAMILY STATS
========================================= */
.family-stats {
    padding: 0;
    position: relative;
    margin-top: -45px;
    z-index: 5;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stat-card {
    text-align: center;
    padding: 30px 20px;
    border-right: 1px solid var(--border);
}

.stat-card:last-child {
    border-right: none;
}

.stat-card h3 {
    color: var(--primary);
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-card p {
    color: var(--text);
    font-size: 14px;
}


/* =========================================
   FAMILY TREE
========================================= */
.family-tree-section {
    padding-top: 130px;
}

.tree-actions {
    display: flex;
    gap: 12px;
}

.tree-actions input,
.member-filters input,
.member-filters select {
    height: 46px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 10px;
    padding: 0 15px;
    outline: none;
    color: var(--heading);
}

.tree-actions input {
    width: 260px;
}

.tree-actions input:focus,
.member-filters input:focus,
.member-filters select:focus {
    border-color: var(--primary);
}

.tree-wrapper {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 45px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tree-generation {
    position: relative;
    margin-bottom: 65px;
}

.tree-generation:last-child {
    margin-bottom: 0;
}

.generation-title {
    color: var(--text);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 25px;
}

.generation-members {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    min-height: 80px;
}


/* =========================================
   DYNAMIC TREE MEMBER CARD
========================================= */
.tree-member {
    width: 180px;
    padding: 20px;
    text-align: center;
    background: #fbfcfb;
    border: 1px solid var(--border);
    border-radius: 15px;
    transition: 0.25s;
    position: relative;
}

.tree-member:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.tree-member img {
    width: 65px;
    height: 65px;
    margin: 0 auto 12px;
    border-radius: 50%;
    object-fit: cover;
}

.tree-member h4 {
    font-size: 15px;
    color: var(--heading);
    margin-bottom: 4px;
}

.tree-member span {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}


/* =========================================
   FAMILY MEMBERS
========================================= */
.family-members-section {
    background: #eef3ef;
}

.member-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.member-filters input {
    flex: 1;
}

.member-filters select {
    width: 220px;
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}


/* =========================================
   DYNAMIC MEMBER CARD
========================================= */
.member-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: 0 4px 18px rgba(20, 45, 30, 0.04);
    transition: 0.25s;
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.member-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.member-card img {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-light);
}

.member-card h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.relationship {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
}

.member-meta {
    color: var(--text);
    font-size: 14px;
    margin-bottom: 20px;
}

.member-card-actions {
    display: flex;
    gap: 8px;
}

.member-card-actions button {
    flex: 1;
    padding: 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 13px;
}

.member-card-actions button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.member-card-actions .delete-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}


/* =========================================
   EMPTY MEMBERS
========================================= */
.empty-members-message {
    grid-column: 1 / -1;
    padding: 70px 20px;
    text-align: center;
    background: var(--white);
    border: 1px dashed #bdc9c1;
    border-radius: 16px;
}

.empty-members-message h3 {
    font-size: 22px;
    margin-bottom: 8px;
}

.empty-members-message p {
    color: var(--text);
    margin-bottom: 20px;
}


/* =========================================
   MODAL
========================================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 20, 15, 0.6);
    backdrop-filter: blur(3px);
}

.modal-content {
    width: min(580px, 100%);
    max-height: 90vh;
    overflow-y: auto;

    position: relative;
    z-index: 2;

    background: var(--white);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 20px;

    width: 36px;
    height: 36px;

    border: 0;
    border-radius: 50%;

    background: #eef2ef;
    color: var(--heading);

    font-size: 24px;
    line-height: 1;
}

.modal-header {
    margin-bottom: 28px;
}

.modal-header h2 {
    font-size: 28px;
    margin-bottom: 6px;
}

.modal-header p {
    color: var(--text);
}


/* =========================================
   FORM
========================================= */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    color: var(--heading);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 7px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px 14px;
    background: var(--white);
    color: var(--heading);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
}


/* =========================================
   MEMBER DETAILS MODAL
========================================= */
.details-profile {
    text-align: center;
    padding: 15px 0 30px;
    border-bottom: 1px solid var(--border);
}

.details-image img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto 15px;
    background: var(--primary-light);
}

.details-profile h2 {
    font-size: 25px;
    margin-bottom: 5px;
}

.details-profile span {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
}

.details-information {
    padding-top: 25px;
}

.detail-item {
    margin-bottom: 18px;
}

.detail-item strong {
    display: block;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 4px;
}

.detail-item span,
.detail-item p {
    color: var(--heading);
}


/* =========================================
   FOOTER
========================================= */
.site-footer {
    background: #17251e;
    color: #c6d0ca;
}

.footer-container {
    padding: 60px 0;
    display: flex;
    justify-content: space-between;
    gap: 50px;
}

.footer-brand {
    max-width: 430px;
}

.footer-brand .logo {
    display: inline-block;
    color: var(--white);
    margin-bottom: 12px;
}

.footer-brand p {
    font-size: 14px;
}

.footer-links {
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.footer-links a {
    transition: 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
}


/* =========================================
   RESPONSIVE - TABLET
========================================= */
@media (max-width: 900px) {

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content p {
        margin-left: auto;
        margin-right: auto;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card:nth-child(2) {
        border-right: none;
    }

    .stat-card:nth-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }

    .members-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .tree-actions {
        width: 100%;
    }

    .tree-actions input {
        flex: 1;
        width: auto;
    }
}


/* =========================================
   RESPONSIVE - MOBILE
========================================= */
@media (max-width: 650px) {

    .container {
        width: min(100% - 28px, 1180px);
    }

    section {
        padding: 65px 0;
    }

    .navbar {
        min-height: 65px;
    }

    .nav-links {
        display: none;
    }

    .navbar .btn {
        padding: 10px 13px;
        font-size: 12px;
    }

    .hero {
        min-height: auto;
        padding: 80px 0 110px;
    }

    .hero-container {
        gap: 45px;
    }

    .hero-content h1 {
        font-size: 40px;
    }

    .hero-content p {
        font-size: 16px;
    }

    .hero-placeholder {
        min-height: 280px;
    }

    .family-stats {
        margin-top: -50px;
    }

    .stats-container {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 22px 10px;
    }

    .stat-card h3 {
        font-size: 25px;
    }

    .family-tree-section {
        padding-top: 100px;
    }

    .section-header h2 {
        font-size: 30px;
    }

    .tree-actions {
        flex-direction: column;
    }

    .tree-actions input {
        width: 100%;
    }

    .tree-wrapper {
        padding: 25px 15px;
    }

    .member-filters {
        flex-direction: column;
    }

    .member-filters select {
        width: 100%;
    }

    .members-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 30px 20px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .footer-container {
        flex-direction: column;
        padding: 45px 0;
    }

    .footer-links {
        flex-wrap: wrap;
    }
}








/* =========================================
   CONNECTED FAMILY TREE
========================================= */

.tree-wrapper {
    position: relative;
    padding: 55px 35px;
}

/* Each generation */

.tree-generation {
    position: relative;
    margin-bottom: 90px;
}

.tree-generation:last-child {
    margin-bottom: 0;
}


/* Generation members */

.generation-members {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 35px;
}


/* =========================================
   VERTICAL GENERATION CONNECTION
========================================= */

.tree-generation:not(:last-child)::after {
    content: "";
    position: absolute;

    width: 2px;
    height: 55px;

    background: #b8c9bf;

    left: 50%;
    bottom: -72px;

    transform: translateX(-50%);
}


/* =========================================
   HORIZONTAL CONNECTION LINE
========================================= */

.generation-members::before {
    content: "";
    position: absolute;

    height: 2px;

    background: #b8c9bf;

    top: -16px;

    left: 15%;
    right: 15%;
}


/* Don't show horizontal line
   when generation is empty */

.generation-members:has(p)::before {
    display: none;
}


/* =========================================
   TREE MEMBER
========================================= */

.tree-member {
    position: relative;

    width: 190px;

    padding: 22px 15px;

    background: #ffffff;

    border: 1px solid #dfe6e1;

    border-radius: 16px;

    text-align: center;

    cursor: pointer;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;

    z-index: 2;
}


/* Line from horizontal connector
   to member */

.tree-member::before {
    content: "";

    position: absolute;

    width: 2px;
    height: 17px;

    background: #b8c9bf;

    top: -17px;

    left: 50%;

    transform: translateX(-50%);
}


.tree-member:hover {
    transform: translateY(-6px);

    border-color: var(--primary);

    box-shadow:
        0 12px 35px
        rgba(35, 80, 55, 0.12);
}


/* =========================================
   PROFILE IMAGE
========================================= */

.tree-member img {
    width: 72px;
    height: 72px;

    border-radius: 50%;

    object-fit: cover;

    margin: 0 auto 13px;

    border: 4px solid #e8f3ed;
}


/* =========================================
   NAME
========================================= */

.tree-member h4 {
    font-size: 15px;

    color: var(--heading);

    margin-bottom: 5px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* =========================================
   RELATIONSHIP BADGE
========================================= */

.tree-member span {
    display: inline-block;

    padding: 4px 10px;

    background: var(--primary-light);

    color: var(--primary);

    border-radius: 20px;

    font-size: 11px;

    font-weight: 600;
}


/* =========================================
   GENERATION TITLE
========================================= */

.generation-title {
    position: relative;

    width: fit-content;

    margin: 0 auto 40px;

    padding: 7px 14px;

    background: #edf5f0;

    color: var(--primary);

    border-radius: 20px;

    font-size: 11px;

    font-weight: 700;

    letter-spacing: 1px;

    text-transform: uppercase;

    z-index: 3;
}


/* =========================================
   TREE SEARCH RESULT
========================================= */

.tree-member.tree-highlight {
    border: 2px solid var(--primary);

    box-shadow:
        0 0 0 5px
        rgba(47, 107, 79, 0.10);
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 650px) {

    .tree-wrapper {
        padding: 40px 15px;
        overflow-x: auto;
    }

    .generation-members {
        min-width: max-content;
        gap: 20px;
        padding: 0 20px;
    }

    .tree-member {
        width: 155px;
    }

    .tree-member img {
        width: 60px;
        height: 60px;
    }

}