/* styles.css */

/* 重置样式及字体 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
/* 颜色变量 */
:root {
    --primary-color: #667eea; /* 主色调，偏蓝紫 */
    --primary-dark: #556cd6;    /* 主色调的深色版本 */
    --primary-light: rgba(102, 126, 234, 0.1); /* 主色调的浅色版本，带透明度 */
    --secondary-color: #764ba2; /* 次要色调，偏紫 */
    --accent-color: #f56565; /* 用于错误和警告强调的强调色 */
    --success-color: #48bb78; /* 用于成功提示或肯定按钮的颜色 */
    --warning-color: #ed8936; /* 用于一般警告信息的颜色 */
    --text-dark: #2d3748;      /* 深色文本 */
    --text-medium: #718096;    /* 中度深色文本 */
    --text-light: #a0aec0;     /* 浅色文本 */
    --white: #ffffff;
    --gray-50: #f7fafc;        /* 极浅灰色 */
    --gray-100: #edf2f7;       /* 较浅灰色 */
    --gray-200: #e2e8f0;       /* 浅灰色 */
    --gray-300: #cbd5e0;       /* 中等灰色 */
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.05);   /* 轻微阴影 */
    --shadow-medium: 0 10px 15px rgba(0, 0, 0, 0.1);  /* 中等阴影 */
    --radius-md: 12px;         /* 中等圆角 */
    --radius-lg: 16px;         /* 大圆角 */
    --radius-full: 9999px;     /* 完全圆角（用于胶囊形） */
    --transition-normal: 0.3s ease; /* 标准过渡效果 */
}
/* 基础布局 */
body {
    background: linear-gradient(135deg, #f6f9ff 0%, #f0f4ff 100%); /* 优雅的渐变背景 */
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}
/* 整体容器 */
.container {
    max-width: 1600px; /* 更宽的容器，适应大屏幕 */
    margin: 0 auto;
    padding: 20px 15px;
    flex: 1; /* 让内容区域弹性增长 */
}
/* 头部 */
.header {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(255, 255, 255, 0.5); /* 模拟玻璃效果的边框 */
    backdrop-filter: blur(10px); /* 毛玻璃效果 */
}
.header h1 {
    text-align: center;
    font-size: 2.2em;
    color: var(--primary-color);
    margin-bottom: 20px;
    letter-spacing: -0.5px; /* 字体间距微调 */
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}
/* 导航栏 */
.nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 5px;
}
.nav a {
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); /* 渐变按钮背景 */
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full); /* 胶囊形按钮 */
    transition: var(--transition-normal);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.25); /* 按钮阴影 */
    position: relative;
}
.nav a:hover, .nav a.active {
    transform: translateY(-3px); /* 悬停和激活时略微上浮 */
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
}
/* 新闻容器 */
.news-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(255, 255, 255, 0.5); /* 再次模拟玻璃效果 */
    backdrop-filter: blur(10px);
    width: 100%;
}

/* 新闻头 */
.news-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 20px;
}
.news-title {
    font-size: 1.8em;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}
/* 元数据 */
.metadata {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    color: var(--text-medium);
    flex-wrap: wrap;
    gap: 15px 25px;
    font-size: 1.6em; /* 增大元数据字体大小 */
}
.metadata-item { display: flex; align-items: center; gap: 8px; }
.metadata-item i { color: var(--primary-color); }
/* 微语 */
.weiyu-container {
    background-color: var(--primary-light);
    padding: 18px 22px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 30px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0; /* 左侧直角，右侧圆角 */
    font-style: italic;
    color: var(--text-dark);
}
/* 新闻列表 */
.news-list { list-style-type: none; counter-reset: news-counter; padding-left: 0; margin: 0; }
.news-list li {
    position: relative;
    border-bottom: 1px solid var(--gray-200);
    padding: 18px 170px 18px 0; /* 右侧留白给搜索链接 */
    font-size: 1.05em;
    line-height: 1.7;
    word-break: break-all; /* 防止长单词/URL溢出 */
    display: flex;
    align-items: flex-start;
    gap: 15px;
}
.news-list li:last-child { border-bottom: none; }

