/* style.css - 优化版：专业 / 简洁 / 大气 */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2D6BF6;
    --primary-soft: #E5EDFF;
    --primary-dark: #1D4ED8;
    --accent: #10B981;
    --danger: #EF4444;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --border-subtle: #E5E7EB;
    --text-main: #111827;
    --text-sub: #6B7280;
    --sidebar-bg: #FFFFFF;
}

/* 页面基础 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* 左侧边栏样式（改成现代浅色风格） */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(15, 23, 42, 0.06);
    z-index: 10;
    flex-shrink: 0;
}

/* 中间笔记清单区域 */
.notes-list-container {
    width: 380px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* 右侧笔记内容区域 */
.note-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--card-bg);
}

.sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h2 i {
    color: var(--primary);
}

/* 搜索框 */
.search-box {
    padding: 12px 16px;
    position: relative;
    border-bottom: 1px solid var(--border-subtle);
}

.search-box input {
    width: 100%;
    padding: 9px 34px 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: #F9FAFB;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-box input::placeholder {
    color: var(--text-sub);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 107, 246, 0.15);
    background: #FFFFFF;
}

.search-box i {
    position: absolute;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
    font-size: 0.9rem;
}

/* 分类列表 */
.categories-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 12px;
}

/* 自定义滚动条（适度） */
.categories-list::-webkit-scrollbar,
.contents-list::-webkit-scrollbar {
    width: 6px;
}

.categories-list::-webkit-scrollbar-thumb,
.contents-list::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 999px;
}

.category-item {
    padding: 8px 10px;
    margin: 2px 4px;
    cursor: pointer;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.18s ease;
    color: var(--text-main);
    font-size: 0.92rem;
    position: relative;
}

.category-item:hover {
    background: var(--primary-soft);
}

.category-item.active {
    background: rgba(45, 107, 246, 0.08);
    border-left-color: var(--primary);
    font-weight: 600;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.category-header span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.category-header i {
    font-size: 0.9rem;
    color: var(--primary);
}

/* 分类角标和操作按钮（JS 中已有部分样式，这里做补充和统一） */
.badge {
    background: rgba(45, 107, 246, 0.12);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    min-width: 26px;
    text-align: center;
}

.category-actions {
    display: none;
    align-items: center;
    gap: 4px;
}

.category-item:hover .category-actions {
    display: inline-flex;
}

.btn-edit-category,
.btn-delete-category {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 2px 4px;
    color: var(--text-sub);
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-edit-category:hover {
    background: rgba(45, 107, 246, 0.08);
    color: var(--primary-dark);
}

.btn-delete-category:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

/* 中间笔记清单区域样式 */
.notes-list-header {
    padding: 16px 22px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.notes-list-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
}

.notes-list-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notes-list {
    flex: 1;
    padding: 18px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 笔记列表项样式 */
.note-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.note-item:hover {
    border-color: rgba(45, 107, 246, 0.35);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.note-item.active {
    border-color: var(--primary);
    background: rgba(45, 107, 246, 0.05);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.note-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.note-item-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.note-item:hover .note-item-actions {
    opacity: 1;
}

.note-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-sub);
    margin-top: 8px;
}

.note-item-category {
    background: rgba(45, 107, 246, 0.1);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 999px;
}

.note-item-updated {
    font-size: 0.75rem;
}

/* 右侧笔记内容区域样式 */
.note-content-header {
    padding: 16px 22px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.note-content-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.note-content-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.note-content-body {
    flex: 1;
    padding: 22px;
    overflow-y: auto;
    line-height: 1.7;
}

.note-content-body .empty-note-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-sub);
    text-align: center;
}

.note-content-body .empty-note-content i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--border-subtle);
}

.note-content-body .empty-note-content p {
    font-size: 1rem;
}

/* 笔记内容样式 */
.note-content {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.7;
    word-break: break-word;
}

.note-content h1,
.note-content h2,
.note-content h3 {
    color: var(--text-main);
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.3;
}

