/* ===== 设计系统变量 ===== */
:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --text: #1A1F36;
  --text-2: #5B6478;
  --text-3: #8A92A6;
  --border: #E8ECF2;
  --border-2: #F0F2F5;
  --primary: #1F6FEB;
  --primary-dark: #1558C7;
  --primary-soft: #E8F0FE;
  --danger: #E5484D;
  --success: #16A34A;
  --warning: #F97316;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", "WenQuanYi Micro Hei", "WenQuanYi Zen Hei", "Segoe UI", Roboto, "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ===== App 布局 ===== */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ===== 顶部栏 ===== */
.topbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #5B9DFF 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(31,111,235,0.3);
  flex-shrink: 0;
}
.app-info { display: flex; flex-direction: column; min-width: 0; }
.app-name { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }
.app-sub { font-size: 11px; color: var(--text-3); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--primary-soft); color: var(--primary); }

/* ===== 移动端切换 tab ===== */
.view-tabs {
  display: flex;
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.view-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-2);
  transition: all .15s;
}
.view-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(31,111,235,0.25);
}

/* ===== 主体 ===== */
.main { flex: 1; display: flex; min-height: 0; }
.form-pane, .preview-pane { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.form-pane { background: var(--bg); }
.preview-pane { background: #E9ECF1; }

/* 桌面端：左右分栏 */
@media (min-width: 900px) {
  .view-tabs { display: none; }
  .form-pane { flex: 0 0 48%; border-right: 1px solid var(--border); }
  .preview-pane { flex: 1; }
  .main { display: flex; }
  .form-pane, .preview-pane { display: flex; }
  .form-pane.view-form, .preview-pane.view-preview { display: flex; }
}

/* 移动端：切换显示 */
@media (max-width: 899px) {
  .form-pane.view-form { display: flex; flex: 1; }
  .preview-pane.view-preview { display: none; flex: 1; }
  .app.show-preview .form-pane.view-form { display: none; }
  .app.show-preview .preview-pane.view-preview { display: flex; }
}

.form-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 100px; }
.form-bottom-pad { height: 24px; }

/* ===== 表单卡片 ===== */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: opacity .2s;
}
.form-card.dim { opacity: .5; }
.form-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
}
.form-title::before {
  content: ""; width: 3px; height: 14px;
  background: var(--primary); border-radius: 2px;
}
.form-title-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.form-title-row .form-title { margin-bottom: 0; }
.row-right { display: flex; align-items: center; gap: 12px; }
.btn-add { font-size: 13px; color: var(--primary); font-weight: 600; }
.eye { font-size: 12px; color: var(--text-3); }
.eye.off { color: var(--warning); }

.form-item { margin-bottom: 12px; }
.form-item:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); transition: all .15s;
}
.form-input:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-textarea {
  width: 100%; padding: 10px 12px; min-height: 72px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); resize: vertical; transition: all .15s;
}
.form-textarea:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-textarea.tall { min-height: 140px; }

.form-sub { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.form-sub:last-child { margin-bottom: 0; }
.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.btn-del { font-size: 12px; color: var(--danger); }
.btn-move { display: flex; gap: 14px; }
.move { font-size: 12px; color: var(--primary); }
.form-empty { font-size: 12px; color: var(--text-3); text-align: center; padding: 16px 0; }

/* 头像上传 */
.avatar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar-preview {
  width: 60px; height: 60px; border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: var(--surface-2); flex-shrink: 0;
  border: 2px solid var(--border);
}
.avatar-preview.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 22px; border: 2px dashed #C5CCD8;
}
.avatar-link { font-size: 13px; color: var(--primary); font-weight: 500; }
.avatar-link.danger { color: var(--danger); }

/* ===== 预览区 ===== */
.preview-scroll {
  flex: 1; overflow-y: auto; padding: 20px 16px;
  display: flex; justify-content: center;
}
.resume-render {
  width: 100%; max-width: 595px; min-height: 600px;
  background: #fff; padding: 0;
  box-shadow: var(--shadow-lg);
  border-radius: 4px; overflow: hidden;
}

