/*--------------------------------------------------------------
# Mobile Scroll Progress Bar and Back to Top Enhancements
--------------------------------------------------------------*/

/* Scroll Progress Bar */
.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 9999;
    display: none; /* Hidden by default, shown on mobile */
}

.scroll-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4B0082 0%, #008080 50%, #8B4513 100%);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 2px 4px rgba(75, 0, 130, 0.3);
}

/* Mobile Back to Top Button */
#mobile-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #4B0082 0%, #008080 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(75, 0, 130, 0.4);
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#mobile-back-to-top.show {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

#mobile-back-to-top:hover,
#mobile-back-to-top:active {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(75, 0, 130, 0.6);
    background: linear-gradient(135deg, #008080 0%, #4B0082 100%);
}

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

.back-to-top i {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Mobile-specific styles */
@media only screen and (max-width: 768px) {
    .scroll-progress-container {
        display: block;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        line-height: 45px;
        bottom: 15px;
        right: 15px;
        font-size: 16px;
    }
    
    /* Touch-friendly enhancement */
    .back-to-top {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* iOS specific enhancements */
@supports (-webkit-touch-callout: none) {
    .scroll-progress-container {
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
    
    .back-to-top {
        -webkit-backdrop-filter: blur(5px);
        backdrop-filter: blur(5px);
    }
}

/* Android specific enhancements */
@media screen and (-webkit-min-device-pixel-ratio: 1.5) {
    .scroll-progress-bar {
        will-change: width;
    }
    
    .back-to-top {
        will-change: transform;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .scroll-progress-bar {
        background: linear-gradient(90deg, #4B0082 0%, #008080 50%, #8B4513 100%);
        background-size: 200% 100%;
        animation: gradient-slide 3s ease infinite;
    }
}

@keyframes gradient-slide {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Scroll progress percentage indicator (optional) */
.scroll-percentage {
    position: fixed;
    top: 10px;
    right: 15px;
    background: rgba(75, 0, 130, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-family: 'Times New Roman', Times, serif;
    z-index: 9997;
    display: none;
    transition: opacity 0.3s ease;
}

@media only screen and (max-width: 480px) {
    .scroll-percentage {
        display: block;
        opacity: 0;
    }
    
    .scroll-percentage.show {
        opacity: 1;
    }
}