/* Organization Chart Styles - Modern/Futuristic */
:root {
    --chart-bg: #0b0c10;
    --chart-line: #00d2ff;
    --chart-line-dim: rgba(0, 210, 255, 0.2);
    --primary-neon: #00d2ff;
    --secondary-neon: #ffcc00;
    --accent-red: #ff3333;
    --accent-green: #33ff99;
    --card-bg: rgba(11, 15, 25, 0.9);
    --font-head: 'Orbitron', 'Oswald', sans-serif;
    --font-body: 'Roboto', sans-serif;
    
    --level-1-color: #ffffff; /* Strategic Command */
    --level-2-color: #ffcc00; /* Branches */
    --level-3-color: #00d2ff; /* Wings/Groups */
    --level-4-color: #ffffff; /* Squadrons */
}

body {
    background-color: transparent;
    overflow-x: hidden;
    margin: 0;
    min-height: 100vh;
}

/* Background Grid Animation reused */
.video-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, #1b222c 0%, #050505 100%);
}
.video-bg-container::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(600px) rotateX(60deg);
    opacity: 0.5;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: perspective(600px) rotateX(60deg) translateY(0); }
    100% { transform: perspective(600px) rotateX(60deg) translateY(50px); }
}

/* Hero Section */
.hero.aircraft-hero {
    height: 50vh;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* border-bottom: 2px solid var(--primary-neon); */
}
.hero-title {
    font-family: 'krinkes decor';
    font-size: 4rem;
    color: #fff;
    /* text-shadow: 0 0 20px rgba(0,210,255,0.6); */
}

/* ------------------------------------------------------------------ */
/* ORGANIZATIONAL CHART TREE CSS */
/* ------------------------------------------------------------------ */
.org-section {
    padding: 80px 20px;
    overflow-x: auto; /* Allow scrolling if chart gets too wide */
    width: 100%;
    display: flex;
    justify-content: center;
}

.tree {
    display: table; /* Ensures width wraps content */
    margin: 0 auto;
    padding-bottom: 60px;
}

.tree ul {
    padding-top: 40px; 
    position: relative;
    transition: all 0.5s;
    display: flex;
    justify-content: center;
    padding-left: 0; /* Reset default ul padding */
}

/* Connecting Lines Logic */
.tree li {
    float: left; 
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px; /* COMPACTED: Reduced padding */
    transition: all 0.5s;
}

/* Vertical lines connecting to children */
.tree li::before, .tree li::after {
    content: '';
    position: absolute; 
    top: 0; 
    right: 50%;
    border-top: 2px solid var(--chart-line);
    width: 50%; 
    height: 40px;
    z-index: -1;
}
.tree li::after {
    right: auto; 
    left: 50%;
    border-left: 2px solid var(--chart-line);
}

/* Remove connectors for single children or edges */
.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;
}

/* Adding the vertical connector from parent to children block */
.tree li:last-child::before {
    border-right: 2px solid var(--chart-line);
    border-radius: 0 5px 0 0;
}
.tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

/* Downward connector from parent node */
.tree ul ul::before {
    content: '';
    position: absolute; 
    top: 0; 
    left: 50%;
    border-left: 2px solid var(--chart-line);
    width: 0; 
    height: 40px;
    transform: translateX(-50%);
}

/* NODE STYLES - COMPACT */
.node-card {
    display: inline-block;
    padding: 10px 15px; /* Reduced padding */
    text-decoration: none;
    background: var(--card-bg);
    border: 1px solid var(--chart-line-dim);
    border-radius: 8px;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    min-width: 140px; /* Reduced min-width */
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 10;
} 

/* Hover brightness */
.node-card:hover {
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
    border-color: var(--primary-neon);
    transform: translateY(-5px);
    background: rgba(20, 30, 45, 1);
}

/* Typography in Nodes */
.node-title {
    font-family: var(--font-head);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1rem;
    color: #fff;
    margin-bottom: 5px;
    letter-spacing: 1px;
}
.node-subtitle {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #cbd5e1;
    font-weight: 400;
}

/* Branch Logos */
.branch-logo {
    height: 60px;
    width: auto;
    display: block;
    margin: 0 auto 10px auto;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.2));
    transition: transform 0.3s ease;
}

.node-card:hover .branch-logo {
    transform: scale(1.1);
}


/* Level Specific Styles */