/* 顶部通栏 classic */
.rs-header { display: flex; align-items: center; justify-content: space-between; padding: 36px 40px 28px; }
.rs-header-text { flex: 1; min-width: 0; }
.rs-name { font-size: 28px; font-weight: 750; line-height: 1.2; letter-spacing: .5px; }
.rs-position { font-size: 15px; margin-top: 6px; font-weight: 500; }
.rs-contact { font-size: 13px; margin-top: 12px; line-height: 1.6; font-weight: 500; }
.rs-body { padding: 8px 40px 36px; }
.rs-avatar { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; margin-left: 20px; border: 3px solid rgba(255,255,255,0.5); flex-shrink: 0; background: rgba(255,255,255,0.15); }
.rs-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* sidebar flex 等高 */
.rs-sidebar-wrap { display: flex; align-items: stretch; }
.rs-sidebar { width: 36%; padding: 36px 22px; box-sizing: border-box; }
.rs-main { flex: 1; padding: 36px 30px; box-sizing: border-box; }
.rs-sb-name { font-size: 21px; font-weight: 750; line-height: 1.2; }
.rs-sb-position { font-size: 14px; margin-top: 6px; font-weight: 500; }
.rs-sb-contact { margin-top: 20px; }
.rs-sb-line { font-size: 13px; margin-bottom: 8px; line-height: 1.45; word-break: break-all; font-weight: 500; }
.rs-sb-sec { margin-top: 24px; }
.rs-sb-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.32); }
.rs-sb-skill { font-size: 13px; margin-bottom: 8px; padding-left: 12px; position: relative; font-weight: 500; }
.rs-sb-skill::before { content: ""; position: absolute; left: 0; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .7; }
.rs-sb-text { font-size: 13px; line-height: 1.6; }
.rs-sb-avatar { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; margin: 0 auto 16px; border: 3px solid rgba(255,255,255,0.4); }
.rs-sb-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* twocol */
.rs-twocol { display: flex; align-items: stretch; }
.rs-twocol-left { width: 34%; padding: 36px 22px; box-sizing: border-box; }
.rs-tc-name { font-size: 21px; font-weight: 750; line-height: 1.2; }
.rs-tc-position { font-size: 13px; margin-top: 6px; font-weight: 500; }
.rs-tc-contact { margin-top: 20px; }
.rs-tc-line { font-size: 12px; margin-bottom: 8px; line-height: 1.45; word-break: break-all; font-weight: 500; }
.rs-twocol-right { flex: 1; padding: 28px 28px; box-sizing: border-box; }
.rs-tc-avatar { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; margin-bottom: 14px; border: 3px solid rgba(255,255,255,0.6); }
.rs-tc-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 通用模块 */
.rs-section { margin-bottom: 20px; }
.rs-section-title-row { display: flex; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,.08); }
.rs-section-bar { width: 5px; height: 16px; border-radius: 3px; margin-right: 8px; flex-shrink: 0; }
.rs-section-title { font-size: 15px; font-weight: 700; flex-shrink: 0; }
.rs-section-title-line { flex: 1; height: 2px; margin-left: 12px; border-radius: 1px; opacity: .6; }
.rs-item { position: relative; margin-bottom: 12px; padding-left: 14px; }
.rs-item::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; }
.rs-item-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rs-item-main { font-size: 14px; font-weight: 680; line-height: 1.4; }
.rs-item-time { font-size: 12px; color: inherit; opacity: .55; flex-shrink: 0; white-space: nowrap; }
.rs-item-sub { font-size: 12px; opacity: .64; margin-top: 3px; line-height: 1.45; }
.rs-text { font-size: 13px; line-height: 1.7; margin-top: 6px; opacity: .9; text-align: justify; }
.rs-skill { display: flex; align-items: center; margin-bottom: 10px; }
.rs-skill-name { width: 120px; font-size: 13px; font-weight: 620; }
.rs-skill-dots { display: flex; gap: 5px; align-items: center; }
.rs-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }

