/* =================================================================
   文件: style.css
   描述: 网站前台所有页面样式
   版本: v4.0 (最终版, 集成所有功能样式)
   ================================================================= */

/* --- 1. 变量与主题定义 --- */
:root {
    /* 基础颜色 */
    --primary-color: #3b82f6;
    /* 主要颜色 (如链接、按钮) */
    --secondary-color: #60a5fa;
    /* 次要颜色 (如悬停效果) */
    --text-color: #1f2937;
    /* 默认文字颜色 */

    /* 组件背景 */
    --card-background: rgba(255, 255, 255, 0.9);
    /* 卡片背景 (带透明度) */

    /* 动画与过渡 */
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* 背景渐变 (亮色模式) */
    --background-light: linear-gradient(-45deg, #e6f2ff, #fff0f5, #f0f7ff, #fff5e6);
    /* 背景渐变 (暗色模式) */
    --background-dark: linear-gradient(-45deg, #1a202c, #2d3748, #4a5568, #2d3748);
}

/* 暗黑模式下的变量覆盖 */
.dark-mode {
    --primary-color: #60a5fa;
    --secondary-color: #3b82f6;
    --text-color: #e2e8f0;
    --card-background: rgba(26, 32, 44, 0.9);
}

/* --- 2. 全局与基础样式 --- */
/* 全局重置 */
* {
    box-sizing: border-box;
    /* 盒子模型计算方式 */
    margin: 0;
    padding: 0;
}

/* 页面主体 */
body {
    font-family: 'Noto Sans SC', sans-serif;
    /* 字体设置 */
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    /* 使用 Flexbox 布局实现垂直居中 */
    justify-content: center;
    align-items: center;
    background: var(--background-light);
    /* 默认使用亮色背景 */
    background-size: 400% 400%;
    /* 背景尺寸，用于动画 */
    animation: gradientBG 15s ease infinite;
    /* 应用背景渐变动画 */
    overflow-x: hidden;
    /* 防止水平溢出 */
    font-size: 16px;
    transition: var(--transition);
}

/* 暗黑模式下的 body 样式 */
body.dark-mode {
    background: var(--background-dark);
}

/* --- 3. 布局容器 --- */
/* 主内容包裹容器 */
.wrapper {
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    /* 内容最大宽度 */
    position: relative;
    z-index: 1;
    /* 确保内容在背景动画之上 */
}

/* 白色卡片区域 */
.main {
    background-color: var(--card-background);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    backdrop-filter: blur(10px);
    /* 背景模糊效果 (毛玻璃) */
    transition: var(--transition);
    position: relative;
}

.main:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    /* 悬停时阴影加深 */
}

/* 页脚 */
.footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-color);
    opacity: 0.8;
}

/* --- 4. 文本与列表样式 --- */
/* 主标题 H1 */
h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* 链接列表 */
ul {
    list-style-type: none;
    margin-bottom: 1.5rem;
}

/* 列表项 */
li {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: rgba(248, 250, 252, 0.8);
    border-radius: 10px;
    transition: var(--transition);
    position: relative;
    padding-top: 1.5rem;
}

.dark-mode li {
    background-color: rgba(26, 32, 44, 0.8);
}

li:hover {
    transform: translateY(-3px);
    /* 悬停时轻微上浮 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 列表项内的链接 */
li a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

li a:hover {
    color: var(--secondary-color);
}

/* 公告栏 */
.notice {
    background-color: rgba(230, 242, 255, 0.8);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 10px;
}

.dark-mode .notice {
    background-color: rgba(44, 55, 72, 0.8);
}

/* --- 5. 按钮与交互元素 --- */
/* 收藏按钮 */
.bookmark-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.bookmark-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 暗黑模式切换按钮 */
.mode-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

/* 复制链接按钮 */
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: var(--transition);
    margin: 0 10px;
}

.copy-btn:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* 手动刷新按钮 */
#refresh-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#refresh-btn:hover {
    transform: rotate(90deg);
}

/* --- 6. 状态与信息显示 --- */
/* 延迟(ms)显示 */
.ms-display {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.7em;
    padding: 2px 5px;
    border-top-left-radius: 10px;
    border-bottom-right-radius: 10px;
    color: white;
    transition: background-color 0.3s ease;
}

.ms-checking {
    background-color: #ffeb3b;
    color: black;
}

.ms-normal {
    background-color: #4CAF50;
}

.ms-error {
    background-color: #f44336;
}

.ms-unconfigured {
    background-color: #9e9e9e;
}

.ms-blocked {
    background-color: #90a4ae;
}

/* ✨ 新增: "外部直达" 状态的延迟样式 */

/* 状态徽章 (正常/无法访问等) */
.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-left: 10px;
    color: white;
}

.status-normal {
    background-color: #4CAF50;
}

.status-error {
    background-color: #f44336;
}

.status-checking {
    background-color: #ffeb3b;
    color: black;
}

.status-unconfigured {
    background-color: #9e9e9e;
}

.status-blocked {
    background-color: #90a4ae;
}

/* ✨ 新增: "外部直达" 状态的专属样式 (中性灰蓝色) */

/* 禁用状态的列表项 */
li.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

li.disabled a {
    pointer-events: none;
}

/* 统计信息容器 */
#stats-container {
    background-color: var(--card-background);
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#last-checked-time {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
}

.stat-label {
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.8;
}

.url-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* --- 7. 动画与特效 --- */
/* 背景渐变动画 */
@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* 背景浮动元素 */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.bg-animation span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    animation: move 25s infinite linear;
}

.dark-mode .bg-animation span {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes move {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
        border-radius: 0;
    }

    100% {
        transform: translateY(-1000px) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}

/* 鼠标点击粒子特效 */
.particle {
    position: fixed;
    /* 相对于视口定位 */
    top: 0;
    left: 0;
    border-radius: 50%;
    /* 圆形 */
    pointer-events: none;
    /* 穿透鼠标事件，不影响点击 */
    background: #000;
    /* 默认背景色，会被 JS 覆盖 */
    transform: translate(-50%, -50%);
    /* 居中于鼠标指针 */
    animation: particle-animation 1s forwards;
    /* 应用动画 */
    z-index: 9999;
    /* 最高层级 */
}

@keyframes particle-animation {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        /* 最终位置和大小由 JS 提供的变量决定 */
        transform: translate(var(--x), var(--y)) scale(0);
        opacity: 0;
    }
}


/* --- 8. 响应式设计 --- */
/* 适配平板及小尺寸桌面 (小于 768px) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .wrapper {
        padding: 1rem;
    }

    .main {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .bookmark-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    li {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        padding-top: 1.25rem;
    }

    .url-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    li a {
        font-size: 0.9rem;
    }

    .status-badge {
        margin-left: 0;
    }

    .copy-btn {
        margin: 5px 0 0 0;
    }

    #last-checked-time {
        font-size: 1em;
    }

    .stat-value {
        font-size: 1.3em;
    }

    .mode-toggle {
        font-size: 1.3rem;
    }
}

/* 适配主流手机 (小于 480px) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .main {
        padding: 1rem;
    }

    .wrapper {
        padding: 0.5rem;
    }

    .bookmark-btn,
    li {
        margin-bottom: 0.5rem;
    }

    .footer {
        font-size: 0.8rem;
    }
}