/* === Variables === */
:root {
    --nav-background-colour: light-dark(#CABEA9, #262A63);
    --guide-line: rgba(15, 23, 42, 0.2); /* 20% opacity of text-ink */
}

/* === Outside Navigation Styles === */

/* Main Workspace Area (Non-navigation area */
.workspace {
    flex: 1;
    padding: 40px 24px 100px 24px;
    overflow-y: auto;
}

.breadcrumb {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 8px;
}

h1 {
    font-size: 24pt;
    margin-bottom: 14px;
}

.dummy-card {
    background: rgba(15, 23, 42, 0.05);
    height: 120px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px dashed var(--guide-line);
}

/* === Main Navigation Mobile Styles === */

/* Fixed (always on screen) top bar containing the hamburger button */
.mobile-hamburger-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(16px + 44px + 16px); /* top padding + hamburger size + bottom padding */
    background: light-dark(rgba(202, 190, 169, 0.7), rgba(38, 42, 99, 0.7)); /* Semi-transparent backdrop */
    backdrop-filter: blur(4px); /* Optional: add a blur effect */
    z-index: 1000; /* Above the page but below the nav */
}

/* The hamburger button itself (to open main navigation drawer) */
.mobile-hamburger {
    display: block;
    width: 44px;
    height: 44px;
    position: absolute;
    top: 16px;
    left: 16px;
    cursor: pointer;
}

/* The main navigation drawer that slides in from the left */
.main-nav {
    /* POSITIONING - Fixed to screen, essentially removing it from the header flow */
    position: fixed; 
    top: 0;
    left: -80%; /* Start off-screen to the left */
    bottom: 0;

    /* WIDTH - Drawer width */
    width: 80%; /* Don't cover full screen so they see the backdrop */
    max-width: 300px; /* Standard drawer width */

    /* BACKGROUND */
    background: var(--nav-background-colour);
    
    /* BORDER */
    /*border-bottom: 1px solid var(--surface-3);
    box-shadow: var(--shadow-3);*/
    
    /* LAYOUT - Vertical column */
    display: none; /* Hidden so that Assistive Tech (ex. screen readers) doesn't read it when closed */
    flex-direction: column;
    align-items: stretch;

    /* GAP - space between nav items and sections */
    gap: 24px;
    
    /* SPACING */
    padding: 24px;

    /* OVERFLOW - Allow scrolling INSIDE the menu if it's taller than screen */
    overflow-y: auto;

    /* Z-INDEX - Above backdrop and content */
    z-index: 1100;
}

/* When the main nav is open, we want to make it visible and trigger the slide-in animation */
.main-nav.open {
    display: flex; /* Make it visible */
    
    /* ANIMATION - Slide in from left */
    transform: translateX(calc(100% + 48px)); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The backdrop that appears behind the main nav when it's open */
.mobile-backdrop {}

/* The close button inside the main nav */
.close-main-nav-btn {
    align-self: flex-start;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-colour);
    cursor: pointer;
}

/* Main nav content styles */
.main-nav ul {
    list-style: none;
}

.main-nav ul li {
    min-width: 100%;
}

.main-nav ul li a {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-colour);
    text-decoration: none;
    font-weight: 500;
}

/* For all non-current event "in event" navs, we want JUST the top level link */
.in-event-nav {
    display: block;
}

/* show the current event "in event" nav */
.in-event-nav.current-event {
    position: fixed; 
    bottom: -100%; 
    left: 0; 
    width: 100%; 
    height: 80vh;
    background: var(--nav-background-colour);
    border-top: 1px solid var(--guide-line);
    border-radius: 24px 24px 0 0; 
    z-index: 20;
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    display: none; 
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
}

.in-event-nav.current-event.sheet-open {
    bottom: 0;
    display: flex;
}

/* === MOBILE-FIRST BASE STYLES === */

.app-layout { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    overflow: hidden; 
    min-width: 100%;
}

/* Persistent bottom Nav / Sheet Trigger */
.bottom-nav {
    background-color: var(--nav-background-colour);
    border-top: 1px solid var(--guide-line);
    padding: 16px 24px 32px 24px; /* Extra bottom padding for mobile safe area */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

/* Mobile Trigger Bar */
.mobile-trigger-bar {
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%;
    background: var(--nav-background-colour); 
    border-top: 1px solid var(--guide-line);
    padding: 16px 24px 32px 24px; 
    z-index: 10;
}

.sheet-trigger {
    background-color: var(--primary-background-colour);
    color: var(--primary-text-colour);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* The Bottom Sheet */

.nav-header {
    /*padding: 24px;*/
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--guide-line);
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-colour);
    cursor: pointer;
}

/* For all non-current event "in event" navs, we want JUST the top level link */
.in-event-nav .nav-content {
    display: none;
}

/* Terminal Tree Navigation inside Sheet */
.in-event-nav.current-event .nav-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    display: inline;
}

.tree-list {
    list-style: none;
    position: relative;
}

.tree-list ul {
    display: none; 
    margin-left: 14px; 
    padding-left: 14px; 
    border-left: 1px solid var(--guide-line); 
    margin-top: 8px;
}

.tree-list ul.open {
    display: block;
}

.tree-item {
    margin-bottom: 12px;
}

.tree-row {
    display: flex;
    align-items: center/*flex-start*/;
    gap: 12px;
    height: 100%;
}

/* The + / - Terminal Box */
.toggle-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Aligns the box with the first line of text */
    flex-shrink: 0; /* Prevents squishing on small screens */
    margin-top: -4px; /* Aligns with first line of wrapped text */
}

.toggle-box {
    width: 24px;
    height: 24px;
    border: 1px solid var(--text-colour);
    border-radius: 4px; /* Slightly softer corners for the more Basecamp vibe */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    background: var(--nav-background-colour);
    color: var(--text-colour);
}

.tree-label {
    font-size: 1.125rem;
    line-height: 1.5;
    cursor: pointer;
    padding-top: 4px;
}

/* Highlight current active page */
.active-page {
    font-weight: 700;
    color: var(--secondary-colour);
}

/* === DESKTOP BREAKPOINT (Sidebar Mode) ==== */
@media (min-width: 828px) {
    /* Morph the layout into a CSS Grid */
    .app-layout { 
        flex-direction: row; 
        display: grid; 
        grid-template-columns: 320px 1fr; 
    }
    
    /* Kill the mobile trigger */
    .mobile-trigger-bar { 
        display: none; 
    }

    .mobile-hamburger-wrapper {
        display: none;
    }

    .close-main-nav-btn {
        display: none;
    }
    
    /* Morph the sheet into a persistent sidebar */
    .main-nav {
        position: static; /* Removes it from fixed positioning */
        height: 100vh;
        width: 100%;
        border-radius: 0;
        border-top: none;
        border-right: 1px solid var(--guide-line);
        box-shadow: none;
        transform: none; /* overrides any transition states */
        align-items: flex-start;
        display: flex;
    }

    .in-event-nav.current-event {
        display: block;
        position: relative;
        background: transparent;
        height: auto;
    }

    /* On Desktop, we want all the "in event" nav content to show, since we have the space for it */
    .in-event-nav .nav-content {
        padding: 24px;
        overflow-y: auto;
        flex: 1;
        display: inline;
    }
    
    /* Hide the mobile close button */
    .close-btn {
        display: none;
    }
    
    .workspace {
        padding-bottom: 24px; /* remove mobile nav padding */
    }
}