/* 图片加载优化样式 - 高清优化版 */

/* 图片容器的相对定位，用于加载动画的绝对定位 */
.video-thumbnail {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 强制硬件加速，提升渲染质量 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* 加载动画容器 - 高清优化 */
.image-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 使用纯色背景，避免渐变模糊 */
    background: #2c3e50;
    z-index: 2;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 强制硬件加速 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* 消除锯齿和模糊 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* 加载动画内容包装器 */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

/* 品牌文字样式 */
.loading-brand {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.9;
    /* 文字渲染优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    /* 防止文字模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 轻微的呼吸动画 */
    animation: brandPulse 2s ease-in-out infinite;
}

@keyframes brandPulse {
    0%, 100% {
        opacity: 0.9;
        transform: translateZ(0) scale(1);
        -webkit-transform: translateZ(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateZ(0) scale(1.02);
        -webkit-transform: translateZ(0) scale(1.02);
    }
}

/* 加载动画已完成时隐藏 */
.image-loading.loaded {
    opacity: 0;
    pointer-events: none;
}

/* 旋转的加载图标 - 高清版 */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #00bcd4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    /* 消除动画模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 确保圆形边缘清晰 */
    box-shadow: 0 0 0 1px rgba(0, 188, 212, 0.1);
}

/* 旋转动画 - 优化版 */
@keyframes spin {
    0% { 
        transform: translateZ(0) rotate(0deg); 
        -webkit-transform: translateZ(0) rotate(0deg);
    }
    100% { 
        transform: translateZ(0) rotate(360deg);
        -webkit-transform: translateZ(0) rotate(360deg);
    }
}

/* 脉冲加载动画 - 高清版 */
.loading-pulse {
    width: 56px;
    height: 56px;
    background: #00bcd4;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    /* 消除动画模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 添加清晰的边缘 */
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 188, 212, 0.3);
}

@keyframes pulse {
    0% {
        transform: translateZ(0) scale(0.7);
        -webkit-transform: translateZ(0) scale(0.7);
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 188, 212, 0.3);
    }
    50% {
        transform: translateZ(0) scale(1);
        -webkit-transform: translateZ(0) scale(1);
        opacity: 0.8;
        box-shadow: 0 0 40px rgba(0, 188, 212, 0.5);
    }
    100% {
        transform: translateZ(0) scale(0.7);
        -webkit-transform: translateZ(0) scale(0.7);
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 188, 212, 0.3);
    }
}

/* 波浪加载动画 - 高清版 */
.loading-wave {
    display: flex;
    align-items: center;
    gap: 6px;
    /* 消除动画模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.loading-wave .wave-bar {
    width: 6px;
    height: 32px;
    background: #00bcd4;
    border-radius: 3px;
    animation: wave 1.2s ease-in-out infinite;
    /* 消除动画模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 添加光泽效果 */
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.loading-wave .wave-bar:nth-child(1) { animation-delay: 0s; }
.loading-wave .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.loading-wave .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.loading-wave .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.loading-wave .wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 40%, 100% {
        transform: translateZ(0) scaleY(0.4);
        -webkit-transform: translateZ(0) scaleY(0.4);
        opacity: 0.8;
        box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
    }
    20% {
        transform: translateZ(0) scaleY(1);
        -webkit-transform: translateZ(0) scaleY(1);
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 188, 212, 0.6);
    }
}

/* 圆点加载动画 - 超清晰版 */
.loading-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.loading-dots .dot {
    width: 12px;
    height: 12px;
    background: #00bcd4;
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4);
}

.loading-dots .dot:nth-child(1) { animation-delay: 0s; }
.loading-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 70%, 100% {
        transform: translateZ(0) scale(0.8);
        -webkit-transform: translateZ(0) scale(0.8);
        opacity: 0.7;
        box-shadow: 0 0 15px rgba(0, 188, 212, 0.4);
    }
    35% {
        transform: translateZ(0) scale(1.2);
        -webkit-transform: translateZ(0) scale(1.2);
        opacity: 1;
        box-shadow: 0 0 25px rgba(0, 188, 212, 0.8);
    }
}

/* 图片本身的样式优化 - 高清版 */
.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    /* 图片渲染优化 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-quality;
    /* 消除模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 平滑过渡 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 图片加载完成后显示 - 优化版 */