.note-content h1 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.3em;
}

.note-content h2 {
    font-size: 1.3em;
}

.note-content h3 {
    font-size: 1.1em;
}

.note-content p {
    margin-bottom: 1.2em;
}

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

.note-content a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.note-content ul,
.note-content ol {
    padding-left: 2em;
    margin-bottom: 1.2em;
}

.note-content li {
    margin-bottom: 0.5em;
}

.note-content blockquote {
    border-left: 3px solid var(--primary);
    background-color: var(--primary-soft);
    color: var(--text-sub);
    padding: 1em 1.2em;
    margin: 1.5em 0;
    border-radius: 0 4px 4px 0;
}

.note-content pre,
.note-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    background-color: #f8f8f8;
    border-radius: 4px;
}

.note-content pre {
    padding: 1em;
    overflow-x: auto;
    margin: 1.5em 0;
    white-space: pre-wrap;
}

.note-content p > code,
.note-content li > code {
    padding: 0.2em 0.4em;
    font-size: 0.9em;
}

.note-content hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 2em 0;
}

.note-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em 0;
}

/* 右侧主内容区样式（保留原有样式，但可能不再使用） */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* 顶部标题栏 */
.content-header {
    padding: 16px 22px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.content-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
}

.content-header .actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 内容列表 */
.contents-list {
    flex: 1;
    padding: 18px 22px;
    overflow-y: auto;

    /* 关键：改成 minmax(0, 1fr)，避免被内容撑爆 */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
    overflow-x: hidden; /* 禁止横向滚动条 */
}

/* 内容卡片 */
.content-item {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 14px 16px 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    cursor: pointer;

    /* grid 卡片自动撑满列 */
    width: 100%;
	max-width: 100%;
    
    display: flex;
    flex-direction: column;

    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    position: relative;
    overflow: hidden; /* Prevent content from breaking out of the card */
}


.content-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    border-color: rgba(45, 107, 246, 0.35);
}

.content-item h3 {
    margin-bottom: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
    word-break: break-word; /* Force long titles to wrap */
}

/* 渲染 HTML 内容预览 */
.content-preview-html {
    font-size: 0.92rem;
    color: var(--text-main); /* 改为更易读的主文本颜色 */
    line-height: 1.7; /* 增加行高 */
    word-break: break-word;
}

.content-preview-html p {
    margin-bottom: 0.8em; /* 增加段落下边距 */
}

/* 笔记内容美化样式 */
.content-preview-html h1,
.content-preview-html h2,
.content-preview-html h3 {
    color: var(--text-main);
    font-weight: 600;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}

.content-preview-html h1 {
    font-size: 1.4em;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.3em;
}

.content-preview-html h2 {
    font-size: 1.2em;
}

.content-preview-html h3 {
    font-size: 1.1em;
}

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

.content-preview-html a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.content-preview-html ul,
.content-preview-html ol {
    padding-left: 2em;
    margin-bottom: 1em;
}

.content-preview-html li {
    margin-bottom: 0.4em;
}

.content-preview-html blockquote {
    border-left: 3px solid var(--primary);
    background-color: var(--primary-soft);
    color: var(--text-sub);
    padding: 0.8em 1em;
    margin: 1em 0;
    border-radius: 0 4px 4px 0;
}

.content-preview-html pre,
.content-preview-html code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    background-color: #f8f8f8; /* 使用一个固定的浅灰色背景 */
    border-radius: 4px;
}

.content-preview-html pre {
    padding: 1em;
    overflow-x: auto;
    margin: 1em 0;
    white-space: pre-wrap;
}

.content-preview-html p > code,
.content-preview-html li > code {
    padding: 0.2em 0.4em;
    font-size: 0.9em;
}

.content-preview-html hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 1.5em 0;
}

.content-preview-html img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

/* 在卡片视图中，仍然限制预览高度 */
.content-item .content-preview-html {
    max-height: 100px;
    overflow: hidden;
}


