/* ========================================
   PHP 个人博客 - 完整样式表
   ======================================== */

/* --- 基础重置与变量 --- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --text: #1a1a2e;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --warning: #f59e0b;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --max-width: 1200px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-secondary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

/* --- 容器 --- */
.container { max-width: 800px; margin: 0 auto; padding: 0 20px; }

/* --- 顶部导航 --- */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.95);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}
.logo:hover { color: var(--primary); }

.nav-links {
    list-style: none;
    display: flex;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* 移动端菜单 */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: all 0.3s;
}

/* --- Flash 消息 --- */
.flash-message {
    max-width: var(--max-width);
    margin: 16px auto;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
}
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error); }

/* --- 按钮通用 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: var(--bg-secondary); color: var(--text); }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: white;
}

.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* --- 首页布局 --- */
.main-content { padding: 24px 0 48px; }

.home-layout {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

/* --- 文章卡片 --- */
.post-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    margin-bottom: 16px;
}
.post-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-lg);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}
.post-meta time { color: var(--text-secondary); }

.post-category {
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 20px;
}
.post-category:hover { background: #dbeafe; }

.post-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--primary); }

.post-excerpt {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.post-stats { font-size: 13px; color: var(--text-secondary); }

/* 标签 */
.tag {
    display: inline-block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}
.tag:hover { color: var(--primary); }

.post-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.post-tags .tag {
    background: var(--bg-tertiary);
    padding: 2px 10px;
    border-radius: 20px;
}

/* --- 分页 --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 0;
}
.page-btn {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.page-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- 侧边栏 --- */
.sidebar-widget {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.widget-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
    color: var(--text);
}

.blog-description { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }

.blog-stats {
    display: flex;
    gap: 12px;
}
.stat-item {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}
.stat-number { display: block; font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-label { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.recent-posts { list-style: none; }
.recent-posts li {
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.recent-posts li:last-child { border-bottom: none; }
.recent-posts a { font-size: 14px; color: var(--text); font-weight: 500; }
.recent-posts a:hover { color: var(--primary); }
.recent-posts time { font-size: 12px; color: var(--text-secondary); }

.category-list { list-style: none; }
.category-list li a {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-tertiary);
    font-size: 14px;
    color: var(--text);
}
.category-list li:last-child { border-bottom: none; }
.category-list .count {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud .tag {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}

/* --- 文章详情页 --- */
.post-detail {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--border);
    margin-bottom: 32px;
}

.post-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.post-detail-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.3;
    margin: 8px 0 12px;
}

.post-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}
.post-info .author { font-weight: 600; color: var(--text); }

.post-body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
}
.post-body h2 { font-size: 22px; font-weight: 700; margin: 28px 0 14px; }
.post-body h3 { font-size: 18px; font-weight: 600; margin: 24px 0 12px; }
.post-body p { margin-bottom: 16px; }
.post-body ul, .post-body ol { margin: 12px 0 16px 24px; }
.post-body li { margin-bottom: 6px; }
.post-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
    margin: 16px 0;
}
.post-body code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}
.post-body pre code {
    background: none;
    padding: 0;
}
.post-body blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
}
.post-body a { color: var(--primary); text-decoration: underline; }
.post-body img { border-radius: var(--radius); margin: 16px 0; }

.post-nav { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

/* --- 评论区 --- */
.comments-section { margin-top: 48px; }
.comments-section h2 { font-size: 20px; margin-bottom: 24px; }

.comment-list { margin-bottom: 32px; }

.comment-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--bg-tertiary);
}
.comment-item:last-child { border-bottom: none; }

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.comment-content { flex: 1; }
.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.comment-author { font-weight: 600; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--text-secondary); }
.comment-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.no-comments { color: var(--text-secondary); padding: 20px 0; text-align: center; }

.comment-form h3 { font-size: 16px; margin-bottom: 16px; }

/* --- 表单样式 --- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-group small { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* --- 页面标题 --- */
.page-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 24px;
}

