/* 履歴書作成ツール固有の見た目（プレビュー枠・カード・数値入力などは assets/image-tool.css の共通部品） */

/* PC: 左にプレビュー（追従）、右に入力欄。入力欄が広く要るので半々にする */
.resume-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.resume-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: min(calc(100vh - 110px), 980px);
  padding: 14px;
}
.sheet {
  display: block;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(27, 31, 51, 0.12), 0 14px 34px -14px rgba(27, 31, 51, 0.4);
}
.sheet[hidden] { display: none; }
.page-tabs span { padding-left: 14px; padding-right: 14px; }
.preview-fold { display: none; }

/* 入力欄: 見出しつきのカードを縦に並べる */
.resume-form { gap: 14px; }
.resume-form .controls-body { border: 1px solid var(--color-border); }
.group-title {
  float: left; /* legend をカードの中の見出しとして置く */
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  font-weight: 800;
  font-size: 1rem;
  color: var(--color-text-strong);
  letter-spacing: -0.01em;
}
.group-title small { font-weight: 600; font-size: 0.78rem; color: var(--color-muted); }
.group-title + * { clear: both; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0 0 12px; }
.field-label { font-weight: 700; font-size: 0.84rem; color: var(--color-text); }
.field-label small { font-weight: 500; color: var(--color-muted); }
.field-row { display: flex; flex-wrap: wrap; gap: 0 12px; }
.field-row > .field { flex: 1 1 180px; }
.field-row > .field-narrow { flex: 0 1 150px; }
.resume-form :is(input[type="text"], input[type="date"], input[type="tel"], input[type="email"], input[type="number"], textarea) {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border-strong, #cfd5e3);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text-strong);
  font: inherit;
  font-size: 16px; /* iOS で入力時に拡大されないように */
  line-height: 1.5;
}
.resume-form textarea { resize: vertical; }
.resume-form :is(input, textarea):hover { border-color: #b7bfd2; }
.resume-form :is(input, textarea):focus-visible { outline: none; border-color: var(--color-primary); box-shadow: var(--ring); }
.resume-form ::placeholder { color: #a3aabb; }
.resume-form .control-help { margin-top: 0; }
.resume-form .check { margin: 4px 0 8px; }

/* 折りたたみのカード（連絡先） */
.fold-group summary { cursor: pointer; list-style: none; margin: 0; }
.fold-group summary::-webkit-details-marker { display: none; }
.fold-group summary::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin: 0 10px 2px 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.fold-group[open] summary::before { transform: rotate(45deg); }
.fold-group[open] summary { margin-bottom: 12px; }

/* 学歴・職歴などの行: 年・月・内容と、上下・削除のボタン */
.rows { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.resume-form .row input.row-year { flex: 0 0 5.4em; width: 5.4em; }
.resume-form .row input.row-month { flex: 0 0 4em; width: 4em; }
.resume-form .row input.row-text { flex: 1 1 200px; }
.row-actions { display: flex; gap: 2px; margin-left: auto; }
.row-actions .btn { width: 32px; height: 32px; padding: 0; justify-content: center; }
.row-actions .btn svg { width: 16px; height: 16px; }
.add-row { margin-bottom: 8px; }

/* 顔写真: 3:4 の枠。写真をドラッグで動かす */
.photo-editor { display: flex; gap: 16px; align-items: flex-start; }
.photo-frame {
  position: relative;
  flex: none;
  width: 132px;
  aspect-ratio: 3 / 4;
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-surface-2);
  box-shadow: inset 0 0 0 1.5px var(--color-border);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.photo-frame.has-photo { cursor: grab; box-shadow: 0 0 0 1px rgba(27, 31, 51, 0.15); }
.photo-frame.is-dragging { cursor: grabbing; }
.photo-frame.is-dragover { box-shadow: inset 0 0 0 2px var(--color-primary), 0 0 0 4px var(--color-primary-soft); }
.photo-frame canvas { display: block; width: 100%; height: 100%; }
.photo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--color-muted);
}
.photo-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; flex: 1; }
.photo-zoom { width: 100%; margin: 0; }

/* 保存の欄 */
.save-panel { display: flex; flex-direction: column; gap: 10px; }
.warnings {
  margin: 0;
  padding: 10px 14px 10px 30px;
  border-radius: var(--radius-sm);
  background: #fff7e6;
  border: 1px solid #f5d38a;
  color: #7a4b00;
  font-size: 0.86rem;
  line-height: 1.6;
}
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

@media (max-width: 860px) {
  /* 入力欄が長いので、スマホではプレビューを低めにし、たためるようにする */
  .resume-editor { --stage-h: 34vh; grid-template-columns: 1fr; }
  /* 行は「年・月・ボタン」の下に内容を全幅で */
  .resume-form .row input.row-text { order: 3; flex: 1 1 100%; }
  .resume-editor.is-folded { --stage-h: 0px; }
  .resume-editor.is-folded .resume-stage { display: none; }
  .resume-stage { height: var(--stage-h); min-height: 0; padding: 8px; }
  .preview-fold { display: inline-flex; }
  .stage-toolbar { flex-wrap: nowrap; }
  .resume-form textarea { scroll-margin-top: calc(var(--stage-h) + 84px); }
  .photo-frame { width: 108px; }
}
