/* ============================================================
   博客文章系统 - 响应式样式表
   仿微信朋友圈 / 天涯 / 新浪微博风格
   自适应：手机端 / 平板端 / 电脑端
   ============================================================ */

/* ========== CSS 变量 ========== */
:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #555;
    --muted: #999;
    --accent: #d44138;
    --accent-hover: #b83730;
    --accent-light: #fef0ef;
    --accent2: #2a7ae2;
    --accent2-hover: #1a5fc4;
    --accent2-light: #e8f4fd;
    --border: #e4e6eb;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
    --topbar-height: 56px;
    --sidebar-width: 280px;
    --content-max-width: 1100px;
}

/* ========== Reset ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent2);
    text-decoration: none;
}

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

/* ========== 顶部导航栏 ========== */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--topbar-height);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    backdrop-filter: blur(10px);
}

.topbar-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
}

.topbar .logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.topbar .logo svg {
    flex-shrink: 0;
}

.logo-img {
    height: 28px;
    width: auto;
    flex-shrink: 0;
    border-radius: 4px;
}

.beta-tag {
    font-size: 0.7rem;
    background: var(--accent);
    color: #fff;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 500;
}

/* 语言切换按钮 - 右上角 */
.lang-switcher {
    background: none;
    border: 1.5px solid #d0d0d0;
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.lang-switcher:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* 导航链接 */
.topbar nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.topbar nav a {
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.88rem;
    transition: var(--transition);
    white-space: nowrap;
    border-bottom: none;
}

.topbar nav a:hover {
    background: #f5f5f5;
    color: var(--accent);
}

.topbar nav a.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
}

.topbar nav a.admin-link {
    background: var(--accent2);
    color: #fff !important;
    font-weight: 500;
}

.topbar nav a.admin-link:hover {
    background: var(--accent2-hover);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ========== 主布局 ========== */
.main-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 20px 16px 60px;
    display: flex;
    gap: 20px;
    min-height: calc(100vh - var(--topbar-height));
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
    align-self: flex-start;
}

.sidebar-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 6px;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
    background: #fafbfc;
    font-family: inherit;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 65, 56, 0.08);
    background: #fff;
}

.btn-search {
    padding: 9px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    font-family: inherit;
}

.btn-search:hover {
    background: var(--accent-hover);
}

/* 分类列表 */
.category-list {
    list-style: none;
}

.category-list li {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1px;
    user-select: none;
}

.category-list li:hover {
    background: #fdf2f1;
}

.category-list li.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.category-list li .count {
    background: #eee;
    color: var(--muted);
    font-size: 0.75rem;
    padding: 2px 9px;
    border-radius: 10px;
    min-width: 28px;
    text-align: center;
    font-weight: 500;
}

.category-list li.active .count {
    background: #fdd;
    color: var(--accent);
}

/* 母分类标题 */
.category-list li.category-group-title {
    padding: 10px 12px 4px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.02em;
    margin-bottom: 0;
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.15s;
}

.category-list li.category-group-title:hover {
    background: #f9f9f9;
    color: var(--accent);
}

.category-list li.category-group-title .group-label {
    flex: 1;
}

.category-list li.category-group-title .group-arrow {
    font-size: 0.6rem;
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform 0.15s;
}

/* 热门文章 */
.hot-articles .hot-item {
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: var(--transition);
}

.hot-articles .hot-item:last-child {
    border-bottom: none;
}

.hot-articles .hot-item:hover {
    color: var(--accent);
}

