/* Mobile Sidebar Navigation for All Phone Sizes */

/* Main sidebar container */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #ffffff;
    z-index: 9999;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

/* Sidebar header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
}

.sidebar-brand .cube-container {
    transform: scale(0.7);
    margin-right: 10px;
}

.sidebar-brand .brand-text {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* Sidebar navigation */
.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav-item i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

/* Sidebar dropdown */
.sidebar-dropdown {
    padding-left: 20px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.sidebar-dropdown.show {
    max-height: 500px;
}

.sidebar-dropdown-item {
    padding: 10px 20px 10px 35px;
    display: block;
    color: #ffffff;
    text-decoration: none;
    opacity: 0.8;
    transition: all 0.2s;
}

.sidebar-dropdown-item:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Sidebar divider */
.sidebar-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

/* User section */
.sidebar-user {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 14px;
}

.sidebar-user-email {
    font-size: 12px;
    opacity: 0.8;
}

/* Sidebar overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Mobile toggle button */
.mobile-sidebar-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.5);
    border: none;
    z-index: 9997;
    font-size: 24px;
}

/* Show toggle button only on mobile */
@media (max-width: 991px) {
    .mobile-sidebar-toggle {
        display: flex;
    }
    
    /* Additional iOS/Safari fixes */
    .mobile-sidebar {
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
        -webkit-transition: -webkit-transform 0.3s ease;
        transition: -webkit-transform 0.3s ease;
        
        /* Force hardware acceleration */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000;
        perspective: 1000;
    }
    
    .mobile-sidebar.show {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}

/* Fix for iPhone notch */
@supports (padding-top: env(safe-area-inset-top)) {
    .mobile-sidebar {
        padding-top: env(safe-area-inset-top);
        height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
}

/* Fix for Samsung Galaxy Ultra notch */
@supports (padding-top: constant(safe-area-inset-top)) {
    .mobile-sidebar {
        padding-top: constant(safe-area-inset-top);
        height: calc(100vh - constant(safe-area-inset-top) - constant(safe-area-inset-bottom));
    }
}

/* Hide sidebar on desktop */
@media (min-width: 992px) {
    .mobile-sidebar,
    .sidebar-overlay,
    .mobile-sidebar-toggle {
        display: none !important;
    }
}
