/* Notes App - Minimalist Desktop UI */
:root {
  --bg: #fafafa;           /* 背景浅灰 */
  --panel: #ffffff;        /* 面板白 */
  --text: #1a1a1a;         /* 深灰文字 */
  --muted: #8a8a8a;         /* 次要文字 */
  --line: #e5e5e5;         /* 分割线 */
  --accent: #2563eb;       /* 强调色 蓝色 */
  --accent-600: #1d4ed8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .06);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  letter-spacing: 0;
  line-height: 1.6;
}

/* 链接去下划线 */
a { text-decoration: none; }
a:hover { text-decoration: none; }


/* 顶部导航 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 60px;
  background: #fff;
  display: flex; align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display:flex; align-items:center; gap:12px; font-weight:600; }
.topbar .brand .logo { width:20px; height:20px; color: var(--accent); }
.topbar .title { font-size: 17px; color: var(--text); }
.topbar .spacer { flex: 1; }

.search {
  display:flex; align-items:center; gap:10px; width: 520px; max-width: 42vw; height:40px;
  background: #fafafa; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 16px;
  text-decoration: none;
}
.search svg { width:18px; height:18px; color:var(--muted); flex-shrink:0; }
.search input[type="search"] {
  border: none; outline: none; background: transparent; flex:1; padding: 0 8px;
  color: var(--text); font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}
.search input[type="search"]::-webkit-search-decoration,
.search input[type="search"]::-webkit-search-cancel-button,
.search input[type="search"]::-webkit-search-results-button,
.search input[type="search"]::-webkit-search-results-decoration { display:none; }
.search input[type="search"]::-ms-clear,
.search input[type="search"]::-ms-reveal { display:none; width:0; height:0; }

.top-actions { display:flex; align-items:center; gap:8px; margin-left: 16px; }
.icon-btn {
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius: 8px;
  border: none; background:transparent;
  transition: all .2s ease; color: var(--text);
}
.icon-btn svg { width:20px; height:20px; }
.icon-btn:hover {
  background: #f5f5f5;
  color: var(--accent);
}

/* 布局 */
.shell { display:flex; height: calc(100vh - 60px); }
.sidebar {
  width: 280px; background: #fff; border-right: 1px solid var(--line);
  display:flex; flex-direction: column;
}
.sidebar .user {
  display:flex; align-items:center; gap:12px; padding: 20px 20px; border-bottom: 1px solid var(--line);
}
.avatar {
  width:40px; height:40px; border-radius: 50%; background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  flex-shrink:0;
}
.user .name { font-weight: 500; font-size: 15px; }

.section-title { font-size: 11px; color:var(--muted); padding: 16px 20px 8px; text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }

