/* site-navigation.css - Complete Navigation System Styles */

/* ========== VARIABLES (if not defined elsewhere) ========== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1420;
    --bg-tertiary: #1a1f2e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-dim: #707070;
    --accent-bio: #00ff7f;
    --accent-crystal: #00ffff;
    --accent-psi: #ff00ff;
    --accent-tech: #ffa500;
    --border: #2a2f3e;
    --hover: rgba(0, 255, 127, 0.1);
}

/* ========== NAV BAR (STICKY TOP) ========== */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right {
    display: flex;
    align-items: center;
}

/* Nav buttons - visible by default (mobile first) */
.nav-button {
    display: flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    color: var(--accent-bio);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background: var(--hover);
    border-color: var(--accent-bio);
}

.nav-button.active {
    background: var(--accent-bio);
    color: var(--bg-primary);
    border-color: var(--accent-bio);
}

.nav-home {
    color: var(--accent-bio);
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.nav-home:hover {
    color: var(--accent-crystal);
}

/* Mobile first - show icon only */
.nav-home-icon {
    display: block;
    font-size: 1.5rem;
}

.nav-home-text {
    display: none;
}

.nav-title {
    flex: 1;
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile first - show short title */
.nav-title-full {
    display: none;
}

.nav-title-short {
    display: block;
}

/* ========== MAIN SIDEBAR (LEFT) ========== */
.main-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: 250px;
    height: calc(100vh - 60px);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 90;
    padding: 1.5rem;
    transition: transform 0.3s ease;
    /* Mobile first - hidden by default */
    transform: translateX(-100%);
}

.main-sidebar.active {
    transform: translateX(0);
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

/* Sidebar close button - visible on mobile */
.sidebar-close {
    display: flex;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.sidebar-close:hover {
    color: var(--accent-bio);
}

/* Sidebar items */
.main-sidebar-item {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    position: relative;
}

.main-sidebar-item:hover {
    background: var(--hover);
    color: var(--accent-crystal);
    border-left-color: var(--accent-crystal);
}

.main-sidebar-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-bio);
    border-left-color: var(--accent-bio);
}

/* Index item special style */
.main-sidebar-item[data-section="index"] {
    margin-bottom: 1rem;
    padding: 0.75rem 0.5rem;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-bio);
}

.main-sidebar-item[data-section="index"] h3 {
    color: var(--accent-bio);
    font-size: 0.9rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.main-sidebar-item[data-section="index"]:hover {
    background: var(--hover);
    border-left-color: var(--accent-bio);
}

.main-sidebar-item[data-section="index"]:hover h3 {
    color: var(--accent-crystal);
}

/* Status indicators */
.main-sidebar-item.completed::after {
    content: "✓";
    float: right;
    color: var(--accent-bio);
}

.main-sidebar-item.wip::after {
    content: "⏳";
    float: right;
    color: var(--accent-tech);
}

/* ========== QUICK NAV (RIGHT TOC) ========== */
.quick-nav {
    position: fixed;
    right: 0;
    top: 60px;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 60px);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow: hidden;
    z-index: 95;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    /* Mobile first - hidden by default */
    transform: translateX(100%);
}

.quick-nav.active {
    transform: translateX(0);
    box-shadow: -2px 0 10px rgba(0,0,0,0.3);
}

/* Quick nav close button - visible on mobile */
.quicknav-close {
    display: flex;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: color 0.3s ease;
}

.quicknav-close:hover {
    color: var(--accent-bio);
}

/* Quick nav header */
.quick-nav-header {
    padding: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.quick-nav-header h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--accent-bio);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Quick nav content */
.quick-nav-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    padding-top: 0.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}


/* Quick nav items */
.quick-nav-h1 {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--accent-bio);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    border-left: 3px solid var(--accent-bio);
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
}

.quick-nav-h1:hover:not(.nav-no-link) {
    background: var(--hover);
    color: var(--accent-crystal);
}

.quick-nav-h2 {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.quick-nav-h2:hover {
    color: var(--accent-bio);
    background: var(--hover);
    border-left-color: var(--accent-bio);
}

.quick-nav-h2.active {
    color: var(--accent-bio);
    background: var(--bg-tertiary);
    border-left-color: var(--accent-bio);
}

.quick-nav-h3 {
    display: block;
    padding: 0.375rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.quick-nav-h3:hover {
    color: var(--accent-crystal);
    background: var(--hover);
    border-left-color: var(--accent-crystal);
}

.quick-nav-h3.active {
    color: var(--accent-crystal);
    background: var(--bg-tertiary);
    border-left-color: var(--accent-crystal);
}

.quick-nav-h4 {
    display: block;
    padding: 0.3rem 0.75rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.85;
}

.quick-nav-h4:hover {
    color: var(--accent-crystal);
    background: var(--hover);
    border-left-color: var(--accent-crystal);
    opacity: 1;
}

.quick-nav-h4.active {
    color: var(--accent-crystal);
    background: var(--bg-tertiary);
    border-left-color: var(--accent-crystal);
    opacity: 1;
}

/* Non-clickable items */
.nav-no-link {
    opacity: 0.5;
    cursor: default;
    font-style: italic;
    pointer-events: none;
}

.nav-no-link:hover {
    background: none !important;
    color: inherit !important;
    border-left-color: transparent !important;
}

/* Wrappers */
.quick-nav-h2-wrapper {
    margin-left: 0;
    margin-bottom: 0.5rem;
}

.quick-nav-h3-wrapper {
    margin-left: 1rem;
}

.quick-nav-h4-wrapper {
    margin-left: 0.5rem;
}

/* ========== PAGE FOOTER NAVIGATION ========== */
.page-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 4rem;
    margin-bottom: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.page-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.page-nav a:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-bio);
    color: var(--accent-bio);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 127, 0.1);
}

