@import "../table/_table";

.org-chart {
    --box-width: 170px;
    display: flex; flex-direction: column; align-items: center; position: relative;
    &::after {
        content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 95%; border-left: 1px dashed #698299;
    }
    .org-level {
        display: flex; justify-content: center; position: relative; width: 100%;
        &.level-1 {
            margin-bottom: 20px;
            .box {
                width: var(--box-width); height: var(--box-width); border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: var(--theme); color: #fff; font-size: 2.2rem; font-weight: 600; border: 10px solid #b7d6e5;
            }
        }
        &.level-2 {
            margin-bottom: 20px; 
            .box {
                border: 0; background: var(--navy); color: #fff; font-size: 1.8rem;
            }
        }
        &.level-3 {
            flex-direction: column; gap: 10px;
            .org-row {
                --row-gap: 50px;
                display: flex; justify-content: center; gap: var(--row-gap); position: relative;
                .org-node {
                    height: 50px; display: flex; align-items: center;
                }
                .line-h:after {
                    content: ''; width: calc(100% + var(--row-gap) * 2); height: 1px; position: absolute; top: 50%; left: calc(var(--row-gap) * -1); border-top: 1px dashed #698299;
                }
            }
        }
    }
    .org-node {
        width: var(--box-width); text-align: center; position: relative; z-index: 10;
        .box {
            border: 1px solid var(--theme); color: var(--theme); padding: 12px 0; width: 100%; background-color: #fff; font-weight: bold; position: relative; z-index: 1; border-radius: 5px; font-weight: 500; font-size: 1.7rem;
        }
    }
}

.org-detail {
    display: flex; gap: 20px; padding: 50px 0;
    .box {
        flex: 1; border: 1px solid #0ca28f; background: #F9FBF5; padding: 0 20px 20px; border-radius: 10px;
        .head {
            border-radius: 0 0 15px 15px; color: #fff; font-size: 1.6rem; font-weight: 600; text-align: center; padding: 6px 0; width: 60%; margin: 0 auto;
            background: #0ca28f;
        }
        .detail-list {
            padding-top: 20px;
            .detail-item {
                position: relative; font-size: 1.6rem; padding-left: 13px; line-height: 1.4; color: #333;
                &:not(:last-child) {
                    padding-bottom: 5px;
                }
                &:after {
                    content: ''; width: 4px; height: 4px; background: #0ca28f; border-radius: 50%; position: absolute; top: 8px; left: 0;
                }
            }
        }
    }
}

.org-img {
    margin-bottom: 30px;
    img {
        max-width: 100%; height: auto; display: block;
    }
}

/* 반응형 */
@media (max-width: 1024px) {
    .org-chart {
        --box-width: 150px;
        .org-level {
            &.level-1 {
                margin-bottom: 16px;
                .box {
                    font-size: 2rem; border-width: 8px;
                }
            }
            &.level-2 {
                margin-bottom: 16px;
                .box {
                    font-size: 1.6rem;
                }
            }
            &.level-3 {
                .org-row {
                    --row-gap: 40px;
                    .org-node {
                        height: 46px;
                    }
                }
            }
        }
        .org-node {
            .box {
                padding: 10px 0; font-size: 1.5rem;
            }
        }
    }
    .org-detail {
        gap: 10px; padding: 40px 0;
        .box {
            padding: 0 15px 15px;
            .head {
                font-size: 1.5rem;
            }
            .detail-list {
                padding-top: 15px;
                .detail-item {
                    font-size: 1.4rem; padding-left: 10px;
                    &:after {
                        top: 6px;
                    }
                }
            }
        }
    }
}

@media (max-width: 768px) {
    .org-chart {
        --box-width: 130px;
        &::after {
            border-left-width: 1px;
        }
        .org-level {
            &.level-1 {
                margin-bottom: 14px;
                .box {
                    font-size: 1.8rem; border-width: 6px;
                }
            }
            &.level-2 {
                margin-bottom: 14px;
                .box {
                    font-size: 1.5rem;
                }
            }
            &.level-3 {
                gap: 8px;
                .org-row {
                    --row-gap: 28px;
                    .org-node {
                        height: 42px;
                    }
                }
            }
        }
        .org-node {
            .box {
                padding: 8px 0; font-size: 1.4rem;
            }
        }
    }
    .org-detail {
        gap: 10px; padding: 30px 0; flex-wrap: wrap;
        .box {
            padding: 0 20px 10px; flex: 1 1 40%;
            .head {
                font-size: 1.4rem; width: 80%;
            }
        }
    }
}

@media (max-width: 480px) {
    .org-chart {
        --box-width: 110px; padding: 0 20px;
        .org-level {
            &.level-1 {
                margin-bottom: 12px;
                .box {
                    font-size: 1.6rem; border-width: 5px;
                }
            }
            &.level-2 {
                margin-bottom: 12px;
                .box {
                    font-size: 1.4rem;
                }
            }
            &.level-3 {
                gap: 6px;
                .org-row {
                    --row-gap: 10px;
                    .org-node {
                        height: 38px;
                    }
                }
            }
        }
        .org-node {
            .box {
                padding: 6px 0; font-size: 1.3rem;
            }
        }
    }
    .org-detail {
        .box {
            padding: 0 10px 10px;
            .head {
                font-size: 1.3rem; width: 70%;
            }
            .detail-list {
                .detail-item {
                    font-size: 1.3rem; padding-left: 7px;
                    &:not(:last-child) {
                        padding-bottom: 3px;
                    }
                    &:after {
                        width: 3px; height: 3px; top: 7px;
                    }
                }
            }
        }
    }
}