/* =====================================================================
 * oasis/signup.css  —  Signup screen only styles
 *
 * Loaded by templates/auth/signup.html AFTER auth.css + forms.css.
 * The signup screen uses the full-page section layout (header + step-bar
 * + sections + footer action bar) rather than the centered auth-card.
 *
 * Sections:
 *   1. Page-level typography (.page-title / .page-desc)
 *   2. Step indicator (.step-bar) — note: differs from .demo-steps
 *   3. Section card (.section + .section-head + .section-body)
 *   4. Field row (multi-column input layout)
 *   5. Form select (.form-select, sibling of .form-input)
 *   6. Postal / telephone split wrappers
 *   7. Toggle group + buttons (existing in forms.css, .signup tweaks)
 *   8. Selectable chips (multi / radio)
 *   9. Site (factory) card + rep-toggle + add button
 *  10. Same-as-company toggle + agreement box
 *  11. Action buttons (.btn / .btn-submit / .btn-back)
 * ===================================================================== */


/* ---------- 1. Page-level typography ---------- */
.page-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 4px; }
.page-desc  { font-size: 0.82rem; color: var(--text-sec); margin-bottom: 24px; line-height: 1.6; }


/* ---------- 2. Step indicator (signup's multi-step header strip) ---------- */
.step-bar {
  position: fixed; top: 56px; left: 0; right: 0; z-index: 99;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px; flex-wrap: wrap;
}
.step-item { display: flex; align-items: center; gap: 7px; font-size: 0.76rem; color: var(--text-muted); }
.step-item .num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border-light); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
}
.step-item.active { color: var(--accent); font-weight: 600; }
.step-item.active .num { background: var(--accent); color: #FFF; }
.step-arrow { color: var(--border); font-size: 0.8rem; }


/* ---------- 3. Section card (signup's primary container) ---------- */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: visible;
}
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-light);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.section-head .sec-num {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent); color: #FFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
}
.section-head .sec-num.gray { background: var(--text-muted); }
.section-head .sec-num svg { width: 14px; height: 14px; stroke: #FFF; }
.section-head h2 { font-size: 0.98rem; font-weight: 700; }
.section-head .sec-hint { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }
.section-body { padding: 18px; }


/* ---------- 4. Field row (multi-column input layout) ---------- */
.field-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.field-row:last-child { margin-bottom: 0; }


/* ---------- 5. Form select ---------- */
.form-select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 0.86rem;
  color: var(--text); background: var(--field-bg);
  transition: all var(--transition); outline: none;
}
.form-select:focus {
  border-color: var(--hdr-bg); background: #FFF;
  box-shadow: 0 0 0 3px rgba(1, 173, 110, 0.12);
}
.form-select.error {
  border-color: var(--danger); background: #FFF6F7;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.10);
}


/* ---------- 6. Postal / telephone split wrappers ---------- */
.postal-wrap { display: flex; align-items: center; gap: 6px; }
.postal-wrap .form-input { width: 64px; text-align: center; flex: none; }
.postal-wrap .sep { color: var(--text-muted); }

.tel-wrap { display: flex; align-items: center; gap: 6px; }
.tel-wrap .form-input { flex: 1; text-align: center; min-width: 0; }
.tel-wrap .sep { color: var(--text-muted); }

