/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: visible;
}

a {
    text-decoration: none;
    color: #0066cc;
}

a:hover {
    text-decoration: underline;
}

/* Header Styles */
header {
    background-color: #fff;
    padding: 30px 0 20px;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
}

.navigation-menu {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.nav-item {
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #555;
    text-decoration: none;
}

.nav-item:hover {
    background-color: #f0f5ff;
    color: #0066cc;
    text-decoration: none;
}

.nav-item.active {
    background-color: #0066cc;
    color: white;
}

.author-info {
    margin-bottom: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 30px;
    text-align: left;
}

.avatar-container {
    width: 120px;
    height: 120px;
    min-width: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #f0f5ff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.author-text-content {
    display: flex;
    flex-direction: column;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-title {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f0f5ff;
    color: #0066cc;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.social-btn:hover {
    background-color: #0066cc;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    text-decoration: none;
}

.social-tooltip {
    position: relative;
}

.social-tooltip .tooltip-text {
    visibility: hidden;
    width: auto;
    white-space: nowrap;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
}

.social-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.social-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Content Styles */
.content {
    padding: 60px 0;
    overflow-x: visible;
    width: 100%;
}

.back-link {
    display: inline-block;
    margin-bottom: 30px;
    color: #0066cc;
}

.back-link i {
    margin-right: 5px;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
    color: #333;
}

/* Family Tree Styles */
.family-tree-container {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
    position: relative;
}

.tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: max-content;
    width: max-content;
    padding: 0 40px;
    margin: 0 auto;
}

.generation {
    margin-bottom: 60px;
    text-align: center;
    width: 100%;
    min-width: max-content;
    padding: 0 40px;
}

.generation-title {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4rem;
}

.generation-members {
    display: flex;
    flex-direction: row !important;
    justify-content: center;
    flex-wrap: nowrap !important;
    gap: 40px;
    min-width: max-content;
    padding: 20px 0;
}

.branch-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.branch-title {
    width: 100%;
    text-align: center;
    color: #666;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #ccc;
    font-size: 0.9rem;
    font-style: italic;
}

.person {
    width: 180px;
    min-width: 180px;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
    position: relative;
    z-index: 3;
    padding: 15px;
    transform: translateZ(0);
    will-change: transform;
}

.person.male {
    border-left: 4px solid #0066cc;
}

.person.female {
    border-left: 4px solid #e91e63;
}

.person-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 10px;
    border: 3px solid #f0f5ff;
}

.person-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.person-dates {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 10px;
}

.view-details {
    display: inline-block;
    padding: 5px 10px;
    background-color: #f0f5ff;
    color: #0066cc;
    border-radius: 15px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.view-details:hover {
    background-color: #0066cc;
    color: white;
    text-decoration: none;
}

/* Styles cho người đã hiển thị (reference) */
.person-reference {
    width: 150px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 10px;
    text-align: center;
    position: relative;
    margin: 5px;
    border: 2px dashed #ccc;
    z-index: 2;
}

.person-reference.male {
    border-left: 4px solid #0066cc;
}

.person-reference.female {
    border-left: 4px solid #e91e63;
}

.person-ref-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.person-ref-note {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-bottom: 5px;
}

.view-original {
    display: inline-block;
    padding: 3px 8px;
    background-color: #f0f5ff;
    color: #0066cc;
    border-radius: 12px;
    font-size: 0.8rem;
    text-decoration: none;
}

.view-original:hover {
    background-color: #0066cc;
    color: white;
}

/* Connector Styles */
.connector-container, .spouse-connector-line {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.connector-line {
    position: absolute;
}

.spouse-connector {
    width: 30px;
    height: 2px;
    background-color: #ff9800;
    margin-top: 60px;
    position: relative;
    display: inline-block;
}

.spouse-connector::before,
.spouse-connector::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ff9800;
    top: -2px;
}

.spouse-connector::before {
    left: -3px;
}

.spouse-connector::after {
    right: -3px;
}

/* Person Details Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 600px;
    position: relative;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.person-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.person-detail-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.person-detail-info {
    flex-grow: 1;
}

.person-detail-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.person-detail-dates {
    color: #666;
    margin-bottom: 5px;
}

.person-detail-section {
    margin-bottom: 20px;
}

.person-detail-section h3 {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f0f0;
}

.relation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.relation-item {
    background-color: #f5f5f5;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 102, 204, 0.3);
    border-radius: 50%;
    border-top-color: #0066cc;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 0;
    color: #666;
}

.empty-state i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #555;
}

/* Footer */
footer {
    background-color: #333;
    color: #fff;
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Style cho kết nối kiểu mindmap */
.family-connector {
    position: absolute;
    background-color: #0066cc;
    z-index: 2;
}

/* Thêm style cho SVG container */
.svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    transform: translateZ(0);
}

/* Thêm chỉ dẫn cuộn và zoom */
.zoom-instructions {
    text-align: center;
    margin: 10px 0 20px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    font-style: italic;
    color: #555;
}

/* Zoom controls */
.zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 90;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 1.2rem;
    color: #0066cc;
    border: none;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background-color: #f0f5ff;
    transform: translateY(-2px);
}

/* Điều chỉnh để hoạt động tốt trên thiết bị di động */
@media (max-width: 768px) {
    .branch-container {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .spouse-connector {
        width: 30px !important;
        height: 2px !important;
        margin-top: 60px !important;
    }

    .author-info {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .navigation-menu {
        flex-wrap: wrap;
        gap: 10px;
    }

    .person {
        width: 180px;
        min-width: 180px;
        font-size: 0.9rem;
    }
    
    .generation-members {
        padding-bottom: 40px;
    }
    
    .family-tree-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .tree {
        padding: 0 20px;
    }
    
    .zoom-instructions {
        display: block;
    }

    .zoom-controls {
        bottom: 10px;
        right: 10px;
    }
}

/* Thêm style mới để chỉ dẫn người dùng cuộn ngang */
.scroll-indicator {
    display: none;
    text-align: center;
    padding: 10px;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .scroll-indicator {
        display: block;
    }
}
