/* ============================================================
   WithYou 技术分享平台 - 博客样式
   ============================================================ */

/* ============ 基础重置 ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #333;
    background: #f0f2f5;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: #1e6fff;
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: #0050d8;
}

img {
    max-width: 100%;
    vertical-align: middle;
}

/* ============ 通用组件 ============ */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.5;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}
.btn-default {
    background: #fff;
    color: #666;
    border-color: #d9d9d9;
}
.btn-default:hover:not(:disabled) {
    color: #1e6fff;
    border-color: #1e6fff;
}
.btn-danger {
    background: #ff4d4f;
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: #ff7875;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.3);
}
.btn-sm {
    padding: 5px 14px;
    font-size: 13px;
}
.btn-large {
    padding: 10px 20px;
    font-size: 14px;
}
.btn-block {
    display: flex;
    justify-content: center;
    width: 100%;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-icon:hover {
    background: #e8e8e8;
    color: #333;
}
.btn-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #999;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-icon-sm:hover {
    background: rgba(0,0,0,0.06);
    color: #333;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
    font-size: 13px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.form-textarea {
    resize: vertical;
    min-height: 60px;
}
.form-select {
    cursor: pointer;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.badge-draft {
    background: #fff7e6;
    color: #d46b08;
    border: 1px solid #ffd591;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}
.checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-success { background: #52c41a; }
.toast-error { background: #ff4d4f; }
.toast-info { background: #1890ff; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-sm {
    max-width: 380px;
}
@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}
.modal-body {
    padding: 20px 24px;
}
.modal-footer {
    padding: 12px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Text Utils */
.text-muted {
    color: #999;
    font-size: 13px;
}

/* ============ 导航栏 ============ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}
.navbar-brand:hover {
    color: #1a1a2e;
}
.brand-logo {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
}
.brand-text {
    font-size: 18px;
}
.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.user-menu:hover {
    background: #f5f5f5;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-name {
    font-size: 14px;
    color: #333;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    min-width: 140px;
    padding: 6px;
    display: none;
    z-index: 200;
}
.user-menu.open .user-dropdown {
    display: block;
}
.user-dropdown a {
    display: block;
    padding: 8px 16px;
    color: #555;
    font-size: 14px;
    border-radius: 6px;
    transition: background 0.15s;
}
.user-dropdown a:hover {
    background: #f5f5f5;
    color: #ff4d4f;
}

/* ============ 登录页 ============ */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    margin: 0 auto 16px;
}
.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}
.login-header p {
    color: #999;
    font-size: 14px;
}
.login-card .form-group {
    margin-bottom: 20px;
}
.login-card .form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: #bbb;
    pointer-events: none;
}
.input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}
.input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fff;
}
.toggle-pwd {
    position: absolute;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    border-radius: 6px;
}
.toggle-pwd:hover {
    color: #666;
    background: #f0f0f0;
}
.toggle-pwd svg {
    width: 18px;
    height: 18px;
}
.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
}

/* ============ 主页布局 ============ */
.main-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 56px;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
    transition: transform 0.3s ease;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.sidebar-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}
.sidebar-body {
    padding: 8px 0;
}
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 200;
    align-items: center;
    justify-content: center;
}

/* 标签树 */
.label-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    color: #555;
    position: relative;
}
.label-item:hover {
    background: #f5f7fa;
}
.label-item.active {
    background: linear-gradient(90deg, rgba(102,126,234,0.08), transparent);
    color: #667eea;
    font-weight: 500;
}
.label-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: #667eea;
    border-radius: 0 3px 3px 0;
}
.label-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.label-actions {
    display: none;
    gap: 2px;
}
.label-item:hover .label-actions {
    display: flex;
}
.tree-arrow {
    transition: transform 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}
.tree-arrow.expanded {
    transform: rotate(90deg);
}
.label-children {
    overflow: hidden;
}

/* 主内容 */
.content {
    flex: 1;
    margin-left: 280px;
    padding: 24px 32px;
    min-height: calc(100vh - 56px);
}
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.content-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
}
.content-filter .form-select {
    width: auto;
    min-width: 120px;
    padding: 6px 12px;
    font-size: 13px;
}

/* 文章卡片列表 */
.note-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.note-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.note-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}
.note-card-body {
    padding: 20px 24px;
}
.note-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}
.note-title a {
    color: #1a1a2e;
    transition: color 0.2s;
}
.note-title a:hover {
    color: #667eea;
}
.note-summary {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #999;
}
.note-date {
    display: flex;
    align-items: center;
    gap: 4px;
}
.note-actions {
    display: flex;
    gap: 16px;
}
.action-link {
    font-size: 13px;
    color: #999;
    transition: color 0.2s;
}
.action-link:hover {
    color: #667eea;
}
.action-link.action-delete:hover {
    color: #ff4d4f;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}
.empty-state svg {
    margin-bottom: 16px;
}
.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    padding-bottom: 32px;
}
.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.page-btn:hover:not(:disabled):not(.active) {
    border-color: #667eea;
    color: #667eea;
}
.page-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}
.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-ellipsis {
    color: #999;
    padding: 0 4px;
}

