/* ====== 备忘录页专属样式（多文件笔记模式） ====== */

.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 !important;
  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(37, 99, 235, 0.06);
  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: #dc2626; background: #fef2f2; }

/* 空状态 */
.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(37, 99, 235, 0.08), 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: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  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(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.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(37, 99, 235, 0.12);
}

.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(37, 99, 235, 0.08) 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(37, 99, 235, 0.12); }

.auth-error { color: #dc2626; 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-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: #dc2626; border-color: #fecaca; }

/* ===== 响应式 ===== */
@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%; }
}
