/* ========== CSS 变量 ========== */
:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --accent: #06b6d4;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --radius: 10px;
    --radius-lg: 16px;
}

/* ========== 全局 Reset ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ========== 导航栏 ========== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.navbar-nav a {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.navbar-nav a:hover {
    color: var(--primary);
    background: #f1f5f9;
}
.navbar-nav a.active {
    color: var(--primary);
    background: #eef2ff;
}
.navbar-user {
    font-size: 13px;
    color: var(--text-lighter);
    margin-right: 8px;
}

/* ========== 容器 ========== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}
.container-sm {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ========== 卡片 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
    box-shadow: var(--shadow-md);
}
.card-body {
    padding: 24px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    gap: 6px;
    line-height: 1;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79,70,229,0.35);
    color: #fff;
}
.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}
.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.btn-danger:hover {
    background: #fee2e2;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 8px;
}
.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    border-radius: 12px;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-control::placeholder {
    color: var(--text-lighter);
}
.form-inline {
    display: flex;
    gap: 10px;
}
.form-inline .form-control {
    flex: 1;
}

/* ========== 表格 ========== */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ========== 标签/徽章 ========== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #f1f5f9;
    color: var(--text-light);
}
.badge-info {
    background: #e0f2fe;
    color: #0284c7;
}

/* ========== 页面标题区 ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

/* ========== 文章卡片（前台列表） ========== */
.article-card {
    display: block;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.article-card:last-child { border-bottom: none; }
.article-card:hover { background: #f8fafc; }
.article-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}
.article-card-title:hover { color: var(--primary); }
.article-card-summary {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-card-meta {
    font-size: 13px;
    color: var(--text-lighter);
    display: flex;
    gap: 16px;
}

/* ========== 文章详情排版 ========== */
.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
}
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
    margin: 1.5em 0 0.5em;
    font-weight: 700;
    color: var(--text);
}
.article-content h1 { font-size: 28px; }
.article-content h2 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.article-content h3 { font-size: 18px; }
.article-content p { margin: 1em 0; }
.article-content img { max-width: 100%; border-radius: 8px; margin: 16px 0; }
.article-content blockquote {
    border-left: 4px solid var(--primary-light);
    padding: 12px 20px;
    margin: 16px 0;
    background: #f1f5f9;
    border-radius: 0 8px 8px 0;
    color: var(--text-light);
}
.article-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e11d48;
}
.article-content pre {
    background: #f6f8fa;
    color: #24292f;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid #e2e8f0;
}
.article-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}
.article-content a { color: var(--primary); text-decoration: underline; }
.article-content ul, .article-content ol { padding-left: 24px; margin: 12px 0; }
.article-content li { margin: 4px 0; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.article-content table { border-collapse: collapse; margin: 16px 0; }
.article-content table th, .article-content table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
}
.article-content table th { background: #f8fafc; }

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 32px 24px;
    font-size: 13px;
    color: var(--text-lighter);
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

/* ========== 英雄区（首页） ========== */
.hero {
    text-align: center;
    padding: 80px 24px;
}
.hero-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
    margin-bottom: 16px;
}
.hero-desc {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== 操作列 ========== */
.action-links {
    display: flex;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
}
.action-links form { display: inline-flex; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-lighter);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ========== 模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-icon {
    font-size: 40px;
    margin-bottom: 16px;
}
.modal-message {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 24px;
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.modal-actions .btn {
    min-width: 100px;
}

/* ========== 标签选择器（后台文章表单） ========== */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.tag-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.tag-checkbox:hover {
    border-color: var(--primary-light);
    background: #eef2ff;
}
.tag-checkbox input[type="checkbox"] {
    accent-color: var(--primary);
}

/* ========== 导航栏下拉菜单 ========== */
.nav-dropdown {
    position: relative;
}
.nav-dropdown > a {
    cursor: pointer;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    padding: 6px 0;
    list-style: none;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-menu li a {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-light);
    border-radius: 0;
    white-space: nowrap;
}
.nav-dropdown-menu li a:hover {
    color: var(--primary);
    background: #f1f5f9;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .navbar-inner { padding: 0 16px; }
    .container, .container-sm { padding: 20px 16px; }
    .hero-title { font-size: 28px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .form-inline { flex-direction: column; }
    th, td { padding: 10px 12px; font-size: 13px; }
}
