/* ===== CSS 变量系统（支持暗色模式） ===== */
:root {
    --bg-primary: #f9f9f9;
    --bg-secondary: #fff;
    --bg-card: transparent;
    --bg-hover: #f8f9fa;
    --bg-badge: #fff8e1;
    --text-primary: #2c3e50;
    --text-secondary: #555;
    --text-muted: #7f8c8d;
    --border-color: #eee;
    --border-accent: #e67e22;
    --link-color: #3498db;
    --link-hover: #27ae60;
    --btn-bg: #3498db;
    --btn-hover: #27ae60;
    --btn-text: #fff;
    --pin-bg: #e67e22;
    --shadow: none;
    --input-bg: #fff;
    --input-border: #ddd;
}

[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: rgba(255,255,255,0.03);
    --bg-hover: rgba(255,255,255,0.05);
    --bg-badge: rgba(230,126,34,0.15);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --border-color: #2a2a4a;
    --border-accent: #e67e22;
    --link-color: #5dade2;
    --link-hover: #2ecc71;
    --btn-bg: #2980b9;
    --btn-hover: #27ae60;
    --btn-text: #fff;
    --pin-bg: #d35400;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --input-bg: #1a1a2e;
    --input-border: #3a3a5a;
}

/* ===== 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft Yahei", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding-bottom: 100px;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1000px;
    width: 90%;
    margin: 50px auto;
    background-color: var(--bg-card);
    padding: 0;
}

/* ===== 头部 ===== */
.header { text-align: center; margin-bottom: 20px; }
.header h1 { font-size: 2.5rem; color: var(--text-primary); margin-bottom: 15px; }
.intro { text-align: center; line-height: 1.8; color: var(--text-secondary); font-size: 1.1rem; margin-bottom: 40px; padding: 0 20px; }

/* ===== 搜索栏 ===== */
.search-bar {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 20px;
}
.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 18px;
    border: 2px solid var(--input-border);
    border-radius: 25px;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s;
}
.search-input:focus { border-color: var(--link-color); }
.search-btn {
    padding: 10px 24px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}
.search-btn:hover { background: var(--btn-hover); }

/* ===== 分类（还原原版布局） ===== */
.categories {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}
.categories h2 { font-size: 1.3rem; color: var(--text-primary); margin-bottom: 20px; }
.cat-link {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 50px auto;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid var(--btn-bg);
    background-color: var(--btn-bg);
    transition: all 0.3s;
    font-size: 20px;
}
.cat-link:hover {
    background-color: var(--btn-hover);
    border-color: var(--btn-hover);
    color: #fff;
}

.empty { text-align: center; padding: 40px 0; color: var(--text-muted); font-size: 1rem; }
.search-count { text-align: center; color: var(--text-muted); margin-bottom: 20px; }

/* ===== 文章列表 ===== */
.article-list { padding: 0; }
.article-item { padding: 30px 0; text-align: center; border-bottom: 1px solid var(--border-color); }
.article-item:last-child { border-bottom: none; }
.article-title { font-size: 1.5rem; margin-bottom: 15px; }
.article-title a { color: var(--link-color); text-decoration: none; }
.article-title a:hover { color: var(--link-hover); }
.article-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.article-more a {
    display: inline-block;
    color: var(--btn-text);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--btn-bg);
    background-color: var(--btn-bg);
    border-radius: 4px;
    transition: all 0.3s;
}
.article-more a:hover {
    background-color: var(--btn-hover);
    border-color: var(--btn-hover);
    color: var(--btn-text);
}

/* ===== 置顶 ===== */
.pin-badge {
    display: inline-block;
    background-color: var(--pin-bg);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
}
.article-item.pinned {
    background-color: var(--bg-badge);
    border-left: 3px solid var(--pin-bg);
    padding-left: 15px;
    margin-bottom: 5px;
    border-radius: 0 4px 4px 0;
}

/* ===== 友情链接 ===== */
.friend-links {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background-color: transparent;
    z-index: 999;
    text-align: center;
}
.friend-links h2 { font-size: 1.3rem; color: var(--text-primary); margin-bottom: 15px; }
.links-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.links-list a {
    padding: 6px 18px;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid var(--btn-bg);
    transition: all 0.3s;
    font-size: 0.9rem;
}
.links-list a:hover {
    background-color: var(--btn-hover);
    color: var(--btn-text);
    border-color: var(--btn-hover);
}
.no-links { color: var(--text-muted); font-size: 0.9rem; }
.no-links a { color: var(--link-color); text-decoration: none; }

/* ===== 分页 ===== */
.pagination { text-align: center; margin-top: 30px; }
.pagination a {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    color: var(--link-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s;
}
.pagination a:hover, .pagination a.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    border-color: var(--btn-bg);
}

