/**
 * 图片懒加载刷新按钮样式
 */

/* 图片容器 - 相对定位用于放置刷新按钮 */
#post .lazy-image-container,
#article-container .lazy-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

#post .lazy-image-container img,
#article-container .lazy-image-container img {
    display: block;
    width: 100%;
    height: auto;
}

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

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

#post .lazy-refresh-btn:hover,
#article-container .lazy-refresh-btn:hover {
    background: rgba(147, 112, 219, 0.95);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 
        0 6px 20px rgba(147, 112, 219, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

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

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

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

/* 冷却中状态 */
#post .lazy-refresh-btn.cooldown,
#article-container .lazy-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.error,
#article-container .lazy-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 img.lazy-error,
#article-container img.lazy-error {
    opacity: 0.5;
    filter: grayscale(50%);
}

/* 深色模式适配 */
[data-theme='dark'] #post .lazy-refresh-btn,
[data-theme='dark'] #article-container .lazy-refresh-btn {
    background: rgba(45, 35, 65, 0.95);
    border-color: rgba(138, 43, 226, 0.4);
    color: #ba85d3;
    box-shadow: 
        0 4px 15px rgba(138, 43, 226, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] #post .lazy-refresh-btn:hover,
[data-theme='dark'] #article-container .lazy-refresh-btn:hover {
    background: rgba(138, 43, 226, 0.95);
    color: #fff;
    box-shadow: 
        0 6px 20px rgba(138, 43, 226, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

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

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

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

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

/* 小尺寸图片适配 */
#post .lazy-image-container.small .lazy-refresh-btn,
#article-container .lazy-image-container.small .lazy-refresh-btn {
    padding: 6px 12px;
    font-size: 11px;
}

#post .lazy-image-container.small .lazy-refresh-btn svg,
#article-container .lazy-image-container.small .lazy-refresh-btn svg {
    width: 14px;
    height: 14px;
}

/* 大尺寸图片适配 */
#post .lazy-image-container.large .lazy-refresh-btn,
#article-container .lazy-image-container.large .lazy-refresh-btn {
    padding: 10px 20px;
    font-size: 14px;
}

#post .lazy-image-container.large .lazy-refresh-btn svg,
#article-container .lazy-image-container.large .lazy-refresh-btn svg {
    width: 18px;
    height: 18px;
}

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

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