/* ====== 备忘录页专属样式（多文件笔记模式） ====== */

.memo-main {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 68px - 100px);
}

/* ===== 导航右侧 ===== */
.memo-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* ===== 多文件布局（左右分栏） ===== */
.memo-app {
  display: flex;
  min-height: calc(100vh - 68px - 100px);
}

/* ===== 左侧：文件列表侧边栏 ===== */
.memo-sidebar {
  width: 240px;
  min-width: 220px;
  max-width: 300px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: calc(100vh - 68px - 40px);
  position: sticky;
  top: 68px;
  overflow-y: auto;
  transition: transform 0.3s ease, opacity 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-new-btn {
  padding: 6px 12px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 文件列表 */
.file-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  user-select: none;
}

.file-item:hover {
  background: var(--bg);
}

.file-item.active {
  background: rgba(255, 122, 24, 0.07);
  border-left-color: var(--primary);
}

.file-item-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.file-item.active .file-item-name {
  font-weight: 600;
  color: var(--primary);
}

.file-delete-btn {
  opacity: 0;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item:hover .file-delete-btn { opacity: 0.5; }
.file-delete-btn:hover { opacity: 1 !important; color: var(--danger); background: rgba(255, 84, 112, 0.12); }

/* 空状态 */
.sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  flex: 1;
}

.sidebar-empty svg { margin-bottom: 12px; }

.sidebar-empty p {
  font-size: 13px;
  line-height: 1.7;
}

/* ===== 右侧：编辑器区域 ===== */
.memo-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* 防止内容撑破 flex 容器 */
  padding: 28px 36px 32px;
  max-width: 100%;
}

/* ===== 工具栏 ===== */
.memo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.memo-toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.memo-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.memo-page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.memo-save-status {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.memo-save-status:not(:empty)::before { content: '· '; }

/* 保存按钮 */
.memo-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.2s ease;
}
.memo-save-btn svg { flex-shrink: 0; }

/* 侧边栏切换按钮（移动端显示） */
.sidebar-toggle-btn {
  display: none;
  padding: 8px 12px !important;
  border-radius: 10px !important;
}

/* ===== 编辑器区域 ===== */
.memo-editor-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.memo-editor-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.10), var(--shadow-lg);
}

.memo-editor {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 350px;
  padding: 24px 28px;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: transparent;
  font-family: var(--font-body);
  letter-spacing: 0.2px;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  tab-size: 4;
}

.memo-editor::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* ===== 底部信息栏 ===== */
.memo-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 2px;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.memo-char-count { font-variant-numeric: tabular-nums; }
.memo-last-saved { font-variant-numeric: tabular-nums; }

/* ===== 新建文件弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 11, 0.74);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 1;
  visibility: visible;   /* 抵消 style.css 的 visibility:hidden —— memo 用 display 控制显隐 */
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 系统开启"减弱动画"时：禁用透明度动画，强制弹窗立即可见
   （修复：动画被跳过时元素停在 opacity:0 导致弹窗"透明消失"） */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-box {
    animation: none !important;
    opacity: 1 !important;
  }
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 30px;
  width: 90%;
  max-width: 400px;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.modal-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  margin-bottom: 18px;
}

.modal-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.16);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-cancel-btn {
  padding: 9px 18px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
}

.modal-confirm-btn {
  padding: 9px 22px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
}

/* ===== 认证视图（登录 / 注册） ===== */
.memo-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 68px - 140px);
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 122, 24, 0.10) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand { text-align: center; margin-bottom: 24px; }

.auth-brand .logo-icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gradient-soft); border-radius: 16px;
}

.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.auth-sub { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

.auth-tabs {
  display: flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px; margin-bottom: 22px;
}

.auth-tab {
  flex: 1; padding: 9px 0; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: var(--text-secondary); transition: all 0.2s ease; cursor: pointer;
}
.auth-tab.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow-sm); }

.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }
.auth-field input {
  width: 100%; padding: 11px 13px; font-size: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.16); }

.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 4px; }

.auth-submit { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-foot { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; line-height: 1.6; }

/* 导航栏用户框（登录后显示） */
.memo-ver-badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--accent-ink); background: var(--accent);
  font-family: var(--font-mono);
}
.memo-user-box {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  padding: 5px 6px 5px 12px; border-radius: 999px; font-size: 13px; color: var(--text-secondary);
}
.memo-user-avatar { color: var(--primary); }
.memo-user-name { font-weight: 600; color: var(--text); }

