/* Enhanced Mobile Menu Styles with Animations */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    will-change: transform, opacity;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.mobile-sidebar.active,
.mobile-sidebar.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-sidebar-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: all 0.4s ease;
    opacity: 0;
}

.mobile-sidebar.active .mobile-sidebar-bg {
    opacity: 1;
}

.mobile-sidebar-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 350px;
    height: 100%;
    background: linear-gradient(135deg, #000000 0%, #1f2937 50%, #374151 100%);
    padding: 2rem;
    overflow-y: auto;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(-24px) scale(0.98);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 2px solid rgba(168, 85, 247, 0.3);
    position: relative;
}

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

/* Lock body scroll when menu open */
body.menu-open {
    overflow: hidden;
    touch-action: none;
}

/* Animated background particles */
.mobile-sidebar-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.06) 0%, transparent 50%);
    animation: particleFloat 10s ease-in-out infinite;
    pointer-events: none;
}

@keyframes particleFloat {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0rem;
    padding-top: 0rem;
    margin-bottom: 1rem;
    padding-bottom: 0rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 2;
}

.mobile-logo {
    height: 80px;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(168, 85, 247, 0.3));
}

.mobile-logo:hover {
    transform: scale(1.05) rotate(2deg);
    filter: drop-shadow(0 6px 12px rgba(168, 85, 247, 0.5));
}

.mobile-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.mobile-close-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.mobile-close-btn:hover::before {
    left: 100%;
}

.mobile-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.mobile-close-btn svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(50px);
    opacity: 0;
    /* animation is applied when the sidebar opens */
}

.mobile-sidebar.active .mobile-nav-link {
    animation: slideInLeft 0.6s ease forwards;
}
.mobile-sidebar.active .mobile-nav-link:nth-child(1) { animation-delay: 0.1s; }
.mobile-sidebar.active .mobile-nav-link:nth-child(2) { animation-delay: 0.2s; }
.mobile-sidebar.active .mobile-nav-link:nth-child(3) { animation-delay: 0.3s; }
.mobile-sidebar.active .mobile-nav-link:nth-child(4) { animation-delay: 0.4s; }
.mobile-sidebar.active .mobile-nav-link:nth-child(5) { animation-delay: 0.5s; }

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

.mobile-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(168, 85, 247, 0.1),
        rgba(168, 85, 247, 0.3),
        rgba(168, 85, 247, 0.1)
    );
    transition: left 0.5s;
}

.mobile-nav-link:hover::before {
    left: 100%;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(168, 85, 247, 0.1));
    color: white;
    transform: translateX(12px) scale(1.02);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 
        0 10px 30px rgba(168, 85, 247, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mobile-nav-link:active {
    transform: translateX(8px) scale(0.98);
}

/* Accessible focus styles */
.mobile-nav-link:focus-visible,
.mobile-auth-btn:focus-visible,
.mobile-close-btn:focus-visible,
.mobile-menu-btn:focus-visible,
.mobile-credits-card:focus-visible {
    outline: 2px solid rgba(168, 85, 247, 0.85);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.25);
}

.mobile-user-info {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform: translateY(30px);
    opacity: 0;
    animation: slideInUp 0.6s ease 0.6s forwards;
}

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

.mobile-user-info::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(168, 85, 247, 0.1), transparent);
    animation: rotate 8s linear infinite;
    opacity: 0.5;
}

.mobile-user-info::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 1.4rem;
    background: linear-gradient(135deg, #000000 0%, #1f2937 50%, #374151 100%);
}

.mobile-user-info > * {
    position: relative;
    z-index: 2;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mobile-user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #8b5cf6, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-weight: bold;
    font-size: 1.75rem;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
}

.mobile-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Header mini avatar (account info beside hamburger) */
.mobile-account-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    overflow: hidden;
}

.mobile-account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.mobile-user-avatar::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #a855f7, #8b5cf6, #10b981, #f59e0b);
    animation: rotate 4s linear infinite;
    z-index: -1;
}

.mobile-user-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    z-index: 1;
}

.mobile-user-avatar > * {
    position: relative;
    z-index: 2;
}

.mobile-user-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(168, 85, 247, 0.6);
}

.mobile-user-details {
    text-align: center;
}

.mobile-user-details h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.mobile-user-details p {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.mobile-credits-card {
    background: linear-gradient(135deg, 
        rgba(168, 85, 247, 0.2), 
        rgba(168, 85, 247, 0.1)
    );
    border: 2px solid rgba(168, 85, 247, 0.4);
    border-radius: 1rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    color: #a855f7;
    font-weight: 700;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.mobile-credits-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(168, 85, 247, 0.3), 
        transparent
    );
    transition: left 0.6s;
}

.mobile-credits-card:hover::before {
    left: 100%;
}

.mobile-credits-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
    border-color: rgba(168, 85, 247, 0.6);
}

.mobile-auth-section {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 2;
}