.hot-articles .hot-item .hot-title {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-articles .hot-item .hot-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ========== 联系我们卡片 ========== */
.contact-card-hover {
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.4s, border-color 0.4s, background 0.4s;
}
.contact-card-hover:hover {
    box-shadow: var(--shadow-hover);
    border-color: #edcece;
    background: radial-gradient(circle at 50% 20%, rgba(212, 65, 56, 0.03), transparent 70%);
}

/* 标题区域 */
.contact-card-hover .card-title {
    transition: color 0.3s;
}
.contact-card-hover .card-title::after {
    content: '▾';
    font-size: 0.7rem;
    margin-left: 6px;
    opacity: 0.35;
    transition: opacity 0.3s, transform 0.3s;
}
.contact-card-hover:hover .card-title::after {
    opacity: 0.7;
    transform: rotate(180deg);
}

/* 常驻预览行 */
.contact-preview {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: -4px;
    padding-left: 13px;
    transition: opacity 0.25s;
}

/* 悬停展开的内容区 — JS 动态判断向上/向下展开 */
.contact-dropdown {
    position: absolute;
    left: -1px;
    right: -1px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid #edcece;
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 向下展开 */
.contact-dropdown.expand-down {
    top: 100%;
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    transform: translateY(-10px);
}

/* 向上展开 */
.contact-dropdown.expand-up {
    bottom: 100%;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    transform: translateY(10px);
}

.contact-card-hover:hover .contact-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.contact-card-hover:hover {
    z-index: 30;
}

/* 分隔线 */
.contact-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #ece0e0, transparent);
}
/* 向上展开时分隔线移到底部 */
.contact-dropdown.expand-up .contact-divider {
    order: 10;
    margin-top: 14px;
}

/* 提示文字 */
.contact-text {
    font-size: 0.84rem;
    line-height: 2.1;
    color: #3a3a50;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #fffaf8;
    border-radius: 8px;
    border: 1px solid #fde8e0;
    text-align: left;
    letter-spacing: 0.02em;
    overflow-y: auto;
    /* 在受限下拉容器内自动填充并滚动 */
    flex: 1 1 auto;
    min-height: 40px;
    max-height: 220px;
}

.contact-text p {
    margin-bottom: 1.2em;
}

.contact-text p:last-child {
    margin-bottom: 0;
}

/* 滚动条美化 */
.contact-text::-webkit-scrollbar {
    width: 5px;
}

.contact-text::-webkit-scrollbar-track {
    background: transparent;
}

.contact-text::-webkit-scrollbar-thumb {
    background: #d5c5c3;
    border-radius: 10px;
}

.contact-text::-webkit-scrollbar-thumb:hover {
    background: #b5a5a3;
}

/* 按钮 */
.topbar nav .contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: #d44138;
    background: #ffffff;
    padding: 11px 0;
    border-radius: 8px;
    transition: box-shadow 0.25s, background 0.25s, color 0.25s;
    box-shadow: 0 2px 8px rgba(212, 65, 56, 0.25);
    width: 100%;
    box-sizing: border-box;
    letter-spacing: 0.05em;
}
.topbar nav .contact-btn:hover {
    color: #fff;
    background: #d44138;
    box-shadow: 0 4px 14px rgba(212, 65, 56, 0.35);
}
.topbar nav .contact-btn:active {
    color: #fff;
    background: #c0392b;
    box-shadow: 0 1px 4px rgba(212, 65, 56, 0.2);
}
.topbar nav .contact-btn svg {
    flex-shrink: 0;
    transition: transform 0.25s;
}
.topbar nav .contact-btn:hover svg {
    transform: translateX(2px);
}

/* ========== 导航栏联系我们下拉 ========== */
.nav-contact-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* 透明桥接层 — 填补触发器和下拉面板之间的空隙，鼠标移过不会丢失悬停 */
.nav-contact-wrapper::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 14px;
    z-index: 1001;
}

.nav-contact-trigger {
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.88rem;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.nav-contact-trigger:hover {
    background: #f5f5f5;
    color: var(--accent);
}

.nav-contact-trigger::after {
    content: '▾';
    font-size: 0.65rem;
    margin-left: 5px;
    opacity: 0.35;
    transition: opacity 0.3s, transform 0.3s;
    display: inline-block;
    vertical-align: middle;
}

.nav-contact-wrapper:hover .nav-contact-trigger {
    background: #f5f5f5;
    color: var(--accent);
}

.nav-contact-wrapper:hover .nav-contact-trigger::after {
    opacity: 0.7;
    transform: rotate(180deg);
}

.nav-contact-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid #edcece;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    padding: 18px;
    width: 300px;
    max-width: 90vw;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-contact-wrapper:hover .nav-contact-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ========== 链接弹窗（编辑器） ========== */
.link-popover {
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    width: 320px;
    max-width: calc(100vw - 16px);
}

.link-popover-body {
    padding: 14px 16px;
}

.link-popover-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.link-popover-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
    font-family: inherit;
}

