/*! CSS Used from: Embedded */
.family-tree {
    height: 800px;
    border: 1px dashed red;
    background-color:antiquewhite;
    overflow: hidden;
    position: relative;
    cursor: grab;
    padding: 20px;
}

.tree ul {
    padding-left:0px;
    padding-top: 20px;
    position: relative;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

.tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 15px 1px 0 1px;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

    .tree li::before, .tree li::after {
        content: '';
        position: absolute;
        top: 0;
        right: 50%;
        border-top: 1px solid deepskyblue;
        width: 50%;
        height: 15px;
    }

    .tree li::after {
        right: auto;
        left: 50%;
        border-left: 1px solid deepskyblue
    }

    .tree li:only-child::after, .tree li:only-child::before {
        display: none;
    }

    .tree li:only-child {
        padding-top: 0;
    }

    /* Thu hẹp khoảng cách cho người không có con */
    .tree li.no-children {
       /* padding-top: 5px !important;*/
       /* margin-bottom: 15px;*/
    }

        .tree li.no-children a {
            background-color: #f0f0f0;
            border: 1px solid deepskyblue;
        }

    /* Giảm khoảng cách giữa các node không có con */
    .tree li.no-children + .tree li.no-children {
    /*    margin-left: -10px;*/
    }

    /* Khoảng cách cố định 50px cho nhóm anh em có người không có con */
    .tree ul.compact-siblings {
        display: flex;
        justify-content: space-between;
        gap: 50px;
    }

    .tree ul.compact-siblings li {
        flex: 1;
        margin: 0;
        padding: 15px 0 0 0;
    }

    .tree ul.compact-siblings li:first-child {
        margin-left: 0;
    }

    .tree ul.compact-siblings li:last-child {
        margin-right: 0;
    }

    /* Đảm bảo đường nối hoạt động với flexbox */
    .tree ul.compact-siblings li::before,
    .tree ul.compact-siblings li::after {
        position: absolute;
        top: 0;
        width: 50%;
        height: 15px;
    }

        .tree ul.compact-siblings li::before {
            right: 50%;
            border-top: 1px solid deepskyblue;
        }

        .tree ul.compact-siblings li::after {
            left: 50%;
            border-left: 1px solid deepskyblue;
        }

    .tree ul.compact-siblings li:first-child::before {
        border: none;
    }

    .tree ul.compact-siblings li:last-child::after {
        border: none;
    }

    .tree li:first-child::before, .tree li:last-child::after {
        border: 0 none;
    }

.tree li:last-child::before {
    border-right: 1px solid deepskyblue;
    border-radius: 0 5px 0 0;
    -webkit-border-radius: 0 5px 0 0;
    -moz-border-radius: 0 5px 0 0;
}

    .tree li:first-child::after {
        border-radius: 5px 0 0 0;
        -webkit-border-radius: 5px 0 0 0;
        -moz-border-radius: 5px 0 0 0;
    }

.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 1px solid deepskyblue;
    width: 0;
    height: 20px;
}

.tree li a {

    line-height: 18px;
    min-width: 45px;
    max-width:53px;
    background-color: lightblue;
    padding: 3px;
    text-decoration: none;
    color: #000;
    font-family: arial, verdana, tahoma;
    font-size: 11px;
    display: inline-block;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

    .tree li a:hover, .tree li a:hover + ul li a {
        background: #c8e4f8;
        color: #000;
        border: 1px solid #94a0b4;
    }

        .tree li a:hover + ul li::after, .tree li a:hover + ul li::before, .tree li a:hover + ul::before, .tree li a:hover + ul ul::before {
            border-color: #94a0b4;
        }