/* 元信息 */
.content-item small {
    display: block;
    margin-top: 10px;
    font-size: 0.78rem;
    color: #f98995;
}

/* 内容卡片右上角操作按钮（由 JS 注入 .actions） */
.content-item .actions {
    position: absolute;
    top: 8px;
    right: 10px;
    display: none;
    gap: 6px;
}

.content-item:hover .actions {
    display: flex;
}

.btn-edit,
.btn-delete {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-edit i,
.btn-delete i {
    pointer-events: none;
}

.btn-edit:hover {
    background: rgba(45, 107, 246, 0.08);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--danger);
    color: var(--danger);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 0;
    color: var(--text-sub);
    font-style: italic;
    font-size: 0.92rem;
}

/* 编辑器整体卡片 */
.editor-container {
    background: var(--card-bg);
    margin: 16px 22px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* 编辑器头部 */
.editor-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #F9FAFB;
}

.editor-header input {
    flex: 1;
    border: none;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 6px 8px;
    background: transparent;
    outline: none;
    color: var(--text-main);
}

.editor-header input::placeholder {
    color: #9CA3AF;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

/* 编辑器主体（Quill 容器） */
.editor-body {
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

#quillEditor {
    display: flex;
    flex-direction: column !important;
    width: 100%;
    background: #FFFFFF;
    border-radius: 8px;
    flex: 1 1 auto;
    min-height: 70vh;
    height: 100% !important;
    max-height: none !important;
}

/* 调整 Quill 默认边框，与整体风格统一 */
.ql-toolbar.ql-snow {
    border-radius: 8px 8px 0 0;
    border-color: var(--border-subtle);
    flex: 0 0 auto;
    width: 100%;
    display: block;
}

.ql-container.ql-snow {
    border-radius: 0 0 8px 8px;
    border-color: var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: calc(100% - 42px);
}

.ql-editor {
    font-size: 0.95rem;
    line-height: 1.7;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    max-height: 68vh;
}

/* 兼容旧的 contentEditor（即便现在不用，保留不影响） */
#contentEditor {
    width: 100%;
    min-height: 400px;
    border: none;
    padding: 15px;
    resize: vertical;
    font-family: monospace;
    font-size: 14px;
}

/* 编辑器底部 */
.editor-footer {
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 10px;
    background: #F9FAFB;
}

.editor-footer input,
.editor-footer select {
    padding: 8px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 0.9rem;
    outline: none;
    background: #FFFFFF;
    min-width: 0;
}

.editor-footer input {
    flex: 2;
}

.editor-footer select {
    flex: 1;
}

.editor-footer input:focus,
.editor-footer select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 107, 246, 0.15);
}

/* 按钮样式 */
.btn-primary,
.btn-secondary {
    border: none;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: #E5E7EB;
    color: #374151;
}

.btn-secondary:hover {
    background: #D1D5DB;
}

.btn-beautify:hover {
    background: var(--accent);
    color: #FFFFFF;
}

.btn-revert:hover {
    background: var(--text-sub);
    color: #FFFFFF;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 50;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg);
    margin: 9% auto;
    padding: 0;
    width: 380px;
    max-width: calc(100% - 40px);
    border-radius: 12px;
    box-shadow: 0 24px 40px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F9FAFB;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close {
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-sub);
    padding: 0 4px;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

.close:hover {
    background: #E5E7EB;
    color: var(--text-main);
}

.modal-body {
    padding: 18px 16px 10px;
}

.modal-body input,
.modal-body select {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

.modal-body input:focus,
.modal-body select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 107, 246, 0.15);
}

