/* ─── 基础重置 ─── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #e8eaed;
  --text: #1a1a2e;
  --text-secondary: #666;
  --primary: #0066cc;
  --primary-hover: #0052a3;
  --accent: #ff6b35;
  --success: #27ae60;
  --error: #e74c3c;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── 顶部导航 ─── */
.navbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-size: 20px;
  color: var(--primary);
}

.brand {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-right select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  outline: none;
}

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

/* ─── 主工作区 ─── */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editor-panel {
  width: 30%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.panel-header {
  height: 36px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.char-count {
  font-variant-numeric: tabular-nums;
}

.preview-status {
  color: var(--primary);
  font-size: 11px;
}

/* ─── 可拖拽分隔条 ─── */
.divider {
  width: 5px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
}

.divider:hover,
.divider.active {
  background: var(--primary);
}

/* ─── 编辑器 ─── */
#editor {
  flex: 1;
  width: 100%;
  padding: 20px;
  border: none;
  outline: none;
  resize: none;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface);
  tab-size: 2;
}

#editor::placeholder {
  color: #bbb;
}

/* ─── 预览面板 ─── */
.preview-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
}

.preview-content {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  min-height: 200px;
  box-shadow: var(--shadow);
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: #ccc;
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 16px;
  color: #ddd;
}

.empty-state p {
  font-size: 13px;
  line-height: 2;
}

/* ─── 复制按钮 ─── */
.btn-copy {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

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

.hidden {
  display: none !important;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  background: #333;
  color: white;
  border-radius: 20px;
  font-size: 13px;
  z-index: 2000;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── 响应式：小屏幕 ─── */
@media (max-width: 768px) {
  .workspace {
    flex-direction: column;
  }
  .editor-panel {
    width: 100% !important;
    height: 35vh;
    flex-shrink: 0;
  }
  .divider {
    display: none;
  }
  .preview-panel {
    flex: 1;
  }
  .preview-scroll {
    padding: 12px;
  }
  .preview-content {
    padding: 20px;
    border-radius: 0;
    box-shadow: none;
  }
}