/* --- 分类页 --- */
.category-header { margin-bottom: 24px; }
.category-header h1 { font-size: 24px; margin-bottom: 8px; }
.category-desc { color: var(--text-secondary); margin-bottom: 8px; }
.back-link { font-size: 14px; color: var(--text-secondary); }
.back-link:hover { color: var(--primary); }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.category-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s;
}
.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.category-card h3 { font-size: 18px; margin-bottom: 8px; }
.category-card p { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.category-card .post-count { font-size: 13px; color: var(--primary); font-weight: 600; }

/* --- 标签云 --- */
.tag-cloud-large { display: flex; flex-wrap: wrap; gap: 12px; }
.tag-large {
    display: inline-block;
    padding: 8px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 15px;
    color: var(--text);
    transition: all 0.2s;
}
.tag-large:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- 关于页 --- */
.about-page { padding: 32px; background: var(--bg); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.about-intro { margin-bottom: 32px; }
.about-intro h2 { font-size: 22px; margin-bottom: 8px; }
.about-intro p { color: var(--text-secondary); font-size: 16px; }

.about-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.about-stats .stat-card {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}
.about-stats .stat-number { display: block; font-size: 28px; font-weight: 800; color: var(--primary); }
.about-stats .stat-label { font-size: 13px; color: var(--text-secondary); }

.about-tech { margin-top: 24px; }
.about-tech h2 { font-size: 18px; margin-bottom: 12px; }
.about-tech li { padding: 6px 0; font-size: 14px; color: var(--text-secondary); }

/* --- 空状态 --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}
.empty-state h2 { margin-bottom: 12px; color: var(--text); }

/* --- 页脚 --- */
.site-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}
.site-footer a { color: var(--primary); }
.footer-icp { margin-top: 8px; font-size: 13px; color: var(--text-secondary); }
.footer-icp a { color: var(--text-secondary); text-decoration: none; }
.footer-icp a:hover { color: var(--primary); }

/* --- 欢迎弹窗 --- */
.welcome-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 9999;
    animation: slideUp 0.4s ease-out;
    max-width: 90vw;
}
.welcome-icon { font-size: 20px; }
.welcome-toast strong { color: var(--primary); }
.welcome-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    margin-left: 8px;
    flex-shrink: 0;
}
.welcome-close:hover { color: var(--text); }
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- 设备标签（后台） --- */
.device-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.device-mobile { background: #ecfdf5; color: #059669; }
.device-tablet { background: #eef2ff; color: #4f46e5; }
.device-desktop { background: #f1f5f9; color: #64748b; }

/* ========================================
   后台管理样式 - 侧边栏布局
   ======================================== */

/* --- 后台 CSS 变量 --- */
.admin-body {
    --sidebar-w: 240px;
    --topbar-h: 60px;
    --admin-bg: #f1f5f9;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #4f46e5;
    --sidebar-hover-bg: #1e293b;
    --card-bg: #ffffff;
    --admin-text: #1e293b;
    --admin-muted: #64748b;
    --admin-border: #e2e8f0;
}

/* --- 登录页 --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #4f46e5 100%);
}
.login-card {
    background: white;
    padding: 44px 40px;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
}
.login-card h1 { font-size: 26px; margin-bottom: 4px; color: #0f172a; font-weight: 800; }
.login-subtitle { color: var(--admin-muted); margin-bottom: 28px; font-size: 14px; }
.login-footer { margin-top: 24px; text-align: center; font-size: 13px; }
.login-card .form-group input {
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 10px;
    border: 2px solid var(--admin-border);
    margin-bottom: 4px;
}
.login-card .form-group input:focus {
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}
.login-card .btn-primary {
    padding: 12px;
    font-size: 15px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 8px;
}

/* --- 后台主体 --- */
.admin-body {
    display: flex;
    min-height: 100vh;
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: var(--font);
}

/* --- 侧边栏 --- */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
}
.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--sidebar-active);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}
.brand-text {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.sidebar-close { display: none; }

/* 侧边栏导航 */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
    margin-bottom: 2px;
}
.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: #e2e8f0;
}
.sidebar-link.active {
    background: var(--sidebar-active);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79,70,229,0.4);
}
.sidebar-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

