/**
 * Плоское генеалогическое древо - красивая вертикальная структура
 */

.family-page {
    background: var(--bg-primary);
}

.family-tree-section {
    padding: 40px 0 180px;
}

/* Легенда */
.tree-legend {
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.legend-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-icon svg {
    width: 20px;
    height: 20px;
}

.legend-icon.male {
    border-color: #4ECDC4;
    background: rgba(78, 205, 196, 0.15);
    color: #4ECDC4;
}

.legend-icon.female {
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.15);
    color: #FF6B6B;
}

.legend-icon.main {
    border-color: var(--accent-primary);
    background: rgba(78, 205, 196, 0.25);
    color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.4);
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 2px dashed var(--border-color);
}

.empty-state p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: 15px 0;
}

/* Контейнер древа */
.tree-flat-container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
}

/* Поколение */
.generation-level {
    margin-bottom: 60px;
    position: relative;
    animation: fadeInUp 0.6s ease both;
}

.generation-level:nth-child(1) { animation-delay: 0.1s; }
.generation-level:nth-child(2) { animation-delay: 0.2s; }
.generation-level:nth-child(3) { animation-delay: 0.3s; }
.generation-level:nth-child(4) { animation-delay: 0.4s; }
.generation-level:nth-child(5) { animation-delay: 0.5s; }
.generation-level:nth-child(6) { animation-delay: 0.6s; }
.generation-level:nth-child(7) { animation-delay: 0.7s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Заголовок поколения */
.generation-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.generation-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-tertiary));
    border-radius: 2px;
}

/* Ряд людей */
.generation-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    position: relative;
}

/* Связь с предыдущим поколением */
.generation-level::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background: linear-gradient(180deg, var(--accent-primary), transparent);
}

.generation-level:first-child::before {
    display: none;
}

/* Карточка человека */
.person-card {
    width: 180px;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.person-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 20px 20px 0 0;
    transition: all 0.3s ease;
}

.person-card.male::before {
    background: linear-gradient(90deg, #4ECDC4, #45B7D1);
}

.person-card.female::before {
    background: linear-gradient(90deg, #FF6B6B, #ff5252);
}

.person-card.main-person {
    border-width: 3px;
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(78, 205, 196, 0.05));
    box-shadow: 0 0 40px rgba(78, 205, 196, 0.3);
}

.person-card.main-person::before {
    height: 5px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-tertiary), var(--accent-primary));
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.person-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-primary);
}

.person-card.main-person:hover {
    box-shadow: 0 0 50px rgba(78, 205, 196, 0.5), 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Фото */
.person-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    border: 3px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.person-card.male .person-photo {
    border-color: #4ECDC4;
}

.person-card.female .person-photo {
    border-color: #FF6B6B;
}

.person-card.main-person .person-photo {
    border-width: 4px;
    border-color: var(--accent-primary);
    box-shadow: 0 0 25px rgba(78, 205, 196, 0.5), 0 6px 20px rgba(0, 0, 0, 0.4);
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 25px rgba(78, 205, 196, 0.5), 0 6px 20px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 35px rgba(78, 205, 196, 0.8), 0 6px 20px rgba(0, 0, 0, 0.4);
    }
}

.person-card:hover .person-photo {
    transform: scale(1.1);
}

.person-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.photo-placeholder svg {
    width: 50%;
    height: 50%;
}

.person-card:hover .photo-placeholder {
    opacity: 1;
}

.person-card:hover .photo-placeholder svg {
    transform: scale(1.1);
}

.person-card.male .photo-placeholder {
    color: #4ECDC4;
}

.person-card.female .photo-placeholder {
    color: #FF6B6B;
}

.person-card.main-person .photo-placeholder {
    color: var(--accent-primary);
}

/* Информация */
.person-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.person-card.main-person .person-name {
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.person-dates {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.person-relation {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.person-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: #000000;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 10px;
}

/* Связи между поколениями (декоративные линии) */
.generation-connector {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 60px;
    background: linear-gradient(180deg, var(--accent-primary), var(--border-color));
}

/* Адаптивность */
@media (max-width: 1024px) {
    .generation-row {
        gap: 30px;
    }
    
    .person-card {
        width: 160px;
        padding: 20px;
    }
    
    .person-photo {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 768px) {
    .family-tree-section {
        padding: 30px 0 160px;
    }
    
    .tree-legend {
        padding: 15px 20px;
        gap: 20px;
    }
    
    .legend-item {
        font-size: 0.9rem;
    }
    
    .legend-icon {
        width: 35px;
        height: 35px;
    }
    
    .legend-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .generation-level {
        margin-bottom: 50px;
    }
    
    .generation-title {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .generation-row {
        gap: 20px;
    }
    
    .person-card {
        width: 140px;
        padding: 18px;
    }
    
    .person-photo {
        width: 80px;
        height: 80px;
    }
    
    .photo-placeholder svg {
        width: 40px;
        height: 40px;
    }
    
    .person-name {
        font-size: 0.95rem;
    }
    
    .person-dates {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .tree-legend {
        flex-direction: column;
        gap: 12px;
    }
    
    .legend-item {
        width: 100%;
        justify-content: center;
    }
    
    .generation-title {
        font-size: 1.3rem;
    }
    
    .generation-row {
        gap: 15px;
    }
    
    .person-card {
        width: 130px;
        padding: 15px;
    }
    
    .person-photo {
        width: 70px;
        height: 70px;
        border-width: 2px;
    }
    
    .photo-placeholder svg {
        width: 35px;
        height: 35px;
    }
    
    .person-name {
        font-size: 0.9rem;
    }
    
    .person-dates {
        font-size: 0.75rem;
    }
}

@media (max-width: 320px) {
    .generation-row {
        gap: 12px;
    }
    
    .person-card {
        width: 120px;
        padding: 12px;
    }
    
    .person-photo {
        width: 60px;
        height: 60px;
    }
    
    .photo-placeholder svg {
        width: 30px;
        height: 30px;
    }
    
    .person-name {
        font-size: 0.85rem;
    }
}

/* Большие экраны */
@media (min-width: 2000px) {
    .tree-flat-container {
        max-width: 2000px;
    }
    
    .generation-title {
        font-size: 2.2rem;
    }
    
    .generation-row {
        gap: 50px;
    }
    
    .person-card {
        width: 220px;
        padding: 30px;
    }
    
    .person-photo {
        width: 130px;
        height: 130px;
    }
    
    .photo-placeholder svg {
        width: 70px;
        height: 70px;
    }
    
    .person-name {
        font-size: 1.2rem;
    }
    
    .person-dates {
        font-size: 1rem;
    }
}

@media (min-width: 3000px) {
    .tree-flat-container {
        max-width: 2600px;
    }
    
    .generation-row {
        gap: 60px;
    }
    
    .person-card {
        width: 260px;
        padding: 35px;
    }
    
    .person-photo {
        width: 150px;
        height: 150px;
    }
    
    .person-name {
        font-size: 1.4rem;
    }
}

@media (min-width: 5000px) {
    .tree-flat-container {
        max-width: 3500px;
    }
    
    .generation-row {
        gap: 80px;
    }
    
    .person-card {
        width: 300px;
        padding: 40px;
    }
    
    .person-photo {
        width: 180px;
        height: 180px;
        border-width: 5px;
    }
    
    .photo-placeholder svg {
        width: 90px;
        height: 90px;
    }
    
    .person-name {
        font-size: 1.6rem;
    }
    
    .person-dates {
        font-size: 1.2rem;
    }
}

