/**
 * Advanced Reading Progress Bar Styles
 * Beautiful design with dark mode support
 * 
 * Features:
 * - Glassmorphism effect
 * - Smooth gradient animations
 * - Dark mode auto-detection
 * - RTL support
 * - Responsive design
 * - Accessibility friendly
 */

/* ============================================
   CONTAINER & WRAPPER
   ============================================ */

.nexus-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.nexus-progress-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.nexus-progress-wrapper {
    position: relative;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Dark Mode - Wrapper */
.nexus-progress-container.dark-mode .nexus-progress-wrapper,
body.dark-mode .nexus-progress-wrapper,
body.dark .nexus-progress-wrapper {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ============================================
   PROGRESS FILL
   ============================================ */

.nexus-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
            #667eea 0%,
            #764ba2 25%,
            #f093fb 50%,
            #4facfe 75%,
            #00f2fe 100%);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* Dark Mode - Progress Fill */
.nexus-progress-container.dark-mode .nexus-progress-fill,
body.dark-mode .nexus-progress-fill,
body.dark .nexus-progress-fill {
    background: linear-gradient(90deg,
            #00c9ff 0%,
            #92fe9d 25%,
            #00f2fe 50%,
            #4facfe 75%,
            #667eea 100%);
    box-shadow: 0 0 25px rgba(0, 201, 255, 0.6),
        0 0 50px rgba(146, 254, 157, 0.3);
}

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ============================================
   GLOW EFFECT
   ============================================ */

.nexus-progress-glow {
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0.6) 100%);
    animation: glowMove 2s ease-in-out infinite;
}

/* Dark Mode - Glow */
.nexus-progress-container.dark-mode .nexus-progress-glow,
body.dark-mode .nexus-progress-glow,
body.dark .nexus-progress-glow {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(0, 242, 254, 0.3) 50%,
            rgba(0, 242, 254, 0.6) 100%);
}

@keyframes glowMove {

    0%,
    100% {
        transform: translateX(-100%);
        opacity: 0;
    }

    50% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   MILESTONE ANIMATION
   ============================================ */

.nexus-progress-fill.milestone-reached {
    animation: milestoneReached 0.6s ease-out;
}

@keyframes milestoneReached {

    0%,
    100% {
        height: 4px;
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    }

    50% {
        height: 6px;
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.8),
            0 0 60px rgba(102, 126, 234, 0.6);
    }
}

/* Dark Mode - Milestone */
.nexus-progress-container.dark-mode .nexus-progress-fill.milestone-reached,
body.dark-mode .nexus-progress-fill.milestone-reached,
body.dark .nexus-progress-fill.milestone-reached {
    animation: milestoneReachedDark 0.6s ease-out;
}

@keyframes milestoneReachedDark {

    0%,
    100% {
        height: 4px;
        box-shadow: 0 0 25px rgba(0, 201, 255, 0.6);
    }

    50% {
        height: 6px;
        box-shadow: 0 0 50px rgba(0, 201, 255, 0.9),
            0 0 80px rgba(146, 254, 157, 0.7);
    }
}

/* ============================================
   INFO PANEL
   ============================================ */

.nexus-progress-info {
    position: absolute;
    top: 8px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    font-weight: 600;
    color: #333;
    opacity: 0;
    transform: translateY(-10px);
    animation: slideDown 0.4s ease-out 0.3s forwards;
    pointer-events: auto;
}

/* RTL Support */
[dir="rtl"] .nexus-progress-info {
    right: auto;
    left: 20px;
}

/* Dark Mode - Info Panel */
.nexus-progress-container.dark-mode .nexus-progress-info,
body.dark-mode .nexus-progress-info,
body.dark .nexus-progress-info {
    background: rgba(30, 30, 30, 0.95);
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

@keyframes slideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   PERCENTAGE
   ============================================ */

.nexus-progress-percentage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Dark Mode - Percentage */
.nexus-progress-container.dark-mode .nexus-progress-percentage,
body.dark-mode .nexus-progress-percentage,
body.dark .nexus-progress-percentage {
    background: linear-gradient(135deg, #00c9ff 0%, #92fe9d 100%);
    box-shadow: 0 2px 10px rgba(0, 201, 255, 0.4);
}

/* ============================================
   TIME REMAINING
   ============================================ */

.nexus-progress-time {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nexus-progress-time::before {
    content: '⏱️';
    font-size: 14px;
}

/* Dark Mode - Time */
.nexus-progress-container.dark-mode .nexus-progress-time,
body.dark-mode .nexus-progress-time,
body.dark .nexus-progress-time {
    color: #b0b0b0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .nexus-progress-wrapper {
        height: 3px;
    }

    .nexus-progress-info {
        right: 10px;
        padding: 6px 12px;
        gap: 10px;
        font-size: 11px;
    }

    [dir="rtl"] .nexus-progress-info {
        right: auto;
        left: 10px;
    }

    .nexus-progress-percentage {
        min-width: 40px;
        padding: 3px 8px;
        font-size: 10px;
    }

    .nexus-progress-time {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .nexus-progress-info {
        gap: 8px;
        padding: 5px 10px;
    }

    .nexus-progress-time {
        display: none;
        /* Hide time on very small screens */
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    .nexus-progress-fill,
    .nexus-progress-glow,
    .nexus-progress-info {
        animation: none !important;
        transition: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .nexus-progress-wrapper {
        background: #000;
    }

    .nexus-progress-fill {
        background: #fff !important;
    }

    .nexus-progress-info {
        background: #000 !important;
        color: #fff !important;
        border: 2px solid #fff;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .nexus-progress-container {
        display: none !important;
    }
}
