﻿/* ============================================
   KINTREE — PREMIUM TREE DESIGN
   ============================================ */

/* ---- CONTAINER ---- */
.tree-container {
    width: 100%;
    overflow-x: auto;
    padding: 48px 32px;
    background: linear-gradient(135deg, #f4f3f0 0%, #eceae5 100%);
    min-height: 80vh;
    display: flex;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

    /* Subtle grid background */
    .tree-container::before {
        content: '';
        position: fixed;
        inset: 0;
        background-image: radial-gradient(circle, rgba(201,168,76,0.06) 1px, transparent 1px);
        background-size: 32px 32px;
        pointer-events: none;
    }

/* ---- TREE STRUCTURE ---- */
.tree ul {
    padding-top: 24px;
    position: relative;
    display: flex;
    justify-content: center;
    transition: all 0.4s ease;
}

.tree li {
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 24px 8px 0;
    transition: all 0.4s ease;
    flex: 1 1 auto;
}

    /* ---- CONNECTOR LINES ---- */
    .tree li::before,
    .tree li::after {
        content: '';
        position: absolute;
        top: 0;
        right: 50%;
        border-top: 2px solid #c9a84c40;
        width: 50%;
        height: 24px;
    }

    .tree li::after {
        right: auto;
        left: 50%;
        border-left: 2px solid #c9a84c40;
    }

    .tree li:only-child::after,
    .tree li:only-child::before {
        display: none;
    }

    .tree li:only-child {
        padding-top: 0;
    }

    .tree li:first-child::before,
    .tree li:last-child::after {
        border: 0 none;
    }

    .tree li:last-child::before {
        border-right: 2px solid #c9a84c40;
        border-radius: 0 6px 0 0;
    }

    .tree li:first-child::after {
        border-radius: 6px 0 0 0;
    }

.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #c9a84c40;
    width: 0;
    height: 24px;
}

/* ---- TREE NODE CARD ---- */
.tree-node {
    background: #ffffff;
    border: 1.5px solid #e8e5de;
    border-radius: 16px;
    padding: 14px 20px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    min-width: 80px;
    position: relative;
    z-index: 10;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06), 0 0 0 0 transparent;
    cursor: pointer;
}

    .tree-node:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.12);
        border-color: var(--kt-gold, #c9a84c);
        z-index: 20;
    }

    /* ---- CURRENT / FOCUS NODE ---- */
    .tree-node.is-current {
        border-color: var(--kt-gold, #c9a84c) !important;
        background: linear-gradient(135deg, #fffbf0 0%, #fff8e1 100%);
        box-shadow: 0 0 0 3px rgba(201,168,76,0.2), 0 8px 24px rgba(201,168,76,0.18) !important;
        transform: scale(1.04);
        z-index: 30;
    }

/* ---- DECEASED NODE ---- */
.deceased-node {
    filter: grayscale(60%);
    opacity: 0.82;
}

.deceased-icon {
    color: #9ca3af;
    font-weight: 700;
    margin-left: 3px;
    font-size: 0.85rem;
}

/* ---- MEMBER UNIT (avatar + name) ---- */
.member-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
}

    .member-unit img {
        width: 56px;
        height: 56px;
        object-fit: cover;
        border-radius: 50%;
        border: 2px solid #f0ede6;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        transition: border-color 0.2s;
    }

.tree-node:hover .member-unit img {
    border-color: var(--kt-gold, #c9a84c);
}

.tree-node.is-current .member-unit img {
    border-color: var(--kt-gold, #c9a84c);
}

/* Avatar placeholder */
.member-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8e5de, #d5d2cb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #8b8580;
    border: 2px solid #f0ede6;
    letter-spacing: 0.03em;
}

.tree-node.is-current .member-avatar-placeholder {
    border-color: var(--kt-gold, #c9a84c);
}

/* ---- NAMES ---- */
.name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 5px;
    white-space: nowrap;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.tree-node.is-current .name {
    color: #92620a;
}

.member-years-small {
    font-size: 0.65rem;
    color: #94a3b8;
    display: block;
    margin-top: 2px;
    font-weight: 400;
}

/* ---- SPOUSE DIVIDER ---- */
.spouse-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    flex-shrink: 0;
}

    .spouse-divider i {
        color: #f87171;
        font-size: 0.75rem;
    }

/* ---- TREE ACTIONS (export button) ---- */
.tree-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .tree-container {
        padding: 24px 12px;
    }

    .tree-node {
        width: max-content;
        min-width: 60px;
        padding: 10px 14px;
        gap: 8px;
        border-radius: 12px;
    }

    .member-unit img,
    .member-avatar-placeholder {
        width: 44px;
        height: 44px;
        font-size: 0.95rem;
    }

    .name {
        font-size: 0.72rem;
    }
}

.no-click {
    pointer-events: none !important;
    cursor: default !important;
}

/* ---- SHIFT FOR SPOUSES (Centering blood line) ---- */
.spouse-on-right {
    margin-left: 116px;
}

.spouse-on-left {
    margin-right: 116px;
}

/* Novo: klizanje linije za decu ka centru srca */
.shift-children-right {
    transform: translateX(58px);
}

.shift-children-left {
    transform: translateX(-58px);
}

@media (max-width: 768px) {
    .spouse-on-right {
        margin-left: 88px;
    }

    .spouse-on-left {
        margin-right: 88px;
    }

    .shift-children-right {
        transform: translateX(44px);
    }

    .shift-children-left {
        transform: translateX(-44px);
    }
}