/* Root Node */
.root-node .node-card {
    background: linear-gradient(135deg, #1e293b, #0f172e);
    border: 2px solid #fff;
    padding: 20px 40px;
}
.root-node .node-title {
    font-size: 1.4rem;
    color: #fff;
}
.root-node .node-subtitle {
    color: #94a3b8;
    font-size: 1rem;
    font-weight: 700;
}

/* Branch Headers (USAF, NAVY, etc.) */
.branch-node .node-card {
    background: rgba(5, 50, 80, 0.8);
    border-top: 4px solid var(--secondary-neon);
}
.branch-node .node-title {
    color: var(--secondary-neon);
    font-size: 1.1rem;
}

/* Wing/Regiment Headers */
.wing-node .node-card {
    background: rgba(30, 20, 10, 0.8);
    border-left: 4px solid var(--primary-neon);
    min-width: 140px; /* Reduced */
}

/* Squadron Links (Final Leafs) */
a.squad-link {
    cursor: pointer;
    border: 1px solid var(--primary-neon);
    background: linear-gradient(180deg, rgba(0,210,255,0.1) 0%, rgba(0,0,0,0.8) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* Reduced gap */
    padding: 10px; /* Reduced padding */
    min-width: 150px; /* Reduced from 220px */
    text-decoration: none;
}

a.squad-link:hover {
    background: linear-gradient(180deg, rgba(0,210,255,0.2) 0%, rgba(0,0,0,0.9) 100%);
    box-shadow: 0 0 30px rgba(0,210,255,0.3);
}

a.squad-link img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
    transition: transform 0.3s;
}
a.squad-link:hover img {
    transform: scale(1.15) rotate(5deg);
}

.squad-name {
    font-family: var(--font-head);
    color: var(--primary-neon);
    font-size: 0.85rem; /* Reduced */
    font-weight: 700;
}
.squad-alias {
    font-family: 'krinkes decor';
    color: #fff;
    font-size: 1.3rem; /* Reduced */
    text-shadow: 0 0 5px var(--primary-neon);
}

/* Flag/Branch Indicators specific styling */
.branch-usaf .node-card { border-color: #003366; border-top-color: #003366; color: #fff; }
.branch-army .node-card { border-color: #4b5320; border-top-color: #4b5320; }
.branch-navy .node-card { border-color: #000080; border-top-color: #000080; }
.branch-spain .node-card { border-color: #aa151b; border-top-color: #f1bf00; }

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .org-section {
        justify-content: flex-start; /* Align left to scroll */
    }
}

/* RESPONSIVE VERTICAL STACK FOR MOBILE & LAPTOPS */
@media (max-width: 1366px) {
    .org-section {
        padding: 40px 10px;
        overflow-x: hidden; /* Prevent horizontal scroll */
        justify-content: center;
        width: 100vw;
    }

    .tree {
        display: block;
        width: 100%;
        padding-bottom: 20px;
        transform: none;
    }

    /* Reset Flex and Floats */
    .tree ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 0;
        margin: 0;
    }

    .tree li {
        float: none;
        display: block;
        width: 100%;
        padding: 20px 0 0 0;
        text-align: center;
    }

    /* Disable Horizontal Connectors */
    .tree li::before, 
    .tree li::after,
    .tree ul ul::before,
    .tree li:last-child::before,
    .tree li:first-child::after {
        display: none !important;
    }

    /* Vertical Connector Lines for Mobile */
    /* Add a simple line down the middle between elements */
    .tree ul li {
        position: relative;
    }
    
    .tree ul li::after {
        content: '';
        position: absolute;
        top: -20px; /* Connect to item above */
        left: 50%;
        border-left: 2px solid var(--chart-line);
        height: 20px;
        width: 0;
        display: block !important;
        transform: translateX(-50%);
    }

    /* Hide connector for the very first root item */
    .tree > ul > li:first-child::after {
        display: none !important;
    }

    /* Card sizing */
    .node-card, a.squad-link {
        width: 90%;
        max-width: 350px;
        margin: 0 auto;
        min-width: unset;
        box-sizing: border-box;
    }
    
    a.squad-link {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        padding: 15px;
    }
    
    .squad-link img {
        width: 50px;
        height: 50px;
        margin-right: 15px;
        margin-bottom: 0;
    }
    
    .squad-name {
        font-size: 0.9rem;
    }
    
    .squad-alias {
        font-size: 1.2rem;
    }
}
}