/**
 * PERMANENT HORIZONTAL LAYOUT FIX - WORKING SOLUTION
 * Based on successful flex-wrap killer approach
 */

/* FORCE HORIZONTAL LAYOUT - NO WRAPPING */
.gm-level {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 12px !important;
    max-width: 1200px !important;
    margin: 0 auto 4rem !important;
    padding: 0 10px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

/* FORCE ALL GM NODES TO FIXED SIZE */
.gm-level .org-node {
    flex: 0 0 170px !important;
    width: 170px !important;
    min-width: 170px !important;
    max-width: 170px !important;
    height: 300px !important;
    margin: 0 !important;
    padding: 1.2rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* KILL ANY POTENTIAL FLEX-WRAP INHERITANCE */
.gm-level *,
.org-level.gm-level,
.org-level.gm-level * {
    flex-wrap: nowrap !important;
}

/* ENSURE CONTENT FITS PROPERLY */
.gm-level .node-content {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.gm-level .node-avatar {
    width: 70px !important;
    height: 70px !important;
    margin-bottom: 1rem !important;
    flex-shrink: 0 !important;
}

.gm-level .node-info {
    text-align: center !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

.gm-level .node-name {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    margin-bottom: 0.5rem !important;
    height: auto !important;
}

.gm-level .node-title {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
    opacity: 0.9 !important;
    margin: 0 !important;
}

/* RESPONSIVE BREAKPOINTS FOR HORIZONTAL LAYOUT */

/* Large screens - more space */
@media (min-width: 1400px) {
    .gm-level {
        max-width: 1300px !important;
        gap: 15px !important;
    }
    
    .gm-level .org-node {
        flex: 0 0 190px !important;
        width: 190px !important;
        min-width: 190px !important;
        max-width: 190px !important;
    }
}

/* Medium screens - keep horizontal */
@media (max-width: 1200px) and (min-width: 993px) {
    .gm-level {
        max-width: 1000px !important;
        gap: 10px !important;
    }
    
    .gm-level .org-node {
        flex: 0 0 150px !important;
        width: 150px !important;
        min-width: 150px !important;
        max-width: 150px !important;
        height: 280px !important;
        padding: 1rem !important;
    }
    
    .gm-level .node-avatar {
        width: 60px !important;
        height: 60px !important;
    }
    
    .gm-level .node-name {
        font-size: 0.8rem !important;
    }
    
    .gm-level .node-title {
        font-size: 0.7rem !important;
    }
}

/* Small screens - horizontal but scrollable */
@media (max-width: 992px) and (min-width: 769px) {
    .gm-level {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        max-width: 100% !important;
        gap: 8px !important;
        padding: 0 20px !important;
    }
    
    .gm-level .org-node {
        flex: 0 0 140px !important;
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
        height: 260px !important;
        padding: 0.8rem !important;
    }
    
    .gm-level .node-avatar {
        width: 50px !important;
        height: 50px !important;
        margin-bottom: 0.8rem !important;
    }
    
    .gm-level .node-name {
        font-size: 0.75rem !important;
    }
    
    .gm-level .node-title {
        font-size: 0.65rem !important;
    }
}

/* Mobile - finally allow vertical stacking */
@media (max-width: 768px) {
    .gm-level {
        flex-direction: column !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 15px !important;
        overflow-x: visible !important;
        max-width: 100% !important;
        padding: 0 15px !important;
    }
    
    .gm-level .org-node {
        flex: none !important;
        width: 100% !important;
        max-width: 280px !important;
        min-width: auto !important;
        height: 300px !important;
        padding: 1.5rem !important;
    }
    
    .gm-level .node-avatar {
        width: 80px !important;
        height: 80px !important;
        margin-bottom: 1rem !important;
    }
    
    .gm-level .node-name {
        font-size: 1rem !important;
    }
    
    .gm-level .node-title {
        font-size: 0.85rem !important;
    }
}

/* Debugging - temporary border to see layout */
/*
.gm-level {
    border: 2px solid red !important;
    background: rgba(255,0,0,0.1) !important;
}

.gm-level .org-node {
    border: 1px solid blue !important;
}
*/
