﻿.organizational-chart {
    overflow-x: auto;
}

#orgchart {
    position: relative;
    padding: 30px;
}


.node-chart {
    padding: 10px 15px;
    background-color: #002855;
    color: white;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    width: 220px;
    min-height: 50px;
    margin:30px 20px;
    word-break: break-word;
    display: flex;
    justify-content: center;
    align-items: center;
}
.column-chart .row-chart .node-chart {
    margin: 0;
    display:flex;
    justify-content:center;
    align-items:center;
}
.node-chart:empty::before {
    content: "\00a0"; /* non-breaking space */
}

    .node-chart:empty {
        visibility: hidden; /* ẩn nhưng vẫn chiếm chỗ */
    }

:root {
    --primary: #002855;
    --gap-lg: 20px;
    --gap-md: 15px;
    --gap-sm: 10px;
    --node-width-lg: 220px;
    --node-width-md: 180px;
    --node-width-sm: 150px;
}

/* ====== Layout chung ====== */
.organizational-chart {
    overflow-x: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
}

#orgchart {
    position: relative;
    padding: 30px;
    min-width: 1024px; /* để tránh quá bó khi desktop, mobile vẫn cuộn ngang được */
}

.row-chart {
    display: flex;
    justify-content: center;
    gap: var(--gap-lg);
    flex-wrap: nowrap;
    flex-direction: row;
    margin-bottom: 50px;
}

.node-chart {
    padding: 10px 15px;
    background-color: var(--primary);
    color: #fff;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    width: var(--node-width-lg);
    min-height: 50px;
    word-break: break-word;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .node-chart:empty::before {
        content: "\00a0"; /* non-breaking space */
    }

    .node-chart:empty {
        visibility: hidden; /* ẩn nhưng vẫn giữ layout để jsPlumb không lệch */
    }

.listPath {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #777;
    font-size: 14px;
}

    .listPath a {
        color: inherit;
        text-decoration: none;
    }

.nameModule {
    margin-top: 10px;
    font-size: 28px;
    color: var(--primary);
}

/* ====== Responsive ====== */

/* < 1200px */
@media (max-width: 1200px) {
    #orgchart {
        min-width: auto; /* Cho phép co nhỏ theo viewport */
        padding: 20px;
    }

    .row-chart {
        gap: var(--gap-md);
        flex-wrap: wrap;
    }

    .node-chart {
        width: var(--node-width-md);
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* < 992px */
@media (max-width: 992px) {
    .row-chart {
        gap: var(--gap-sm);
        justify-content: flex-start;
    }

    .node-chart {
        width: var(--node-width-sm);
        font-size: 13px;
        padding: 8px;
    }
}

/* < 768px (tablet) */
@media (max-width: 768px) {
    #orgchart {
        padding: 10px;
    }

    .row-chart {
        flex-direction: column;
        /*align-items: center;*/
        gap: 8px;
    }

    .node-chart {
        width: 90%;
        font-size: 13px;
        margin: 5px 0;
    }
}

/* < 480px (mobile) */
@media (max-width: 480px) {
    .node-chart {
        width: 100%;
        font-size: 12px;
        padding: 6px;
    }
}
#danguy {
    display: flex;
    background: #2d3194;
    color: #fff;
    font-weight: bold;
    font-size: 36px;
    border-radius: 12px;
    border: 2px solid #a65d12;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), 0 3px 8px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
    height: 100px;
    width: 25%;
    align-items: center;
    justify-content: center;
}

    #danguy::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255,255,255,0.28); /* highlight bóng sáng */
        border-radius: 12px 12px 0 0;
    }


#ttqp {
    display: flex;
    background: linear-gradient(to bottom, #fff4a8 0%, #ffd94d 45%, #f5b800 100%);
    color: #fff;
    font-weight: bold;
    font-size: 22px;
    border-radius: 12px;
    border: 2px solid #dba300;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), 0 3px 8px rgba(0,0,0,0.4);
    
    position: relative; /* để tạo lớp bóng */
    overflow: hidden;
}

    #ttqp::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255,255,255,0.28);
        border-radius: 12px 12px 0 0;
    }