/* 侧边栏角标（待审核数量） */
.sidebar-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-link-logout { color: #f87171; }
.sidebar-link-logout:hover { background: rgba(239,68,68,0.12); color: #fca5a5; }

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* --- 主内容区 --- */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- 顶部栏 --- */
.admin-topbar {
    height: var(--topbar-h);
    background: white;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--admin-text); }

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}
.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--admin-text);
    border-radius: 1px;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sidebar-active);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 600; color: var(--admin-text); }

/* --- 内容区 --- */
.admin-content {
    flex: 1;
    padding: 28px;
}

/* 后台 Flash */
.admin-body .flash-message {
    margin-bottom: 20px;
}

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-page-header h1 { font-size: 22px; font-weight: 700; }
.admin-page-header p { font-size: 14px; color: var(--admin-muted); }

/* --- 后台卡片 --- */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.admin-card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
}

/* --- 后台表格 --- */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    text-align: left;
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--admin-muted);
    background: var(--admin-bg);
    border-bottom: 2px solid var(--admin-border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--admin-text);
}
.admin-table tr:hover td { background: #f8fafc; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge.published { background: #ecfdf5; color: #059669; }
.status-badge.draft { background: #fef3c7; color: #d97706; }

/* 操作按钮 */
.actions { display: flex; gap: 6px; }
.action-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.action-btn.edit { background: #eef2ff; color: var(--sidebar-active); }
.action-btn.edit:hover { background: var(--sidebar-active); color: white; }
.action-btn.delete { background: #fef2f2; color: #dc2626; }
.action-btn.delete:hover { background: #dc2626; color: white; }
.action-btn:not(.edit):not(.delete) { background: #f1f5f9; color: var(--admin-muted); }
.action-btn:not(.edit):not(.delete):hover { background: #e2e8f0; }

/* --- 统计卡片 --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card-admin {
    background: var(--card-bg);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s;
}
.stat-card-admin:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-card-admin:nth-child(1) .stat-icon { background: #eef2ff; }
.stat-card-admin:nth-child(2) .stat-icon { background: #ecfdf5; }
.stat-card-admin:nth-child(3) .stat-icon { background: #fef3c7; }
.stat-card-admin:nth-child(4) .stat-icon { background: #fce7f3; }
.stat-info .stat-number { display: block; font-size: 26px; font-weight: 800; color: var(--admin-text); line-height: 1.1; }
.stat-info .stat-label { font-size: 13px; color: var(--admin-muted); margin-top: 2px; }
.stat-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}
.stat-badge:hover {
    background: #dc2626;
    color: white;
}

/* --- 仪表盘 --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.dashboard-grid .admin-card:first-child {
    grid-column: 1 / -1;
}

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-actions .btn { padding: 10px 20px; border-radius: 10px; font-weight: 600; }

.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dashboard-card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
}

.recent-comments { font-size: 14px; }
.comment-row {
    padding: 11px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.comment-row:last-child { border-bottom: none; }
.comment-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.comment-status.approved { background: #ecfdf5; color: #059669; }
.comment-status.pending { background: #fef3c7; color: #d97706; }

.empty-hint {
    color: var(--admin-muted);
    text-align: center;
    padding: 28px;
    font-size: 14px;
}

/* --- 后台搜索 --- */
.admin-search {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    max-width: 480px;
}
.admin-search input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--admin-border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: white;
}
.admin-search input:focus { border-color: var(--sidebar-active); box-shadow: 0 0 0 4px rgba(79,70,229,0.1); }

/* --- 文章编辑表单 --- */
.post-edit-form .admin-card { margin-bottom: 16px; position: relative; }

/* --- 智能抓取 --- */
.fetch-card { border: 2px dashed #cbd5e1; background: #f8fafc; }
.fetch-card h2 { color: var(--sidebar-active); }
.fetch-desc { font-size: 14px; color: var(--admin-muted); margin-bottom: 16px; }
.fetch-row { display: flex; gap: 10px; }
.fetch-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--admin-border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: white;
}
.fetch-input:focus { border-color: var(--sidebar-active); box-shadow: 0 0 0 4px rgba(79,70,229,0.1); }
.fetch-btn { white-space: nowrap; height: auto; }

.fetch-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    margin-top: 14px;
    border-radius: 10px;
    font-size: 14px;
}
.fetch-status.fetch-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}
.fetch-status:not(.fetch-error) {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.fetch-preview {
    margin-top: 16px;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}
.fetch-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--admin-bg);
    border-bottom: 1px solid var(--admin-border);
}
.fetch-preview-body {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}
.fetch-preview-body h3 { font-size: 20px; margin-bottom: 10px; line-height: 1.4; }
.fetch-preview-excerpt { font-size: 14px; color: var(--admin-muted); margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--admin-border); }
.fetch-preview-content { font-size: 14px; line-height: 1.8; color: var(--admin-text); }
.fetch-preview-content p { margin-bottom: 10px; }
.fetch-preview-content img { border-radius: 8px; margin: 12px 0; }
.fetch-preview-content h2, .fetch-preview-content h3 { margin: 16px 0 8px; }
.fetch-preview-content pre { background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; margin: 12px 0; }
.fetch-preview-content blockquote { border-left: 4px solid var(--sidebar-active); padding: 10px 16px; margin: 12px 0; background: #f8fafc; border-radius: 0 8px 8px 0; }

/* --- 编辑器工具栏 --- */
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    margin-bottom: -1px;
}
.toolbar-group { display: flex; gap: 2px; flex-wrap: wrap; }
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--admin-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.toolbar-btn:hover {
    background: white;
    border-color: var(--admin-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.toolbar-btn-upload {
    background: #eef2ff;
    color: var(--sidebar-active);
    border-color: rgba(79,70,229,0.2);
}
.toolbar-btn-upload:hover {
    background: var(--sidebar-active);
    color: white;
    border-color: var(--sidebar-active);
}

/* --- 图片抓取面板 --- */
.toolbar-btn-fetch-img {
    background: #ecfdf5;
    color: #059669;
    border-color: rgba(5,150,105,0.2);
}
.toolbar-btn-fetch-img:hover {
    background: #059669;
    color: white;
    border-color: #059669;
}

.image-fetch-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    background: white;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.15);
    z-index: 200;
    min-width: 460px;
}
.image-fetch-panel.show { display: block; }

.ifp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-border);
    font-size: 14px;
    font-weight: 700;
    color: var(--admin-text);
}
.ifp-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--admin-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.ifp-close:hover { color: var(--admin-text); }

