/* Vertical Header / Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    /* Base Glass Background */
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 2.5rem 2rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2rem;

    /* Refined Border: Higher contrast */
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.4);

    z-index: 100;
    transition: transform 0.3s ease;
    overflow: hidden;
    /* Ensure pseudo-elements stay contained */
}

/* Animated Ambient Glow / Mesh Gradient behind the glass */
.sidebar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.08), transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08), transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(217, 70, 239, 0.05), transparent 40%);
    z-index: -1;
    animation: sidebarAmbient 15s ease-in-out infinite alternate;
    pointer-events: none;
    opacity: 0.8;
}

@keyframes sidebarAmbient {
    0% {
        transform: rotate(0deg) translate(0, 0);
    }

    33% {
        transform: rotate(5deg) translate(20px, 30px);
    }

    66% {
        transform: rotate(-5deg) translate(-20px, 10px);
    }

    100% {
        transform: rotate(0deg) translate(0, 0);
    }
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center logo on desktop */
    width: 100%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 101;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

.logo {
    display: block;
    width: 100%;
    max-width: 150px;
    /* Limit width of the full logo */
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    /* Simple zoom effect */
}

.full-logo {
    width: 100%;
    max-width: 150px;
    /* Limit size */
    height: auto;
    display: block;
    /* transition is inherited from .logo */
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    /* Reduced for better grouping */
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.5s ease, transform 0.5s ease, box-shadow 0.5s ease;
    /* Added box-shadow */
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.nav-separator {
    height: 1px;
    margin: 1.5rem 15%;
    /* Match footer horizontal spacing */
    background: linear-gradient(90deg,
            transparent,
            var(--accent-color),
            transparent);
    box-shadow: 0 0 10px var(--accent-glow);
    opacity: 0.6;
    list-style: none;
}

.nav-links a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s ease;
}

.nav-links a svg {
    opacity: 0.7;
    transition: all 0.5s ease;
    position: relative;
    z-index: 2;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateX(5px);
}

.nav-links a:hover::before,
.nav-links a.active::before {
    opacity: 1;
}

.nav-links a:hover svg,
.nav-links a.active svg {
    opacity: 1;
    color: #fff;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center horizontally */
    text-align: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sidebar-footer .copyright {
    opacity: 0.6;
}

.sidebar-footer .footer-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center buttons */
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sidebar-footer button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.sidebar-footer button:hover {
    opacity: 1;
    color: #fff;
    text-decoration: underline;
}

/* Mobile / Tablet Responsive Styles */
@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        height: 80px;
        /* Collapsed height */
        padding: 0 1.5rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        flex-direction: column;
        justify-content: flex-start;
        /* Align items to top */
        transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        background: rgba(10, 15, 30, 0.85);
        /* Slightly more opaque on mobile */
    }

    .sidebar.active {
        height: 100vh;
        background: rgba(10, 15, 30, 0.95);
    }

    .header-top {
        height: 80px;
        /* Match collapsed height */
        justify-content: space-between;
        /* Logo left, Burger right */
        width: 100%;
        flex-shrink: 0;
    }

    .logo,
    .full-logo {
        max-width: 80px;
    }

    .menu-toggle {
        display: flex;
    }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    /* Hide Nav & Footer when collapsed */
    nav,
    .sidebar-footer {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        transform: translateY(20px);
    }

    /* Show when active */
    .sidebar.active nav,
    .sidebar.active .sidebar-footer {
        opacity: 1;
        pointer-events: all;
        transform: translateY(0);
        transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
        /* Delay for open animation */
    }

    nav {
        margin-top: 2rem;
        width: 100%;
    }

    .nav-links {
        align-items: stretch;
        gap: 1.5rem;
    }

    .nav-links a {
        font-size: 1.25rem;
        padding: 1rem 1rem;
        width: 100%;
        justify-content: flex-start;
    }

    .sidebar-footer {
        margin-bottom: 2rem;
    }
}