/* Family Tree Styles - Fixed Zoom Issues */
.family-tree-container {
    position: relative;
    overflow: hidden;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    min-height: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.tree-controls {
    position: sticky;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    align-self: flex-end;
}

.tree-controls button {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.tree-controls button:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

/* Tree Wrapper for Zoom */
.tree-wrapper {
    position: relative;
    overflow: auto;
    width: 100%;
    min-height: 500px;
    background: #f9f9f9;
    border-radius: 8px;
}

.zoom-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    transition: transform 0.3s ease;
    transform-origin: 0 0;
    display: inline-block;
}

/* Ensure tree content doesn't get cut off */
.family-tree {
    display: inline-block;
    min-width: 100%;
    padding: 20px;
}

/* Vertical Tree Layout - Fixed Generation Alignment */
.vertical-tree-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    min-width: max-content;
}

.generation-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    margin-bottom: 80px;
}

.generation-label {
    text-align: center;
    font-weight: bold;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 1.2rem;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: inline-block;
    border-radius: 30px;
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.generation-members {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 50px;
    flex-wrap: wrap;
    position: relative;
    width: 100%;
    padding: 20px 10px;
}

/* Family Unit - Fixed Positioning */
.family-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.couple-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.couple-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    position: relative;
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: max-content;
}

/* Default Avatar Styles */
.member-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #3498db;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.default-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 36px;
    font-weight: bold;
}

.default-avatar .initial {
    font-size: 36px;
    font-weight: bold;
    text-transform: uppercase;
}

.default-avatar.male {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.default-avatar.female {
    background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
}

/* Gender Icons */
.member-card.male {
    border-top: 4px solid #3498db;
}

.member-card.female {
    border-top: 4px solid #e91e63;
}

.gender-icon {
    position: absolute;
    top: -10px;
    right: -10px;
    background: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.male .gender-icon {
    color: #3498db;
    border: 2px solid #3498db;
}

.female .gender-icon {
    color: #e91e63;
    border: 2px solid #e91e63;
}

/* Member Card */
.member-card-link {
    text-decoration: none;
    display: block;
}

.member-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    min-width: 200px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    border: 2px solid transparent;
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.member-card.deceased {
    background: #f5f5f5;
    border: 1px solid #ddd;
    opacity: 0.8;
}

.member-name {
    font-size: 1.1rem;
    margin: 10px 0 5px;
    color: #2c3e50;
    font-weight: 600;
}

.member-age {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.member-dates {
    font-size: 0.7rem;
    color: #95a5a6;
    margin: 5px 0;
}

.view-profile-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s;
}

.member-card:hover .view-profile-link {
    color: #2980b9;
    text-decoration: underline;
}

/* Horizontal Line */
.horizontal-line {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #e74c3c, #f39c12);
    position: relative;
    margin: 0 10px;
}

.horizontal-line::before,
.horizontal-line::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #e74c3c;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.horizontal-line::before {
    left: -5px;
}

.horizontal-line::after {
    right: -5px;
}

.marriage-icon {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    background: white;
    padding: 2px 5px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Children Connection */
.children-connection {
    position: relative;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.vertical-line {
    width: 3px;
    height: 40px;
    background: linear-gradient(180deg, #95a5a6, #bdc3c7);
    margin: 0 auto;
    position: relative;
}

.children-wrapper {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
    position: relative;
    margin-top: 20px;
    padding-top: 25px;
}

.children-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #bdc3c7, #bdc3c7, transparent);
}

/* Generation Connector */
.generation-connector {
    position: relative;
    margin: 20px 0 30px;
    text-align: center;
}

.vertical-connector-line {
    width: 3px;
    height: 60px;
    background: linear-gradient(180deg, #bdc3c7, #95a5a6);
    margin: 0 auto;
}

.children-connector-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 4px 12px;
    font-size: 12px;
    color: #e74c3c;
    border-radius: 20px;
    white-space: nowrap;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Horizontal Tree Layout */
.horizontal-tree-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 30px 20px;
    min-height: 500px;
}

.generation-column {
    flex: 0 0 auto;
    min-width: 260px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vertical-label {
    text-align: center;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1rem;
}

.vertical-members {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.member-horizontal {
    width: 100%;
}

.spouse-badge {
    text-align: center;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #e74c3c;
    background: #fee;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .family-tree-container {
        padding: 15px;
    }
    
    .member-card {
        min-width: 150px;
        padding: 10px;
    }
    
    .member-avatar {
        width: 60px;
        height: 60px;
    }
    
    .default-avatar .initial {
        font-size: 28px;
    }
    
    .member-name {
        font-size: 0.9rem;
    }
    
    .couple-wrapper {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .horizontal-line {
        width: 3px;
        height: 40px;
        margin: 5px 0;
    }
    
    .horizontal-line::before,
    .horizontal-line::after {
        left: 50%;
        transform: translateX(-50%);
        top: auto;
    }
    
    .horizontal-line::before {
        top: -5px;
    }
    
    .horizontal-line::after {
        bottom: -5px;
        top: auto;
    }
    
    .marriage-icon {
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: -25px;
    }
    
    .generation-members {
        gap: 30px;
        padding: 15px 5px;
    }
    
    .children-wrapper {
        gap: 30px;
    }
    
    .tree-controls {
        position: relative;
        align-self: center;
        margin-bottom: 20px;
        top: 0;
        right: 0;
    }
    
    .generation-label {
        font-size: 1rem;
        padding: 6px 15px;
    }
    
    .horizontal-tree-layout {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    
    .generation-column {
        width: 100%;
        max-width: 300px;
    }
    
    .vertical-members {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.generation-row {
    animation: fadeInUp 0.5s ease-out;
}

/* Fix for left-most member being cut off */
.vertical-tree-layout,
.horizontal-tree-layout {
    min-width: max-content;
    width: 100%;
}

.generation-members {
    justify-content: center;
    min-width: max-content;
}

.tree-wrapper {
    overflow-x: auto;
    overflow-y: visible;
}
/* Tree Level Structure */
.tree-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-bottom: 40px;
}

.level-members {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.level-children {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.children-container {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
    position: relative;
    padding-top: 20px;
}

.children-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #bdc3c7;
}

/* Classic Tree Styles */
.classic-tree-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.classic-children {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    position: relative;
}

.classic-children-wrapper {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
    margin-top: 20px;
    position: relative;
}

.classic-children-wrapper::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #bdc3c7;
}