/* ===================================================================
   ADVANCED UX FEATURES - 2026 Edition
   =================================================================== */

/* ===================================================================
   READING PROGRESS STATS (Premium Modern Design)
   =================================================================== */

.reading-stats {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    box-shadow:
        0 8px 32px rgba(26, 115, 232, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 9998;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    direction: ltr;
    text-align: left;
    transform: translateY(0);
    animation: slideInDown 0.6s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reading-stats:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 12px 40px rgba(26, 115, 232, 0.18),
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.rtl .reading-stats,
[dir="rtl"] .reading-stats {
    right: auto;
    left: 20px;
    direction: ltr;
    text-align: left;
}

.reading-stats-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1e293b;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.reading-percentage {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(26, 115, 232, 0.1);
    position: relative;
}

.reading-percentage::before {
    content: '📊';
    position: absolute;
    left: -22px;
    font-size: 14px;
    -webkit-text-fill-color: initial;
}

.reading-separator {
    color: #cbd5e1;
    font-weight: 400;
}

.reading-time {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.reading-time::before {
    content: '⏱️';
    font-size: 13px;
}

.reading-stats.reading-complete {
    background: linear-gradient(135deg, #00a389 0%, #00c9a7 100%);
    color: #fff;
    animation: celebrateComplete 0.6s ease, pulse 2s infinite;
    box-shadow:
        0 12px 40px rgba(0, 163, 137, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.1);
}

.reading-stats.reading-complete .reading-percentage,
.reading-stats.reading-complete .reading-time,
.reading-stats.reading-complete .reading-separator {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.reading-stats.reading-complete .reading-percentage::before,
.reading-stats.reading-complete .reading-time::before {
    content: '🎉';
}

@keyframes celebrateComplete {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 12px 40px rgba(0, 163, 137, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    50% {
        box-shadow: 0 16px 50px rgba(0, 163, 137, 0.6), 0 6px 16px rgba(0, 0, 0, 0.15);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .reading-stats {
        top: 12px;
        right: 12px;
        padding: 12px 20px;
        font-size: 13px;
    }

    .rtl .reading-stats {
        right: auto;
        left: 12px;
    }

    .reading-percentage {
        font-size: 14px;
    }

    .reading-percentage::before {
        left: -20px;
        font-size: 12px;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .reading-stats {
        display: none;
        /* Hide on very small screens to save space */
    }
}

/* Hide any duplicate dark/black progress bars */
.reading-stats[style*="background: #"],
.reading-stats[style*="background:#"],
.reading-stats[style*="background-color: #"],
.reading-stats[style*="background-color:#"] {
    display: none !important;
}

/* Ensure ONLY our white progress bar shows */
.reading-stats:not([style*="rgba(255, 255, 255"]):not([style*="linear-gradient"]) {
    display: none !important;
}

/* Print styles - hide interactive features */
@media print {
    .reading-stats {
        display: none !important;
    }
}