.notebooks { padding: 8px 12px 12px; }
.nb-item {
  display:flex; align-items:center; gap:12px; padding: 10px 12px; border-radius: 8px; cursor:pointer; position:relative;
  color: var(--text); font-size: 14px;
}
.nb-item:hover { background: #f5f5f5; }
.nb-item .icon { width:18px; height:18px; color:var(--muted); }
.nb-item.active { background: #eff6ff; color: var(--accent); }
.nb-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}

.tags { padding: 8px 16px 20px; display:flex; flex-wrap: wrap; gap:8px; }
.tag {
  padding: 6px 14px; border-radius: 6px; background: #f5f5f5; color: var(--text);
  border: none; font-size: 13px;
  transition: all .2s ease;
}
.tag:hover { background: #e5e5e5; color: var(--accent); }

/* 中央编辑区 */
.editor {
  flex: 1; display:flex; flex-direction: column; min-width: 0; background: #fff;
}
.title-bar { padding: 24px 28px 16px; border-bottom: 1px solid var(--line); }
.title-input {
  width: 100%; border: none; outline: none; font-size: 28px; font-weight: 600; background: transparent; color: var(--text);
}

.toolbar {
  position: sticky; top: 60px; z-index: 10; align-self: flex-start; margin: 12px 28px; padding: 8px; border-radius: 8px; background: #fafafa;
  border: 1px solid var(--line); display:flex; gap:4px;
}
.t-btn {
  padding: 8px 14px; border-radius: 6px; border: none; background:transparent; color: var(--text);
  transition: all .2s ease; font-size: 13px; font-weight: 500;
}
.t-btn:hover { background: #fff; }

.editor-body { flex:1; display:flex; min-height: 0; }

/* EasyMDE 覆盖为分栏视图 */
.editor-pane { 
  flex: 1; 
  position: relative; 
  border-right: 1px solid var(--line); 
  min-width: 0;
  overflow: hidden;
}
.editor-pane:first-child {
  flex: 0 0 50%;
  max-width: 50%;
}
.editor-pane:last-child { 
  border-right: none; 
}

/* 状态栏 */
.statusbar { height: 40px; border-top: 1px solid var(--line); background: #fff; display:flex; align-items:center; justify-content: space-between; padding: 0 28px; color: var(--muted); font-size: 13px; }

/* 右侧属性面板 */
.inspector {
  width: 320px; background: #fafafa; border-left: 1px solid var(--line);
  display:flex; flex-direction: column; gap: 16px; padding: 20px;
}
.card { background:#fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card .card-hd { padding: 16px 16px 12px; font-weight: 600; color: var(--text); font-size: 14px; border-bottom: 1px solid var(--line); }
.card .card-bd { padding: 16px; }

.prop-row { display:flex; gap:8px; flex-wrap: wrap; }
.chip { padding: 6px 10px; border:1px solid var(--line); border-radius: 8px; background:#fff; }
.select, .input { width:100%; padding:8px 10px; border-radius: 8px; border: 1px solid var(--line); background:#fff; color: var(--text); }

.grid { display:grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { aspect-ratio: 1 / 1; border-radius: 8px; background: linear-gradient(135deg, #dfe7f2, #eef3f8); border: 1px solid var(--line); }
.empty { color:#98a1ae; font-size: 12px; }

.timeline { position: relative; padding-left: 12px; }
.timeline::before { content:''; position:absolute; left:4px; top:0; bottom:0; width:1px; background: var(--line); }
.t-item { position: relative; margin:10px 0; padding-left: 12px; color: var(--muted); font-size: 12px; }
.t-item::before { content:''; position:absolute; left:-1px; top:6px; width:7px; height:7px; border-radius: 50%; background: var(--accent); }

/* 折叠侧边栏 */
.shell.collapsed .sidebar { width: 72px; }
.shell.collapsed .nb-item span, .shell.collapsed .user .name, .shell.collapsed .section-title { display:none; }
.shell.collapsed .nb-item { justify-content: center; }

/* 动效 */
.nb-item, .tag, .icon-btn, .t-btn { transition: all .2s ease; }

/* 基础按钮与表单 */
.btn { display:inline-flex; align-items:center; justify-content:center; padding:10px 18px; border-radius:8px; border:none; background:#f5f5f5; color:var(--text); cursor:pointer; transition: all .2s ease; font-size: 14px; font-weight: 500; }
.btn:hover { background:#e5e5e5; }
.btn-primary { background: var(--accent); color:#fff; }
.btn-primary:hover { background: var(--accent-600); }
.btn-secondary { background:#f0f0f0; color:var(--text); }
.btn-sm { padding:6px 12px; font-size:13px; border-radius:6px; }

.input, textarea, input[type="text"], input[type="password"], input[type="search"] {
  border:1px solid var(--line); border-radius:8px; padding:12px 16px; outline:none; background:#fff;
  font-size: 14px; transition: all .2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.input:focus, textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus {
  border-color:var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea {
  resize: none;
}

/* 下拉框样式优化 - 使用!important确保优先级 */
select.select,
select[id="categoryId"],
select[name="categoryId"],
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a8a' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px !important;
  cursor: pointer !important;
  width: 100% !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  padding: 12px 36px 12px 16px !important;
  outline: none !important;
  background-color: #fff !important;
  font-size: 14px !important;
  color: var(--text) !important;
  transition: all .2s ease !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}
select.select:hover,
select[id="categoryId"]:hover,
select[name="categoryId"]:hover,
select:hover {
  border-color: var(--accent) !important;
}
select.select:focus,
select[id="categoryId"]:focus,
select[name="categoryId"]:focus,
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}
/* 下拉框选项样式优化 */
select.select option,
select[id="categoryId"] option,
select[name="categoryId"] option,
select option {
  padding: 12px 16px !important;
  background: #fff !important;
  color: var(--text) !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
  border: none !important;
  cursor: pointer !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
}

/* 下拉框选项悬停和选中状态 */
select.select option:hover,
select[id="categoryId"] option:hover,
select[name="categoryId"] option:hover,
select option:hover {
  background: rgba(37, 99, 235, 0.05) !important;
}

select.select option:checked,
select[id="categoryId"] option:checked,
select[name="categoryId"] option:checked,
select option:checked,
select.select option[selected],
select[id="categoryId"] option[selected],
select[name="categoryId"] option[selected],
select option[selected] {
  background: rgba(37, 99, 235, 0.08) !important;
  color: var(--accent) !important;
  font-weight: 500 !important;
}

select.select option:disabled,
select[id="categoryId"] option:disabled,
select[name="categoryId"] option:disabled,
select option:disabled {
  color: var(--muted) !important;
  background: #fafafa !important;
  font-style: italic !important;
  opacity: 0.6 !important;
}

/* 优化下拉框的焦点和展开状态 */
select.select:focus,
select[id="categoryId"]:focus,
select[name="categoryId"]:focus,
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* 为下拉框添加更好的视觉反馈 */
select.select,
select[id="categoryId"],
select[name="categoryId"],
select {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

select.select:active,
select[id="categoryId"]:active,
select[name="categoryId"]:active,
select:active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* 自定义下拉：选择内容展开为圆角面板，悬停/选中使用主题色 */
.select2 { position: relative; width: 100%; }
.select2-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text);
  font-size: 14px; cursor: pointer; transition: all .2s ease;
}
.select2-toggle:hover { border-color: var(--accent); }
.select2-toggle:focus { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.select2 .chevron { color: var(--muted); transition: transform .2s ease; }
.select2[aria-expanded="true"] .chevron, .select2.open .chevron { transform: rotate(180deg); }
.select2-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 260px; overflow: auto; list-style: none; margin: 0; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md);
  z-index: 30;
}
.select2-option { padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.select2-option[aria-selected="true"] { background: rgba(37,99,235,.12); color: var(--accent); font-weight: 600; }
.select2-option:hover { background: rgba(37,99,235,.06); }
.select2-option.is-active { background: rgba(37,99,235,.06); }
.select2-option.is-placeholder { color: var(--muted); font-style: italic; }
.select2-divider { height: 1px; background: var(--line); margin: 6px 0; border-radius: 999px; }


/* 搜索框样式 */
.topbar .search {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .search input[type="search"] {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
/* 隐藏浏览器search默认装饰 */
.topbar .search input::-webkit-search-decoration,
.topbar .search input::-webkit-search-cancel-button,
.topbar .search input::-webkit-search-results-button,
.topbar .search input::-webkit-search-results-decoration { display:none; }
.topbar .search input::-ms-clear,
.topbar .search input::-ms-reveal { display:none; width:0; height:0; }

/* 表格 */
.table { width:100%; border-collapse: collapse; }
.table th, .table td { border-bottom:1px solid var(--line); padding:10px 8px; text-align: left; vertical-align: middle; }
.table thead th { font-weight:600; color:#6b778c; font-size:12px; text-transform: uppercase; letter-spacing:.6px; background:#fafbfc; }
.table.fixed { table-layout: fixed; }
.table.fixed th, .table.fixed td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 文本工具 */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display:block; max-width:100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* 列表页操作区 */
.actions { display:flex; align-items:center; justify-content:center; gap:8px; }
.title-link { color: var(--text); }
.title-link:hover { color: var(--accent); }
.date { font-variant-numeric: tabular-nums; }


/* 布局容器辅助 */
.container { max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.card-centered { max-width: 400px; margin: 10vh auto; background:#fff; border:1px solid var(--line); border-radius:12px; padding: 32px; }
.card-centered h2 { margin: 0 0 12px; font-size: 24px; font-weight: 600; }
.card-centered .desc { color:var(--muted); font-size: 14px; margin-bottom: 24px; }

/* Admin tables refinement */
.table { font-size: 14px; }
.table tbody tr:hover { background: #fafafa; }
.table.compact th, .table.compact td { padding: 12px 16px; }
.table.striped tbody tr:nth-child(even) { background: #fafafa; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.empty { color:var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }

