/* ==========================================================================
   MOBILE OPTIMIZATIONS
   ========================================================================== */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.mobile-menu-toggle i {
    width: 24px;
    height: 24px;
}

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

/* Show on mobile */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block !important;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-primary);
        border-left: 1px solid var(--border-color);
        padding: 80px 30px 30px;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        gap: 0;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links a {
        display: block;
        padding: 16px 0;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Floating Action Button (Mobile Only) */
.floating-action-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: var(--accent);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .floating-action-btn {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.floating-action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .floating-action-btn:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.floating-action-btn.active {
    transform: rotate(135deg);
    background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .floating-action-btn.active {
    background: rgba(59, 130, 246, 0.3);
}

.floating-action-btn i {
    width: 24px;
    height: 24px;
}

.fab-menu {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 998;
    flex-direction: column;
    gap: 12px;
}

.fab-menu.active {
    display: flex;
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: scale(0) translateY(20px);
    opacity: 0;
    white-space: nowrap;
}

.fab-menu.active .fab-menu-item {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.fab-menu.active .fab-menu-item:nth-child(1) {
    animation: fabItemAppear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.05s forwards;
}

.fab-menu.active .fab-menu-item:nth-child(2) {
    animation: fabItemAppear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.1s forwards;
}

.fab-menu.active .fab-menu-item:nth-child(3) {
    animation: fabItemAppear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.15s forwards;
}

@keyframes fabItemAppear {
    from {
        transform: scale(0) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.fab-menu-item:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
    border-color: var(--accent);
}

.fab-menu-item i {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.fab-menu-item span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Hide navbar on scroll */
.navbar.hidden {
    transform: translateY(-100%);
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    /* Show FAB, hide desktop nav actions */
    .floating-action-btn {
        display: flex;
    }
    
    .nav-actions {
        display: none !important;
    }
    
    /* Hero visual fixed height */
    .hero-visual {
        height: 450px !important;
        max-height: 450px !important;
        border-radius: 4px !important;
    }
    
    .hero-image {
        border-radius: 4px !important;
    }
    
    /* Problems section - uniform boxes */
    .problem-bento-item.large,
    .problem-bento-item.medium,
    .problem-bento-item.small {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 240px !important;
    }
    
    /* Feature stack wrapper - add bottom spacing */
    .horizontal-features-wrapper {
        padding-bottom: 100px !important;
    }
    
    /* Feature stack - hide previous items */
    .feature-stack-item.previous {
        opacity: 0 !important;
        display: none !important;
    }
    
    /* Feature stack - smooth transitions */
    .feature-stack-item {
        transition: opacity 0.4s ease, transform 0.4s ease !important;
    }
    
    /* Feature stack - redesigned layout */
    .feature-stack-content {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
        padding: 0 20px !important;
        min-height: auto !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .feature-stack-image {
        order: 1 !important;
        width: 90% !important;
        max-width: 500px !important;
        margin-top: -80px !important;
        z-index: 2 !important;
    }
    
    .feature-stack-text {
        order: 2 !important;
        text-align: center !important;
        background: var(--bg-secondary) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 24px !important;
        padding: 80px 32px 40px !important;
        margin-top: -60px !important;
        z-index: 1 !important;
        width: 100% !important;
    }
    
    .feature-number {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        margin: 0 auto 20px !important;
        display: block !important;
        text-align: center !important;
    }
}

@media (max-width: 480px) {
    /* Add spacing after feature stack */
    .horizontal-features-wrapper {
        padding-bottom: 80px !important;
    }
    
    .floating-action-btn {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }
    
    .fab-menu {
        bottom: 80px;
        right: 20px;
    }
    
    .hero-visual {
        height: 450px !important;
        max-height: 450px !important;
        border-radius: 4px !important;
    }
    
    .hero-image {
        border-radius: 4px !important;
    }
    
    .problem-bento-item.large,
    .problem-bento-item.medium,
    .problem-bento-item.small {
        min-height: 220px !important;
    }
    
    .feature-stack-image {
        width: 95% !important;
        margin-top: -60px !important;
    }
    
    .feature-stack-text {
        padding: 70px 24px 32px !important;
        margin-top: -50px !important;
    }
}