.ifp-body { padding: 16px; }

.ifp-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.ifp-input-row .fetch-input {
    font-size: 13px;
    padding: 8px 12px;
}

.ifp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--admin-border);
    border-bottom: 1px solid var(--admin-border);
    margin-top: 12px;
}
.ifp-select-all {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text);
    cursor: pointer;
}
.ifp-count {
    font-size: 12px;
    color: var(--admin-muted);
    margin-left: auto;
}

/* 图片网格 */
.ifp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding: 12px 0;
}
.ifp-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--admin-border);
    cursor: pointer;
    transition: all 0.15s;
    background: #f1f5f9;
}
.ifp-item:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ifp-item.ifp-selected {
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.3);
}
.ifp-item.ifp-error {
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ifp-item.ifp-error::after {
    content: '?';
    font-size: 20px;
    color: #cbd5e1;
    font-weight: 700;
}

.ifp-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ifp-item.ifp-error img { display: none; }

.ifp-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 18px;
    height: 18px;
    accent-color: var(--sidebar-active);
    z-index: 2;
    cursor: pointer;
}

.ifp-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--sidebar-active);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 2;
}
.ifp-check span { line-height: 1; }
.ifp-item.ifp-selected .ifp-check { display: flex; }

/* --- 颜色选择器 --- */
.color-picker-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.toolbar-btn-color,
.toolbar-btn-highlight {
    gap: 3px;
    padding: 0 8px;
}
.color-icon {
    font-weight: 800;
    font-size: 14px;
    position: relative;
}
.color-icon::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    border-radius: 1px;
}
.color-bar {
    display: block;
    width: 12px;
    height: 3px;
    border-radius: 2px;
    background: transparent;
}
.highlight-icon {
    font-weight: 800;
    font-size: 13px;
    background: #fef3c7;
    padding: 1px 4px;
    border-radius: 3px;
}