.modal-footer {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 顶部通知（JS 动态插入） */
.notification {
    position: fixed;
    top: 18px;
    right: 18px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.86rem;
    z-index: 60;
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(18px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 分页控件样式 */
.pagination-controls {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    display: none; /* 由 JS 控制显示/隐藏 */
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--sidebar-bg);
}

.pagination-summary {
    font-size: 0.85rem;
    color: var(--text-sub);
}

.pagination-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pagination-button {
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    background: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pagination-button:hover:enabled {
    background: rgba(45, 107, 246, 0.06);
    border-color: var(--primary);
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-current {
    font-size: 0.85rem;
    color: var(--text-sub);
}

/* 响应式调整 */
@media (max-width: 960px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
    }
    .main-content {
        flex: 1;
    }
    .editor-container {
        margin: 12px;
    }
    .contents-list {
        padding: 12px;
    }
}

@media (max-width: 600px) {
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .editor-footer {
        flex-direction: column;
        align-items: stretch;
    }
}

/* 小屏幕自动变成 1 列 */
@media (max-width: 900px) {
    .contents-list {
        grid-template-columns: 1fr;
    }
}

/* ===== 手机端专用修复：允许整页滚动，卡片里显示所有文章 ===== */

/* 1. 小屏幕时，不再强制整页 100vh + 内部滚动，而是让页面正常上下滚动 */
@media (max-width: 960px) {
    .container {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .contents-list {
        max-height: none;
        overflow-y: visible;  /* 让它跟着页面一起滚 */
    }
}

/* 2. 手机端：让编辑 / 删除按钮始终可见，而不是依赖 hover */
@media (max-width: 900px) {
    .contents-list .content-item {
        padding-right: 12px;
    }

    .contents-list .content-item .actions {
        position: static !important;    /* 放到卡片内部流布局 */
        display: flex !important;       /* 永远显示出来，手机没有 hover */
        margin-top: 8px;
        justify-content: flex-end;
        gap: 6px;
    }
}

/* View-toggle button icon */
#viewToggleBtn i {
    font-size: 0.9rem;
}

/* List View styles */
.contents-list.list-view {
    display: block; /* Override grid display */
}

.contents-list.list-view .content-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px; /* Spacing between list items */
    gap: 16px;
}

.contents-list.list-view .content-item h3 {
    margin-bottom: 0;
    flex: 1; /* Allow title to take up space */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contents-list.list-view .content-preview-html {
    display: none; /* Hide content preview in list view */
}

.contents-list.list-view .content-item small {
    margin-top: 0;
    flex-shrink: 0; /* Prevent shrinking */
}

.contents-list.list-view .content-item .actions {
    position: static; /* Override absolute positioning */
    display: flex; /* Always show actions in list view */
}

/* Ensure button icon is vertically centered in list view */
.contents-list.list-view .content-item .actions button {
    align-self: center;
}

/* Loader for AI Beautify */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    border-radius: 12px; /* Match parent container */
    transition: opacity 0.3s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-content .fa-spinner {
    font-size: 2.5rem;
    color: var(--primary);
    animation: spin 1s linear infinite;
}

.loader-content span {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 笔记编辑器样式 */
.note-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 16px;
}

.note-editor-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.note-title-input {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    outline: none;
    color: var(--text-main);
    background: #FFFFFF;
    transition: all 0.2s ease;
}

.note-title-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 107, 246, 0.15);
}

.note-editor-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

.note-tags-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 0.9rem;
    outline: none;
    color: var(--text-main);
    background: #FFFFFF;
}

.note-tags-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 107, 246, 0.15);
}

.note-category-select {
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 0.9rem;
    outline: none;
    color: var(--text-main);
    background: #FFFFFF;
    min-width: 120px;
}

.note-category-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 107, 246, 0.15);
}

.note-quill-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.note-quill-editor .ql-toolbar.ql-snow {
    border-radius: 8px 8px 0 0;
    border-color: var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.note-quill-editor .ql-container.ql-snow {
    border-radius: 0 0 8px 8px;
    border-color: var(--border-subtle);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.note-quill-editor .ql-editor {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.7;
    padding: 16px;
    overflow-y: auto;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .note-editor-meta {
        flex-direction: column;
        align-items: stretch;
    }
    
    .note-tags-input,
    .note-category-select {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .note-editor-header {
        gap: 8px;
    }
    
    .note-title-input {
        font-size: 1.1rem;
        padding: 6px 10px;
    }
}