/* ============ 文章详情页 ============ */
.detail-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 20px 60px;
}
.article {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.article-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
}
.article-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.4;
    margin-bottom: 12px;
}
.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.meta-item {
    font-size: 14px;
    color: #999;
}
.article-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.article-summary {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 16px 20px;
    margin-bottom: 28px;
    border-radius: 0 8px 8px 0;
    color: #555;
    font-size: 15px;
    line-height: 1.7;
}
.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    word-wrap: break-word;
}
.article-content p {
    margin-bottom: 16px;
}
.article-content h1, .article-content h2, .article-content h3 {
    margin-top: 28px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1a1a2e;
}
.article-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #c7254e;
}
.article-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
}
.article-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}
.article-content blockquote {
    border-left: 4px solid #667eea;
    padding: 12px 20px;
    margin: 16px 0;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
    color: #555;
}
.article-content img {
    border-radius: 8px;
    margin: 12px 0;
}
.article-content ul, .article-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}
.article-content li {
    margin-bottom: 6px;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 14px;
}
.article-content th, .article-content td {
    border: 1px solid #e8e8e8;
    padding: 10px 14px;
    text-align: left;
}
.article-content th {
    background: #f5f7fa;
    font-weight: 600;
    color: #333;
}
.article-content tr:nth-child(even) {
    background: #fafbfc;
}
.article-content hr {
    border: none;
    border-top: 1px solid #e8e8e8;
    margin: 24px 0;
}
.article-content a {
    color: #667eea;
    text-decoration: underline;
    text-decoration-color: rgba(102, 126, 234, 0.3);
    text-underline-offset: 2px;
}
.article-content a:hover {
    text-decoration-color: #667eea;
}
.article-content h1 { font-size: 1.8em; }
.article-content h2 { font-size: 1.5em; }
.article-content h3 { font-size: 1.25em; }
.article-content h4 { font-size: 1.1em; margin-top: 20px; margin-bottom: 8px; }

/* Loading */
.loading-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 共享区域 */
.share-section {
    margin-top: 32px;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.share-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}
.share-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.share-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f5f7fa;
    border-radius: 20px;
    font-size: 13px;
}
.share-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.share-avatar-text {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.share-name {
    color: #555;
}

/* ============ 编辑器页 ============ */
.editor-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 72px 20px 40px;
}
.editor-container form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 文章设置头部 */
.editor-settings-header {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.settings-content {
    max-width: 1400px;
    margin: 0 auto;
}
.settings-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.settings-item {
    flex: 1;
    min-width: 180px;
}
.settings-item.checkbox-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: center;
}
.settings-item.checkbox-group .checkbox-label {
    margin-bottom: 0;
}
.form-group label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}
.form-input,
.form-select {
    font-size: 14px;
    padding: 6px 10px;
    height: 32px;
}
.selected-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.selected-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #e9ecef;
    border-radius: 16px;
    font-size: 12px;
    color: #495057;
}
.selected-label .remove-label {
    cursor: pointer;
    color: #6c757d;
    font-size: 14px;
}

