/**
 * Enhanced Genealogy Tree Styles
 * Modern UI/UX with Orange Theme
 */

/* ============================================
   SECTION HEADER
   ============================================ */
.genealogy-section-header {
    padding: 40px 20px;
    background: linear-gradient(135deg, #fff5e6 0%, #ffffff 100%);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.1);
}

.genealogy-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ff9800;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.genealogy-title i {
    margin-right: 15px;
    color: #f57c00;
}

.genealogy-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
    font-weight: 500;
}

.genealogy-hint {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #ff9800;
    color: white;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    animation: pulse-hint 2s ease-in-out infinite;
}

.genealogy-hint i {
    font-size: 1.2rem;
    animation: point-animation 1.5s ease-in-out infinite;
}

@keyframes pulse-hint {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
    }
}

@keyframes point-animation {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* ============================================
   TREE NODE ENHANCEMENTS
   ============================================ */
.genealogy-tree li a {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.genealogy-tree li a:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.3);
}

/* Clickable nodes with children */
.genealogy-tree li a.has-children {
    border: 3px solid #ff9800;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.2);
}

.genealogy-tree li a.has-children:hover {
    border-color: #f57c00;
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

/* Expand indicator */
.expand-indicator {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.4);
    z-index: 100;
    transition: all 0.3s ease;
    animation: bounce-indicator 2s ease-in-out infinite;
    pointer-events: none; /* Prevent interference with click events */
}

/* Ensure parent <a> tag maintains position */
.genealogy-tree li a.has-children {
    position: relative;
    display: inline-block;
}

/* Keep indicators attached to their cards */
.genealogy-tree li a {
    position: relative;
    z-index: 1;
}

/* Only show indicators for nodes in visible branches */
.genealogy-tree .expand-indicator {
    display: none; /* Hide all by default */
}

/* Show indicators for root level */
.genealogy-tree > ul > li > a > .expand-indicator {
    display: flex;
}

/* Show indicators for expanded branches */
.genealogy-tree ul.active > li > a > .expand-indicator {
    display: flex;
}

.genealogy-tree li a.has-children:hover .expand-indicator {
    background: #f57c00;
    transform: translateX(-50%) scale(1.2);
}

@keyframes bounce-indicator {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Active/expanded state */
.genealogy-tree li a.has-children.expanded .expand-indicator i {
    transform: rotate(180deg);
}

/* ============================================
   TREE CONNECTIONS - Orange Theme
   ============================================ */
.genealogy-tree li::before,
.genealogy-tree li::after {
    border-color: #ff9800 !important;
}

.genealogy-tree ul ul::before {
    border-color: #ff9800 !important;
}

.genealogy-tree li a:hover + ul li::after,
.genealogy-tree li a:hover + ul li::before,
.genealogy-tree li a:hover + ul::before,
.genealogy-tree li a:hover + ul ul::before {
    border-color: #f57c00 !important;
}

/* ============================================
   MEMBER CARDS - Orange Theme
   ============================================ */
.member-view-box {
    transition: all 0.3s ease;
}

.member-view-box:hover {
    transform: scale(1.05);
}

.genealogy-tree li a.has-children .member-view-box {
    border: 2px solid #ff9800;
    background: linear-gradient(135deg, #fff5e6 0%, #ffffff 100%);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .genealogy-title {
        font-size: 1.8rem;
    }

    .genealogy-subtitle {
        font-size: 1rem;
    }

    .genealogy-hint {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .expand-indicator {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
}

/* ============================================
   RTL SUPPORT
   ============================================ */
[dir="rtl"] .genealogy-title i {
    margin-right: 0;
    margin-left: 15px;
}

[dir="rtl"] .genealogy-hint {
    flex-direction: row-reverse;
}

/* ============================================
   LOADING ANIMATION
   ============================================ */
.genealogy-tree li {
    animation: fadeInUp 0.6s ease-out backwards;
}

.genealogy-tree li:nth-child(1) { animation-delay: 0.1s; }
.genealogy-tree li:nth-child(2) { animation-delay: 0.2s; }
.genealogy-tree li:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLL ENHANCEMENTS
   ============================================ */
.genealogy-scroll {
    scroll-behavior: smooth;
}

.genealogy-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.genealogy-scroll::-webkit-scrollbar-track {
    background: #fff5e6;
    border-radius: 10px;
}

.genealogy-scroll::-webkit-scrollbar-thumb {
    background: #ff9800;
    border-radius: 10px;
    transition: 0.3s;
}

.genealogy-scroll::-webkit-scrollbar-thumb:hover {
    background: #f57c00;
}

/* ============================================
   PULSE ANIMATION FOR CLICKABLE NODES
   ============================================ */
.genealogy-tree a.has-children.pulse-once {
    animation: pulse-node 1s ease-out;
}

@keyframes pulse-node {
    0% {
        box-shadow: 0 4px 15px rgba(255, 152, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 152, 0, 0),
                    0 0 0 20px rgba(255, 152, 0, 0);
    }
    100% {
        box-shadow: 0 4px 15px rgba(255, 152, 0, 0.2);
    }
}

