/* ============================================
   READING PROGRESS BAR
   ============================================ */

/* Progress Bar Container */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.reading-progress.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Progress Bar Fill */
.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #00B4D8 100%);
    width: 0%;
    transition: width 0.1s ease-out;
    position: relative;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* Gradient Animation */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.reading-progress-bar.animated {
    background-size: 200% 100%;
    animation: gradientFlow 3s ease infinite;
}

/* Progress Bar Glow Effect */
.reading-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6));
    animation: shine 2s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-40px);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(40px);
        opacity: 0;
    }
}

/* Progress Percentage Display (optional) */
.reading-progress-percent {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.reading-progress-percent.visible {
    opacity: 1;
}

/* Scroll to Top Button (pairs well with progress bar) */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
}

.scroll-to-top:active {
    transform: translateY(-3px);
}

/* Scroll Progress Circle (alternative style) */
.scroll-progress-circle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.scroll-progress-circle.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.scroll-progress-circle circle {
    fill: none;
    stroke-width: 4;
}

.scroll-progress-circle .progress-bg {
    stroke: rgba(0, 0, 0, 0.1);
}

.scroll-progress-circle .progress-fill {
    stroke: #667eea;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s ease-out;
}

.scroll-progress-circle-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.scroll-progress-circle-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Estimated Time Remaining */
.reading-time-remaining {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reading-time-remaining.visible {
    opacity: 1;
    visibility: visible;
}

.reading-time-remaining-icon {
    font-size: 1.1rem;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .reading-progress {
        height: 3px;
    }

    .reading-progress-percent {
        top: 60px;
        right: 10px;
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .scroll-to-top {
        width: 44px;
        height: 44px;
        bottom: 20px;
        right: 20px;
        font-size: 1.25rem;
    }

    .scroll-progress-circle {
        width: 52px;
        height: 52px;
        bottom: 20px;
        right: 20px;
    }

    .scroll-progress-circle-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .reading-time-remaining {
        bottom: 20px;
        left: 20px;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .reading-progress {
        background: rgba(255, 255, 255, 0.1);
    }

    .reading-progress-percent,
    .reading-time-remaining {
        background: rgba(255, 255, 255, 0.9);
        color: #0D1B2A;
    }

    .scroll-progress-circle .progress-bg {
        stroke: rgba(255, 255, 255, 0.2);
    }
}

/* Accessibility */
.scroll-to-top:focus,
.scroll-progress-circle-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Print */
@media print {
    .reading-progress,
    .reading-progress-percent,
    .scroll-to-top,
    .scroll-progress-circle,
    .reading-time-remaining {
        display: none;
    }
}
