@media (max-width: 991.98px) {
    /* Hide desktop sidebar on mobile */
    .sidebar {
        display: none !important;
    }
    
    .page-container,
    .app-wrapper {
        margin-left: 0 !important;
    }
}

/* Mobile Menu Base Styles */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1048;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.mobile-grid-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 1049;
    transition: right 0.3s ease-in-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-grid-menu.active {
    right: 0;
}

/* Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.mobile-menu-title {
    margin: 0;
    font-weight: 600;
    font-size: 18px;
}

.mobile-menu-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Area */
.mobile-menu-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Main Menu Grid */
.mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 25px 20px;
    background: #f8f9fc;
    overflow-y: auto;
    flex: 1;
    transition: transform 0.3s ease-in-out;
}

.mobile-menu-grid.submenu-active {
    transform: translateY(-100%);
}

@media (max-width: 480px) {
    .mobile-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 20px 15px;
    }
}

/* Menu Items */
.mobile-menu-item {
    position: relative;
    opacity: 0;
    animation: slideInRight 0.6s ease forwards;
}

.mobile-menu-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-item:nth-child(2) { animation-delay: 0.2s; }
.mobile-menu-item:nth-child(3) { animation-delay: 0.3s; }
.mobile-menu-item:nth-child(4) { animation-delay: 0.4s; }
.mobile-menu-item:nth-child(5) { animation-delay: 0.5s; }
.mobile-menu-item:nth-child(6) { animation-delay: 0.6s; }

.mobile-menu-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 15px 20px;
    background: #ffffff;
    border: none;
    border-radius: 16px;
    text-decoration: none;
    color: #495057;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 120px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    overflow: hidden;
}

.mobile-menu-card:hover,
.mobile-menu-card:focus {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
    color: #667eea;
    text-decoration: none;
}

.mobile-menu-card:active {
    transform: translateY(-4px) scale(0.98);
}

.mobile-menu-item.active .mobile-menu-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Menu with submenu styling */
.mobile-menu-card.has-submenu {
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.mobile-menu-card.has-submenu:hover {
    border-color: #667eea;
}

.mobile-menu-card.has-submenu.expanded {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: #667eea;
}

.mobile-menu-card.has-submenu.expanded .mobile-submenu-indicator {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.mobile-menu-card.has-submenu.expanded .mobile-submenu-indicator i {
    transform: rotate(180deg);
}

/* Menu Icon */
.mobile-menu-icon {
    position: relative;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.mobile-submenu-indicator {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 24px;
    height: 24px;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    transition: all 0.3s ease;
}

.mobile-submenu-indicator i {
    transition: transform 0.3s ease;
}

/* Menu Label */
.mobile-menu-label {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    word-wrap: break-word;
    hyphens: auto;
}

/* Submenu Section Styles */
.mobile-submenu-section {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    transition: top 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.mobile-submenu-section.active {
    top: 0;
}

.mobile-submenu-header {
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.mobile-submenu-back {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-submenu-title {
    margin: 0;
    font-weight: 600;
    font-size: 16px;
}

.mobile-submenu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 25px 20px;
    background: #f8f9fc;
    flex: 1;
    overflow-y: auto;
}

.mobile-submenu-item {
    text-decoration: none;
    opacity: 0;
    animation: slideInUp 0.4s ease forwards;
}

.mobile-submenu-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-submenu-item:nth-child(2) { animation-delay: 0.2s; }
.mobile-submenu-item:nth-child(3) { animation-delay: 0.3s; }
.mobile-submenu-item:nth-child(4) { animation-delay: 0.4s; }
.mobile-submenu-item:nth-child(5) { animation-delay: 0.5s; }
.mobile-submenu-item:nth-child(6) { animation-delay: 0.6s; }

.mobile-submenu-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    color: #495057;
    transition: all 0.3s ease;
    min-height: 100px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
}

.mobile-submenu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.25);
    color: #667eea;
}

.mobile-submenu-icon {
    margin-bottom: 10px;
    position: relative;
}

.mobile-submenu-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}