.editor-main {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}
.editor-title {
    flex: 1;
    padding: 8px 12px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    background: #fff;
    outline: none;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
    margin-right: 16px;
}
.editor-title:focus {
    border-color: #e9ecef;
}
.editor-title::placeholder {
    color: #999;
}
.editor-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.auto-save {
    font-size: 12px;
    color: #666;
}
.user-menu {
    position: relative;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

/* Markdown 工具栏 */
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: #f1f3f5;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

/* 颜色选择器 */
.color-picker {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    width: 200px;
    margin-top: 8px;
    overflow: hidden;
}

.color-picker-header {
    padding: 10px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.color-picker-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.color-picker-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.color-picker-close:hover {
    background: #e9ecef;
    color: #333;
}

.color-picker-body {
    padding: 16px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.color-item {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-item:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-right .editor-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: none;
    background: transparent;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

/* 响应式颜色选择器 */
@media (max-width: 768px) {
    .color-picker {
        width: 160px;
    }
    
    .color-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .color-item {
        width: 28px;
        height: 28px;
    }
}
.toolbar-btn:hover {
    background: #e8e8e8;
    color: #333;
}
.toolbar-btn.active {
    background: #667eea;
    color: #fff;
}
.toolbar-btn span {
    font-size: 13px;
}

/* 视图模式切换按钮组 */
.view-mode-group {
    display: flex;
    background: #eee;
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}
.view-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border: none;
    background: transparent;
    color: #888;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.view-mode-btn:hover {
    color: #555;
}
.view-mode-btn.active {
    background: #fff;
    color: #667eea;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 编辑区域 */
.editor-body {
    display: flex;
    position: relative;
    min-height: 400px;
    height: calc(100vh - 230px);
}

/* 分栏模式（默认） */
.editor-body.split-mode .editor-content-wrapper {
    width: 50%;
}
.editor-body.split-mode .editor-divider {
    display: block;
}
.editor-body.split-mode .preview-pane {
    display: block;
    width: 50%;
}

/* 纯编辑模式 */
.editor-body.edit-mode .editor-content-wrapper {
    width: 100%;
}
.editor-body.edit-mode .editor-divider {
    display: none;
}
.editor-body.edit-mode .preview-pane {
    display: none;
}

/* 纯预览模式 */
.editor-body.preview-mode .editor-content-wrapper {
    display: none;
}
.editor-body.preview-mode .editor-divider {
    display: none;
}
.editor-body.preview-mode .preview-pane {
    display: block;
    width: 100%;
}

.editor-divider {
    width: 1px;
    background: #e8e8e8;
    flex-shrink: 0;
    cursor: col-resize;
}

.editor-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
}

.editor-content {
    flex: 1;
    padding: 20px;
    border: none;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    background: #f8f9fa;
    resize: none;
    outline: none;
    overflow-y: auto;
    font-family: "Monaco", "Menlo", "Consolas", "Source Code Pro", monospace;
}
.editor-content::placeholder {
    color: #999;
}

.editor-stats {
    padding: 8px 16px;
    background: #e9ecef;
    border-top: 1px solid #dee2e6;
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 16px;
}

/* Markdown 预览面板 */
.preview-pane {
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    background: #fff;
}
.preview-pane::-webkit-scrollbar,
.editor-content::-webkit-scrollbar {
    width: 6px;
}
.preview-pane::-webkit-scrollbar-thumb,
.editor-content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}
.preview-pane::-webkit-scrollbar-thumb:hover,
.editor-content::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}
.preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc;
    font-size: 15px;
}

/* 编辑器底部 */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}
.footer-left {
    flex: 1;
}
.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.footer-right .checkbox-label {
    margin-bottom: 0;
    font-size: 12px;
    color: #666;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}
.modal.show {
    display: block;
}
.modal-content {
    position: absolute;
    background-color: #fff;
    border-radius: 8px;
    width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover {
    color: #333;
}
.modal-body {
    padding: 20px;
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
    gap: 12px;
}

/* 分类标签 */
.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.category-tag {
    padding: 4px 12px;
    background: #f0f2f5;
    border-radius: 16px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}
.category-tag:hover {
    background: #e6f7ff;
    color: #1890ff;
}
.category-tag.active {
    background: #1890ff;
    color: #fff;
}

/* 标签搜索区域 */
.label-search-wrapper {
    position: relative;
}

/* 标签搜索结果下拉 */
.label-search-results {
    position: absolute;
    top: calc(100% - 0px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1001;
}

.label-dropdown-item {
    padding: 8px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.15s;
}
.label-dropdown-item:hover {
    background-color: #f0f5ff;
    color: #667eea;
}
.label-dropdown-item.disabled {
    color: #999;
    cursor: default;
    font-style: italic;
}
.label-dropdown-item.disabled:hover {
    background-color: transparent;
    color: #999;
}

/* 封面上传 */
.cover-upload {
    margin-top: 8px;
}
.cover-placeholder {
    width: 120px;
    height: 80px;
    border: 2px dashed #d9d9d9;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.cover-placeholder:hover {
    border-color: #1890ff;
}
.plus-icon {
    font-size: 24px;
    color: #d9d9d9;
    margin-bottom: 8px;
}
.cover-placeholder p {
    margin: 0;
    font-size: 12px;
    color: #999;
}
.cover-tip {
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}
.editor-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
    .editor-container form {
        flex-direction: column;
    }
    .editor-sidebar {
        width: 100%;
        min-width: unset;
        position: static;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar-toggle {
        display: flex;
    }
    .content {
        margin-left: 0;
        padding: 16px;
    }
    .navbar-inner {
        padding: 0 16px;
    }
    .brand-text {
        display: none;
    }
    .user-name {
        display: none;
    }
    .article {
        padding: 20px;
    }
    .article-title {
        font-size: 22px;
    }
    .detail-container {
        padding: 68px 12px 40px;
    }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