.video-thumbnail img.loaded {
    opacity: 1;
    transform: translateZ(0) scale(1);
    -webkit-transform: translateZ(0) scale(1);
}

/* 图片加载失败时的样式 */
.video-thumbnail img.error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* 图片加载失败时显示的默认图标 - 高清版 */
.image-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ff5722;
    color: white;
    font-size: 16px;
    z-index: 1;
    /* 消除模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 添加清晰边框 */
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.image-error .error-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.9;
    /* 图标渲染优化 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 骨架屏加载效果 - 高清版 */
.skeleton-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        #e8e8e8 0%, 
        #f5f5f5 25%, 
        #ffffff 50%, 
        #f5f5f5 75%, 
        #e8e8e8 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.8s ease-in-out infinite;
    z-index: 1;
    /* 消除动画模糊 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 添加细微边框增强清晰度 */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    50% {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    100% {
        background-position: -200% 0;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* 渐进式加载效果 */
.progressive-loading {
    position: relative;
    overflow: hidden;
}

.progressive-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer 2s infinite;
    z-index: 3;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 移动设备优化 - 保持清晰度 */
@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .loading-pulse {
        width: 48px;
        height: 48px;
    }
    
    .loading-wave .wave-bar {
        width: 5px;
        height: 24px;
    }
    
    .loading-dots .dot {
        width: 10px;
        height: 10px;
        border-width: 1px;
    }
    
    .loading-brand {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    .loading-content {
        gap: 12px;
    }
    
    .image-error {
        font-size: 14px;
    }
    
    .image-error .error-icon {
        font-size: 28px;
        margin-bottom: 8px;
    }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
    .video-thumbnail {
        background: #2d3748;
    }
    
    .image-loading {
        background: #1a202c;
    }
    
    .loading-brand {
        color: #e2e8f0;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }
    
    .skeleton-loading {
        background: linear-gradient(90deg, #2d3748 25%, #4a5568 50%, #2d3748 75%);
        background-size: 200% 100%;
    }
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .loading-pulse,
    .loading-wave .wave-bar,
    .loading-dots .dot,
    .skeleton-loading,
    .progressive-loading::before,
    .loading-brand {
        animation: none;
    }
    
    .image-loading,
    .video-thumbnail img {
        transition: none;
    }
    
    .loading-brand {
        opacity: 1;
        transform: translateZ(0) scale(1);
        -webkit-transform: translateZ(0) scale(1);
    }
}

/* 高分辨率屏幕优化 (Retina等) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .loading-spinner {
        border-width: 3px;
    }
    
    .loading-wave .wave-bar {
        border-width: 0.5px;
    }
    
    .skeleton-loading {
        border-width: 0.5px;
    }
    
    .image-error {
        border-width: 1px;
    }
    
    .loading-dots .dot {
        border-width: 1px;
    }
}

/* 超高分辨率屏幕优化 (4K等) */
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi) {
    .loading-spinner {
        border-width: 4px;
        width: 52px;
        height: 52px;
    }
    
    .loading-pulse {
        width: 60px;
        height: 60px;
        border-width: 3px;
    }
    
    .loading-wave .wave-bar {
        width: 7px;
        height: 36px;
        border-width: 1px;
    }
    
    .loading-dots .dot {
        width: 14px;
        height: 14px;
        border-width: 2px;
    }
    
    .loading-brand {
        font-size: 18px;
        letter-spacing: 2.5px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    }
    
    .loading-content {
        gap: 18px;
    }
}

/* 高对比度模式适配 - 增强版 */
@media (prefers-contrast: high) {
    .image-loading {
        background: #000000;
        border: 3px solid #ffffff;
    }
    
    .loading-spinner {
        border-color: rgba(255, 255, 255, 0.3);
        border-top-color: #ffffff;
        border-width: 4px;
    }
    
    .loading-pulse {
        background: #ffffff;
        border: 3px solid #000000;
    }
    
    .loading-wave .wave-bar {
        background: #ffffff;
        border: 2px solid #000000;
    }
    
    .skeleton-loading {
        background: linear-gradient(90deg, #333333 0%, #666666 50%, #333333 100%);
        border: 2px solid #ffffff;
    }
    
    .loading-brand {
        color: #ffffff;
        text-shadow: 0 0 4px #000000;
        font-weight: 700;
    }
} 