.news-list li.type-header {
    background-color: var(--gray-50);
    color: var(--primary-dark);
    font-weight: bold;
    padding: 10px 20px;
    margin-top: 15px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
    font-size: 1.1em;
    letter-spacing: 0.5px;
    counter-reset: news-counter; /* 类别头重置计数器 */
    display: block; /* 确保它占据整行 */
}
.news-list li.type-separator {
    padding: 0;
    margin: 20px 0;
    border-bottom: none;
    text-align: center;
    display: block;
}
.news-list li.type-separator hr {
    border: none;
    border-top: 1px dashed var(--gray-200);
    height: 1px;
    width: 80%;
    margin: auto;
}
/* 列表序号 (移除了 ::before 伪元素，改为直接HTML span) */
.news-list li .news-num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); /* 序号背景渐变 */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
    z-index: 1;
    text-align: center;
    white-space: nowrap; /* 防止数字换行 */
}
/* 新闻文本放在 span 中 */
.news-list li .news-text {
    flex-grow: 1;
}

.search-link {
    padding: 7px 15px; background-color: var(--accent-color); color: white; text-decoration: none; border-radius: var(--radius-full);
    font-size: 0.85em; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.search-link:hover {
    background-color: var(--primary-dark);
    transform: translateY(-50%) scale(1.05);
}
.search-link svg { width: 14px; height: 14px; }

/* 来源信息小标签 */
.source-info {
    font-size: 0.85em;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    color: white;
    font-weight: 500;
}
.source-api { background-color: var(--success-color); }
.source-database { background-color: var(--primary-color); }
.source-latest { background-color: var(--warning-color); } /* 用于数据库回退/历史缓存 */
.source-unknown { background-color: var(--text-light); }

/* 历史列表样式 START */
.history-list { list-style-type: none; padding-left: 0; }
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    padding: 18px 15px;
    transition: background-color 0.2s ease;
    flex-wrap: nowrap;
    gap: 20px; /* 增大元素之间的间距 */
}
.history-item:hover {
    background-color: var(--gray-50);
}
.history-item:last-child { border-bottom: none; }

.history-date {
    flex-shrink: 0;
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.3em; /* 字体加大 */
    min-width: 150px; /* 确保日期有足够宽度，适应大的字体 */
    text-align: center;
}

.history-item-text {
    flex: 1 1 auto; /* 让文本内容弹性增长和收缩，但至少保持其内容所需宽度 */
    min-width: 0; /* 允许内容在需要时收缩到最小 */
    color: var(--text-medium);
    font-size: 1.15em; /* 字体加大 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 0; /* 间距由 gap 控制 */
}

.history-item-text span {
    font-size: 1em;
    color: var(--text-dark);
    font-style: italic;
    white-space: nowrap;
}

.history-item-link {
    flex-shrink: 0;
    text-decoration: none;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
    margin-left: auto; /* Push to the right */
    font-size: 1.15em; /* 字体加大 */
}
/* 历史列表样式 END */