/* ===== 暗色模式切换按钮（右上角） ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== 文章详情页 ===== */
.article-content {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 30px;
}
.article-detail-title { font-size: 2rem; color: var(--text-primary); text-align: center; margin-bottom: 20px; line-height: 1.4; }
.article-detail-meta { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.article-detail-meta span { margin: 0 15px; }
.article-body { line-height: 1.8; color: var(--text-secondary); font-size: 1.1rem; padding: 0 20px; }
.article-body p { margin-bottom: 20px; }
.article-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 20px auto; display: block; }
.back { text-align: center; margin-top: 30px; }
.back a {
    color: var(--btn-text);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--btn-bg);
    background-color: var(--btn-bg);
    border-radius: 4px;
    transition: all 0.3s;
    margin: 0 10px;
}
.back a:hover { background-color: var(--btn-hover); border-color: var(--btn-hover); }

/* ===== 评论区 ===== */
.comments-section {
    max-width: 1000px;
    width: 90%;
    margin: 30px auto;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.comments-section h2 { text-align: center; color: var(--text-primary); margin-bottom: 25px; font-size: 1.4rem; }
.comment-form { margin-bottom: 30px; }
.comment-form .form-row { margin-bottom: 15px; }
.comment-form label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 0.95rem; }
.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--link-color); }
.comment-form textarea { min-height: 100px; resize: vertical; }
.comment-form button {
    padding: 10px 24px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}
.comment-form button:hover { background: var(--btn-hover); }

.comment-list { border-top: 1px solid var(--border-color); padding-top: 20px; }
.comment-item {
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
}
.comment-item:last-child { border-bottom: none; }
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.comment-nick { font-weight: bold; color: var(--text-primary); font-size: 1rem; }
.comment-time { color: var(--text-muted); font-size: 0.85rem; }
.comment-body { color: var(--text-secondary); line-height: 1.7; word-break: break-word; }
.comment-empty { text-align: center; color: var(--text-muted); padding: 30px 0; }

.comment-msg-success { padding: 10px; background: rgba(39,174,96,0.1); color: #27ae60; border-radius: 6px; margin-bottom: 15px; text-align: center; }
.comment-msg-error { padding: 10px; background: rgba(231,76,60,0.1); color: #e74c3c; border-radius: 6px; margin-bottom: 15px; text-align: center; }

/* ===== 验证码 ===== */
.captcha-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.captcha-question {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-badge);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
    letter-spacing: 2px;
    user-select: none;
    white-space: nowrap;
}
.captcha-group input[type="number"] {
    width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s;
    -moz-appearance: textfield;
}
.captcha-group input[type="number"]::-webkit-inner-spin-button,
.captcha-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.captcha-group input:focus { outline: none; border-color: var(--link-color); }
.captcha-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-hover);
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.2s, transform 0.3s;
}
.captcha-refresh:hover {
    background: var(--btn-bg);
    transform: rotate(180deg);
}

/* ===== 响应式布局 ===== */
@media (max-width: 768px) {
    .container { width: 95%; margin: 20px auto; }
    .header h1 { font-size: 1.8rem; }
    .intro { font-size: 1rem; padding: 0 10px; }
    .cat-link { max-width: 100%; font-size: 18px; margin: 30px auto; }
    .article-title { font-size: 1.2rem; }
    .article-detail-title { font-size: 1.5rem; }
    .article-body { font-size: 1rem; padding: 0 10px; }
    .comments-section { width: 95%; padding: 20px 15px; }
    .landing-title { font-size: 2rem; }
    .landing-content { font-size: 1rem; }
    .landing-container { padding: 30px 15px; }
    .enter-btn { padding: 12px 35px; font-size: 1rem; }
    .search-form { flex-direction: column; align-items: center; }
    .search-input { max-width: 100%; }
    .pagination a { padding: 6px 10px; font-size: 0.9rem; }
    .friend-links { display: none; }
    .back { display: flex; flex-direction: column; gap: 10px; align-items: center; }
    .back a { margin: 0; }
}

@media (max-width: 480px) {
    .header h1 { font-size: 1.4rem; }
    .cat-link { font-size: 16px; padding: 10px 15px; }
    .article-title { font-size: 1.1rem; }
    .comment-form textarea { min-height: 80px; }
    .captcha-group { flex-direction: column; align-items: stretch; }
}

/* 置顶文章标识 */
.text-orange { color: #e67e22; font-weight: bold; }


/* 前端使用的工具类（从 admin.css 迁移） */
.link-reset { text-decoration: none; color: inherit; }
.search-form { display: flex; gap: 10px; justify-content: center; }
.error-page { text-align: center; padding: 100px; font-family: sans-serif; }

