
/* Đảm bảo toàn bộ trang không bị cuộn ngang dọc ngoài ý muốn */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
}
/* Header và Menu */
.header-section {
    position: relative;
    z-index: 1000;
    background: white;
}

/* Vùng chứa cây phả hệ */
#tree-container { 
    width: 100%; 
    height: calc(100vh - 130px); 
    background-color: #fcfcfc;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center; 
}

.link {    fill: none;    stroke: #81d4fa;    stroke-width: 2px;}

.node image {    clip-path: circle(25px at center);}

.node image:hover {    filter: brightness(1.2);    transition: 0.3s;}

.node text { font: 13px "Segoe UI", Tahoma, sans-serif; font-weight: 500; }

.node-avatar {    stroke: #1565c0;    stroke-width: 2px;    fill: #fff;}

.member-code {    font-size: 10px;    fill: #e67e22;    font-weight: bold;}

.member-name {    font-size: 13px;    font-weight: bold;    fill: #2c3e50;}
/* Hiệu ứng nổi bật cho node được tìm thấy */
.search-match {
    stroke: #ffeb3b !important;
    stroke-width: 6px !important;
    transition: 0.5s;
    filter: drop-shadow(0 0 10px rgba(255, 235, 59, 0.8));
}
.node circle {    cursor: pointer;    transition: 0.3s;}
/* Màu sắc khác cho các nút có con đang bị ẩn */
.node--collapsed circle {    fill: #ffccbc !important;stroke: #e64a19 !important;}
/* Hiệu ứng chuông rung */
.bell-ring-animation {
    display: inline-block;
    color: #f39c12; /* Màu vàng cam của chuông */
    animation: bell-ring 2s ease-in-out infinite;
    transform-origin: top center; /* Rung từ đỉnh chuông */
}

@keyframes bell-ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-10deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
    60% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

/* Tăng cường độ nổi bật cho số ngày */
#modalCountdown {color: #d63031;text-shadow: 1px 1px 1px rgba(0,0,0,0.1);}
.tree-toolbar {
    position: absolute;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    width: calc(100% - 40px);
}
#search-results-list .list-group-item {
    font-size: 0.85rem;
    cursor: pointer;
}
.search-match { stroke: #ffc107 !important; stroke-width: 8px !important; }
/* Đảm bảo cây hiển thị toàn màn hình trừ đi chiều cao của Menu */
#tree-container { 
    height: calc(100vh - 56px); 
    width: 100%; 
    background: #fff; 
    overflow: hidden;
}
/* CSS cho chức năng tìm kiếm tích hợp lại */
.search-match { stroke: #ffc107 !important; stroke-width: 5px !important; }

/* Làm cho ô tìm kiếm và hộp danh sách khớp nhau */
#search-spouse-input {border-bottom: none;border-bottom-left-radius: 0;border-bottom-right-radius: 0;}
/* Hộp chứa danh sách vợ chồng */
.spouse-selection-box {
    height: 90px; /* Cố định chiều cao */
    overflow-y: auto; /* Tạo thanh cuộn dọc */
    padding: 5px 10px;
    border: 1px solid #dee2e6;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    transition: border-color 0.2s;
}
/* Hiệu ứng khi không tìm thấy kết quả (tùy chọn) */
.no-result-msg {padding: 10px;text-align: center;color: #999;font-size: 12px;}
.spouse-selection-box:focus-within {
    border-color: #198754; /* Đổi màu viền khi đang chọn */
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.1);
}

/* Từng dòng thành viên */
.spouse-item {border-bottom: 1px dotted #eee;transition: background 0.2s;}
.spouse-item:last-child {border-bottom: none;}
.spouse-item:hover {background-color: #f8f9fa; /* Hiệu ứng hover */}
.spouse-item .form-check-input:checked + .form-check-label {font-weight: bold;color: #198754;}
/* Tùy biến thanh cuộn cho đẹp (Webkit browsers) */
.spouse-selection-box::-webkit-scrollbar {width: 6px;}
.spouse-selection-box::-webkit-scrollbar-track {background: #f1f1f1;}
.spouse-selection-box::-webkit-scrollbar-thumb {background: #ccc;border-radius: 10px;}
.spouse-selection-box::-webkit-scrollbar-thumb:hover {background: #999;}
.list-group-item.active-selection {background-color: #e9ecef;border-color: #dee2e6;color: #000;}
.spouse-item.keyboard-focus {background-color: #f0fdf4; /* Màu xanh lá nhạt */outline: 1px solid #198754;}
.zoom-controls {
    position: absolute;
    bottom: 160px;
    right: 0px;
    z-index: 1000;
    display: flex;
    text-align: center;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}
.zoom-controls .btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 0;
    font-size: 1.2rem;
    color: #495057;
}
.zoom-controls .btn:hover {
    background-color: #f8f9fa;
    color: #0d6efd;
}
.zoom-slider-container {
    padding: 10px 0;
    background: #fff;
    display: flex;
    justify-content: center;
    height: 120px; /* Chiều cao thanh trượt */
}

#zoom-range {
    writing-mode: vertical-lr; 
    direction: rtl; /* Đưa nút kéo lên trên cho đúng chiều phóng to */
    width: 12px;
    height: 100%;
    cursor: pointer;
    padding: 0 5px;
}
/* Thiết lập hình nền cho toàn bộ vùng chứa sơ đồ */
#tree-container {
    position: relative;
    /* Sử dụng biến từ Django để thay đổi ảnh động */
    /*background-image:linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)),  url('{{ branch_bg }}') !important; */
    /*background-image:linear-gradient(rgb(231 193 193 / 48%), rgb(229 226 204 / 80%)), url('{{ branch_bg }}') !important;*/
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    width: 100%;
    height: 100vh;
}

/* Đảm bảo SVG trong suốt để thấy được hình nền phía sau */
#tree-container svg {
    background: transparent !important;
}

/* Làm nổi bật các đường nối link trên nền ảnh */
.link {
    stroke: #555;
    stroke-opacity: 0.6;
    stroke-width: 1.5px;
}
/* Tạo bộ lọc hiệu ứng vàng đồng (Gold Filter) */
.gold-border {
    stroke: #d4af37; /* Màu vàng đồng */
    stroke-width: 3px;
    filter: drop-shadow(0px 0px 3px rgba(212, 175, 55, 0.8));
}

/* Bo tròn và tạo khung cho ảnh đại diện trong SVG */
.node-photo-frame {
    fill: #fff;
    stroke: #b8860b; /* Dark Goldenrod */
    stroke-width: 2px;
}

/* Hiệu ứng khi di chuột vào ảnh */
.node image:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
    transition: transform 0.3s ease;
}
.link {
    fill: none;
    /* Màu nâu gỗ sồi cổ điển */
    stroke: #5d4037; 
    stroke-opacity: 0.8;
    /* Độ dày lớn hơn để tạo cảm giác cành cây chắc chắn */
    stroke-width: 2.5px;
    /* Tạo hiệu ứng nét vẽ mềm mại */
    stroke-linecap: round;
    /* Hiệu ứng chuyển động nhẹ khi mở rộng cây */
    transition: stroke-width 0.3s ease;
}

/* Hiệu ứng khi di chuột vào cành cây */
.link:hover {
    stroke: #3e2723;
    stroke-width: 4px;
    stroke-opacity: 1;
}
#tree-container::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 80%; /* Rộng gấp đôi để lặp lại hiệu ứng trôi */
    height: 100%;
    background: url('/media/images/clouds.png') repeat-x;
    background-size: contain;
    opacity: 0.3; /* Làm mờ để không che sơ đồ */
    z-index: 0;
    pointer-events: none; /* Không cản trở việc click vào cây */
    animation: moveClouds 6s linear infinite;
}

@keyframes moveClouds {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@keyframes fall {
    0% {
        transform: translateY(-10vh) rotate(0deg) translateX(0);
        opacity: 0;
    }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% {
        transform: translateY(110vh) rotate(720deg) translateX(50px);
        opacity: 0;
    }
}

.falling-leaf {
    position: absolute;
    color: #2e7d32;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.1));
}
/* Hiệu ứng mờ dần ở đáy khi chưa mở rộng */
        #modalBio.collapsed-gradient {
            mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
            -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
        }
        /* Định vị cố định khối nút ở cạnh phải của Modal */
    .fixed-side-buttons {
        position: absolute;
        right: -45px; /* Đẩy ra sát mép phải */
        top: 80px;    /* Khoảng cách từ trên xuống */
        z-index: 1060;
    }

    /* Định dạng nút bấm */
    .side-btn {
        border-radius: 4px 0 0 4px !important;
        width: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: -2px 2px 5px rgba(0,0,0,0.2);
        flex-direction: column;
    }

    /* Xoay chữ dọc */
    .vertical-text {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        font-size: 12px;
        white-space: nowrap;
    }

    /* Đảm bảo modal-content không bị cắt mất phần nút bên phải */
    .modal-content {
        overflow: visible !important;
    }
    
    /* Cấu hình lại modal-body để cuộn nội dung */
    .modal-body {
        max-height: 80vh; /* Giới hạn chiều cao */
        overflow-y: auto; /* Cho phép cuộn dọc */
    }