/* CSS Version: 2026-05-06 17:01:03 */
/**
 * CloudNote 全局样式表
 * 功能概述: 响应式布局+暗黑模式+仿华为备忘录UI
 * 适配环境: 主流浏览器 Chrome/Firefox/Safari/Edge
 * 修改备注: 2026-05-01 初始创建
 */

/* ==================== CSS变量(明亮模式) ==================== */
:root {
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-hover: #F0F2F5;
    --bg-active: #E8F0FE;
    --bg-modal: rgba(0, 0, 0, 0.5);
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;
    --primary-color: #4A90D9;
    --primary-hover: #3A7BC8;
    --danger-color: #EF4444;
    --danger-hover: #DC2626;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --priority-high: #EF4444;
    --priority-medium: #F59E0B;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

/* ==================== CSS变量(暗黑模式) ==================== */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-sidebar: #1E293B;
    --bg-hover: #334155;
    --bg-active: #1E3A5F;
    --bg-modal: rgba(0, 0, 0, 0.7);
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border-color: #334155;
    --border-light: #2D3A4F;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
}

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

/* ==================== 应用容器 ==================== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: 252px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo svg {
    width: 22px;
    height: 22px;
}

.sidebar-close {
    display: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.sidebar-close:hover {
    background: var(--bg-hover);
}

.sidebar-search {
    padding: 10px 16px;
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 7px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

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

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    min-height: 0;
}

.nav-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px;
}

.category-list, .status-list {
    list-style: none;
}

.category-item, .status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.category-item:hover, .status-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.category-item.active, .status-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
    font-weight: 500;
}

.category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8rem;
}

.sidebar-user-icon {
    font-size: 1rem;
}

.sidebar-user-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-logout:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.08);
}

.sidebar-footer-btns {
    display: flex;
    gap: 8px;
}

/* ==================== 侧边栏遮罩(移动端) ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal);
    z-index: 99;
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.menu-btn {
    display: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

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

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.top-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== 备忘录列表 ==================== */
.memo-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.memo-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.memo-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.memo-card.pinned {
    border-left: 3px solid var(--primary-color);
}

.memo-card.completed {
    opacity: 0.7;
}

.memo-card.completed .memo-title {
    text-decoration: line-through;
}

.memo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.memo-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    flex: 1;
    word-break: break-word;
}

.memo-lock {
    font-size: 0.85rem;
    margin-right: 2px;
    vertical-align: middle;
}

.memo-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: var(--transition);
}

.memo-card:hover .memo-actions {
    opacity: 1;
}

.memo-action-btn {
    padding: 3px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}

.memo-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.memo-action-btn.delete:hover {
    color: var(--danger-color);
}

.memo-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.memo-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 2px 10px;
    border-radius: 20px;
}

.memo-date {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.memo-priority {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.memo-priority.high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--priority-high);
}

.memo-priority.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--priority-medium);
}

