/**
 * 视频懒加载刷新按钮样式
 */

/* 视频容器 - 相对定位用于放置刷新按钮 */
#post .lazy-video-container,
#article-container .lazy-video-container {
    position: relative;
    display: block;
    max-width: 100%;
    background: linear-gradient(45deg,
        rgba(147, 112, 219, 0.05) 0%,
        rgba(138, 43, 226, 0.08) 50%,
        rgba(147, 112, 219, 0.05) 100%);
    border-radius: 12px;
    overflow: hidden;
}

#post .lazy-video-container video,
#article-container .lazy-video-container video {
    display: block;
    width: 100%;
    height: auto;
    min-height: 200px;
    background: #000;
}

/* 视频占位符样式 */
#post .lazy-video.lazy-placeholder,
#article-container .lazy-video.lazy-placeholder {
    background: linear-gradient(45deg,
        rgba(147, 112, 219, 0.1) 0%,
        rgba(138, 43, 226, 0.15) 25%,
        rgba(75, 0, 130, 0.1) 50%,
        rgba(138, 43, 226, 0.15) 75%,
        rgba(147, 112, 219, 0.1) 100%) !important;
    background-size: 400% 400% !important;
    animation: videoShimmer 3s infinite ease-in-out !important;
    border-radius: 12px;
    overflow: hidden;
}

/* 视频加载动画 */
@keyframes videoShimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 视频刷新按钮包装器 - 居中对齐 */
#post .lazy-refresh-wrapper.video-refresh-wrapper,
#article-container .lazy-refresh-wrapper.video-refresh-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

/* 视频刷新按钮样式 */
#post .lazy-refresh-btn.video-refresh-btn,
#article-container .lazy-refresh-btn.video-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(147, 112, 219, 0.5);
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 
        0 6px 20px rgba(147, 112, 219, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#post .lazy-refresh-btn.video-refresh-btn:hover,
#article-container .lazy-refresh-btn.video-refresh-btn:hover {
    background: rgba(147, 112, 219, 0.95);
    border-color: rgba(147, 112, 219, 0.8);
    transform: scale(1.05);
    box-shadow: 
        0 8px 25px rgba(147, 112, 219, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#post .lazy-refresh-btn.video-refresh-btn:active,
#article-container .lazy-refresh-btn.video-refresh-btn:active {
    transform: scale(0.98);
}

/* 刷新按钮文字 */
#post .lazy-refresh-btn.video-refresh-btn .refresh-text,
#article-container .lazy-refresh-btn.video-refresh-btn .refresh-text {
    white-space: nowrap;
}

/* 播放图标样式 */
#post .lazy-refresh-btn.video-refresh-btn svg,
#article-container .lazy-refresh-btn.video-refresh-btn svg {
    fill: rgba(147, 112, 219, 0.8);
    transition: fill 0.3s ease;
}

#post .lazy-refresh-btn.video-refresh-btn:hover svg,
#article-container .lazy-refresh-btn.video-refresh-btn:hover svg {
    fill: #fff;
}

/* 加载中状态 */
#post .lazy-refresh-btn.video-refresh-btn.loading,
#article-container .lazy-refresh-btn.video-refresh-btn.loading {
    background: rgba(147, 112, 219, 0.95);
    color: #fff;
    cursor: not-allowed;
    pointer-events: none;
}

/* 加载动画 */
#post .lazy-refresh-btn.video-refresh-btn .loading-spinner,
#article-container .lazy-refresh-btn.video-refresh-btn .loading-spinner {
    animation: refreshSpin 1s linear infinite;
}

@keyframes refreshSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 冷却中状态 */
#post .lazy-refresh-btn.video-refresh-btn.cooldown,
#article-container .lazy-refresh-btn.video-refresh-btn.cooldown {
    background: rgba(255, 193, 7, 0.95);
    color: #333;
    cursor: not-allowed;
    pointer-events: none;
    animation: cooldownPulse 1s ease-in-out;
}

@keyframes cooldownPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 错误状态 */
#post .lazy-refresh-btn.video-refresh-btn.error,
#article-container .lazy-refresh-btn.video-refresh-btn.error {
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    cursor: not-allowed;
    pointer-events: none;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

