/* ==========================================================================
   Animated Background CSS — Floating Particles with Neural Connections
   ========================================================================== */

/* ---- Container: sits behind all content, covers the full viewport -------- */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* ---- Clean backdrop with subtle overlay for readability ------------------ */
.animated-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg, #ffffff);
    background: linear-gradient(var(--bg, #ffffff), var(--bg, #ffffff));
    opacity: 0.92;
    z-index: 1;
}

/* Ensure content sections have readable backgrounds */
.page-content-wrapper section {
    position: relative;
    z-index: 10;
}

/* ---- Canvas element styling --------------------------------------------- */
.animated-particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: block;
}

/* ---- When user prefers reduced motion, hide the canvas ------------------- */
.animated-bg.reduced-motion {
    display: none;
}

/* ---- Ensure page content stays above the animation ---------------------- */
.page-content-wrapper {
    position: relative;
    z-index: 10;
}

/* ---- Centered nav controls (particle toggle + dark mode) --------------- */
.navbar-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

/* ---- Nav toggle button styling ------------------------------------------ */
.nav-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent, #800000);
    background: rgba(255, 255, 255, 0.85);
    color: var(--accent, #800000);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.nav-toggle-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.3);
}

.nav-toggle-btn:active {
    transform: scale(0.9);
}

.nav-toggle-btn:focus {
    outline: 2px solid var(--accent, #800000);
    outline-offset: 2px;
}

.nav-toggle-btn.active {
    background: rgba(128, 0, 0, 0.1);
    color: var(--accent, #800000);
    border-color: rgba(128, 0, 0, 0.3);
}

/* ---- Dark mode support -------------------------------------------------- */
body.dark-mode .animated-bg::before {
    background: var(--bg, #121212);
}

body.dark-mode .nav-toggle-btn {
    background: rgba(30, 30, 30, 0.85);
    color: #ffffff;
    border-color: var(--accent, #800000);
}

body.dark-mode .nav-toggle-btn:hover {
    background: rgba(40, 40, 40, 0.95);
    border-color: var(--accent-hover, #6b0000);
}

body.dark-mode .navbar .navbar-light .navbar-brand,
body.dark-mode .navbar .navbar-light .nav-link,
body.dark-mode .navbar .navbar-light .navbar-brand .brand-title,
body.dark-mode .navbar .navbar-light .brand-subtitle {
    color: var(--text, #ffffff);
}

body.dark-mode .navbar .navbar-light .nav-link.active {
    color: var(--accent, #800000);
}

/* ---- Mobile: smaller nav controls --------------------------------------- */
@media (max-width: 991.98px) {
    .navbar-center {
        justify-content: center;
        padding: 0.5rem 0;
    }

    .nav-toggle-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}
