/* 基础样式 */
:root {
    --primary-color: #4a90d9;
    --primary-hover: #357abd;
    --accent-color: #ff7a18;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* 导航栏 */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
    flex-shrink: 0;
}

.nav-icon {
    width: 24px;
    height: 24px;
}

.nav-search {
    flex: 0 1 360px;
    max-width: 360px;
    margin-right: auto;
}

.nav-search form {
    display: flex;
    position: relative;
}

.nav-search input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.nav-search button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    color: var(--text-secondary);
}

.nav-search button svg {
    width: 18px;
    height: 18px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.25);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn svg {
    width: 18px;
    height: 18px;
}

/* 主内容区 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

/* 页面标题 */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 笔记卡片网格 */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.note-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.note-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}

.note-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.note-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    background: rgba(74, 144, 217, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* 笔记编辑页面 */
.note-editor-page {
    max-width: 900px;
    margin: 0 auto;
}

.note-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.note-actions {
    display: flex;
    gap: 0.5rem;
}

.inline-form {
    display: inline;
}

/* 表单 */
.form-group {
    margin-bottom: 1rem;
}

.title-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.title-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.title-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.tags-input {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.tags-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 编辑器 */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: 500px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--card-bg);
}

.editor-pane,
.preview-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-pane label,
.preview-pane label {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.editor-pane textarea {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: none;
    resize: none;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    background: var(--card-bg);
    color: var(--text-primary);
}

.editor-pane textarea:focus {
    outline: none;
}

.preview-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Markdown 内容样式 */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}

.preview-content h1 { font-size: 1.75rem; }
.preview-content h2 { font-size: 1.5rem; }
.preview-content h3 { font-size: 1.25rem; }

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content ul,
.preview-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.preview-content li {
    margin-bottom: 0.25rem;
}

.preview-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85em;
}

.preview-content pre {
    background: #f6f8fa;
    color: #24292e;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    margin-bottom: 1rem;
}

.preview-content pre code {
    background: none;
    padding: 0;
}

.preview-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.preview-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.preview-content a:hover {
    text-decoration: underline;
}

.preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.preview-content th,
.preview-content td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

.preview-content th {
    background: var(--bg-color);
    font-weight: 600;
}

/* 笔记内容查看 */
.note-content-view {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    min-height: 300px;
}

.note-content-view .preview-content {
    padding: 0;
}

