/* mobile-navigation.css */

/* --- MOBILE NAVIGATION VARIABLES --- */
:root {
    --nav-bg: #0f0f1e;
    --nav-accent-cyan: #00d4ff;
    --nav-accent-purple: #7b2cbf;
    --nav-glass-bg: rgba(255, 255, 255, 0.1);
    --nav-glass-border: rgba(255, 255, 255, 0.2);
    --nav-text: #ffffff;
    --nav-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- HAMBURGER ICON & BACK BUTTON --- */
.mobile-nav-controls {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1001;
    display: flex;
    justify-content: space-between;
    flex-direction: row-reverse;
    /* Back button on left, Hamburger on right */
    align-items: center;
    pointer-events: none;
}

@media screen and (min-width: 769px) {

    .mobile-nav-controls,
    .mobile-sidebar,
    .nav-overlay {
        display: none !important;
    }
}

.nav-btn {
    width: 45px;
    height: 45px;
    background: var(--nav-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--nav-glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    transition: var(--nav-transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.15);
}

/* Hamburger Lines */
.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--nav-text);
    margin: 3px 0;
    transition: var(--nav-transition);
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

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

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Back Button */
.back-btn {
    display: none;
    /* Hidden by default, shown via JS on nested pages */
    color: var(--nav-text);
    font-size: 1.2rem;
    text-decoration: none;
}

.back-btn:hover i {
    transform: translateX(-3px);
}

.back-btn i {
    transition: transform 0.3s ease;
}

/* --- SIDEBAR MENU --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--nav-transition);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--nav-bg);
    z-index: 1002;
    transition: var(--nav-transition);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.mobile-sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

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

/* Menu Items */
.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-item {
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(-20px);
}

.mobile-sidebar.active .mobile-menu-item {
    animation: slideInItem 0.4s forwards;
}

@keyframes slideInItem {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: 0.3s;
    border-left: 3px solid transparent;
}

.mobile-menu-link i {
    width: 25px;
    margin-right: 15px;
    font-size: 1.2rem;
    opacity: 0.8;
}

.mobile-menu-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--nav-accent-purple);
}

.mobile-menu-link.active {
    background: rgba(0, 212, 255, 0.1);
    border-left-color: var(--nav-accent-cyan);
    color: var(--nav-accent-cyan);
}

/* Dropdown */
.has-dropdown {
    position: relative;
}

.dropdown-trigger-container {
    display: flex;
    align-items: center;
    width: 100%;
    padding-right: 0.5rem;
}

.dropdown-item-link {
    flex: 1;
}

.arrow-toggle {
    padding: 10px;
    cursor: pointer;
    transition: var(--nav-transition);
}

.arrow-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.has-dropdown.open .arrow-icon {
    transform: rotate(180deg);
}

.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding-left: 2rem;
    list-style: none;
}

.has-dropdown.open .mobile-submenu {
    max-height: 500px;
}

.submenu-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.3s;
}

.submenu-link i {
    font-size: 0.9rem;
    margin-right: 10px;
}

.submenu-link:hover {
    color: var(--nav-text);
}

/* Staggered Animation Delay Calculation */
.mobile-sidebar.active .mobile-menu-item:nth-child(1) {
    animation-delay: 0.1s;
}

.mobile-sidebar.active .mobile-menu-item:nth-child(2) {
    animation-delay: 0.15s;
}

.mobile-sidebar.active .mobile-menu-item:nth-child(3) {
    animation-delay: 0.2s;
}

.mobile-sidebar.active .mobile-menu-item:nth-child(4) {
    animation-delay: 0.25s;
}

.mobile-sidebar.active .mobile-menu-item:nth-child(5) {
    animation-delay: 0.3s;
}

.mobile-sidebar.active .mobile-menu-item:nth-child(6) {
    animation-delay: 0.35s;
}

/* Body Lock */
body.nav-open {
    overflow: hidden;
}