/* ===== 一键排版 - 主样式 ===== */
:root {
  --primary:    #1a7cfa;
  --primary-dk: #0e5ed4;
  --success:    #28a745;
  --warning:    #ffc107;
  --danger:     #dc3545;
  --bg:         #f5f7fa;
  --card:       #ffffff;
  --border:     #e0e4ec;
  --text:       #2c3e50;
  --muted:      #8492a6;
  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

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

/* ===== 顶部导航 ===== */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 900;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nav-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: all .2s;
}
.nav-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.nav-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.nav-btn.primary:hover { background: var(--primary-dk); }

/* ===== 公告栏 ===== */
.notice-bar {
  background: #fffbe6;
  border-bottom: 1px solid #ffe58f;
  padding: 8px 24px;
  font-size: 13px;
  color: #7a5700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notice-bar .notice-icon { font-size: 15px; }

/* ===== 主内容区 ===== */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ===== 工具栏 ===== */
.toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.toolbar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.toolbar-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-right: 6px;
}

/* 排版选项复选框 */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.opt-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.opt-label input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

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

/* ===== 操作按钮区 ===== */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  white-space: nowrap;
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-size: 16px;
  padding: 9px 28px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(26,124,250,.3);
}
.btn-primary:hover { background: var(--primary-dk); box-shadow: 0 4px 12px rgba(26,124,250,.4); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #218838; }

.btn-outline {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #f0f5ff; }

.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ===== 编辑器区域 ===== */
.editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 768px) {
  .editor-row { grid-template-columns: 1fr; }
}

.editor-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}

.editor-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.word-count {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

/* 富文本编辑器 */
.rich-editor {
  min-height: 480px;
  max-height: 680px;
  overflow-y: auto;
  padding: 16px;
  outline: none;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  flex: 1;
}

.rich-editor:focus {
  outline: none;
}

.rich-editor p { margin-bottom: 10px; }
.rich-editor h1,.rich-editor h2,.rich-editor h3 { margin: 12px 0 8px; font-weight: 700; }
.rich-editor table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.rich-editor td, .rich-editor th { border: 1px solid #ddd; padding: 6px 10px; }
.rich-editor a { color: var(--primary); }
.rich-editor blockquote {
  border-left: 3px solid var(--primary);
  padding: 6px 12px;
  margin: 8px 0;
  color: var(--muted);
  background: #f0f5ff;
}

/* 输入/输出编辑器的不同样式 */
#output-editor {
  background: #fafcff;
}

/* ===== 复制/下载按钮组 ===== */
.copy-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.copy-group-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== 工具面板（查找替换等）===== */
.tools-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.tools-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.tool-tab {
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  transition: all .2s;
  margin-bottom: -1px;
}
.tool-tab.active, .tool-tab:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tool-pane { display: none; }
.tool-pane.active { display: block; }

.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.form-input {
  flex: 1;
  min-width: 120px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border .2s;
}
.form-input:focus { border-color: var(--primary); }

/* ===== 统计信息 ===== */
.stats-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 14px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: var(--shadow);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.stat-item .stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: slideIn .25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}
.toast.success { background: #1d7a3b; }
.toast.error   { background: #c0392b; }
.toast.info    { background: #1565c0; }

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

/* ===== 模态框 ===== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 5px;
}
.form-group .form-input { width: 100%; }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

/* ===== 历史记录面板 ===== */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  gap: 10px;
  transition: background .15s;
}
.history-item:hover { background: var(--bg); }
.history-item .h-title { flex: 1; font-size: 14px; }
.history-item .h-meta  { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: #fff;
  margin-top: 32px;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--primary); }

/* ===== 加载动画 ===== */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 快捷键提示 ===== */
.kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 11px;
  font-family: monospace;
  color: #555;
}

/* ===== 励志进度条 ===== */
.motivation-bar {
  max-width: 1170px;
  margin: 0 auto 28px;
  padding: 24px 28px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 16px;
  color: #fff;
  box-shadow: 0 8px 32px rgba(15,52,96,.4), inset 0 1px 0 rgba(255,255,255,.1);
  position: relative;
  overflow: hidden;
}
.motivation-bar::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,.03) 0%, transparent 60%);
  pointer-events: none;
}
.motivation-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.motivation-icon {
  font-size: 22px;
  animation: pulse 2s ease-in-out infinite;
}
.motivation-icon:last-child { animation-delay: .5s; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.motivation-title {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, #ffd700, #ff6b6b, #ffd700);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shine 3s linear infinite;
}
@keyframes shine {
  to { background-position: 200% center; }
}
.progress-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px 16px;
}
.progress-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 12px;
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  transition: all .3s ease;
}
.progress-item:hover {
  background: rgba(255,255,255,.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.progress-item.spring {
  background: linear-gradient(135deg, rgba(255,107,107,.15), rgba(255,215,0,.15));
  border-color: rgba(255,107,107,.2);
}
.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.progress-name {
  font-weight: 600;
  font-size: 13px;
  color: #e0e0e0;
}
.progress-detail {
  font-size: 11px;
  color: #a0a0a0;
  text-align: right;
}
.progress-detail span { font-weight: 600; color: #fff; }
.progress-track {
  height: 6px;
  background: rgba(255,255,255,.12);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,.3), transparent);
  border-radius: 3px 3px 0 0;
}
.progress-fill.day { background: linear-gradient(90deg, #667eea, #764ba2); }
.progress-fill.week { background: linear-gradient(90deg, #f093fb, #f5576c); }
.progress-fill.month { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.progress-fill.year { background: linear-gradient(90deg, #43e97b, #38f9d7); }
.progress-fill.spring { background: linear-gradient(90deg, #fa709a, #fee140); }
.progress-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.progress-pct {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.spring-pct {
  background: linear-gradient(90deg, #fa709a, #fee140);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.progress-sub {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* 暗色模式适配 */
body.dark .motivation-bar {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
body.dark .progress-item { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.06); }
body.dark .progress-track { background: rgba(255,255,255,.08); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .progress-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .navbar { padding: 0 12px; }
  .main-wrapper { padding: 12px 8px 30px; }
  .toolbar-top { gap: 6px 10px; }
  .action-bar { gap: 6px; }
  .stats-bar { gap: 12px; }
  .progress-grid { grid-template-columns: 1fr 1fr; }
  .motivation-bar { margin: 0 8px 16px; padding: 16px 14px; }
  .motivation-title { font-size: 15px; }
}