/* 分页 */
.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 40px; }
.pagination a, .pagination span {
    padding: 10px 16px; background-color: var(--white); color: var(--text-dark); text-decoration: none;
    border-radius: var(--radius-md); border: 1px solid var(--gray-200); min-width: 42px; text-align: center;
    transition: var(--transition-normal);
}
.pagination a:hover, .pagination a.active { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: white; border-color: var(--primary-color); }
/* 状态提示 */
.warning, .error { padding: 20px 25px; border-radius: var(--radius-md); margin-bottom: 25px; display: flex; align-items: flex-start; gap: 12px; }
.warning { background-color: #fffaf0; color: #dd6b20; border-left: 4px solid var(--warning-color); }
.error { background-color: #fff5f5; color: #c53030; border-left: 4px solid var(--accent-color); }
.warning svg, .error svg { width: 24px; height: 24px; flex-shrink: 0; margin-top: 3px; }

/* 按钮 */
.refresh-btn, .share-btn {
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: 0.9em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.refresh-btn { background: linear-gradient(135deg, var(--success-color), #38a169); }
.share-btn { background: linear-gradient(135deg, #10b981, #059669); }
.refresh-btn:hover, .share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* return-history-btn-container centered */
.return-history-btn-container {
    text-align: center;
    margin-top: 35px;
    margin-bottom: 20px;
}

/* return-history-btn style */
.return-history-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.25);
}
.return-history-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
}


.copy-success-tooltip { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: rgba(0,0,0,0.7); color: white; padding: 10px 20px; border-radius: 5px; z-index: 9999; opacity: 0; transition: opacity 0.3s ease-out; }
.copy-success-tooltip.show { opacity: 1; }
/* Footer */
footer { background-color: var(--white); padding: 40px 20px 25px; margin: 30px auto 0; border-top: 1px solid var(--gray-100); max-width: 1600px; width: 100%; box-shadow: 0 -2px 5px rgba(0,0,0,0.03); }
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap; text-align: center; }
.footer-section { min-width: 200px; flex: 1; padding: 0 20px; margin-bottom: 20px; }
.footer-section h3 { margin-bottom: 15px; color: var(--text-dark); }
.footer-section ul { list-style: none; padding: 0; }
.footer-section a { color: var(--text-medium); text-decoration: none; transition: color 0.2s ease; }
.footer-section a:hover { color: var(--primary-color); }
.copyright { text-align: center; padding: 25px 0 0; margin-top: 20px; border-top: 1px solid var(--gray-100); width: 100%; font-size: 0.95em; color: var(--text-light); }
/* Back-to-top button */
#back-to-top { position: fixed; right: 25px; bottom: 40px; width: 42px; height: 42px; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: white; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); cursor: pointer; transition: transform 0.3s ease, opacity 0.3s ease; z-index: 1000; opacity: 0; visibility: hidden; box-shadow: var(--shadow-medium); }
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(-5px); }
/* Responsive */
@media (max-width: 768px) {
    .container, .header, .news-container { padding: 15px; }
    .header h1 { font-size: 1.8em; }
    .nav { flex-direction: column; gap: 12px;}
    .nav a { width: 100%; text-align: center; }
    .news-container { max-width: 100%; }
    .news-title { font-size: 1.5em; flex-direction: column; align-items: flex-start; }
    .news-title > div { display: flex; flex-direction: column; align-items: flex-start; width: 100%; gap: 12px; }
    .refresh-btn, .share-btn { margin-left: 0; width: 100%; justify-content: center; }
    .metadata { flex-direction: column; align-items: center; gap: 8px; font-size: 1.1em; }

    .news-list li {
        padding: 18px 0 25px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .news-list li .news-num {
        position: static;
        transform: none;
        width: auto;
        height: auto;
        padding: 5px 10px;
        margin-bottom: 5px;
    }
    .news-list li .news-text {
        padding-left: 0;
        width: 100%;
    }

    .search-link {
        position: static;
        transform: none;
        margin-top: 12px;
        align-self: flex-start; /* Align search link to start */
        width: 100%;
        justify-content: center;
    }
    .footer-content { flex-direction: column; gap: 20px; }

    /* History list adjustments for small screens */
    .history-item {
        flex-wrap: wrap;
        align-items: flex-start;
        flex-direction: column;
        gap: 10px; /* 调整间距 */
    }
    .history-date {
        margin-bottom: 0;
        min-width: unset;
        font-size: 1.1em; /* 在小屏幕下字体稍微小点 */
        width: 100%; /* Take full width */
        text-align: left; /* Align date to left */
    }
    .history-item-text {
        width: 100%;
        margin-left: 0;
        max-width: 100% !important;
        margin-bottom: 0;
        white-space: normal;
        font-size: 1em; /* 在小屏幕下字体稍微小点 */
    }
    .history-item-link {
        width: 100%;
        justify-content: center;
        margin-top: 10px; /* 重新添加链接顶部间距 */
        font-size: 1em; /* 在小屏幕下字体稍微小点 */
    }
}
.temp-clipboard-textarea {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    resize: none !important;
    background-color: transparent !important;
    color: transparent !important;
    z-index: -1 !important;
    display: block !important;
}

/* 兼容旧浏览器内联样式的修复 */
/* 确保 .no-news-message 继承新的 li 样式并保持居中 */
.news-list li.no-news-message {
    text-align: center;
    color: var(--text-medium);
    border-bottom: none; /* 移除底部边框 */
    padding: 20px;
    background-color: transparent; /* 确保背景透明或符合设计 */
    box-shadow: none; /* 移除阴影 */
    list-style: none; /* 确保无项目符号 */
    display: block; /* 确保它占据一行 */
    /* 额外的调整以适应新布局 */
    margin: 20px auto; /* 居中 */
    max-width: 80%; /* 限制宽度 */
}