/* Final comprehensive mobile fixes */

/* Ensure consistent behavior across all mobile devices */
@media (max-width: 768px) {
    /* Global mobile fixes */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Allow text selection where needed */
    p, span, h1, h2, h3, h4, h5, h6, .project-description {
        -webkit-user-select: text;
        user-select: text;
    }
    
    /* Ensure header is always visible and properly positioned */
    .glass-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 60px !important;
        z-index: 1000 !important;
        display: flex !important;
        align-items: center !important;
        background: rgba(10, 10, 15, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Ensure header container is properly structured */
    .glass-header .container {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 15px !important;
    }
    
    /* Menu button must be visible and clickable */
    .menu-btn {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 30px !important;
        height: 30px !important;
        cursor: pointer !important;
        z-index: 1001 !important;
    }
    
    /* Menu items positioning */
    .menu-items {
        position: fixed !important;
        top: 60px !important;
        right: -100% !important;
        width: 280px !important;
        height: calc(100vh - 60px) !important;
        background: rgba(0, 0, 0, 0.95) !important;
        display: flex !important;
        flex-direction: column !important;
        padding-top: 30px !important;
        transition: right 0.3s ease !important;
        z-index: 999 !important;
        overflow-y: auto !important;
    }
    
    .menu-items.active {
        right: 0 !important;
    }
    
    /* Home/Hero section proper spacing */
    #home.hero {
        padding-top: 140px !important;
        min-height: calc(100vh - 60px) !important;
    }
    
    /* All sections should have proper scroll margins */
    section {
        scroll-margin-top: 80px !important;
    }
    
    /* Projects carousel must be fully functional */
    .projects-container {
        position: relative !important;
        overflow: hidden !important;
        width: 100% !important;
    }
    
    .projects-carousel {
        display: flex !important;
        width: 100% !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        will-change: transform !important;
    }
    
    .projects-page {
        flex: 0 0 100% !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    /* Project cards mobile optimization */
    .project-card {
        width: 100% !important;
        margin-bottom: 20px !important;
        transform: translateZ(0) !important; /* Force hardware acceleration */
    }
    
    /* Carousel navigation */
    .carousel-nav {
        display: flex !important;
        justify-content: space-between !important;
        margin-bottom: 20px !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    .carousel-button {
        width: 44px !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(0, 0, 0, 0.7) !important;
        color: white !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        border: none !important;
        font-size: 16px !important;
    }
    
    .carousel-button:active {
        transform: scale(0.95) !important;
        background: var(--primary-color) !important;
    }
    
    /* Carousel dots */
    .carousel-dots {
        display: flex !important;
        justify-content: center !important;
        margin-top: 30px !important;
        gap: 15px !important;
    }
    
    .carousel-dot {
        width: 12px !important;
        height: 12px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.3) !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
    }
    
    .carousel-dot.active {
        background: var(--primary-color) !important;
        transform: scale(1.3) !important;
    }
    
    /* Touch feedback */
    .carousel-button:active,
    .carousel-dot:active,
    .menu-btn:active {
        opacity: 0.7 !important;
    }
    
    /* Prevent horizontal scrolling */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth !important;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    .carousel-button {
        width: 40px !important;
        height: 40px !important;
        font-size: 14px !important;
    }
    
    .menu-items {
        width: 260px !important;
    }
    
    #home.hero {
        padding-top: 120px !important;
    }
}