.mobile-auth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border: none;
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    margin-bottom: 0.75rem;
    position: relative;
    overflow: hidden;
    transform: translateY(30px);
    opacity: 0;
    animation: slideInUp 0.6s ease 0.8s forwards;
}

#mobileSignInBtn {
    background: linear-gradient(135deg, #a855f7, #8b5cf6, #7c3aed);
    color: white;
    border: 1px solid rgba(168, 85, 247, 0.3);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

#mobileSignInBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent
    );
    transition: left 0.5s;
}

#mobileSignInBtn:hover::before {
    left: 100%;
}

#mobileSignInBtn:hover {
    background: linear-gradient(135deg, #9333ea, #7c3aed, #6d28d9);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.5);
}

#mobileSignOutBtn {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.2), 
        rgba(220, 38, 38, 0.2)
    );
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

#mobileSignOutBtn:hover {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.4), 
        rgba(220, 38, 38, 0.4)
    );
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}

/* Mobile Header Account Info */
.mobile-header-account-info {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    padding: 0.6rem;
    height: 50px;
    width: auto;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mobile-header-account-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(168, 85, 247, 0.2), 
        transparent
    );
    transition: left 0.5s;
}

.mobile-header-account-info:hover::before {
    left: 100%;
}

.mobile-header-account-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.4);
}

.mobile-account-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.mobile-account-avatar:hover {
    transform: rotate(360deg) scale(1.1);
}

.mobile-account-avatar svg {
    width: 18px;
    height: 18px;
    color: white;
}

.mobile-account-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.mobile-account-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mobile-account-credits {
    font-size: 0.75rem;
    color: #a855f7;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .desktop-nav {
        display: none;
    }

    .mobile-header-account-info {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: block;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        cursor: pointer;
        padding: 0.75rem;
        border-radius: 1rem;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
        backdrop-filter: blur(10px);
    }

    .mobile-menu-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, 
            transparent, 
            rgba(168, 85, 247, 0.2), 
            transparent
        );
        transition: left 0.5s;
    }

    .mobile-menu-btn:hover::before {
        left: 100%;
    }
    
    .mobile-menu-btn:hover {
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.1));
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(168, 85, 247, 0.3);
        border-color: rgba(168, 85, 247, 0.4);
    }
    
    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
        stroke-width: 2;
        transition: transform 0.3s ease;
    }

    .mobile-menu-btn:hover svg {
        transform: rotate(90deg);
    }
}

@media (min-width: 1025px) {
    .mobile-sidebar {
        display: none;
    }
    
    .mobile-menu-btn {
        display: none;
    }
    
    .desktop-nav {
        display: flex;
    }

    .mobile-header-account-info {
        display: none !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .mobile-sidebar-content,
    .mobile-nav-link,
    .mobile-close-btn,
    .mobile-menu-btn {
        transition: none !important;
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 480px) {
    .mobile-sidebar-content {
        width: 100%;
        padding: 1.5rem;
    }
    
    .mobile-user-info {
        padding: 1.5rem;
    }
    
    .mobile-user-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* Enhanced Floating elements animation */
.floating-element {
    position: absolute;
    animation: complexFloat 8s ease-in-out infinite;
    pointer-events: none;
}

.floating-shape {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    opacity: 0.15;
    filter: blur(0.5px);
}

.shape-1 {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.shape-2 {
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 25%;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.shape-3 {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 0;
    transform: rotate(45deg);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

@keyframes complexFloat {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 0.1;
    }
    25% {
        transform: translateY(-15px) translateX(10px) rotate(90deg);
        opacity: 0.2;
    }
    50% {
        transform: translateY(-25px) translateX(-5px) rotate(180deg);
        opacity: 0.15;
    }
    75% {
        transform: translateY(-10px) translateX(-15px) rotate(270deg);
        opacity: 0.25;
    }
}

.floating-element:nth-child(2) {
    animation-delay: 2.5s;
}

.floating-element:nth-child(3) {
    animation-delay: 5s;
}

/* Mobile features with enhanced animations */
.mobile-features {
    display: flex;
    justify-content: space-around;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.mobile-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.mobile-feature:hover {
    transform: translateY(-5px);
}

.mobile-feature-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.mobile-feature-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: rotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-feature:hover .mobile-feature-icon::before {
    opacity: 1;
}

.feature-1 {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.feature-1:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
    transform: scale(1.1);
}

.feature-2 {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.feature-2:hover {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
    transform: scale(1.1);
}

.feature-3 {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.feature-3:hover {
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5);
    transform: scale(1.1);
}

.mobile-feature-icon svg {
    width: 22px;
    height: 22px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.mobile-feature:hover .mobile-feature-icon svg {
    transform: scale(1.1) rotate(5deg);
}

.mobile-feature p {
    font-size: 0.8rem;
    color: #cbd5e1;
    text-align: center;
    margin: 0;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.mobile-feature:hover p {
    color: white;
}

/* Smooth scrollbar for mobile sidebar */
.mobile-sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.mobile-sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.mobile-sidebar-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    border-radius: 3px;
}

.mobile-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
}