/* ========================================== COMMON BOX ========================================== */
.org-box {
    min-height: 100px;
    padding: 18px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #5c1010;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    border: 0;
    outline: 0;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}
.level-3 .org-box,.level-4 .org-box,.level-5 .org-box{background: #ab1515;}
.org-box:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.designation {
    display: block;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 400;
}

/* ========================================== LEVEL 1 ========================================== */
.level-1 {
    position: relative;
    margin-bottom: 75px;
}

.level-1 .org-box {
    min-height: 115px;
    background: #e93135;
    font-size: 20px;
}

/* Vertical lines coming from Level 1 boxes They meet Level 1 -> Level 2 horizontal line */
.level-1 .org-box::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -38px;
    width: 1px;
    height: 38px;
    background: #ab1515;
    transform: translateX(-50%);
}

/* Horizontal line BETWEEN Level 1 and Level 2 */
.level-1::after {
    content: "";
    position: absolute;
    left: 16%;
    right: 16%;
    bottom: -38px;
    height: 1px;
    background: #ab1515;
}

/* ========================================== LEVEL 2 ========================================== */
.level-2 {
    position: relative;
    margin-bottom: 75px;
}

/* Vertical line from horizontal connector down into Level 2 boxes */
.level-2 .org-box::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -38px;
    width: 1px;
    height: 38px;
    background: #ab1515;
    transform: translateX(-50%);
}

/* Vertical lines from Level 2 boxes */
.level-2 .org-box::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -38px;
    width: 1px;
    height: 38px;
    background: #ab1515;
    transform: translateX(-50%);
}

/* Horizontal line BETWEEN Level 2 and Level 3 */
.level-2::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: -38px;
    height: 1px;
    background: #ab1515;
}

/* ========================================== LEVEL 3 ========================================== */
.level-3 {
    position: relative;
    margin-bottom: 20px;
}

/* Vertical lines from Level 2 horizontal line to Level 3 boxes */
.level-3 .org-box::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -38px;
    width: 1px;
    height: 38px;
    background: #ab1515;
    transform: translateX(-50%);
}

/* Level 3 does NOT connect to Level 4 */
/* ========================================== LEVEL 4 ========================================== */
.level-4 {
    margin-top: 20px;
}

.level-4 .org-box::before, .level-4 .org-box::after {
    display: none !important;
}

/* ========================================== TABLET ========================================== */
@media (max-width: 991.98px) {
    .organization-chart {
        padding: 40px 0;
    }

    .org-box {
        min-height: 90px;
        padding: 15px 10px;
        font-size: 15px;
    }

    .level-1 .org-box {
        min-height: 100px;
        font-size: 17px;
    }

    .level-1, .level-2 {
        margin-bottom: 65px;
    }

    .level-1::after {
        bottom: -32px;
    }

    .level-1 .org-box::after {
        bottom: -32px;
        height: 32px;
    }

    .level-2 .org-box::before {
        top: -32px;
        height: 32px;
    }

    .level-2 .org-box::after {
        bottom: -32px;
        height: 32px;
    }

    .level-2::after {
        bottom: -32px;
        right: 16%;
        left: 16%;
    }

    .level-3 .org-box::before {
        top: -33px;
        height: 34px;
    }
}

/* ========================================== MOBILE ========================================== */
@media (max-width: 767.98px) {
    .organization-chart {
        padding: 30px 0;
    }

    .org-chart {
        width: 100%;
    }

    /* On mobile each level becomes vertical. */
    .level-1, .level-2, .level-3, .level-4 {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    /* Remove desktop horizontal lines */
    .level-1::after, .level-2::after {
        display: none;
    }

    /* ========================== LEVEL 1 ========================== */
    .level-1 {
        margin-bottom: 30px;
    }

    .level-1 .org-box {
        min-height: 85px;
        margin-bottom: 15px;
        font-size: 17px;
    }

    /* One vertical connector from Level 1 to Level 2 */
    .level-1::after {
        content: "";
        display: block;
        position: absolute;
        left: 50%;
        bottom: -30px;
        width: 1px;
        height: 44px;
        background: #cfa5a5;
        transform: translateX(-50%);
    }

    .level-1 .org-box::after {
        display: none;
    }

    /* ========================== LEVEL 2 ========================== */
    .level-2 {
        margin-bottom: 30px;
    }

    .level-2 .org-box {
        min-height: 80px;
        margin-bottom: 15px;
    }

    .level-2 .org-box::before, .level-2 .org-box::after {
        display: none;
    }

    /* Vertical connector after Level 2 */
    .level-2::after {
        content: "";
        display: block;
        position: absolute;
        left: 50%;
        bottom: -30px;
        width: 1px;
        height: 44px;
        background: #cfa5a5;
        transform: translateX(-50%);
    }

    /* ========================== LEVEL 3 ========================== */
    .level-3 {
        margin-bottom: 20px;
    }

    .level-3 .org-box {
        min-height: 80px;
        margin-bottom: 15px;
    }

    .level-3 .org-box::before {
        display: none;
    }

    /* ========================== LEVEL 4 ========================== */
    .level-4 {
        margin-top: 0;
    }

    .level-4 .org-box {
        min-height: 80px;
    }

    .level-4 .org-box::before, .level-4 .org-box::after {
        display: none !important;
    }
}

/* ========================================== SMALL MOBILE ========================================== */
@media (max-width: 575.98px) {
    .organization-chart {
        padding: 25px 0;
    }

    .org-box {
        min-height: 70px;
        padding: 12px 10px;
        font-size: 14px;
    }

    .level-1 .org-box {
        min-height: 75px;
        font-size: 15px;
    }

    .level-1 .designation {
        font-size: 13px;
    }

    .level-2 .org-box, .level-3 .org-box, .level-4 .org-box {
        min-height: 70px;
    }
}