.pc-search-btn {
  padding: 9px 12px; border: 1.5px solid var(--accent);
  background: #F0F7F3; color: var(--accent);
  border-radius: var(--radius);
  font-family: inherit; font-size: 0.76rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 4px;
  flex: 0 0 auto;            /* don't shrink inside .postal-wrap — English "Search address" clips otherwise */
}
.pc-search-btn:hover { background: #E3F0E9; }
.pc-search-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pc-search-btn svg { width: 13px; height: 13px; }

/* "Same as company" mirrored fields use readOnly (NOT disabled) so they still
   POST — a disabled input is dropped from the request → @NotBlank fails silently
   (see signup.js toggleSameAsCompany). Style them like :disabled so the lock is
   visible, matching the mockup. Mirrors forms.css .form-input:disabled. */
.form-input[readonly] {
  background: var(--surface-alt); color: var(--text-sec);
  -webkit-text-fill-color: var(--text-sec); opacity: 1; cursor: not-allowed;
}

.addr-group { position: relative; }
.pc-candidates {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: #FFF; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  margin-top: 4px; max-height: 220px; overflow-y: auto;
}
.pc-item {
  padding: 10px 12px; font-size: 0.82rem; cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.pc-item:last-child { border-bottom: none; }
.pc-item:hover { background: #F0F7F3; }
.pc-loading, .pc-empty { padding: 10px 12px; font-size: 0.78rem; color: var(--text-muted); }


/* ---------- 7. Toggle group + buttons (signup variant of .toggle-btn) ---------- */
.toggle-group { display: flex; gap: 8px; }
.toggle-btn {
  flex: 1; padding: 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--text-sec); cursor: pointer;
  transition: all var(--transition);
}
.toggle-btn:hover:not(.active) { border-color: var(--accent); }
.toggle-btn.active { background: var(--accent); border-color: var(--accent); color: #FFF; }
.toggle-group.error .toggle-btn { border-color: var(--danger); }


/* ---------- 8. Selectable chips ---------- */
.chip-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  font-size: 0.8rem; user-select: none;
}
.chip:hover { border-color: var(--accent); }
.chip.checked {
  background: #E8F5E9; border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}
.chip .cbox {
  width: 16px; height: 16px;
  border: 2px solid var(--border); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chip.radio .cbox { border-radius: 50%; }
.chip.checked .cbox { background: var(--accent); border-color: var(--accent); }
.chip .cbox svg { width: 10px; height: 10px; stroke: #FFF; opacity: 0; }
.chip.checked .cbox svg { opacity: 1; }
.chip.radio.checked .cbox { background: var(--accent); }
.chip.radio.checked .cbox::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: #FFF;
}
.chip.radio .cbox svg { display: none; }


/* ---------- 9. Site (factory) card ---------- */
.site-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px; overflow: visible;
}
.site-card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #EAF4EF;
  border-bottom: 1px solid var(--border-light);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.site-card-head .site-no { font-weight: 700; font-size: 0.84rem; color: var(--accent); }
.site-card-body { padding: 14px; }

.rep-toggle {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; font-size: 0.74rem;
  color: var(--text-sec); user-select: none; margin-left: 4px;
}
.rep-toggle .radio {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-radius: 50%; flex-shrink: 0; position: relative;
  transition: all var(--transition);
}
.rep-toggle.selected { color: var(--orange); font-weight: 700; }
.rep-toggle.selected .radio { border-color: var(--orange); }
.rep-toggle.selected .radio::after {
  content: ''; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--orange);
}
.rep-badge {
  font-size: 0.66rem; font-weight: 700;
  color: #B36B00; background: #FFF3DC;
  padding: 2px 8px; border-radius: 4px;
}
/* Representative toggle label swap: unselected shows 代表拠点にする (.rep-set);
   selected swaps to 代表拠点 (.rep-sel) + the 代表 badge. Pure CSS — setRep()
   only toggles the .selected class on the label, no JS text swap needed. */
.rep-toggle .rep-sel, .rep-toggle .rep-badge { display: none; }
.rep-toggle.selected .rep-set { display: none; }
.rep-toggle.selected .rep-sel { display: inline; }
.rep-toggle.selected .rep-badge { display: inline-block; }
.site-remove {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: var(--text-muted);
  padding: 4px 6px; border-radius: 4px;
  font-size: 0.74rem;
  display: flex; align-items: center; gap: 3px;
  transition: all var(--transition);
}
.site-remove:hover { color: var(--danger); background: #FDECEE; }
.site-remove svg { width: 13px; height: 13px; }

.add-site-btn {
  width: 100%; padding: 12px;
  border: 1.5px dashed var(--accent); border-radius: var(--radius);
  background: #F0F7F3; color: var(--accent);
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition);
}
.add-site-btn:hover { background: #E3F0E9; }
.add-site-btn svg { width: 16px; height: 16px; }
.add-site-btn.disabled {
  border-color: var(--border); border-style: solid;
  background: var(--surface-alt); color: var(--text-muted);
  cursor: not-allowed;
}
.add-site-btn.disabled:hover { background: var(--surface-alt); }

/* Site registration limit note (mockup: `事業場の登録は1社あたり20拠点まで…`) —
   the icon was rendering huge because this rule was missing entirely. */
.site-limit-note {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.75rem; color: var(--text-sec);
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px; margin-top: 10px;
  line-height: 1.6;
  transition: all var(--transition);
}
.site-limit-note svg {
  width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px;
  stroke: var(--info-blue);
}
.site-limit-note .tel {
  color: var(--info-blue); font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.site-limit-note.reached {
  background: #FFF7E6; border-color: #FFD480;
  color: #8A5A00; font-weight: 600;
}
.site-limit-note.reached svg { stroke: var(--orange); }
.site-limit-note.reached .tel { color: var(--orange-hover); }


/* ---------- 10. Same-as-company toggle + agreement box ---------- */
.same-company-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; margin-bottom: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  cursor: pointer; font-size: 0.78rem; font-weight: 600;
  color: var(--text-sec); user-select: none;
  transition: all var(--transition);
}
.same-company-toggle:hover { border-color: var(--accent); }
.same-company-toggle .cbox {
  width: 18px; height: 18px;
  border: 2px solid var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.same-company-toggle .cbox svg { width: 11px; height: 11px; stroke: #FFF; opacity: 0; }
.same-company-toggle.checked { background: #E8F5E9; border-color: var(--accent); color: var(--accent); }
.same-company-toggle.checked .cbox { background: var(--accent); border-color: var(--accent); }
.same-company-toggle.checked .cbox svg { opacity: 1; }

.agree-box {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  cursor: pointer;
}
.agree-box .cbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
  transition: all var(--transition);
}
.agree-box.checked .cbox { background: var(--accent); border-color: var(--accent); }
.agree-box .cbox svg { width: 13px; height: 13px; stroke: #FFF; opacity: 0; }
.agree-box.checked .cbox svg { opacity: 1; }
.agree-box .agree-text {
  font-size: 0.8rem; color: var(--text-sec); line-height: 1.6;
}
.agree-box .agree-text a { color: var(--info-blue); text-decoration: underline; }
/* Required-agreement error state — toggled client-side by signup.js when the
   form is submitted without agreeing (pairs with .form-input.error /
   .toggle-group.error so every required control has a red border). */
.agree-box.error { border-color: var(--danger); background: #FFF6F7; }


/* ---------- 11. Action buttons (footer action bar) ---------- */
.footer-inner {
  max-width: 720px; width: 100%; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.btn {
  padding: 12px 24px; border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition);
  /* Anchor reset: signup's "ログインへ戻る" is an <a>, and the browser's
     default `text-decoration: underline` would otherwise draw a line
     under the button text. The mockup (oasis_signup_v05.html) uses
     <button> so the issue doesn't surface there. */
  text-decoration: none;
}
.btn svg { width: 17px; height: 17px; }
.btn-back    { background: transparent; color: var(--text-sec); border: 1.5px solid var(--border); }
.btn-back:hover { background: var(--surface-alt); }
.btn-submit {
  background: var(--orange); color: #FFF;
  box-shadow: 0 4px 14px rgba(255, 153, 0, 0.32);
}
.btn-submit:hover {
  background: var(--orange-hover);
  box-shadow: 0 6px 20px rgba(255, 153, 0, 0.42);
  transform: translateY(-1px);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }


/* ---------- 12. Signup-complete modal (PRG ?complete=1) ----------
   Renders inside the shared .success-overlay / .success-card (auth.css)
   on the same signup page after a successful POST. The base styles
   cap .success-card at 380px, which is too tight for the next-steps
   list — .success-card-wide widens it. The ov-close × button is
   absolute-positioned so it doesn't intrude on the card layout. */
.success-card { position: relative; }
.success-card .ov-close {
  position: absolute; top: 8px; right: 12px;
  width: 32px; height: 32px;
  background: transparent; border: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: var(--text-muted);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.success-card .ov-close:hover { background: var(--surface-alt); color: var(--text); }
.success-card-wide { max-width: 480px; }
.success-card .pdf-note { text-align: left; }
.success-card .next-steps { text-align: left; }


/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .footer-inner .btn { padding: 11px 16px; font-size: 0.84rem; }
  .step-item span.lbl { display: none; }
}
