/* Mobile Sidebar Navigation */

/* Hide default Bootstrap collapse on mobile */
@media (max-width: 767px) {
    .navbar-collapse {
        display: none !important;
    }
}

/* Navbar slide animation on mobile */
@media (max-width: 767px) {
    .navbar-spark {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.mobile-sidebar-open .navbar-spark {
        transform: translateY(-100%);
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none !important;
    box-shadow: none !important;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: opacity 0.2s;
    position: relative;
    z-index: 10;
    outline: none !important;
}

.mobile-menu-toggle:hover {
    opacity: 0.8;
}

.mobile-menu-toggle:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: block;
        margin-left: auto;
    }

    .navbar-toggler {
        display: none;
    }

    /* Hide desktop navigation on mobile, but keep actions visible for toggle button */
    .navbar-spark-nav {
        display: none !important;
    }

    /* Keep navbar-spark-actions visible but hide non-essential items */
    .navbar-spark-actions>*:not(.mobile-menu-toggle):not(.spark-notification-container) {
        display: none !important;
    }

    /* Ensure navbar respects safe area on PWA */
    .navbar-spark {
        padding-top: env(safe-area-inset-top, 0);
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    .navbar-spark-container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

/* Sidebar Overlay */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 6400;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Mobile Sidebar */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--navbar-gradient, linear-gradient(161deg, #020024 0%, #090979 35%, #26164f 100%));
    z-index: 6500;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
}

.mobile-sidebar.active {
    transform: translateX(0);
}

/* Sidebar Header */
.mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1.25rem;
    padding-top: calc(1.5rem + env(safe-area-inset-top, 0));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.mobile-sidebar-logo {
    height: 55px;
    width: auto;
}

.mobile-sidebar-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.5rem;
    padding: 0.25rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.mobile-sidebar-close:hover {
    color: white;
}

.mobile-sidebar-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Sidebar Content */
.mobile-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

/* Navigation Links */
.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    margin: 0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.9375rem;
    font-weight: var(--font-weight-medium);
}

.mobile-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.mobile-nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 3px solid white;
}

.mobile-nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1.125rem;
}

/* Sidebar Footer */
.mobile-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.1);
}

.mobile-user-info {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: white;
    transition: background-color 0.2s;
}

.mobile-user-info:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.mobile-user-info i {
    font-size: 1.5rem;
    color: white;
    margin-right: 0.75rem;
}

.mobile-user-details {
    flex: 1;
}

.mobile-user-name {
    display: block;
    font-weight: var(--font-weight-semibold);
    font-size: 0.9375rem;
    color: white;
}

.mobile-user-role {
    display: block;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.125rem;
}

/* Action Buttons */
.mobile-sidebar-actions {
    display: flex;
    gap: var(--spacing-2);
}

.mobile-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.mobile-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.mobile-action-btn i {
    margin-right: 0.375rem;
}

.mobile-action-btn.logout {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.3);
}

.mobile-action-btn.logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(252, 165, 165, 0.5);
    color: #fecaca;
}

/* Notifications Badge */
.mobile-notifications-link {
    position: relative;
}

.mobile-notification-badge {
    position: absolute;
    top: 0.5rem;
    left: 1.5rem;
    background: #ef4444;
    color: white;
    font-size: 0.6875rem;
    font-weight: var(--font-weight-semibold);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Divider */
.mobile-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1.25rem;
}

/* Smooth Scrolling */
.mobile-sidebar-content {
    -webkit-overflow-scrolling: touch;
}

/* Prevent body scroll when sidebar is open */
body.mobile-sidebar-open {
    overflow: hidden;
}

/* Desktop - hide mobile sidebar */
@media (min-width: 768px) {

    .mobile-menu-toggle,
    .mobile-sidebar,
    .mobile-sidebar-overlay {
        display: none !important;
    }
}

/* Accessibility */
.mobile-sidebar:focus {
    outline: none;
}

/* Animation for notification badge */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.mobile-notification-badge.has-new {
    animation: pulse 2s infinite;
}
