/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Conteneur principal */
.org-chart {
    position: relative;
    padding: 40px 20px 100px;
    background: #f5f5f5;
    min-height: calc(100vh - 250px);
    overflow-x: auto;
    overflow-y: hidden;
}

/* Canvas pour les connexions */
#connectionsCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

/* Contrôles de zoom */
.zoom-controls {
    position: fixed;
    top: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.zoom-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background: #5a6fd8;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    border-radius: 20px;
    padding: 40px;
}

/* Niveau des r�gions */
.org-level {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 60px;
    margin: 40px 0;
}

/* Limitation des axes à 4 par ligne */
.children-container .org-level {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 40px;
    max-width: 1000px;
    margin: 40px auto;
}

.children-container .org-level .org-node {
    flex: 0 0 calc(25% - 30px);
    min-width: 200px;
    max-width: 220px;
}

.children-container .org-level .org-node:nth-child(4n+1) {
    margin-left: 0;
}

.children-container .org-level .org-node:nth-child(n+5) {
    margin-top: 60px;
}


/* Node r�gion */
.org-node {
    position: relative;
    min-width: 240px;
    max-width: 240px;
    color: white;
    padding: 30px 20px;
    border-radius: 12px;
    text-align: center;
    cursor: default;
    transition: all 0.3s ease;
    word-wrap: break-word;
}

.org-node:hover {
    transform: translateY(-5px);
}

/* Types de nodes */
.org-node.region {
    background: #303030;
    box-shadow: 0 4px 15px rgba(48, 48, 48, 0.4);
}

.org-node.region:hover {
    box-shadow: 0 8px 25px rgba(48, 48, 48, 0.6);
}

.org-node.axe {
    background: #800000;
    box-shadow: 0 4px 15px rgba(128, 0, 0, 0.4);
    min-width: 200px;
    max-width: 200px;
    padding: 25px 15px;
}

.org-node.axe:hover {
    box-shadow: 0 8px 25px rgba(128, 0, 0, 0.6);
}

.org-node.structure {
    background: #CC9216;
    box-shadow: 0 4px 15px rgba(204, 146, 22, 0.4);
    min-width: 180px;
    max-width: 220px;
    padding: 20px 15px;
}

.org-node.structure:hover {
    box-shadow: 0 8px 25px rgba(204, 146, 22, 0.6);
}

.org-node.collaboration {
    background: #769523;
    box-shadow: 0 4px 15px rgba(118, 149, 35, 0.4);
    min-width: 160px;
    max-width: 200px;
    padding: 18px 12px;
}

.org-node.collaboration:hover {
    box-shadow: 0 8px 25px rgba(118, 149, 35, 0.6);
}


/* Bouton d'expansion */
.expand-btn {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: #667eea;
    color: white;
    transform: translateX(-50%) scale(1.1);
}

/* Conteneur des enfants */
.children-container {
    margin-top: 60px;
}

.children-container.hidden {
    display: none;
}

/* Nodes masqués */
.org-node.masked {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Titre du node */
.node-title {
    font-weight: 700;
    font-size: 1.3em;
    margin-bottom: 10px;
    line-height: 1.3;
    letter-spacing: 1px;
}

.org-node.axe .node-title {
    font-size: 1.1em;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
    .org-level {
        gap: 40px;
    }
    
    .org-node {
        min-width: 200px;
        max-width: 200px;
        padding: 25px 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 20px;
    }
    
    .org-level {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    
    .org-node {
        min-width: 280px;
        max-width: 280px;
    }
}