.memo-preview {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.memo-todo-count {
    font-size: 0.65rem;
    color: var(--primary-color);
    background: rgba(74, 144, 217, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ==================== 加载状态 ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 空状态 ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* ==================== 悬浮按钮 ==================== */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 50;
}

.fab:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.fab:active {
    transform: scale(0.95);
}

/* ==================== 通用按钮 ==================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel {
    padding: 8px 20px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.btn-danger {
    padding: 8px 20px;
    background: var(--danger-color);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.btn-small {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

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

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
}

.modal.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.editor-fab-actions {
      position: absolute;
      right: 12px;
      top: 70%;
      transform: translateY(-50%);
     display: flex;
     flex-direction: column;
     gap: 8px;
     z-index: 10;
 }

.fab-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.fab-btn:active {
    transform: scale(0.95);
}

/* ==================== 编辑器弹窗 ==================== */
.editor-modal {
    width: 90%;
    max-width: 900px;
    height: 96vh;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

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

.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 18px;
}

.editor-title {
    width: 100%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    padding: 4px 0;
    border: none;
}

.editor-title::placeholder {
    color: var(--text-muted);
}

.title-counter {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: -2px;
    margin-bottom: 6px;
}

.editor-title-wrap {
    position: relative;
}

.editor-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.meta-select {
    flex: 1;
    min-width: 0;
    padding: 5px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

.meta-select:focus {
    border-color: var(--primary-color);
}

/* ==================== 富文本工具栏 ==================== */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.toolbar-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn.has-password {
    color: #D4A017;
    background: rgba(212, 160, 23, 0.1);
}

.toolbar-btn.has-password:hover {
    background: rgba(212, 160, 23, 0.2);
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin: 0 4px;
}

/* ==================== 编辑器内容区 ==================== */
.editor-content {
    min-height: 150px;
    padding: 8px 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    outline: none;
    word-break: break-word;
}

.editor-content:empty::before {
    content: attr(placeholder);
    color: var(--text-muted);
}

.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

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

/* ==================== 待办事项区域 ==================== */
.todo-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.todo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.todo-header h4 {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.todo-item.done {
    opacity: 0.6;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.todo-checkbox:hover {
    border-color: var(--primary-color);
}

.todo-checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.todo-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
}

.todo-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    word-break: break-word;
}

.todo-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.todo-due {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.todo-remove {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition);
}

.todo-item:hover .todo-remove {
    opacity: 1;
}

.todo-remove:hover {
    color: var(--danger-color);
}

/* ==================== 待办添加弹窗 ==================== */
.todo-add-modal {
    width: 90%;
    max-width: 380px;
    padding: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.todo-add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 8px;
}

.todo-add-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.todo-add-body {
    padding: 8px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.todo-add-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.todo-add-input:focus {
    border-color: var(--primary-color);
}

.todo-add-textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    margin-bottom: 8px;
}

.password-modal {
    width: 90%;
    max-width: 360px;
    padding: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.password-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.todo-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-add-row label {
    width: 60px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.todo-add-row input[type="date"],
.todo-add-row input[type="time"],
.todo-time-select {
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.todo-time-select {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
}

.todo-time-sep {
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.todo-add-row input:focus,
.todo-time-select:focus {
    border-color: var(--primary-color);
}

/* ==================== 编辑器底部 ==================== */
.editor-footer {
    padding: 6px 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

#wordCount.near-limit {
    color: var(--warning-color);
    font-weight: 600;
}

#wordCount.over-limit {
    color: var(--danger-color);
    font-weight: 700;
}

/* ==================== 系统设置弹窗 ==================== */
.settings-modal {
    width: 90%;
    max-width: 480px;
    padding: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.settings-body {
    padding: 16px 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.settings-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.settings-input:focus {
    border-color: var(--primary-color);
}

.user-manage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.user-manage-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.user-manage-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-manage-admin {
    font-size: 0.7rem;
    color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
}

.user-manage-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.user-manage-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.user-manage-actions button {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: var(--transition);
}

.user-manage-actions button.danger {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.user-manage-actions button:hover {
    background: var(--bg-hover);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-row span {
    flex: 1;
}

.btn-warning {
    padding: 6px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--warning-color, #f0ad4e);
    border-radius: var(--radius-sm);
    color: var(--warning-color, #f0ad4e);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-warning:hover {
    background: rgba(240, 173, 78, 0.1);
}

/* ==================== 分类管理弹窗 ==================== */
.category-modal {
    width: 90%;
    max-width: 480px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.modal-close {
    font-size: 1.5rem;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.category-modal-body {
    padding: 20px;
}

.add-category-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-category-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.add-category-row input[type="text"]:focus {
    border-color: var(--primary-color);
}

.add-category-row input[type="color"] {
    width: 40px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-primary);
}

.manage-category-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.manage-category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.manage-category-item:hover {
    background: var(--bg-hover);
}

.manage-category-item .category-dot {
    width: 12px;
    height: 12px;
}

.manage-category-item .cat-name {
    flex: 1;
    font-size: 0.9rem;
}

.manage-category-item .cat-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.manage-category-item .cat-delete {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition);
}

.manage-category-item:hover .cat-delete {
    opacity: 1;
}

.manage-category-item .cat-delete:hover {
    color: var(--danger-color);
}

/* ==================== 附件上传弹窗 ==================== */
.attachment-modal {
    width: 90%;
    max-width: 320px;
    padding: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.attachment-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 8px;
}

.attachment-menu-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.attachment-menu-hint {
    padding: 0 20px 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.attachment-menu-list {
    list-style: none;
    padding: 4px 0;
}

.attachment-menu-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.attachment-menu-list li:hover {
    background: var(--bg-hover);
}

.attachment-menu-list li svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.attachment-menu-list li + li {
    border-top: 1px solid var(--border-light);
}

/* ==================== 编辑器内缩略图 & 附件卡片 ==================== */

/* 图片缩略图容器 */
.memo-img-wrap {
    display: inline-block;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    margin: 6px 4px;
    vertical-align: top;
    background: var(--bg-primary);
    font-size: 0;
    line-height: 0;
}

.memo-img-wrap:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 缩略图悬浮提示 */
.memo-thumb-hint {
    display: block;
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.7rem;
    border-radius: 4px;
    pointer-events: none;
}

.memo-img-wrap .memo-thumb-hint {
    display: none;
}

/* 图片缩略图 */
.memo-thumb {
    display: block;
    max-width: 220px;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: cover;
}

.memo-thumb.thumb-original {
    max-width: none;
    max-height: none;
    width: 100%;
    object-fit: contain;
}

/* 行内视频缩略图 */
.memo-video-wrap {
    position: relative;
    display: inline-block;
    margin: 4px 0;
    cursor: pointer;
}

.memo-video-thumb {
    display: block;
    max-width: 220px;
    max-height: 160px;
    width: auto;
    background: #000;
    border-radius: var(--radius-sm);
}

.memo-video-thumb.thumb-original {
    max-width: none;
    max-height: none;
    width: 100%;
}

.memo-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    pointer-events: auto;
    transition: background 0.2s;
}

.memo-video-play:hover {
    background: rgba(0,0,0,0.8);
}

/* 媒体文件新窗口打开条 */
.memo-attach-bar {
    margin-top: -4px;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 8px 8px;
    text-align: right;
}

.memo-attach-bar a {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
}

.memo-attach-bar a:hover {
    text-decoration: underline;
}

/* 文件卡片 */
.memo-file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: var(--transition);
    margin: 6px 0;
    max-width: 400px;
}

.memo-file-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.memo-file-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.memo-file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.memo-file-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memo-file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 兼容旧版 attachment-link */
.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

/* ==================== 删除确认弹窗 ==================== */
.delete-modal {
    width: 90%;
    max-width: 360px;
    padding: 24px;
    text-align: center;
}

.delete-modal h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.delete-modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ==================== 提示消息 ==================== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    background: var(--text-primary);
    color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    z-index: 999;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success-color);
    color: #fff;
}

.toast.error {
    background: var(--danger-color);
    color: #fff;
}

/* ==================== 上传进度条 ==================== */
.upload-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px 32px;
    z-index: 999;
    text-align: center;
    min-width: 260px;
}

.upload-progress-bg {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #67B8F7);
    border-radius: 4px;
    width: 0%;
    transition: width 0.2s ease;
}

.upload-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-cancel {
    padding: 6px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.upload-cancel:hover {
    background: var(--danger-color);
    color: #fff;
    border-color: var(--danger-color);
}

/* 删除按钮样式修复 */
.memo-action-btn.delete {
    color: var(--text-muted);
}

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

.memo-action-btn.delete svg {
    display: block;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
}

.page-link {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

/* ==================== 响应式适配 ==================== */
/* 平板 */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
}

/* 手机 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -252px;
        width: 252px;
        height: 100vh;
        height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 8px);
        z-index: 101;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .sidebar-close {
        display: block;
    }

    .menu-btn {
        display: flex;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .memo-list {
        padding: 12px 16px;
    }

    .memo-card {
        padding: 8px 12px;
        margin-bottom: 6px;
    }

    .memo-title {
        font-size: 0.85rem;
        max-width: 20em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .memo-preview {
        display: none;
    }

    .memo-meta {
        gap: 8px;
        margin-top: 2px;
        font-size: 0.65rem;
    }

    .memo-actions {
        opacity: 1;
    }

    .editor-modal {
        width: 100%;
        height: 100vh;
        max-width: none;
        border-radius: 0;
        max-height: 100vh !important;
    }

    .editor-header {
        display: none;
    }

    .editor-fab-actions {
        right: 10px;
    }

    .editor-title {
        font-size: 0.85rem;
        padding: 2px 0;
    }

    .editor-body {
        padding: 50px 14px 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .title-counter {
        margin-bottom: 4px;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        margin-top: 0;
        pointer-events: none;
        font-size: 0.65rem;
        color: var(--text-muted);
    }

    .editor-title-wrap .editor-title {
        padding-right: 56px;
    }

    .editor-meta {
        gap: 6px;
        margin-bottom: 6px;
        flex-wrap: wrap;
    }

    .meta-select {
        padding: 4px 8px;
        font-size: 0.8rem;
        flex: 1;
        min-width: 0 !important;
        max-width: 100%;
    }
    .editor-toolbar {
        padding: 2px 0;
        margin-bottom: 8px;
    }

    .toolbar-btn {
        width: 26px;
        height: 26px;
    }

    .editor-content {
        min-height: 120px;
        padding: 6px 0;
        font-size: 0.92rem;
    }

    .editor-footer {
        padding: 4px 0;
    }

    .todo-section {
        margin-top: 10px;
        padding-top: 8px;
    }

    .fab {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
    }

    .category-modal {
        width: 95%;
        max-height: 80vh;
    }

    /* iPhone 编辑器弹窗: 90% 宽度 + 圆角（仅 iOS Safari） */
    @supports (-webkit-touch-callout: none) {
        .editor-modal {
            width: 90%;
            max-width: none;
            border-radius: var(--radius-lg);
        }
        .editor-body {
            padding-left: 12px;
            padding-right: 12px;
        }
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .app-container {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .top-bar {
        padding: 10px 12px;
        gap: 8px;
    }

    .top-bar-actions .btn-primary span {
        display: none;
    }

    .top-bar-actions {
        gap: 4px;
    }

    .editor-meta {
        gap: 4px;
        flex-wrap: wrap;
    }

    .meta-select {
        flex: 1;
        min-width: 0;
        padding: 4px 8px;
    }


    .add-category-row {
        flex-wrap: wrap;
    }

    .add-category-row input[type="text"] {
        flex: 1 1 calc(100% - 52px);
    }
}

/* ==================== 移动端手势滑动返回 ==================== */
.editor-modal.swipe-drag {
    transition: none !important;
}

.editor-modal.swipe-out {
    transition: transform 0.3s ease-out !important;
}

.editor-modal.swipe-bounce {
    transition: transform 0.25s ease-out !important;
    transform: translateX(0) !important;
}

/* ==================== 超宽屏限制最大宽度 ==================== */
@media (min-width: 1601px) {
    html {
        background: #D1D5DB !important;
    }
    body {
        max-width: 1600px !important;
        margin: 0 auto !important;
        box-shadow: 0 0 40px rgba(0,0,0,0.08);
        min-height: 100vh;
    }
    .app-container {
        max-width: 1600px !important;
    }
    .fab {
        right: calc(50% - 770px) !important;
    }
    .chat-fab {
        right: calc(50% - 770px) !important;
    }
}
