/* Modern Organizational Chart Styles */
.org-chart-container {
    width: 100%;
    overflow-x: auto;
    padding: 40px 0;
    text-align: center;
}

.org-chart {
    display: inline-flex;
    justify-content: center;
    padding: 20px;
    font-family: inherit;
}

.org-chart ul {
    position: relative;
    padding-top: 20px;
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
}

.org-chart li {
    position: relative;
    padding: 20px 4px 0 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

/* Connectors */
.org-chart li::before,
.org-chart li::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50%;
    height: 20px;
    border-top: 2px solid var(--border-color, #cbd5e1);
}

.org-chart li::before {
    left: 50%;
    border-left: 2px solid var(--border-color, #cbd5e1);
}

.org-chart li::after {
    right: 50%;
    border-right: 2px solid var(--border-color, #cbd5e1);
}

/* Remove connectors from single items */
.org-chart li:only-child::after,
.org-chart li:only-child::before {
    display: none;
}
.org-chart li:only-child {
    padding-top: 0;
}

/* Remove left connector from first child and right from last */
.org-chart li:first-child::before,
.org-chart li:last-child::after {
    border: 0 none;
}

/* Vertical line for the node above */
.org-chart ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid var(--border-color, #cbd5e1);
    width: 0;
    height: 20px;
}

/* Node Styles */
.org-node {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid var(--primary-color, #6c63ff);
    border-radius: 8px;
    padding: 10px 8px;
    width: 165px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.org-node:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(108, 99, 255, 0.2);
}

.org-node .node-title {
    font-weight: 700;
    color: var(--text-dark, #1e293b);
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;
}

/* Color Themes based on the image */
.node-top {
    border-color: #3b82f6;
    background: rgba(239, 246, 255, 0.9);
}
.node-top .node-title { color: #1d4ed8; }

.node-primary {
    border-color: #10b981;
    background: rgba(209, 250, 229, 0.9);
}
.node-primary .node-title { color: #047857; }

.node-rektor {
    border-color: #6366f1;
    background: rgba(224, 231, 255, 0.9);
    border-width: 3px;
    font-size: 13px;
    padding: 15px 20px;
    width: 200px;
}
.node-rektor .node-title { color: #4338ca; font-size: 14px; }

.node-pro-fin {
    border-color: #8b5cf6;
    background: rgba(237, 233, 254, 0.9);
}
.node-pro-fin .node-title { color: #5b21b6; }

.node-pro-edu {
    border-color: #14b8a6;
    background: rgba(204, 253, 245, 0.9);
}
.node-pro-edu .node-title { color: #0f766e; }

.node-pro-sci {
    border-color: #eab308;
    background: rgba(254, 252, 216, 0.9);
}
.node-pro-sci .node-title { color: #a16207; }

.node-pro-youth {
    border-color: #f97316;
    background: rgba(255, 237, 213, 0.9);
}
.node-pro-youth .node-title { color: #c2410c; }

.node-faculty {
    border-color: #0f172a;
    background: rgba(30, 41, 59, 0.9);
}
.node-faculty .node-title { color: #f8fafc; }

/* Vertical Nodes Branching */
.org-chart ul.vertical-nodes {
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
}

.org-chart ul.vertical-nodes li {
    padding: 15px 0 0 0;
}

.org-chart ul.vertical-nodes li::before,
.org-chart ul.vertical-nodes li::after {
    display: none;
}

.org-chart ul.vertical-nodes li::before {
    display: block;
    content: '';
    position: absolute;
    top: -15px; /* connect to previous node */
    left: calc(50% - 1px);
    border: none;
    border-left: 2px solid var(--border-color, #cbd5e1);
    width: 0;
    height: 30px;
}

.org-chart ul.vertical-nodes li:first-child::before {
    display: none;
}


/* Mobile responsiveness */
@media screen and (max-width: 1024px) {
    .org-chart ul {
        flex-direction: column;
        align-items: center;
        padding-top: 0;
    }
    
    .org-chart ul ul::before {
        display: none;
    }
    
    .org-chart li {
        padding: 0;
        margin-top: 20px;
    }
    
    .org-chart li::before,
    .org-chart li::after {
        display: none;
    }
    
    .org-chart li::before {
        display: block;
        content: '';
        position: absolute;
        top: -20px;
        left: 50%;
        border-left: 2px solid var(--border-color, #cbd5e1);
        width: 0;
        height: 20px;
    }
    
    .org-chart li:first-child::before {
        display: none;
    }
    
    .org-node {
        min-width: 250px;
    }
}