.note-meta {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.note-meta p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

/* Flash 消息 */
.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.flash button:hover {
    opacity: 1;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .nav-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        margin-top: 0.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .notes-grid {
        grid-template-columns: 1fr;
    }
    
    .editor-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .editor-pane {
        height: 300px;
    }
    
    .preview-pane {
        min-height: 200px;
    }
    
    .note-actions-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .title-input {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .note-card {
        padding: 1rem;
    }

    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* 导航操作区 */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-user {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0 0.25rem;
    white-space: nowrap;
}

/* 按钮尺寸/变体补充 */
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

/* 登录页 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 360px;
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-card .subtitle {
    margin-bottom: 1.5rem;
}

.auth-card .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
}

.auth-card .form-group input {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.auth-card .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

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

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 后台表格 */
.admin-table-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.admin-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: rgba(74, 144, 217, 0.04);
}

.admin-table a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.admin-table a:hover {
    color: var(--primary-color);
}

.admin-actions {
    display: flex;
    gap: 0.4rem;
    white-space: nowrap;
}

/* 注册页脚 */
.auth-foot {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.auth-foot a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-foot a:hover {
    text-decoration: underline;
}

/* 后台面板 / 新增用户表单 */
.admin-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.panel-title {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.user-new-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-new-form input,
.user-new-form select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.user-new-form input:focus,
.user-new-form select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 角色徽章 */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-admin {
    background: rgba(74, 144, 217, 0.1);
    color: var(--primary-color);
    border-color: transparent;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 页头操作区 */
.page-header {
    position: relative;
}

.header-actions {
    position: absolute;
    top: 0;
    right: 0;
}

/* 富文本编辑器容器 */
.editor-wrap {
    margin-bottom: 1rem;
}

.editor-wrap .toastui-editor-defaultUI {
    border-radius: var(--radius-lg);
}

/* 博客两栏布局 */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 2rem;
    align-items: start;
}

/* 三栏布局（含左侧图标导航） */
.layout-3col {
    grid-template-columns: 72px minmax(0, 1fr) 280px;
}

.layout-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 80px;
}

.lnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.6rem 0.25rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    transition: background 0.15s, color 0.15s;
}

.lnav-item svg {
    width: 22px;
    height: 22px;
}

.lnav-item:hover {
    background: var(--card-bg);
    color: var(--primary-color);
}

.lnav-item.active {
    color: var(--primary-color);
}

/* 文章列表流 */
.post-list {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post-item {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

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

.post-item:hover {
    background: rgba(74, 144, 217, 0.03);
}

.post-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #6aa8e0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.post-body {
    flex: 1;
    min-width: 0;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.post-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.post-title a:hover {
    text-decoration: underline;
}

.post-author {
    color: var(--text-secondary);
}

.post-summary {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* 边栏 */
.layout-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 80px;
}

.side-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: box-shadow 0.2s;
}

.side-card:hover {
    box-shadow: var(--shadow);
}

.side-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.side-stats {
    display: flex;
    gap: 1rem;
}

.side-stats > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.side-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-count {
    opacity: 0.6;
    font-size: 0.75em;
}

.side-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.side-list a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-list a:hover {
    color: var(--primary-color);
}

/* 排行榜列表（博客园风） */
.rank-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    counter-reset: rank;
}

.rank-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.rank-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--text-secondary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-list li:nth-child(1) .rank-num,
.rank-list li:nth-child(2) .rank-num,
.rank-list li:nth-child(3) .rank-num {
    background: var(--accent-color);
}

.rank-list a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-list a:hover {
    color: var(--primary-color);
}

/* a 标签的 tag 也要有指针手势 */
a.tag {
    text-decoration: none;
    transition: background 0.15s;
}

a.tag:hover {
    background: rgba(74, 144, 217, 0.2);
}

/* 笔记详情（文章式） */
.note-article {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
}

.note-header {
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.note-headline {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.note-byline {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.note-byline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.note-body {
    font-size: 1rem;
    line-height: 1.8;
}

@media (max-width: 860px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .layout-3col {
        grid-template-columns: 1fr;
    }
    .layout-nav {
        display: none;
    }
    .layout-side {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .layout-side .side-card {
        flex: 1 1 240px;
    }
}

/* 博客字段：表单行、状态选择 */
.form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-row .tags-input {
    flex: 1;
    margin: 0;
}

.status-select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.status-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 草稿徽章 */
.badge-draft {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255, 122, 24, 0.12);
    color: var(--accent-color);
}

/* 列表项分类/统计 */
.post-cat {
    color: var(--primary-color);
}

.post-stat {
    color: var(--text-secondary);
}

/* 详情页分类/阅读/页脚点赞 */
.note-cat a {
    color: var(--primary-color);
    text-decoration: none;
}

.note-cat a:hover {
    text-decoration: underline;
}

.note-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.like-btn svg {
    width: 18px;
    height: 18px;
}

.like-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.like-btn.liked {
    background: rgba(255, 122, 24, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.like-btn:disabled {
    cursor: default;
}

/* ===== 卡片网格首页 ===== */
/* 分类筛选栏 */
.cat-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.cat-chip {
    flex-shrink: 0;
    padding: 0.45rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.cat-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cat-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.cat-chip .cat-count {
    opacity: 0.7;
    font-size: 0.78em;
}

.cat-chip.active .cat-count {
    opacity: 0.9;
}

/* 卡片网格 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.ncard {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: transform 0.18s, box-shadow 0.18s;
}

.ncard:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.ncard-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ncard-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ncard-cat {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(74, 144, 217, 0.12);
    color: var(--primary-color);
}

/* 分类主题色 */
.ncard-cat.cat-技术 { background: rgba(74,144,217,.12); color:#4a90d9; }
.ncard-cat.cat-default { background: rgba(127,140,141,.12); color: var(--text-secondary); }

.ncard-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.ncard:hover .ncard-title {
    color: var(--primary-color);
}

.ncard-summary {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.ncard-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.ncard-meta {
    display: flex;
    gap: 0.75rem;
}

.ncard-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    padding: 0.45rem 0.75rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.15s;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.page-btn.disabled {
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

/* 代码块复制按钮 */
.preview-content pre {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, all 0.15s;
}

.preview-content pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.code-copy-btn.copied {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    opacity: 1;
}

/* 后台批量操作栏 */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.batch-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.batch-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: auto;
}

.batch-cat {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.batch-cat-input {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
    width: 110px;
}