/* 颜色面板 */
.color-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 220px;
}
.color-panel.show { display: block; }
.color-panel-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--admin-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
}
.color-dot:hover {
    transform: scale(1.2);
    border-color: var(--admin-text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.color-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--admin-border);
}
.color-custom input[type="color"] {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}
.color-custom label {
    font-size: 13px;
    color: var(--admin-muted);
    cursor: pointer;
}

/* 上传状态 */
.upload-status {
    padding: 12px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #0369a1;
}
.upload-progress { display: flex; align-items: center; gap: 8px; }
.upload-spinner {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 编辑器 textarea 与工具栏对接 */
.post-edit-form .editor-toolbar + .form-group textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.form-actions { display: flex; gap: 10px; margin: 20px 0; }
.form-hint { font-size: 13px; color: var(--admin-muted); margin-top: 8px; }

.inline-form { margin-bottom: 16px; }

/* 标签复选框 */
.tag-checkboxes { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.tag-checkbox:hover { border-color: var(--sidebar-active); background: #eef2ff; }
.tag-checkbox input:checked + span { color: var(--sidebar-active); font-weight: 600; }
.tag-checkbox input { accent-color: var(--sidebar-active); }

/* --- 标签管理 --- */
.tag-admin-list { display: flex; flex-direction: column; gap: 4px; }
.tag-admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.tag-admin-item:hover { background: #f8fafc; }
.tag-admin-item:last-child { border-bottom: none; }

/* --- 评论管理 --- */
.filter-bar { display: flex; gap: 6px; margin-bottom: 20px; }
.filter-bar .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 8px 18px;
}
.filter-bar .btn.active {
    background: var(--sidebar-active);
    color: white;
    border-color: var(--sidebar-active);
}

.comment-admin-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-radius: 10px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.comment-admin-item:last-child { border-bottom: none; }
.comment-admin-item:hover { background: #f8fafc; }
.comment-admin-item.pending-comment { background: #fffbeb; border: 1px solid #fde68a; }

.comment-admin-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--sidebar-active);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.comment-admin-body { flex: 1; }
.comment-admin-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.comment-email { font-size: 12px; color: var(--admin-muted); }
.comment-admin-text { font-size: 14px; color: var(--admin-text); margin-bottom: 6px; }
.comment-admin-meta { font-size: 13px; margin-bottom: 8px; }
.comment-admin-actions { display: flex; gap: 6px; }

/* --- 后台页脚 --- */
.admin-footer {
    text-align: center;
    padding: 20px 28px;
    font-size: 12px;
    color: var(--admin-muted);
    background: white;
    border-top: 1px solid var(--admin-border);
}

/* --- 后台按钮覆盖 --- */
.admin-body .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 9px 18px;
}
.admin-body .btn-primary {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
}
.admin-body .btn-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .about-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .home-layout { grid-template-columns: 1fr; }

    /* 侧边栏变抽屉 */
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close {
        display: block;
        position: absolute;
        top: 16px;
        right: 14px;
        background: none;
        border: none;
        color: var(--sidebar-text);
        font-size: 18px;
        cursor: pointer;
        padding: 4px;
    }
    .admin-main {
        margin-left: 0;
    }
    .hamburger { display: flex; }
    .admin-content { padding: 20px; }
    .admin-topbar { padding: 0 20px; }
}

@media (max-width: 640px) {
    .menu-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px 20px;
        gap: 4px;
    }
    .nav-links.show { display: flex; }
    .nav-container { flex-wrap: wrap; }

    .form-row { grid-template-columns: 1fr; }
    .post-detail { padding: 20px; }
    .post-detail-title { font-size: 22px; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .category-grid { grid-template-columns: 1fr; }
    .admin-page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .admin-search { flex-direction: column; max-width: 100%; }

    .login-card { padding: 28px 24px; margin: 16px; }

    .admin-table-full { font-size: 12px; }
    .admin-table-full th,
    .admin-table-full td { padding: 8px 6px; }

    .comment-admin-item { flex-direction: column; }

    .topbar-title { font-size: 16px; }
}