.nav-prev, .nav-next {
    margin: 0;
}

/* ========== BACK TO TOP BUTTON ========== */
.back-to-top {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 45px;
    background: var(--accent-bio);
    color: var(--bg-primary);
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 70;
    box-shadow: 0 4px 12px rgba(0, 255, 127, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-crystal);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 255, 127, 0.4);
}

/* ========== CONTAINER ADJUSTMENTS ========== */
.container {
    margin-top: 60px;
    padding: 1rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Overlay for mobile menus */
body.sidebar-open::before,
body.quicknav-open::before {
    content: '';
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 85;
}

/* ========== RESPONSIVE - TABLET (768px+) ========== */
@media (min-width: 768px) {
    .nav-home-text {
        display: block;
    }
    
    .nav-home-icon {
        display: none;
    }
    
    .nav-title {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .nav-title-full {
        display: block;
    }
    
    .nav-title-short {
        display: none;
    }
    
    .container {
        padding: 2rem;
    }
    
    .quick-nav {
        right: 00px;
        top: 80px;
        width: 250px;
        max-width: none;
        height: auto;
        max-height: calc(100vh - 100px);
        border-radius: 8px;
        border-left: 1px solid var(--border);
    }
    
    .page-nav {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .page-nav a {
        width: auto;
        justify-content: flex-start;
    }
    
    .nav-prev {
        margin-right: auto;
    }
    
    .nav-next {
        margin-left: auto;
    }
    
    .back-to-top {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}


/* ========== RESPONSIVE - DESKTOP (1200px+) ========== */
@media (min-width: 1200px) {
    /* Show left sidebar, hide left button */
    .main-sidebar {
        transform: translateX(0);
        box-shadow: none;
    }
    
    .main-sidebar.active {
        box-shadow: none;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .sidebar-close {
        display: none;
    }
    
    /* Container adjusts for left sidebar */
    .container.with-sidebar {
        margin-left: 270px;
    }
}

/* ========== RESPONSIVE - MEDIUM DESKTOP (1200px-1599px) ========== */
@media (min-width: 1200px) and (max-width: 1399px) {
    /* Quick nav hidden but toggleable */
    .quick-nav {
        transform: translateX(calc(100% + 30px));
    }
    
    .quick-nav.active {
        transform: translateX(0);
    }
    
    /* Keep quick nav button visible */
    .quick-nav-toggle {
        display: flex !important;
    }
}

/* ========== RESPONSIVE - LARGE DESKTOP (1600px+) ========== */
@media (min-width: 1200px) {
    /* Show both sidebars, hide all buttons */
    .nav-button {
        display: none !important;
    }
    
    .quick-nav {
        transform: translateX(0);
        box-shadow: none;
    }
    
    .quick-nav.active {
        box-shadow: none;
    }
    
    .quicknav-close {
        display: none;
    }
    
    /* Container adjusts for both sidebars */
    .container.with-sidebar {
        margin-right: 290px;
    }
}

/* ========== RESPONSIVE - VERY SMALL MOBILE ========== */
@media (max-width: 480px) {
    .nav-title {
        font-size: 0.75rem;
    }
    
    .nav-button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* ========== QUICK NAV ACCORDION STYLES ========== */
.quick-nav-accordion-item {
    margin-bottom: 0.25rem;
}

.quick-nav-accordion-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    border-radius: 4px;
    padding: 2px 0;
}

.quick-nav-accordion-header:hover {
    background: var(--bg-tertiary);
}

.quick-nav-accordion-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    margin-left: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1;
    transition: transform 0.3s ease, color 0.2s ease;
    flex-shrink: 0;
    text-align: center;
}

.quick-nav-accordion-icon.rotated {
    transform: rotate(-90deg);
}

.quick-nav-accordion-header .quick-nav-h2 {
    flex: 1;
    margin: 0;
}

.quick-nav-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 24px;
}

.quick-nav-accordion-content.expanded {
    max-height: 800px; /* Adjust as needed for longer sections */
    overflow-y: auto;
}

/* Hover effect for accordion header */
.quick-nav-accordion-header:hover .quick-nav-accordion-icon {
    color: var(--accent-bio);
}