/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: rgba(255, 255, 255, 1.00); 
   /* background-color: #f4f4f9;*/
    padding-top: 70px;
    padding-bottom: 70px;
}

.content {
    padding: 20px;
    text-align: center;
}

/* Core Navigation Bar Styling */
.navbar {
    position: fixed;
    width: 100%;
    /*background-color: #1e1e24; */
    background-color: rgba(000, 000, 070, 1.00); 
    /* color: #fff; */
    color: rgba(000, 000, 000, 1.00);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.top-nav { top: 0; }
.bottom-nav { bottom: 0; }

/* Main visible mobile strip containing Logo and Button */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    height: 60px;
}

.logo {
    font-weight: bold;
    color: rgba(255, 255, 255, 1.0);
    font-size: 1.2rem;
}

.toggle-btn {
    background: none;
    border: 1px solid #fff;
    color: #fff;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.toggle-btn:hover {
    background-color: #fff;
    color: #1e1e24;
}

/* Mobile-First Collapsible Section Layout */
.nav-links {
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    background-color: #2a2a32;
}

.nav-links a {
    color: #ddd;
    text-decoration: none;
    padding: 12px 20px;
    border-top: 1px solid #3a3a45;
    transition: 0.2s;
}

.nav-links a:hover {
    background-color: #3e3e4a;
    color: #fff;
}

/* Mobile Expansion Trigger */
.navbar.expanded .nav-links {
    max-height: 300px; 
}

/* ==========================================================================
   Desktop Layout Media Break Point (Screens larger than 768px wide)
   ========================================================================== */
@media (min-width: 769px) {
    /* Transform bars from stacked columns back into a single fluid row */
    .navbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 40px;
        height: 60px;
    }

    /* Hide the mobile toggle element completely */
    .toggle-btn {
        display: none;
    }

    /* Override mobile limits: show link area side-by-side with brand header */
    .navbar .nav-links {
        display: flex;
        flex-direction: row;
        max-height: none !important; /* Force expand link wrapper */
        overflow: visible;
        background-color: transparent;
    }

    .nav-links a {
        border-top: none;
        padding: 0 15px;
        height: 60px;
        line-height: 60px; /* Vertically align text to match the container bar */
    }

    .nav-links a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

// Toggles standard element expansion
function toggleNav(navId) {
    const navbar = document.getElementById(navId);
    if (navbar) {
        navbar.classList.toggle('expanded');
        
      // Toggles standard element expansion
function toggleNav(navId) {
    const navbar = document.getElementById(navId);
    if (navbar) {
        navbar.classList.toggle('expanded');
    }
}

// Global window event listener to intercept external clicks
window.addEventListener('click', function(event) {
    // Select all operational elements possessing the navbar selector
    const navbars = document.querySelectorAll('.navbar');
    
    navbars.forEach(navbar => {
        // Evaluate if the active nav is open, and verify if the user's
        // targeted click landed entirely outside of its boundary elements
        if (navbar.classList.contains('expanded') && !navbar.contains(event.target)) {
            navbar.classList.remove('expanded');
        }
    });
});