[id^="khoa"] {
    background: #2d3194;
    display: flex;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #081c45;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
    width:100%;
}

    [id^="khoa"]::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

#cac-khoa {
    background: #2d3194;
    display: flex;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #081c45;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
}

    #cac-khoa::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

#cac-bo-mon {
    background: #2d3194;
    display: flex;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #081c45;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
}

    #cac-bo-mon::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }


[id^="cacvp"] {
    background: #2d3194;
    display: flex;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #081c45;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
    width: 100%;
}

    [id^="cacvp"]::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }
#cac-phong, [id^="cactt"] {
    display: inline-block;
    padding: 12px 25px;
    background: linear-gradient(to bottom, #87a63a 0%, #698B22 50%, #4f6b18 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #698B22; /* viền Olive Drab */
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    
    position: relative;
    overflow: hidden;
    height: 70px;
}

    #cac-phong::after, [id^="cactt"]::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

#cac-trung-tam {
    background: #2d3194;
    display: flex;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #081c45;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
}

    #cac-trung-tam::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

[id^="vien_"] {
    background: #2d3194;
    display: flex;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #081c45;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
    width: 100%;
}

    [id^="vien_"]::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }
#cac-khoa-qp {
    background: linear-gradient(to bottom, #228b22 0%, #006400 50%, #004b00 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #006400;  
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    
    position: relative;
    overflow: hidden;
    height:70px;
}

    #cac-khoa-qp::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

[id^="khoa-qp-"] {
    background: linear-gradient(to bottom, #228b22 0%, #006400 50%, #004b00 100%);
    color: white;
    font-weight: bold;
    font-size: 12px;
    border-radius: 12px;
    border: 2px solid #006400;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
    width: 98%;
    width: 100%;
}

[id^="khoa-qp-"]::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

#cac-bo-mon-qp {
    background: linear-gradient(to bottom, #1c7da1 0%, #00688B 50%, #004e66 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 12px;
    border: 2px solid #00688B; /* viền xanh dương đậm */
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    
    position: relative;
    overflow: hidden;
    height:70px
}

    #cac-bo-mon-qp::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }
[id^="phong-qp-"] {
    background: linear-gradient(to bottom, #1c7da1 0%, #00688B 50%, #004e66 100%);
    color: white;
    font-weight: bold;
    font-size: 12px;
    border-radius: 12px;
    border: 2px solid #00688B; /* viền xanh dương đậm */
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    height: 70px;
    width:100%;
}

 [id^="phong-qp-"]::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 12px 12px 0 0;
    }

#congdoan {
    display: flex;
    background: linear-gradient(to bottom, #ff7b7b 0%, #e60000 50%, #b00000 100%);
    color: #fff;
    font-weight: bold;
    font-size: 22px;
    height: 90px;
    border-radius: 12px;
    border: 2px solid #8b0000;
    text-align: center;
    
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    /* Hiệu ứng bóng nổi và bóng trong */
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 8px rgba(0, 0, 0, 0.5);
    /* Tạo lớp bóng nổi kiểu glossy */
    position: relative;
    overflow: hidden;
    width:20%;
}

    #congdoan::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 12px 12px 0 0;
    }
#bangd {
    display: flex;
    background: linear-gradient(to bottom, #ffe699 0%, #FFC125 50%, #d08e00 100%);
    color: #fff;
    font-weight: bold;
    font-size: 20px;
    border-radius: 12px;
    border: 2px solid #b37700;
    text-align: center;
    
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    /* Hiệu ứng bóng nổi và bóng trong */
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 3px 8px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    height:80px;
}

    #bangd::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 12px 12px 0 0;
    }