/* 错误状态视频样式 */
#post video.lazy-error,
#article-container video.lazy-error {
    opacity: 0.5;
    filter: grayscale(50%);
}

/* 深色模式适配 */
[data-theme='dark'] #post .lazy-video-container,
[data-theme='dark'] #article-container .lazy-video-container {
    background: linear-gradient(45deg,
        rgba(75, 0, 130, 0.1) 0%,
        rgba(138, 43, 226, 0.15) 50%,
        rgba(75, 0, 130, 0.1) 100%);
}

[data-theme='dark'] #post .lazy-refresh-btn.video-refresh-btn,
[data-theme='dark'] #article-container .lazy-refresh-btn.video-refresh-btn {
    background: rgba(45, 35, 65, 0.95);
    border-color: rgba(138, 43, 226, 0.5);
    color: #fff;
    box-shadow: 
        0 6px 20px rgba(138, 43, 226, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme='dark'] #post .lazy-refresh-btn.video-refresh-btn:hover,
[data-theme='dark'] #article-container .lazy-refresh-btn.video-refresh-btn:hover {
    background: rgba(138, 43, 226, 0.95);
    border-color: rgba(138, 43, 226, 0.9);
    box-shadow: 
        0 8px 25px rgba(138, 43, 226, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme='dark'] #post .lazy-refresh-btn.video-refresh-btn.loading,
[data-theme='dark'] #article-container .lazy-refresh-btn.video-refresh-btn.loading {
    background: rgba(138, 43, 226, 0.95);
    color: #fff;
}

[data-theme='dark'] #post .lazy-refresh-btn.video-refresh-btn.cooldown,
[data-theme='dark'] #article-container .lazy-refresh-btn.video-refresh-btn.cooldown {
    background: rgba(255, 193, 7, 0.9);
    color: #222;
}

[data-theme='dark'] #post .lazy-refresh-btn.video-refresh-btn.error,
[data-theme='dark'] #article-container .lazy-refresh-btn.video-refresh-btn.error {
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
}

[data-theme='dark'] #post video.lazy-error,
[data-theme='dark'] #article-container video.lazy-error {
    opacity: 0.4;
    filter: grayscale(70%);
}

/* 视频占位符动画 - 深色模式 */
[data-theme='dark'] #post .lazy-video.lazy-placeholder,
[data-theme='dark'] #article-container .lazy-video.lazy-placeholder {
    background: linear-gradient(45deg,
        rgba(75, 0, 130, 0.2) 0%,
        rgba(138, 43, 226, 0.25) 25%,
        rgba(72, 61, 139, 0.2) 50%,
        rgba(138, 43, 226, 0.25) 75%,
        rgba(75, 0, 130, 0.2) 100%) !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #post .lazy-refresh-btn.video-refresh-btn,
    #article-container .lazy-refresh-btn.video-refresh-btn {
        padding: 14px 28px;
        font-size: 15px;
    }
    
    #post .lazy-refresh-btn.video-refresh-btn svg,
    #article-container .lazy-refresh-btn.video-refresh-btn svg {
        width: 22px;
        height: 22px;
    }
    
    #post .lazy-video-container video,
    #article-container .lazy-video-container video {
        min-height: 150px;
    }
}

/* 确保按钮在视频上方 */
#post .lazy-video-container:hover .lazy-refresh-btn,
#article-container .lazy-video-container:hover .lazy-refresh-btn {
    z-index: 101;
}

/* 视频加载过渡效果 */
#post .lazy-video,
#article-container .lazy-video {
    transition: opacity 0.6s ease-out;
}

#post .lazy-video.lazy-loaded,
#article-container .lazy-video.lazy-loaded {
    opacity: 1;
}

/* 视频封面占位符 */
#post .lazy-video[poster=""],
#article-container .lazy-video[poster=""] {
    background: linear-gradient(135deg, 
        rgba(147, 112, 219, 0.1) 0%, 
        rgba(75, 0, 130, 0.15) 100%);
}
