/* Organization Chart Styles */
.org-chart {
    position: relative;
    margin: 20px auto;
    max-width: 1200px;
    padding: 10px 5px;
}

.org-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.org-chart-title {
    text-align: center;
    color: var(--brand-dark);
    font-size: 1.8rem;
    margin-bottom: 40px;
    font-weight: 700;
    position: relative;
}

.org-chart-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--brand-blue);
    border-radius: 2px;
}

.org-level {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    position: relative;
    width: 100%;
}

.org-level::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 15px;
    background-color: var(--brand-blue);
    z-index: 1;
}

.org-level:last-child::after {
    display: none;
}

/* Support units level with connecting lines */
.org-level-3 {
    position: relative;
}

.org-level-3::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 2px;
    background-color: var(--brand-blue);
    opacity: 0.3;
    z-index: 0;
    border-radius: 1px;
}

/* Horizontal layout for level 4 */
.org-level-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 650px;
}

.org-box {
    background: linear-gradient(135deg, white 0%, #f9f9fa 100%);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    padding: 8px 10px;
    margin: 0 5px;
    text-align: center;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.org-box:hover {
    transform: translateY(-3px);
    border-color: rgba(50, 50, 117, 0.2);
}

.org-box-title {
    color: var(--brand-blue);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.org-box-main {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a3b8f 100%);
    color: white;
    min-width: 140px;
}

.org-box-main .org-box-title {
    color: white;
    font-size: 0.85rem;
}

.org-box-secondary {
    background: linear-gradient(135deg, #f0f2f5 0%, #e6e9f0 100%);
    min-width: 120px;
}

.org-level-connector {
    position: relative;
    width: 100%;
    height: 20px;
    margin-bottom: 20px;
}

.org-level-connector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background-color: var(--brand-blue);
}

.org-level-connector::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: var(--brand-blue);
}

/* Responsive Styles */
@media (max-width: 992px) {
    .org-chart {
        padding: 15px 5px;
    }
    
    .org-level {
        margin-bottom: 20px;
    }
    
    .org-box {
        padding: 10px;
        margin: 0 5px;
    }
    
    .org-box-title {
        font-size: 0.8rem;
    }
}

@media (max-width: 992px) {
    .org-level-4 {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    /* Create a more vertical layout for mobile */
    .org-chart {
        padding: 15px 10px;
    }
    
    .org-level {
        margin-bottom: 25px;
    }
    
    .org-level::after {
        height: 25px;
    }
    
    /* Adjust level 3 with connecting line */
    .org-level-3 {
        flex-direction: column;
        align-items: center;
        margin-bottom: 30px;
    }
    
    .org-level-3::before {
        width: 2px;
        height: 85%;
        top: 50%;
        left: 50%;
    }
    
    .org-box {
        margin: 5px 0;
        min-width: 200px;
    }
    
    .org-box-main {
        min-width: 220px;
    }
    
    .org-level-4 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .org-chart-title {
        font-size: 1.2rem;
    }
    
    .org-level-4 {
        grid-template-columns: repeat(1, 1fr);
        grid-template-rows: repeat(7, 1fr);
        gap: 8px;
    }
    
    .org-box {
        min-width: 220px;
    }
    
    .org-box-title {
        font-size: 0.8rem;
    }
}