.memo-logout-btn {
  padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px;
  transition: all 0.2s ease; cursor: pointer;
}
.memo-logout-btn:hover { color: var(--danger); border-color: rgba(255, 84, 112, 0.45); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .memo-sidebar { width: 200px; min-width: 180px; }
  .memo-editor-area { padding: 20px 24px 28px; }
  .memo-page-title { font-size: 19px; }
}

@media (max-width: 768px) {
  .memo-sidebar {
    position: fixed;
    left: 0;
    top: 68px;
    bottom: 0;
    width: 260px;
    max-width: 80vw;
    z-index: 50;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border);
    height: auto;
  }

  .memo-sidebar.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle-btn { display: inline-flex !important; align-items: center; gap: 5px; }

  .memo-editor-area { padding: 16px 16px 24px; }
  .memo-page-title { font-size: 17px; }
  .memo-editor { min-height: 280px; padding: 18px 18px; font-size: 15px; }
  .memo-toolbar { margin-bottom: 14px; }
}

@media (max-width: 480px) {
  .memo-footer-bar { flex-direction: column; gap: 4px; align-items: flex-start; }
  .modal-box { padding: 22px 20px; width: 94%; }
}

/* ==========================================================================
   工业终端风增强（全局同步 20260909b）
   --------------------------------------------------------------------------
   只做"质感对齐"，不动布局与交互：等宽标签、发丝线、琥珀色条、暗色滚动条。
   所有数值沿用主题 token，主样式换肤时这里自动跟随。
   ========================================================================== */

/* 侧边栏：仪表侧板的感觉 —— 半透明冷灰 + 发丝右边界 */
.memo-sidebar {
  background: linear-gradient(180deg, rgba(17, 22, 30, 0.92), rgba(13, 17, 23, 0.92));
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
}

/* 顶栏高度已从 68px 改为 62px（--topbar-h），同步 sticky/height 基准 */
.memo-sidebar { top: 62px; height: calc(100vh - 62px - 40px); }
.memo-app     { min-height: calc(100vh - 62px - 100px); }
.memo-main    { min-height: calc(100vh - 62px - 100px); }
.memo-auth    { min-height: calc(100vh - 62px - 140px); }

/* 侧栏标题：等宽大写，去掉"卡片感" */
.sidebar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-header { padding: 16px 16px 12px; }

/* 文件行：左侧 3px 身份色条，选中时点亮为琥珀 */
.file-item { border-left: 3px solid transparent; }
.file-item.active {
  background: rgba(255, 122, 24, 0.07);
  border-left-color: var(--accent);
}
.file-item.active .file-item-name { color: var(--accent); }
.file-delete-btn:hover {
  color: var(--danger) !important;
  background: rgba(255, 84, 112, 0.14) !important;
}

/* 编辑器容器：方角 + 聚焦时琥珀描边（沿用 --radius-sm = 2px） */
.memo-editor-wrap { border-radius: var(--radius-sm); }
.memo-editor-wrap:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.10);
}
.memo-editor { letter-spacing: 0.01em; }
.memo-editor::placeholder { opacity: 0.55; }

/* 底部读数栏：等宽，像终端状态行 */
.memo-footer-bar {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* 弹窗：方角 + 顶部琥珀条，与首页弹窗同一语言 */
.modal-box { border-radius: var(--radius-sm); position: relative; overflow: hidden; }
.modal-box::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent);
}
.modal-title { font-family: var(--font-display); letter-spacing: -0.01em; }

/* 登录卡：去掉右上角蓝光斑，改成极淡琥珀 */
.auth-card::before {
  background: radial-gradient(circle, rgba(255, 122, 24, 0.10) 0%, transparent 70%);
}
.auth-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}

/* 用户胶囊：等宽 + 方角，不再走 999px 圆 */
.memo-user-box, .memo-logout-btn { border-radius: var(--radius-sm); }
.memo-user-box { font-family: var(--font-mono); font-size: 12px; }

/* 暗色滚动条：只作用于侧栏与编辑器 */
.memo-sidebar::-webkit-scrollbar,
.memo-editor::-webkit-scrollbar { width: 8px; }
.memo-sidebar::-webkit-scrollbar-track,
.memo-editor::-webkit-scrollbar-track { background: transparent; }
.memo-sidebar::-webkit-scrollbar-thumb,
.memo-editor::-webkit-scrollbar-thumb {
  background: #263042; border-radius: 6px; border: 2px solid transparent;
  background-clip: content-box;
}
.memo-sidebar::-webkit-scrollbar-thumb:hover,
.memo-editor::-webkit-scrollbar-thumb:hover { background: #35435a; background-clip: content-box; }

@media (max-width: 768px) {
  .memo-sidebar { top: 62px; }
}