.link-popover-input:focus {
    border-color: var(--accent2);
    box-shadow: 0 0 0 3px rgba(42, 122, 226, 0.1);
}

.link-popover-check {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.link-popover-check input[type="checkbox"] {
    accent-color: var(--accent2);
}

.link-popover-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    justify-content: flex-end;
}

.link-popover-actions .btn-sm {
    padding: 5px 14px;
    font-size: 0.82rem;
    border-radius: 6px;
}

/* ========== 内容区 ========== */
.content-area {
    flex: 1;
    min-width: 0;
}

/* ========== 文章卡片 ========== */
.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

/* 有封面图的卡片：封面在上，内容在下 */
.article-card.has-cover {
    padding: 0;
}

.article-card:not(.has-cover) {
    padding: 20px 24px;
}

/* 封面图片容器 */
.card-cover {
    width: 100%;
    max-height: 220px;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
    background: #f0f0f0;
}

.card-cover img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.article-card:hover .card-cover img {
    transform: scale(1.03);
}

/* 有封面时，内容区域需要内边距 */
.article-card.has-cover .card-body {
    padding: 16px 24px 20px;
}

.article-card:hover {
    border-color: #d5c5c3;
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.article-card:active {
    transform: scale(0.995);
}

.article-card .card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.category-tag {
    background: var(--accent-light);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.76rem;
    font-weight: 500;
    white-space: nowrap;
}

.article-card .time {
    color: #bbb;
    font-size: 0.78rem;
    white-space: nowrap;
}

.article-card h2 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: #222;
    line-height: 1.4;
    font-weight: 600;
}

.article-card h2:hover {
    color: var(--accent);
}

.article-card .excerpt {
    color: #777;
    font-size: 0.88rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(247, 147, 30, 0.25);
}

