/* assets/css/style.css */

:root {
    --bg-color: #e8ebee;
    --text-blue: #004b93;
    --line-color: #555555;
    --shadow-light: #ffffff;
    --shadow-dark: #c8d0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-blue);
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background-color: var(--bg-color);
    background-image: repeating-radial-gradient(
        circle at 0% 0%,
        transparent 0,
        transparent 45px,
        rgba(0, 0, 0, 0.015) 46px,
        rgba(0, 0, 0, 0.015) 47px
    );
    pointer-events: none;
}

.logo-container {
    position: fixed;
    top: 30px;
    right: 40px;
    z-index: 1000;
}
.logo-container img {
    height: 55px;
    width: auto;
}

.chart-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 100px;
    overflow: auto;
    position: relative;
}

.zoom-wrapper {
    transform-origin: top center;
    transition: transform 0.15s ease-out;
    position: relative;
    padding: 50px;
}

.tree-root, .org-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.org-children {
    display: flex;
    justify-content: center;
    position: relative;
    gap: 40px;
    margin-top: 40px;
}

/* Perfect Staggered Zig-Zag Layout */
.company-stagger-layout {
    display: flex;
    gap: 35px; 
    align-items: flex-start;
    margin-top: 60px;
}
.company-stagger-layout > .org-branch {
    margin-top: 130px; 
}
.company-stagger-layout > .org-branch:nth-child(even) {
    margin-top: 40px; 
}

/* =========================================================
   THE NEUMORPHIC CAPSULE DESIGN (100% ACCURATE)
   ========================================================= */
.org-node.structural-node {
    background-color: var(--bg-color);
    color: var(--text-blue);
    padding: 16px 20px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 19px;
    letter-spacing: 0.5px;
    text-align: center;
    position: relative;
    
    /* Fixed widths guarantee the middle box is mathematically perfectly centered */
    width: 220px; 
    min-width: 220px;
    
    z-index: 2;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        8px 8px 16px var(--shadow-dark), 
        -8px -8px 16px var(--shadow-light),
        inset 1px 1px 2px rgba(255,255,255,0.8),
        inset -1px -1px 2px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.org-node.structural-node:active {
    transform: scale(0.98);
    box-shadow: 
        4px 4px 8px var(--shadow-dark), 
        -4px -4px 8px var(--shadow-light);
}

/* Dots perfectly embedded into the bottom rim */
.dots-container {
    position: absolute;
    bottom: -16px; /* Sits right on the edge now */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px; 
    justify-content: center;
}

.connection-dot {
    width: 10px;
    height: 10px;
    background-color: var(--line-color);
    border-radius: 50%;
    z-index: 5;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4);
}

.org-node.profile-node {
    background: var(--bg-color);
    padding: 12px 20px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    min-width: 200px;
    z-index: 2;
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
}

/* Lines draw behind capsules so origin gaps are invisible */
#connector-lines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1; 
    overflow: visible;
}

/* Zoom Controls & Legend */
.zoom-controls {
    position: fixed;
    bottom: 30px;
    left: 40px;
    display: flex;
    gap: 12px;
    z-index: 1000;
}
.zoom-controls button {
    background: var(--bg-color);
    border: none;
    color: var(--text-blue);
    width: 45px;
    height: 45px;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
    transition: all 0.2s ease;
}
.zoom-controls button:hover { color: #fff; background: var(--text-blue); }
.zoom-controls button:active { box-shadow: inset 3px 3px 6px rgba(0,0,0,0.2); }

.legend-btn {
    position: fixed;
    bottom: 30px;
    right: 40px;
    padding: 12px 30px;
    background: var(--bg-color);
    color: var(--text-blue);
    font-weight: 800;
    border-radius: 30px;
    box-shadow: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
}
.legend-btn:hover { color: #fff; background: var(--text-blue); }

.legend-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(232, 235, 238, 0.85);
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000;
}
.legend-modal.hidden { display: none; }
.legend-content {
    background: var(--bg-color);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 10px 10px 20px var(--shadow-dark), -10px -10px 20px var(--shadow-light);
    width: 380px; text-align: center;
}
.legend-list { list-style: none; padding: 20px 0; text-align: left; }
.legend-list li { display: flex; align-items: center; gap: 15px; margin: 15px 0; font-size: 15px; font-weight: 700; color: var(--text-blue); }
.legend-color { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.md-color { background-color: #2EA84A; }
.emp-color { background-color: #0F58A0; }
.comp-color { background-color: var(--bg-color); box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2); border: 2px solid var(--text-blue); }
.legend-close-btn { 
    background: var(--text-blue); color: white; border: none; padding: 10px 25px; border-radius: 20px; 
    cursor: pointer; font-weight: bold; width: 100%; font-size: 16px; box-shadow: 0 4px 10px rgba(0,75,147,0.3);
}


/* --- Add to bottom of assets/css/style.css --- */

/* Navigation & Breadcrumbs */
.nav-header {
    position: fixed;
    top: 30px;
    left: 40px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-header.hidden { display: none !important; }
.btn-back {
    background: var(--text-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,75,147,0.3);
    transition: transform 0.1s;
}
.btn-back:active { transform: scale(0.95); }
.breadcrumb {
    background: var(--bg-color);
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: 800;
    color: var(--text-blue);
    border: 2px solid var(--text-blue);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1);
}

/* Clickable Nodes */


/* 2-Column Spine Layout */
.spine-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 80px; /* Vert gap, Horiz gap */
    margin-top: 40px;
}
.spine-layout > .org-branch {
    margin-top: 0 !important; /* Removes stagger for spine items */
}


/* --- New Employee Profile Node Design --- */
.profile-node {
    position: relative;
    /* CRITICAL FIX: Increased to 80px to push the box down and reveal the line! */
    margin-top: 80px !important; 
    background: #ffffff;
    border-radius: 30px;
    padding: 55px 20px 20px; 
    min-width: 240px;
    max-width: 260px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 2px solid var(--node-color, #0F58A0);
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center;
}

.profile-pic-wrapper {
    position: absolute;
    top: -60px; /* Keeps the picture floating above the box */
    left: 50%;
    transform: translateX(-50%);
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: #ffffff;
    padding: 4px;
    border: 3px solid var(--node-color, #0F58A0);
    z-index: 5;
}

.profile-pic-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.no-pic {
    width: 100%;
    height: 100%;
    background: #e8ebee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 11px;
    font-weight: bold;
}

.profile-pic-wrapper::before {
    content: '';
    position: absolute;
    top: -12px; left: -12px; right: -12px; bottom: -12px;
    border-radius: 50%;
    background: var(--node-color, #0F58A0);
    opacity: 0.15;
    z-index: -1;
}

.profile-details {
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-details > div:first-child {
    white-space: normal; 
    line-height: 1.2;
}

/* Ensure the profile picture stays on top of the JavaScript line */
.profile-node .profile-pic-wrapper {
    z-index: 5;
}





/* --- Bridge the invisible gap to reconnect the chart lines --- */
.org-children > .org-branch > .profile-node::after {
    content: '';
    position: absolute;
    top: -65px; /* Reaches exactly up through the 65px margin */
    left: calc(50% - 1px);
    width: 2px; /* Standard line thickness */
    height: 65px;
    background: #666; /* Dark grey line matching your design */
    z-index: 1; 
}

/* Ensure the profile picture stays on top of the newly drawn line */
.profile-node .profile-pic-wrapper {
    z-index: 5;
}