/**
 * 通用刷新按钮样式
 * 用于首页和安全中心等页面
 */

/* 首页样式的刷新按钮 */
.refresh-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 5px;
    width: 20px;
    height: 20px;
    background: none;
    border-radius: 50%;
    position: relative;
    border: 1.5px solid var(--gray-bg);
    transition: all 0.3s ease;
    transform-origin: center;
}

.refresh-btn:hover {
    border-color: var(--secondary-color);
    background-color: rgba(255, 255, 255, 0.1);
}

.refresh-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.refresh-btn svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    fill: var(--active-color);
}

/* 加载状态下的连续旋转动画 */
.refresh-btn.loading img {
    animation: continuousRotate 1.2s linear infinite;
}

/* 点击时的单次旋转动画 */
.refresh-btn:not(.loading) img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}


/* 安全中心样式的刷新按钮 */
.security-style .refresh-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    margin-left: 10px;
    border: none;
}

.security-style .refresh-btn:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.security-style .refresh-icon {
    width: 16px;
    height: 16px;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    position: relative;
}

.security-style .refresh-icon::before {
    content: '';
    position: absolute;
    top: -3px;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 6px 6px;
    border-color: transparent transparent var(--secondary-color) transparent;
}

.security-style .refresh-icon::after {
    content: '';
    position: absolute;
    top: 0;
    right: -3px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 0 6px;
    border-color: transparent transparent transparent var(--secondary-color);
}

/* 旋转动画 */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 连续旋转动画（用于加载状态） */
@keyframes continuousRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 安全中心样式的旋转动画 */
.refresh-btn.loading,
.refresh-btn.loading .refresh-icon {
    animation: rotate 1s linear infinite;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .refresh-btn {
        width: 18px;
        height: 18px;
    }

    .refresh-btn::before {
        width: 8px;
        height: 8px;
    }

    .refresh-btn::after {
        border-width: 2px;
        top: 3px;
        right: 7px;
    }

    .security-style .refresh-btn {
        width: 22px;
        height: 22px;
    }

    .security-style .refresh-icon {
        width: 14px;
        height: 14px;
    }
}
