/* 简历编辑页：滚动条、动效、结构 */
.editor-page {
  scroll-behavior: smooth;
}
/* 减少顶部空白（覆盖 tool-page 的 5rem） */
.editor-page.tool-page {
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 全局滚动条（编辑页内） */
.editor-page ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.editor-page ::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}
.editor-page ::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.35);
  border-radius: 4px;
}
.editor-page ::-webkit-scrollbar-thumb:hover {
  background: rgba(99,102,241,0.55);
}
.editor-page ::-webkit-scrollbar-corner {
  background: transparent;
}

.editor-page .editor-container {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 360px 1rem 0;
  box-sizing: border-box;
  animation: editorFadeIn 0.4s ease-out;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@keyframes editorFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.editor-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.editor-btn-upload {
  margin-left: 0.5rem;
}

.editor-template-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.editor-template-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.editor-template-select {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 140px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.editor-template-select:hover {
  border-color: var(--primary);
}
.editor-template-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.editor-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}
.editor-download-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.editor-download-format {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 7rem;
}
.editor-download-format:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.editor-action-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}
.editor-action-btn.locked {
  opacity: 0.7;
  cursor: not-allowed;
}
.editor-actions-payment {
  margin-left: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.editor-payment-label { font-size: 0.9rem; font-weight: 600; }
.editor-payment-order { font-size: 0.8rem; word-break: break-all; margin: 0.25rem 0 0; color: var(--text-muted); }
.editor-payment-mock { font-size: 0.8rem; color: var(--primary); }

/* 表单内各区块可收缩、可拖动排序 */
.editor-form-section {
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}
.editor-form-section-dragging {
  opacity: 0.7;
}
.editor-form-section-drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
}
.editor-form-section-drag {
  flex-shrink: 0;
  width: 28px;
  padding: 0.5rem 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: grab;
  user-select: none;
  background: rgba(255,255,255,0.03);
  border-right: 1px solid var(--border);
}
.editor-form-section-drag:hover {
  color: var(--primary);
}
.editor-form-section-drag:active {
  cursor: grabbing;
}
.editor-form-section-header {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: none;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.editor-form-section-header:hover {
  background: rgba(99,102,241,0.12);
}
.editor-form-section-title {
  flex: 1;
  min-width: 0;
}
.editor-form-section-toggle {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.editor-form-section-body {
  width: 100%;
  flex: 0 0 100%;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.editor-form-section-collapsed .editor-form-section-body {
  display: none;
}

/* 桌面：左+中 两栏，预览列保证最小宽度并居中；最小高度保证左侧收缩时预览仍完整显示 */
.editor-main {
  display: grid;
  grid-template-columns: minmax(260px, 28%) minmax(320px, 1fr);
  gap: 1rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  margin-bottom: 1rem;
  min-height: 65vh;
}

/* 对话固定屏幕右侧，从导航下方开始，避免被顶栏遮挡（留足导航高度） */
.editor-page {
  --editor-header-offset: 72px;
}
.editor-chat-card {
  position: fixed;
  right: 0;
  top: var(--editor-header-offset, 72px);
  bottom: 0;
  width: 360px;
  max-height: calc(100vh - var(--editor-header-offset, 72px));
  height: calc(100vh - var(--editor-header-offset, 72px));
  margin: 0;
  border-radius: 0;
  border-left: 1px solid var(--border);
  z-index: 20;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.editor-chat-card .chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* 移动端 Tab 栏：仅小屏显示 */
.editor-mobile-tabs {
  display: none;
}

/* ---------- 移动端 ---------- */
@media (max-width: 1023px) {
  .editor-container {
    padding-right: 0;
  }

  .editor-chat-card {
    position: static;
    width: 100%;
    height: auto;
    max-height: 70vh;
    margin-bottom: 1rem;
  }

  .editor-mobile-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem;
  }

  .editor-mobile-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
  }
  .editor-mobile-tab:hover {
    color: var(--text);
  }
  .editor-mobile-tab.active {
    color: var(--primary);
    background: rgba(99,102,241,0.15);
  }

  .editor-main {
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  /* 移动端只显示当前 Tab 对应面板 */
  .editor-container[data-mobile-tab="edit"] .editor-side { display: flex; }
  .editor-container[data-mobile-tab="edit"] .editor-preview-wrap { display: none !important; }
  .editor-container[data-mobile-tab="edit"] .editor-chat-card { display: none !important; }

  .editor-container[data-mobile-tab="preview"] .editor-side { display: none !important; }
  .editor-container[data-mobile-tab="preview"] .editor-preview-wrap { display: flex; }
  .editor-container[data-mobile-tab="preview"] .editor-chat-card { display: none !important; }

  .editor-container[data-mobile-tab="chat"] .editor-side { display: none !important; }
  .editor-container[data-mobile-tab="chat"] .editor-preview-wrap { display: none !important; }
  .editor-container[data-mobile-tab="chat"] .editor-main { display: none !important; }
  .editor-container[data-mobile-tab="chat"] .editor-chat-card { display: flex !important; }

  .editor-preview-wrap {
    min-height: 60vh;
  }
  .editor-preview-frame-wrap {
    min-height: 50vh;
  }
  .editor-chat-card .chat-messages {
    max-height: 50vh !important;
  }
}

@media (max-width: 600px) {
  .editor-page .editor-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .editor-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .editor-template-bar {
    margin-left: 0;
  }
  .editor-side,
  .editor-preview-wrap {
    padding: 1rem;
  }
}

.editor-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: box-shadow 0.3s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.editor-side:hover {
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.editor-side .editor-form {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 0.25rem;
}

.editor-side-title,
.editor-preview-title,
.editor-chat-card h2 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.editor-field label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.editor-field input,
.editor-field textarea {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.editor-field textarea {
  min-height: 60px;
  resize: vertical;
}

.editor-field input:focus,
.editor-field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.editor-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.editor-block {
  padding: 0.75rem;
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.editor-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.editor-block-header .editor-remove {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.2rem 0.4rem;
}

.editor-block-header .editor-remove:hover {
  color: #f87171;
}

.editor-add-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  background: rgba(99,102,241,0.2);
  color: var(--primary);
  border: 1px dashed rgba(99,102,241,0.5);
  border-radius: 8px;
  cursor: pointer;
}

.editor-add-btn:hover {
  background: rgba(99,102,241,0.3);
}

.editor-avatar-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.editor-avatar-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-avatar-preview img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.editor-avatar-remove {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.editor-avatar-remove:hover {
  color: #f87171;
}

.editor-avatar-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  background: rgba(99,102,241,0.2);
  color: var(--primary);
  border: 1px solid rgba(99,102,241,0.4);
  border-radius: 8px;
  cursor: pointer;
}

.editor-avatar-btn:hover {
  background: rgba(99,102,241,0.3);
}

.editor-preview-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: box-shadow 0.3s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  min-height: 55vh;
}
.editor-preview-wrap:hover {
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.editor-preview-frame-wrap {
  border-radius: 10px;
  overflow: auto;
  background: #f1f5f9;
  flex: 1;
  min-height: 400px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
.editor-preview-frame-wrap:focus-within {
  box-shadow: inset 0 0 0 2px rgba(99,102,241,0.3);
}

/* 简历预览 iframe 在中间列水平居中：固定内容宽度，由 flex 居中 */
.editor-preview-frame {
  width: 794px;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 100%;
  border: none;
  display: block;
  margin: 0 auto;
}

.editor-chat-card {
  transition: box-shadow 0.3s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.editor-chat-card:hover {
  border-color: rgba(99,102,241,0.2);
}

.editor-chat-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.editor-chat-card .chat-messages {
  flex: 1;
  min-height: 120px;
  max-height: none !important;
  overflow-y: auto;
}

.editor-chat-card .chat-input-row {
  flex-shrink: 0;
  margin-top: 0.5rem;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.editor-actions .payment-panel {
  width: 100%;
  margin-top: 0.5rem;
}

/* 上传区在编辑页中的样式统一 */
.editor-page .editor-upload-card .upload-zone,
.editor-page .tool-card {
  transition: border-color 0.25s, box-shadow 0.25s;
}
.editor-page .tool-card:hover {
  border-color: rgba(99,102,241,0.18);
}

/* 获取激活码弹窗 */
.editor-redeem-modal {
  max-width: 400px;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}
.editor-redeem-modal .modal-close {
  top: 0.75rem;
  right: 0.75rem;
  color: var(--text-muted);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.editor-redeem-modal .modal-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.editor-redeem-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  padding: 1.5rem 1.5rem 0.5rem;
  color: var(--text);
  letter-spacing: 0.02em;
}
.editor-redeem-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 1.5rem 1.25rem;
  line-height: 1.6;
  padding: 0 0.25rem 0 0;
}
.editor-redeem-qr {
  text-align: center;
  margin: 0 1.5rem 1.5rem;
  padding: 1.25rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.editor-redeem-qr img {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  display: block;
  margin: 0 auto;
}
.editor-redeem-form {
  padding: 0 1.5rem 1.5rem;
}
.editor-redeem-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.editor-redeem-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.editor-redeem-form input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}
.editor-redeem-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}
.editor-redeem-form .btn {
  width: 100%;
  padding: 0.9rem 1rem;
  margin-top: 0.25rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  background: var(--gradient-hero);
  border: none;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.editor-redeem-form .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}
.editor-redeem-form .btn:active {
  transform: translateY(0);
}
.editor-redeem-form .error-msg {
  margin-top: -0.35rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
