/* Life at FinPluss - Mobile-Responsive Tree Design */

:root {
    --primary-orange: #f7941d;
    --orange-gradient: linear-gradient(180deg, #ffa733 0%, #f7941d 100%);
    --shadow-orange: 0 4px 10px rgba(247, 148, 29, 0.3);
    --node-border-radius: 8px;
    --node-width: 180px;
    --node-height: 48px;
    --line-color: #444444; 
}

.org-chart-container {
    padding: 60px 0;
    background: #ffffff;
    overflow-x: auto;
    text-align: center;
}

.org-chart-header {
    margin-bottom: 50px;
}

.org-chart-header h1 {
    font-size: 2rem;
    color: #1a365d;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tree Structure Base */
.tree {
    display: inline-block;
}

.tree * {
    margin: 0;
    padding: 0;
}

.tree ul {
    padding-top: 30px;
    position: relative;
    transition: all 0.5s;
    white-space: nowrap;
    display: block;
}

.tree li {
    display: inline-block;
    vertical-align: top;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 30px 4px 0 4px;
    transition: all 0.5s;
}

/* Connectors - Horizontal (Desktop) */
.tree li::before, .tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid var(--line-color);
    width: 50%;
    height: 30px;
}

.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid var(--line-color);
}

.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}

.tree li:only-child {
    padding-top: 0;
}

.tree li:first-child::before, .tree li:last-child::after {
    border: 0 none;
}

.tree li:last-child::before {
    border-right: 2px solid var(--line-color);
    border-radius: 0 8px 0 0;
}

.tree li:first-child::after {
    border-radius: 8px 0 0 0;
}

/* Downward connectors from parents */
.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid var(--line-color);
    width: 0;
    height: 30px;
    margin-left: -1px;
}

/* Node Styling */
.tree li .node {
    width: var(--node-width);
    height: var(--node-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--node-border-radius);
    background: var(--orange-gradient);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
    box-shadow: var(--shadow-orange);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-sizing: border-box;
    font-size: 0.75rem;
    white-space: normal;
    padding: 4px 8px;
    line-height: 1.1;
}

.tree li .node i {
    margin-right: 8px;
    font-size: 0.9rem;
}

/* Node arrow (top) - Points INTO the node */
.node::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--line-color);
    background: transparent;
    z-index: 11;
    top: -8px; 
}

/* Node dot (bottom) - Where the line starts */
.node::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--line-color);
    border-radius: 50%;
    z-index: 1;
    bottom: -6px;
}

/* Remove arrows/dots from the very top of tree (CEO) */
.tree > ul > li > .node::before { display: none; } 

/* Remove bottom dot from last items (leaf nodes) */
.tree li:not(:has(ul)) > .node::after { display: none; }

.node:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(247, 148, 29, 0.5);
}

/* Scroll Hint (Desktop only) */
.scroll-hint { display: none; margin-bottom: 20px; color: #718096; }

@media (min-width: 993px) and (max-width: 1200px) {
    .scroll-hint { display: block; text-align: center; }
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 992px) {
    .org-chart-container {
        padding: 40px 15px;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }

    .tree {
        width: 100%;
        min-width: auto;
        display: block;
    }

    .tree ul {
        display: block;
        padding-top: 30px;
        white-space: normal;
    }

    .tree li {
        display: block;
        padding: 30px 0 0 0;
        width: 100%;
    }

    /* Disable horizontal connectors on mobile */
    .tree li::before, .tree li::after {
        display: none;
    }

    /* Maintain vertical line coming from parent */
    .tree ul ul::before {
        height: 30px;
        left: 50%;
    }

    /* Smaller spacing for mobile nodes */
    .tree li .node {
        margin: 0 auto;
        width: 220px; /* Slightly wider for mobile text readability */
        font-size: 0.8rem;
    }

    /* Ensure vertical chains continue to look like a stack */
    .tree ul ul {
        padding-top: 0;
    }
    
    .tree li > ul {
        padding-top: 30px;
    }
}