/* ===== 模块排序面板 ===== */
.sort-panel {
  flex-shrink: 0; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 14px 16px;
  box-shadow: var(--shadow-md);
}
.sort-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sort-panel-title { font-size: 14px; font-weight: 700; }
.sort-hint { font-size: 12px; color: var(--text-3); }
.sort-list { display: flex; flex-direction: column; gap: 6px; }
.sort-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: grab; font-size: 13px;
}
.sort-item:hover { border-color: var(--primary); }
.sort-handle { color: var(--text-3); font-size: 16px; cursor: grab; }
.sort-icon { font-size: 16px; }
.sort-name { flex: 1; color: var(--text); }
.sort-state { font-size: 11px; color: var(--warning); }

/* ===== 底部操作栏 ===== */
.bottombar {
  flex-shrink: 0;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(15,23,42,0.05);
}
.btn-primary {
  width: 100%;
  padding: 13px 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, #3B82F6 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(31,111,235,0.35);
  transition: transform .1s;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; }

/* ===== 模板抽屉 ===== */
.tpl-drawer-mask {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 100;
  animation: fadein .2s;
}
.tpl-drawer {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  display: flex; flex-direction: column;
  z-index: 101;
  animation: slideup .25s;
}
.tpl-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.tpl-drawer-title { font-size: 16px; font-weight: 700; }
.tpl-drawer-close { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.tpl-drawer-body { overflow-y: auto; padding: 16px; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 600px) { .tpl-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .tpl-grid { grid-template-columns: repeat(5, 1fr); } }

.tpl-card {
  cursor: pointer; border-radius: var(--radius-sm);
  border: 2px solid transparent; overflow: hidden;
  transition: all .15s; background: var(--surface-2);
}
.tpl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tpl-card.active { border-color: var(--primary); }
.tpl-thumb { height: 90px; padding: 6px; position: relative; }
.tpl-thumb-inner { height: 100%; border-radius: 4px; padding: 8px 6px; }
.tpl-thumb-line { height: 4px; border-radius: 2px; margin-bottom: 4px; }
.tpl-thumb-line.short { width: 60%; }
.tpl-card-info { padding: 8px 8px 10px; text-align: center; }
.tpl-name { font-size: 12px; font-weight: 600; color: var(--text); }
.tpl-cat { font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* 动画 */
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #CDD3DC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #B0B8C4; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 专属模板样式 ===== */

/* d06 纯白横幅：头部更矮、内容居中 */
.rs-header { min-height: 0; }
.rs-section { transition: none; }

/* d10 极客暗夜：深色背景下调整细节 */
.resume-render { position: relative; }
.rs-skill-dots { gap: 6px; }

/* 时间线感：经历项之间加细线（所有模板通用增强） */
.rs-item { padding-bottom: 2px; }

/* 模块标题装饰增强：色块更立体 */
.rs-section-bar { box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

/* 经典款头部：增加底部细装饰线 */
.rs-header { position: relative; overflow: hidden; }
.rs-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* sidebar 侧栏顶部装饰光晕 */
.rs-sidebar { position: relative; overflow: hidden; }
.rs-sidebar::before {
  content: ""; position: absolute; top: -40px; right: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
  pointer-events: none;
}

/* twocol 左栏装饰 */
.rs-twocol-left { position: relative; overflow: hidden; }
.rs-twocol-left::before {
  content: ""; position: absolute; bottom: -30px; left: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,0.06); pointer-events: none;
}

/* ===== 预览模式（只读）：隐藏编辑相关，只留预览和导出 ===== */
body.preview-only .view-tabs { display: none; }
body.preview-only .form-pane { display: none !important; }
body.preview-only .preview-pane { flex: 1 !important; display: flex !important; }
body.preview-only #btn-sort,
body.preview-only #btn-tpl { display: none; }
body.preview-only .app-name::after { content: " · 预览"; color: var(--text-3); font-weight: 400; }