.download-btn:hover {
    background: linear-gradient(135deg, #e55d2b, #e68418);
    box-shadow: 0 3px 10px rgba(247, 147, 30, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.has-image-badge {
    color: #aaa;
    font-size: 0.76rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== 文章详情 ========== */
.article-detail {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.article-detail .detail-category {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 0.83rem;
    font-weight: 500;
    margin-bottom: 14px;
}

.article-detail h1 {
    font-size: 1.7rem;
    margin-bottom: 10px;
    color: #111;
    line-height: 1.35;
    font-weight: 700;
}

.article-detail .meta {
    color: var(--muted);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.font-size-label {
    font-size: 0.82rem;
    color: var(--muted);
}

.font-size-btn {
    padding: 3px 10px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    user-select: none;
}

.font-size-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.font-size-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 500;
}

.article-detail .content-body {
    font-size: 1rem;
    line-height: 1.9;
    color: #444;
    word-break: break-word;
}

.article-detail .content-body h2 {
    font-size: 1.3rem;
    margin: 24px 0 12px;
    color: #222;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.article-detail .content-body h3 {
    font-size: 1.1rem;
    margin: 18px 0 8px;
    color: #333;
}

.article-detail .content-body p {
    margin-bottom: 12px;
}

.article-detail .content-body ul,
.article-detail .content-body ol {
    margin: 8px 0 16px 20px;
}

.article-detail .content-body li {
    margin-bottom: 6px;
}

.article-detail .content-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 14px 0;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.article-detail .content-body img:hover {
    box-shadow: var(--shadow-hover);
    transform: scale(1.01);
}

.article-detail .content-body pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 14px 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.article-detail .content-body code {
    background: #f4f4f5;
    color: #e74c3c;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.article-detail .content-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.article-detail .content-body blockquote {
    border-left: 4px solid var(--accent);
    padding: 8px 16px;
    margin: 14px 0;
    background: #fdf8f8;
    color: #666;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ========== 文章详情 - 内容超链接样式 ========== */
.article-detail .content-body a {
    color: var(--accent2);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(42, 122, 226, 0.3);
    transition: color 0.2s, text-decoration-color 0.2s;
    word-break: break-all;
}

.article-detail .content-body a:hover {
    color: var(--accent2-hover);
    text-decoration-color: var(--accent2-hover);
}

/* ========== 文章详情 - 下载CTA按钮 ========== */
.detail-download-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(247, 147, 30, 0.3);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.detail-download-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.detail-download-cta:hover::before {
    left: 100%;
}

.detail-download-cta:hover {
    background: linear-gradient(135deg, #e55d2b, #e68418);
    box-shadow: 0 6px 24px rgba(247, 147, 30, 0.45);
    transform: translateY(-2px);
    color: #fff;
}

.detail-download-cta:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(247, 147, 30, 0.3);
}

.cta-icon {
    font-size: 1.3rem;
}

.cta-text {
    flex: 1;
    text-align: center;
}

.cta-arrow {
    font-size: 1.2rem;
    transition: transform 0.25s ease;
}

.detail-download-cta:hover .cta-arrow {
    transform: translateX(4px);
}

/* 上一篇/下一篇 */
.prev-next-nav {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
}

.prev-next-nav a {
    flex: 1;
    display: block;
    padding: 14px 18px;
    background: var(--card-bg);
    border-radius: var(--radius);
    color: var(--text-secondary);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
    font-size: 0.88rem;
}

.prev-next-nav a:hover {
    border-color: #c5c5c5;
    box-shadow: var(--shadow-hover);
}

.prev-next-nav a .direction {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.prev-next-nav a.prev { text-align: left; }
.prev-next-nav a.next { text-align: right; }

.prev-next-nav a.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-secondary);
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    user-select: none;
}

.pagination a:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(212, 65, 56, 0.3);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #bbb;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

/* ========== Loading ========== */
.loading-spinner {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background: #27ae60; }
.toast-error { background: #e74c3c; }
.toast-info { background: var(--accent2); }

/* ========== 图片模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-overlay img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    object-fit: contain;
    cursor: default;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== 回到顶部 ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ================================================================
   管理后台样式
   ================================================================ */

/* 登录页 */
.admin-login-body {
    background: url('../images/login-bg.jpg') center/cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.admin-login-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
}

.admin-login-body .login-page {
    z-index: 1;
}

/* 管理后台统一背景 */
.admin-body {
    background: url('../images/login-bg.jpg') center/cover no-repeat fixed;
    position: relative;
    min-height: 100vh;
}

/* 管理后台顶部导航：logo在左，导航链接在右 */
.admin-body .topbar-inner nav {
    margin-left: auto;
}

.admin-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
    pointer-events: none;
}

/* 顶部导航栏半透明 */
.admin-body .topbar {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

/* 侧边栏半透明 */
.admin-body .admin-sidebar {
    position: relative;
    z-index: 1;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(8px);
}

.admin-body .admin-sidebar a:hover,
.admin-body .admin-sidebar a.active {
    background: rgba(22, 33, 62, 0.7);
}

/* 主内容区卡片半透明 */
.admin-body .admin-main {
    position: relative;
    z-index: 1;
    background: transparent;
}

.admin-body .admin-card,
.admin-body .stats-grid .stat-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4);
}

.admin-body .admin-section > h2 {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 编辑器容器半透明 */
.admin-body .editor-container {
    position: relative;
    z-index: 1;
}

.admin-body .editor-main {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius);
}

.admin-body .editor-toolbar {
    background: rgba(250, 251, 252, 0.9);
    backdrop-filter: blur(6px);
}

.login-page {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 36px 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header svg {
    color: var(--accent);
    margin-bottom: 12px;
}

.login-header h2 {
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: 6px;
}

.login-header p {
    color: var(--muted);
    font-size: 0.88rem;
}

.form-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-bottom: 12px;
    min-height: 20px;
}

.login-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--muted);
}

/* 管理后台布局 */
.admin-wrapper {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

/* 管理侧边栏 */
.admin-sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #ccc;
    flex-shrink: 0;
    padding: 16px 0;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
}

.admin-sidebar-toggle {
    display: none;
}

.admin-sidebar a {
    display: block;
    padding: 11px 20px;
    color: #bbb;
    font-size: 0.88rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.admin-sidebar a:hover {
    background: #16213e;
    color: #fff;
}

.admin-sidebar a.active {
    background: #16213e;
    color: #fff;
    border-left-color: #e94560;
}

.admin-sidebar .btn-new-article {
    margin: 16px 16px 0;
    padding: 10px !important;
    background: #e94560 !important;
    color: #fff !important;
    border-radius: 8px !important;
    text-align: center !important;
    border-left: none !important;
    font-weight: 600 !important;
}

.admin-sidebar .btn-new-article:hover {
    background: #d63850 !important;
}

/* ========== 功能开关 ========== */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-info {
    flex: 1;
    min-width: 200px;
}

.toggle-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    display: block;
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 28px;
    transition: 0.25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* 管理主内容 */
.admin-main {
    flex: 1;
    padding: 24px;
    background: #f0f2f5;
    overflow-y: auto;
    min-width: 0;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-section h2 {
    font-size: 1.3rem;
    margin-bottom: 18px;
    color: var(--text);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border);
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
}

/* 管理卡片 */
.admin-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.admin-card h3 {
    font-size: 1.05rem;
    margin-bottom: 14px;
    color: var(--text);
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.admin-search-row input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.admin-search-row input:focus {
    border-color: var(--accent2);
    box-shadow: 0 0 0 3px rgba(42,122,226,0.08);
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.admin-table th {
    background: #fafbfc;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-table tr:hover td {
    background: #fdfcfc;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent2);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent2-hover);
    box-shadow: 0 2px 8px rgba(42,122,226,0.3);
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: #fff;
    border: 1px solid #ccc;
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: #aaa;
    background: #fafafa;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 14px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent2);
    outline: none;
    box-shadow: 0 0 0 3px rgba(42,122,226,0.08);
}

.form-group textarea {
    resize: vertical;
}

/* 分类表单行 */
.category-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.category-form-row input {
    flex: 1;
    padding: 8px 14px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: inherit;
}

/* ================================================================
   文章编辑器样式
   ================================================================ */
.editor-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.editor-main {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.editor-title-input {
    width: 100%;
    padding: 18px 24px;
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    outline: none;
    font-family: inherit;
    border-bottom: 1px solid var(--border);
}

.editor-title-input::placeholder {
    color: #ccc;
}

.editor-meta-row {
    display: flex;
    gap: 14px;
    padding: 14px 24px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.editor-meta-row .form-group {
    margin-bottom: 0;
}

.cover-input-row {
    display: flex;
    gap: 6px;
}

.cover-input-row input {
    flex: 1;
    min-width: 100px;
}

/* 工具栏 */
.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    background: #fafbfc;
}

.editor-toolbar button {
    width: 32px;
    height: 30px;
    border: 1px solid transparent;
    background: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.editor-toolbar button:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.toolbar-sep {
    width: 1px;
    background: #ddd;
    margin: 4px 4px;
}

/* 编辑区域 */
.editor-content-area {
    min-height: 400px;
}

.editor-visual {
    padding: 20px 24px;
    min-height: 400px;
    outline: none;
    font-size: 1rem;
    line-height: 1.8;
    color: #444;
}

.editor-visual:empty::before {
    content: attr(placeholder);
    color: #ccc;
    pointer-events: none;
}

.editor-visual img {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}

.editor-visual h2 { font-size: 1.3rem; margin: 16px 0 8px; }
.editor-visual h3 { font-size: 1.1rem; margin: 12px 0 6px; }
.editor-visual pre { background: #1e1e2e; color: #cdd6f4; padding: 14px; border-radius: 6px; overflow-x: auto; }
.editor-visual code { background: #f4f4f5; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.editor-visual blockquote { border-left: 3px solid var(--accent); padding: 6px 14px; color: #666; margin: 8px 0; }

.editor-html {
    width: 100%;
    min-height: 400px;
    padding: 20px 24px;
    border: none;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.editor-actions {
    padding: 16px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

/* ================================================================
   响应式设计 - 平板端 (768px - 1024px)
   ================================================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .main-container {
        padding: 16px 12px 50px;
        gap: 14px;
    }

    .sidebar-card {
        padding: 14px;
    }

    .article-card {
        padding: 16px 18px;
    }

    .article-card.has-cover {
        padding: 0;
    }

    .article-card.has-cover .card-body {
        padding: 14px 18px 18px;
    }

    .card-cover {
        max-height: 200px;
    }

    .card-cover img {
        height: 200px;
    }

    .article-detail {
        padding: 22px 24px;
    }

    .article-detail h1 {
        font-size: 1.4rem;
    }

    .admin-sidebar {
        width: 180px;
    }

    .admin-sidebar a {
        padding: 10px 14px;
        font-size: 0.83rem;
    }

    .admin-main {
        padding: 16px;
    }

    .editor-meta-row {
        gap: 8px;
    }
}

/* ================================================================
   响应式设计 - 手机端 (< 768px)
   ================================================================ */
@media (max-width: 768px) {
    :root {
        --topbar-height: 50px;
    }

    /* 导航栏 */
    .topbar-inner {
        padding: 0 12px;
    }

    .topbar .logo {
        font-size: 1rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .lang-switcher {
        padding: 4px 10px;
        font-size: 0.78rem;
        border-radius: 14px;
    }

    .topbar nav {
        display: none;
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 8px 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border-bottom: 1px solid var(--border);
    }

    .topbar nav.open {
        display: flex;
    }

    .topbar nav a {
        padding: 12px 20px;
        border-radius: 0;
        font-size: 0.95rem;
        border-bottom: 1px solid #f5f5f5;
    }

    .topbar nav a.admin-link {
        border-radius: 0;
        margin: 4px 16px;
    }

    .topbar nav .nav-contact-wrapper {
        display: block;
        position: static;
    }

    .topbar nav .nav-contact-trigger {
        display: block;
        padding: 12px 20px;
        border-radius: 0;
        font-size: 0.95rem;
        border-bottom: 1px solid #f5f5f5;
        cursor: default;
    }

    .topbar nav .nav-contact-dropdown {
        position: relative;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        border-bottom: 1px solid #f5f5f5;
    }

    /* 主布局 */
    .main-container {
        flex-direction: column;
        padding: 10px 8px 40px;
        gap: 10px;
    }

    /* 侧边栏 */
    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }

    .sidebar-card {
        margin-bottom: 10px;
    }

    /* 搜索 */
    .search-box input {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    /* 分类列表 - 横向滚动 */
    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .category-list li {
        padding: 6px 12px;
        font-size: 0.83rem;
        border-radius: 16px;
        background: #f5f5f5;
        margin-bottom: 0;
    }

    .category-list li.active {
        background: var(--accent-light);
    }

    .category-list li .count {
        font-size: 0.7rem;
        padding: 1px 7px;
    }

    /* 文章卡片 */
    .article-card {
        padding: 14px 16px;
        margin-bottom: 10px;
        border-radius: var(--radius-sm);
    }

    .article-card.has-cover {
        padding: 0;
    }

    .article-card.has-cover .card-body {
        padding: 12px 16px 16px;
    }

    .card-cover {
        max-height: 180px;
    }

    .card-cover img {
        height: 180px;
    }

    .article-card h2 {
        font-size: 1.05rem;
    }

    .article-card .excerpt {
        -webkit-line-clamp: 2;
        font-size: 0.85rem;
    }

    .article-card .card-header {
        gap: 6px;
        margin-bottom: 8px;
    }

    .category-tag {
        font-size: 0.73rem;
        padding: 2px 8px;
    }

    /* 文章详情 */
    .article-detail {
        padding: 16px;
        border-radius: var(--radius-sm);
    }

    .article-detail h1 {
        font-size: 1.25rem;
    }

    .article-detail .meta {
        font-size: 0.8rem;
        flex-direction: column;
        gap: 2px;
    }

    .article-detail .content-body {
        font-size: 0.95rem;
    }

    .article-detail .content-body h2 {
        font-size: 1.15rem;
    }

    .article-detail .content-body pre {
        font-size: 0.8rem;
        padding: 12px 14px;
    }

    /* 上一篇/下一篇 */
    .prev-next-nav {
        flex-direction: column;
        gap: 8px;
    }

    .prev-next-nav a {
        padding: 12px 14px;
    }

    /* 分页 */
    .pagination {
        gap: 3px;
    }

    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        font-size: 0.82rem;
        padding: 0 8px;
    }

    /* 管理后台 */
    .admin-wrapper {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        display: flex;
        flex-wrap: wrap;
        padding: 0;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-sidebar a {
        white-space: nowrap;
        padding: 10px 14px;
        border-left: none;
        border-bottom: 2px solid transparent;
        flex-shrink: 0;
        font-size: 0.8rem;
    }

    .admin-sidebar a.active {
        border-left: none;
        border-bottom-color: #e94560;
    }

    .admin-sidebar .btn-new-article {
        margin: 4px 8px;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
        border-radius: 16px !important;
    }

    .admin-main {
        padding: 12px 8px;
    }

    .admin-section h2 {
        font-size: 1.1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 14px 8px;
    }

    .stat-num {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .admin-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-search-row {
        flex-direction: column;
    }

    /* 编辑器 */
    .editor-title-input {
        font-size: 1.15rem;
        padding: 14px 16px;
    }

    .editor-meta-row {
        flex-direction: column;
        padding: 10px 16px;
        gap: 8px;
    }

    .editor-toolbar {
        padding: 6px 8px;
        gap: 1px;
    }

    .editor-toolbar button {
        width: 28px;
        height: 28px;
        font-size: 0.78rem;
    }

    .editor-visual {
        padding: 14px 16px;
        min-height: 300px;
    }

    .editor-actions {
        flex-direction: column;
        padding: 12px 16px;
    }

    .editor-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* 登录 */
    .login-card {
        padding: 24px 20px;
    }

    /* Toast */
    .toast {
        left: 16px;
        right: 16px;
        max-width: none;
        font-size: 0.85rem;
    }

    /* 模态框 */
    .modal-overlay img {
        max-width: 95vw;
        max-height: 80vh;
    }


    /* 回到顶部 */
    .back-to-top {
        bottom: 20px;
        right: 16px;
        width: 38px;
        height: 38px;
    }

}

/* ================================================================
   响应式设计 - 小屏手机 (< 480px)
   ================================================================ */
@media (max-width: 480px) {
    .topbar .logo svg {
        width: 20px;
        height: 20px;
    }

    .topbar .logo {
        font-size: 0.95rem;
        gap: 4px;
    }

    .beta-tag {
        font-size: 0.65rem;
        padding: 1px 6px;
    }

    .article-card h2 {
        font-size: 0.98rem;
    }

    .article-detail h1 {
        font-size: 1.15rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .stat-num {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .category-form-row {
        flex-direction: column;
    }

    .cover-input-row {
        flex-direction: column;
    }
}

/* ================================================================
   响应式设计 - 大屏 (> 1400px)
   ================================================================ */
@media (min-width: 1400px) {
    :root {
        --content-max-width: 1200px;
        --sidebar-width: 300px;
    }

    .article-card {
        padding: 24px 30px;
    }

    .article-card.has-cover {
        padding: 0;
    }

    .article-card.has-cover .card-body {
        padding: 20px 30px 24px;
    }

    .card-cover {
        max-height: 260px;
    }

    .card-cover img {
        height: 260px;
    }

    .article-detail {
        padding: 32px 40px;
    }

    .article-detail h1 {
        font-size: 1.9rem;
    }
}

/* ========== 深色模式 (可选) ========== */
@media (prefers-color-scheme: dark) {
    /* 保留浅色主题作为默认，用户可自行开启 */
}

/* ========== 打印样式 ========== */
@media print {
    .topbar, .sidebar, .back-to-top, .pagination, .prev-next-nav {
        display: none !important;
    }

    .main-container {
        display: block;
        padding: 0;
        max-width: none;
    }

    .article-detail {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}
