/* ============================================================
   入社書類提出フォーム スタイル（スタッフ用フォーム専用）
   ============================================================ */

:root {
  --primary: #1c64f2;
  --primary-dark: #164fc2;
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --border: #dde2ea;
  --text: #1f2937;
  --text-sub: #6b7280;
  --error: #dc2626;
  --success: #16a34a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

#app { min-height: 100vh; }

.screen { min-height: 100vh; }
.screen[hidden] { display: none !important; }

button {
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px;
}

/* ---------- 共通ボタン ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active:not(:disabled) { background: var(--primary-dark); }

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

.btn-block { width: 100%; }

.btn-retry {
  margin-top: 8px;
  background: #fff;
  color: var(--error);
  border: 1px solid var(--error);
  min-height: 40px;
  padding: 6px 16px;
  border-radius: var(--radius);
  font-weight: 600;
}

.btn-add-row {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 4px 0 20px;
  border: 1px dashed var(--primary);
  background: #eef4ff;
  color: var(--primary);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.btn-remove-row {
  border: none;
  background: none;
  color: var(--error);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  min-height: 32px;
}

.btn-edit-link {
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}

/* ---------- 本人確認画面 ---------- */

#screen-verify {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.verify-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.verify-title {
  font-size: 20px;
  margin: 0 0 8px;
  text-align: center;
}

.verify-desc {
  color: var(--text-sub);
  font-size: 14px;
  text-align: center;
  margin: 0 0 24px;
}

.verify-error {
  color: var(--error);
  font-size: 14px;
  text-align: center;
  min-height: 0;
  margin: 4px 0 12px;
}

.verify-loading {
  text-align: center;
  color: var(--text-sub);
  margin-top: 16px;
}

/* ---------- フォームヘッダー / 進捗 ---------- */

.form-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card-bg);
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.greeting-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 6px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  margin-bottom: 8px;
}

#step-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

#step-count {
  color: var(--text-sub);
}

.progress-bar-track {
  height: 6px;
  background: #e5e9f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.25s ease;
}

/* ---------- ステップ本体 ---------- */

.step-content {
  padding: 20px 16px 120px;
  max-width: 640px;
  margin: 0 auto;
}

.subsection-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.notice-box {
  background: #fff7e6;
  border: 1px solid #f2d38a;
  color: #7a5b00;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.confirm-intro {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---------- フォーム項目 ---------- */

.form-field {
  margin-bottom: 18px;
}

.form-field > label,
.form-field > div > label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}

.req-badge {
  display: inline-block;
  background: #fde8e8;
  color: var(--error);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.age-display {
  font-weight: 400;
  color: var(--text-sub);
  font-size: 13px;
}

.form-field input[type="text"],
.form-field input[type="tel"],
.form-field input[type="email"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 16px;
}

.form-field textarea {
  min-height: 88px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 100, 242, 0.15);
}

.form-field input.invalid,
.form-field select.invalid,
.form-field textarea.invalid {
  border-color: var(--error);
}

.field-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 4px;
  min-height: 0;
}

.static-value {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #f0f2f5;
  border-radius: var(--radius);
  color: var(--text-sub);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 15px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-chip input {
  width: 18px;
  height: 18px;
}

/* ---------- 動的リスト（扶養家族・資格・職歴） ---------- */

.array-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.array-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-sub);
}

.array-row-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.array-row-grid label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.array-row-grid input,
.array-row-grid select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
}

/* ---------- ファイルアップロード ---------- */

.file-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.file-tile { margin-bottom: 0; }

.file-tile-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  min-height: auto;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.file-tile-box {
  min-height: 96px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 10px;
}

.file-tile-box:focus {
  outline: none;
  border-color: var(--primary);
}

.file-box-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-sub);
  width: 100%;
}

.file-icon {
  font-size: 22px;
  color: var(--primary);
  font-weight: 700;
}

.file-thumb {
  max-width: 100%;
  max-height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

.file-check {
  color: var(--success);
  font-size: 18px;
  font-weight: 700;
}

.file-name {
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}

.file-size {
  font-size: 11px;
  color: var(--text-sub);
}

.file-replace-hint {
  font-size: 11px;
  color: var(--primary);
}

.file-error-text {
  color: var(--error);
  font-size: 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 同意セクション ---------- */

.consent-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fff;
}

.consent-item details {
  margin-bottom: 10px;
}

.consent-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  padding: 8px 0;
  min-height: 28px;
}

.consent-text {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.8;
  padding: 10px 4px 4px;
  white-space: pre-wrap;
}

/* ---------- 確認画面 ---------- */

.confirm-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.confirm-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.confirm-section-header h3 {
  margin: 0;
  font-size: 15px;
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #edf0f4;
  font-size: 14px;
}

.confirm-row:last-of-type { border-bottom: none; }

.confirm-label {
  color: var(--text-sub);
  flex-shrink: 0;
  min-width: 40%;
}

.confirm-value {
  text-align: right;
  word-break: break-all;
}

.confirm-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 8px;
}

.confirm-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.confirm-file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f0f2f5;
  color: var(--text-sub);
}

.confirm-file-chip img {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 4px;
}

.confirm-file-chip.ok {
  background: #e8f7ec;
  color: var(--success);
}

.confirm-file-chip.missing {
  background: #fde8e8;
  color: var(--error);
}

/* ---------- フッターナビ ---------- */

.form-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}

.saving-indicator {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.footer-buttons {
  display: flex;
  gap: 10px;
}

.footer-buttons .btn {
  flex: 1;
}

/* ---------- 完了画面 ---------- */

#screen-complete {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.complete-card {
  text-align: center;
  max-width: 420px;
}

.complete-icon {
  width: 64px;
  height: 64px;
  line-height: 64px;
  border-radius: 50%;
  background: #e8f7ec;
  color: var(--success);
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto 20px;
}

.complete-card h1 {
  font-size: 20px;
  margin: 0 0 12px;
}

.complete-card p {
  color: var(--text-sub);
  font-size: 14px;
}

/* ---------- 全体エラー ---------- */

.global-error {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  background: #fde8e8;
  color: var(--error);
  border: 1px solid #f5b5b5;
  padding: 12px 16px;
  border-radius: var(--radius);
  z-index: 100;
  font-size: 14px;
  text-align: center;
}

/* ---------- 小さい画面向け微調整 ---------- */

@media (max-width: 360px) {
  .file-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .step-content { padding: 16px 12px 120px; }
}

/* ---------- ある程度広い画面（タブレット等）でも中央寄せで読みやすく ---------- */

@media (min-width: 640px) {
  .form-footer .footer-buttons,
  .step-content {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
  .form-footer {
    padding-left: calc(50% - 320px);
    padding-right: calc(50% - 320px);
  }
  @media (max-width: 719px) {
    .form-footer { padding-left: 16px; padding-right: 16px; }
  }
}