#bangiamhieu {
    display: flex;
    background: #2d3194;
    color: #fff;
    font-weight: bold;
    font-size: 30px;
    border-radius: 12px;
    border: 2px solid #a65d12;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), 0 3px 8px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
    height: 100px;
    width: 25%;
    align-items: center;
    justify-content: center;
}

    #bangiamhieu::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255,255,255,0.28); /* highlight bóng sáng */
        border-radius: 12px 12px 0 0;
    }
#doantn {
    display: flex;
    background: linear-gradient(to bottom, #f2a74a 0%, #e28f27 45%, #c97615 100%);
    color: #fff;
    font-weight: bold;
    font-size: 30px;
    border-radius: 12px;
    border: 2px solid #a65d12;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), 0 3px 8px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
    height: 100px;
    width: 25%;
    align-items: center;
    justify-content: center;
}

    #doantn::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255,255,255,0.28); /* highlight bóng sáng */
        border-radius: 12px 12px 0 0;
    }
#gdqp {
    display: flex;
    background: linear-gradient(to bottom, #f2a74a 0%, #e28f27 45%, #c97615 100%);
    color: #fff;
    font-weight: bold;
    font-size: 30px;
    border-radius: 12px;
    border: 2px solid #a65d12;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), 0 3px 8px rgba(0,0,0,0.4);
    
    position: relative;
    overflow: hidden;
    height: 100px;
    width: 25%;
    align-items: center;
    justify-content: center;
}

    #gdqp::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: rgba(255,255,255,0.28); /* highlight bóng sáng */
        border-radius: 12px 12px 0 0;
    }
.arrow-overlay {
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.25));
}

.edge-label {
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    color: #0d47a1;
}
.node-wrapper {
    position: relative;
    display: inline-block;
}

.submenu-gdqp {
    position: absolute;
    top: 65%;
    left: 70%;
    margin-left: 15px;
    display: none;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    padding: 8px 0;
    min-width: 220px;
    z-index: 999;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.25s ease;
}

    .submenu-gdqp a {
        display: block;
        padding: 10px 15px;
        color: #264186;
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        border-bottom: 1px solid #eee;
        white-space: nowrap;
        transition: all 0.2s ease;
    }

        .submenu-gdqp a:last-child {
            border-bottom: none;
        }

        .submenu-gdqp a:hover {
            background: #fbb349;
            color: #fff;
        }

    .has-submenu:hover + .submenu-gdqp,
    .submenu-gdqp:hover {
        display: flex;
        opacity: 1;
        transform: translateX(0);
    }

#gdqp {
    position: relative;
    z-index: 10;
}

/* responsive submenu */
@media (max-width: 992px) {
    .submenu-gdqp {
        left: auto;
        top: 100%;
        right: 0;
        margin-left: 0;
        margin-top: 8px;
        border-radius: 8px;
        box-shadow: 0 3px 6px rgba(0,0,0,0.1);
        transform: none;
    }
}

@media (max-width: 576px) {
    .submenu-gdqp {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        padding: 0;
        background: transparent;
        min-width: 100%;
    }

        .submenu-gdqp a {
            background: #f9f9f9;
            border: 1px solid #ddd;
            margin-top: 4px;
            border-radius: 6px;
        }

    .has-submenu:hover + .submenu-gdqp {
        display: flex;
    }
}
.node-wrapper {
    display: flex; /* giúp giữ flex layout ngang với các node khác */
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Giữ nguyên kích thước node chính */
#gdqp {
    width: 100% !important; /* ✅ chiếm toàn bộ chiều rộng node-wrapper */
    display: flex;
    align-items: center;
    justify-content: center;
}
/* =========================================================
   🌍 RESPONSIVE TOÀN DIỆN (Desktop → iPad → iPhone)
   ========================================================= */

/* >= 1400px (màn hình lớn, iMac, TV) */
@media (min-width: 1400px) {
    .node-chart {
        font-size: 18px;
        width: 260px;
        padding: 12px 18px;
    }
}

