/**
 * ============================================================
 * AI 写简历 — A4 纸张风格表单样式
 * ============================================================
 */

/* ---------- 变量 ---------- */
:root {
  --a4-width: 595px;
  --paper-bg: #ffffff;
  --paper-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --paper-shadow-hover: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-bg: #eff6ff;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 8px;
}

/* ---------- 页面容器 ---------- */
#page-ai {
  min-height: 100%;
  padding: 0;
}

#page-ai > h2 {
  display: none;
}

/* ---------- A4 纸张区域 ---------- */
.AIResumeForm {
  width: 100%;
  max-width: 80%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.AIResumeForm > img {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: block;
}

.AIResumeForm > h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: -0.01em;
}

.AIResumeForm > .aip {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: center;
}

/* ---------- 表单主体 ---------- */
.ai-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---------- 步骤导航 ---------- */
.step-nav {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  padding: 0 4px;
}

.step-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.2s;
  cursor: pointer;
}

.step-nav-item:hover {
  color: var(--accent);
}

.step-nav-item.active {
  color: var(--accent);
  font-weight: 600;
}

.step-nav-item.completed {
  color: var(--accent-light);
}

.step-nav-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-nav-item.active .step-nav-num {
  background: var(--accent);
  color: #fff;
}

.step-nav-item.completed .step-nav-num {
  background: var(--accent-light);
  color: #fff;
}

.step-nav-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 4px;
  min-width: 16px;
}

/* ---------- A4 卡片盒子 ---------- */
.a4-box {
  background: var(--paper-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--paper-shadow);
  width: 100%;
  margin-bottom: 16px;
  transition: box-shadow 0.2s ease;
}

.a4-box:hover {
  box-shadow: var(--paper-shadow-hover);
}

/* ---------- 步骤标题 ---------- */
.box-header {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

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

.box-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 输入框 ---------- */
.a4-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: #fafafa;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
  margin-top: 16px;
  margin-bottom: 16px;
}

.a4-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.a4-input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.a4-input:last-child {
  margin-bottom: 0;
}

textarea.a4-input {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ---------- 下拉选择 ---------- */
.a4-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

.a4-select option {
  color: var(--text);
  font-size: 14px;
}

/* ---------- 单选列表 ---------- */
.a4-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.a4-option {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  font-size: 14px;
  color: var(--text);
  background: #fafafa;
}

.a4-option:hover {
  border-color: var(--accent-light);
  background: var(--accent-bg);
}

.a4-option.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.a4-option .check-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 12px;
}

.a4-option.active .check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 标签 ---------- */
.a4-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.a4-tag {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fafafa;
  outline: none;
  font-family: inherit;
}

.a4-tag:hover {
  border-color: var(--accent-light);
  color: var(--accent);
  background: var(--accent-bg);
}

.a4-tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- 学历列表 ---------- */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.education-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
}

.education-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.education-fields .a4-input,
.edu-input {
  margin-bottom: 0;
}

.edu-remove {
  padding: 8px 14px;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.edu-remove:hover {
  background: #fee2e2;
}

.edu-add {
  width: 100%;
  padding: 12px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  margin-top: 8px;
}

.edu-add:hover {
  border-color: var(--accent-light);
  color: var(--accent);
  background: var(--accent-bg);
}

/* ---------- 汇总页 ---------- */
.generate-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.generate-box .summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.generate-box .summary-item:last-child {
  border-bottom: none;
}

.generate-box .summary-key {
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  min-width: 80px;
  flex-shrink: 0;
}

.generate-box .summary-val {
  color: var(--text);
  text-align: right;
  word-break: break-all;
  font-weight: 500;
}

/* ---------- AI 生成按钮 ---------- */
.generate-actions {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px solid var(--border-light);
  text-align: center;
}

.a4-btn-generate {
  padding: 16px 48px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.a4-btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

/* ---------- 底部操作栏 ---------- */
.a4-actions-box {
  margin-top: 16px;
  padding: 20px 32px;
}

.a4-actions-box .a4-actions-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.a4-actions-left {
  display: flex;
  gap: 8px;
}

.a4-btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  text-align: center;
  outline: none;
  font-family: inherit;
  white-space: nowrap;
}

.a4-btn-secondary {
  background: var(--border-light);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.a4-btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

.a4-btn-primary {
  background: var(--accent);
  color: #fff;
}

.a4-btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
}

.a4-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- 步骤切换动画 ---------- */
.form-step {
  display: none;
  width: 100%;
}

.form-step.active {
  display: block;
  animation: fadeSlide 0.3s ease;
}

.form-step-generate {
  display: none;
  width: 100%;
}

.form-step-generate.active {
  display: block;
  animation: fadeSlide 0.3s ease;
}

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

/* ---------- AI生成简历展示 ---------- */
.ai-resume-output {
  max-height: 600px;
  overflow-y: auto;
  padding: 24px;
  background: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.ai-resume-output h1,
.ai-resume-output h2,
.ai-resume-output h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text);
}

.ai-resume-output h1 {
  font-size: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

.ai-resume-output h2 {
  font-size: 16px;
  color: var(--accent);
}

.ai-resume-output h3 {
  font-size: 14px;
}

.ai-resume-output p {
  margin: 8px 0;
}

.ai-resume-output ul,
.ai-resume-output ol {
  margin: 8px 0;
  padding-left: 24px;
}

.ai-resume-output li {
  margin: 4px 0;
}

.ai-resume-output strong {
  font-weight: 600;
  color: var(--text);
}

.ai-resume-output hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.ai-resume-output blockquote {
  margin: 8px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  color: var(--text-secondary);
}

.ai-resume-output code {
  padding: 2px 6px;
  background: var(--border-light);
  border-radius: 4px;
  font-size: 13px;
}

.ai-resume-output pre {
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--radius);
  overflow-x: auto;
}

.ai-resume-output pre code {
  background: none;
  padding: 0;
}

.ai-resume-output table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.ai-resume-output th,
.ai-resume-output td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.ai-resume-output th {
  background: var(--border-light);
  font-weight: 600;
}

.generate-loading {
  color: var(--text-muted);
  font-size: 14px;
  padding: 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .AIResumeForm {
    padding: 20px 16px 90px;
  }

  .a4-box {
    padding: 24px 20px;
  }

  .box-title {
    font-size: 16px;
  }

  .education-fields {
    grid-template-columns: 1fr;
  }

  .education-row {
    flex-direction: column;
  }

  .edu-remove {
    width: 100%;
  }

  .a4-actions-box {
    padding: 16px 20px;
  }

  .a4-btn {
    padding: 8px 16px;
    font-size: 12px;
  }

  .a4-btn-generate {
    padding: 14px 32px;
    font-size: 14px;
  }
}