/* <= 1200px (Laptop tiêu chuẩn) */
@media (max-width: 1200px) {
    .row-chart {
        flex-wrap: wrap;
        gap: 15px;
    }

    .node-chart {
        width: 200px;
        font-size: 15px;
    }g

    #gdqp, #bangiamhieu, #doantn, #danguy, #congdoan {
        font-size: 26px;
        width: 40%;
        height: 90px;
    }
}

.node-wrapper {
    width: 27%;
}
/* <= 992px (Tablet ngang hoặc laptop nhỏ) */
/*@media (max-width: 992px) {
    #orgchart {
        min-width: auto;
        padding: 15px;
    }

    .row-chart {
        flex-wrap: wrap;
        justify-content: center;
    }

    .node-chart {
        width: 180px;
        font-size: 14px;
        padding: 8px 10px;
    }

    #gdqp, #bangiamhieu, #doantn, #danguy, #congdoan {
        font-size: 22px;
        width: 45%;
        height: 85px;
    }
}*/
/* <= 768px (iPad dọc, tablet nhỏ) */
/*@media (max-width: 768px) {
    .row-chart {
        align-items: center;
        display: flex;
        justify-content: center;
        flex-direction: row;
    }

    .node-chart {
        width: 90%;
        font-size: 13px;
        padding: 8px;
    }

    #gdqp, #bangiamhieu, #doantn, #danguy, #congdoan {
        width: 80%;
        height: 80px;
        font-size: 20px;
    }
    #danguy{
        margin-right:40px;
    }
    .row-chart .column-chart #cac-khoa, #cac-bo-mon, #cac-trung-tam {
        font-size: clamp(10px, 2vw, 20px) !important;
    }
}*/
/* <= 576px (iPhone 14 Pro Max, 13, 12, SE…) */
@media (max-width: 576px) {
    #row2 {
        margin-right: 15px
    }
    .row-chart {
        /*align-items: center;*/
        display: flex;
        justify-content: center;
        flex-direction: row;
    }
    .node-chart {
        width: 100%;
        font-size: 12px;
        padding: 6px;
    }
  
    #gdqp, #bangiamhieu, #doantn, #danguy, #congdoan {
        width: 30%;
        font-size: clamp(12px, 2vw, 20px);
        height: 70px;
    }

    .submenu-gdqp a {
        font-size: 13px;
        padding: 8px 10px;
    }
    .node-wrapper a {
        width: 100%;
    }
    #cac-khoa, #cac-bo-mon, #cac-trung-tam {
        font-size: clamp(12px, 1vw, 14px);
    }
    #cumkhoa, #cumphong, #cumtt {
        padding: 5px !important;
    }
    [id^="khoa"], [id^="cacvp"], [id^="vien_"] {
        font-size: clamp(10px, 1vw, 14px) !important;
    }
}

/* <= 375px (iPhone SE, màn siêu nhỏ) */
@media (max-width: 375px) {
    .node-chart {
        font-size: 11px;
        width: 100%;
        padding: 5px;
    }

    #gdqp, #bangiamhieu, #doantn, #danguy, #congdoan {
        font-size: clamp(14px, 4vw, 18px);
        height: 65px;
        width: 25%;
    }

    .submenu-gdqp a {
        font-size: 12px;
        padding: 6px 8px;
    }
    .node-wrapper a {
        width: 100%;
    }
}
@media (min-width: 577px) and (max-width: 820px) {
    .dang{
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: row;
    }
    .hoidong {
        display: flex;
        flex-direction: row;
        justify-content: center;
        margin-right: 20px !important;
    }
    #gdqp, #bangiamhieu, #doantn, #danguy, #congdoan {
        width: 30%;
        font-size: clamp(12px, 2vw, 20px);
        height: 70px;
    }
    .dv-tv {
        display: flex;
        flex-direction: row;
        justify-content: center;
    }
    .border-khoi{
        padding:0 0 0 3px!important;
    }
}
