/* =====================================================
   juyo-form.css — 重要事項説明書 入力・プレビュー
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary   : #1a3a6b;
  --accent    : #e6702a;
  --bg-page   : #f0f2f5;
  --bg-form   : #ffffff;
  --bg-doc    : #ffffff;
  --border    : #c8cdd6;
  --border-lt : #dde2ea;
  --text-main : #1e2533;
  --text-sub  : #5a6478;
  --text-lbl  : #3a4560;
  --flash-bg  : rgba(255, 245, 120, 0.82);
  --topbar-h  : 56px;
  --form-w    : 340px;
  --doc-w     : 760px;
  --radius    : 8px;
  --shadow    : 0 2px 12px rgba(0,0,0,0.10);
}

html { height: 100%; }
body {
  height: 100%;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-page);
}

/* =====================================================
   トップバー
   ===================================================== */
#jy-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.jy-back-btn {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  transition: background 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
}
.jy-back-btn:hover { background: rgba(255,255,255,0.12); }
.jy-topbar-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.jy-topbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* =====================================================
   ボタン
   ===================================================== */
.jy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.18s, transform 0.1s;
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
}
.jy-btn:hover  { opacity: 0.87; }
.jy-btn:active { transform: scale(0.97); }
.jy-btn-primary { background: var(--primary); color: #fff; }
.jy-btn-outline {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
}
.jy-btn-print { background: var(--accent); color: #fff; }
.jy-btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* =====================================================
   2カラムレイアウト
   ===================================================== */
#jy-layout {
  display: flex;
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
}

/* ---- 左フォームパネル ---- */
#jy-form-panel {
  width: var(--form-w);
  min-width: 280px;
  background: var(--bg-form);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.jy-panel-header {
  padding: 13px 16px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-lbl);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.jy-panel-sub {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-sub);
  margin-left: 4px;
}
.jy-form-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px 20px;
}
.jy-form-body::-webkit-scrollbar { width: 5px; }
.jy-form-body::-webkit-scrollbar-thumb { background: #c5cad4; border-radius: 3px; }

/* ---- セクション ---- */
.jy-sec {
  margin-bottom: 14px;
  background: #f8fafd;
  border: 1px solid var(--border-lt);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
}
.jy-sec-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.jy-sec-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.jy-row { display: flex; gap: 7px; margin-bottom: 6px; }
.jy-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.jy-field.jy-full { flex: 0 0 100%; width: 100%; }
.jy-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 4px;
}
.req {
  font-size: 10px;
  background: #e53e3e;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}
.jy-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12.5px;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text-main);
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.jy-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,58,107,0.12);
}
.jy-textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
input[type="number"].jy-input { text-align: right; }
.jy-save-area {
  margin-top: 6px;
  padding: 8px 0 2px;
  border-top: 1px solid var(--border-lt);
}

/* =====================================================
   右プレビューパネル
   ===================================================== */
#jy-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
  min-width: 0;
}
.jy-preview-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 28px 40px;
}
.jy-preview-scroll::-webkit-scrollbar { width: 6px; }
.jy-preview-scroll::-webkit-scrollbar-thumb { background: #bbc2cf; border-radius: 3px; }

/* =====================================================
   説明書ドキュメント本体
   ===================================================== */
.jy-doc {
  max-width: var(--doc-w);
  margin: 0 auto;
  background: var(--bg-doc);
  padding: 40px 48px 52px;
  box-shadow: var(--shadow);
  border-radius: 4px;
  font-family: 'Noto Serif JP', 'Noto Sans JP', serif;
  font-size: 11.5px;
  line-height: 1.8;
  color: #1e2533;
}

/* ---- タイトル ---- */
.jy-doc-title {
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 2.5px solid var(--primary);
  color: var(--primary);
}
.jy-doc-title-sub {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  margin-left: 6px;
}
.jy-date-line {
  text-align: right;
  font-size: 12.5px;
  margin: 6px 0 4px;
  color: var(--text-lbl);
}
.jy-bukken-name {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 0 10px;
  letter-spacing: 0.05em;
  text-decoration: underline;
  color: var(--primary);
}
.jy-intro-text {
  font-size: 11px;
  line-height: 1.75;
  margin-bottom: 12px;
  color: #444;
}

/* ---- 章見出し ---- */
.jy-chapter-main {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  padding: 6px 12px;
  margin: 18px 0 6px;
  letter-spacing: 0.06em;
}
.jy-chapter {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  background: #eef2f9;
  padding: 5px 10px;
  margin: 12px 0 4px;
  border-left: 4px solid var(--primary);
  letter-spacing: 0.04em;
}
.jy-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  margin: 10px 0 4px;
  padding-left: 8px;
  border-left: 3px solid #5b7ec9;
}

/* =====================================================
   テーブル
   ===================================================== */
.jy-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 4px;
}
.jy-tbl td, .jy-tbl th {
  border: 1px solid #aab2c2;
  padding: 5px 8px;
  vertical-align: middle;
  line-height: 1.6;
}
.jy-tbl th {
  background: #d0d8ea;
  font-weight: 700;
  text-align: center;
  font-size: 11px;
}
.jy-lbl {
  background: #eef2f9;
  color: var(--text-lbl);
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  width: 110px;
}
.jy-lbl2 {
  background: #f3f5fa;
  color: var(--text-lbl);
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  font-size: 10px;
  width: 80px;
}
.jy-lbl-narrow { width: 70px !important; }
.jy-amt {
  text-align: right;
  font-family: 'Noto Sans JP', monospace;
  font-weight: 600;
  font-size: 11.5px;
  white-space: nowrap;
}
.jy-note {
  font-size: 10px;
  color: #555;
  margin-top: 3px;
  line-height: 1.6;
}
.jy-note-inline {
  font-size: 10px;
  color: #777;
  margin-left: 4px;
}
.jy-small-text { font-size: 10px; line-height: 1.7; color: #444; }
.jy-highlight { color: #cc5500; font-weight: 700; }
.jy-highlight-text { color: #cc3300; font-weight: 700; }

/* ---- チェックマーク ---- */
.jy-check       { color: var(--primary); font-weight: 700; font-size: 13px; }
.jy-check-empty { color: #888; font-size: 13px; }

/* =====================================================
   空白スパン（転記ターゲット）
   ===================================================== */
.jb {
  display: inline-block;
  border-bottom: 1px solid #7a8cbb;
  min-width: 28px;
  padding: 0 2px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11.5px;
  color: #1e2533;
  vertical-align: bottom;
  letter-spacing: 0.02em;
}
.jb-lg   { min-width: 200px; }
.jb-name {
  min-width: 120px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-bottom: 1.5px solid #7a8cbb;
}

/* フラッシュ */
@keyframes jyFlash {
  0%   { background: var(--flash-bg); }
  100% { background: transparent; }
}
.jb.flash { animation: jyFlash 0.6s ease forwards; }

/* =====================================================
   その他・説明テキスト
   ===================================================== */
.jy-other-text {
  font-size: 11px;
  line-height: 1.8;
  padding: 8px 12px;
  background: #fff9f0;
  border: 1px solid #f0c070;
  border-radius: 4px;
  margin-bottom: 8px;
}
.jy-explain-text {
  font-size: 10.5px;
  line-height: 1.75;
  color: #444;
  margin: 12px 0 16px;
  padding: 0 4px;
}

/* =====================================================
   署名欄（黄色枠）
   ===================================================== */
.jy-sign-box {
  border: 2px solid #d4a800;
  background: #fffde8;
  border-radius: 6px;
  padding: 16px 20px 18px;
  margin: 10px 0 20px;
}
.jy-sign-date-row {
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--text-lbl);
}
.jy-sign-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.jy-sign-lbl {
  font-weight: 700;
  color: var(--text-sub);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
}
.jy-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 2px solid #cc3333;
  border-radius: 50%;
  font-size: 14px;
  color: #cc3333;
  margin-left: 8px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* =====================================================
   フッター
   ===================================================== */
.jy-doc-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-sub);
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border-lt);
  line-height: 1.8;
}

/* =====================================================
   トースト
   ===================================================== */
#jy-toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jy-toast {
  background: #222c3d;
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: jyToastIn 0.3s ease;
  min-width: 200px;
}
.jy-toast.success { border-left: 4px solid #34c478; }
.jy-toast.error   { border-left: 4px solid #e53e3e; }
.jy-toast.info    { border-left: 4px solid #3b82f6; }
@keyframes jyToastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   印刷
   ===================================================== */
@media print {
  #jy-topbar,
  #jy-form-panel,
  #jy-toast-container,
  .no-print { display: none !important; }

  html, body { height: auto; overflow: visible; background: #fff; }

  #jy-layout {
    position: static;
    display: block;
    height: auto;
    overflow: visible;
  }
  #jy-preview-panel {
    display: block;
    overflow: visible;
    background: #fff;
  }
  .jy-preview-scroll {
    overflow: visible;
    padding: 0;
    height: auto;
  }
  .jy-doc {
    max-width: 100%;
    margin: 0;
    padding: 12mm 16mm 18mm;
    box-shadow: none;
    border-radius: 0;
    font-size: 9pt;
  }
  .jy-doc-title  { font-size: 14pt; }
  .jy-chapter-main { font-size: 9pt; }
  .jy-tbl td, .jy-tbl th { padding: 3px 5px; }
  .jy-sign-box { border: 2px solid #d4a800; background: #fffde8; }
  .jb { border-bottom: 1px solid #555; }

  @page { size: A4 portrait; margin: 10mm 12mm; }
}

/* =====================================================
   レスポンシブ
   ===================================================== */
@media (max-width: 960px) {
  :root { --form-w: 280px; }
  .jy-doc { padding: 24px 24px 32px; }
}
@media (max-width: 680px) {
  #jy-layout { flex-direction: column; }
  #jy-form-panel {
    width: 100%;
    height: 45vh;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #jy-preview-panel { height: 55vh; }
  .jy-preview-scroll { padding: 10px 10px 24px; }
  .jy-doc { padding: 16px 12px 24px; }
}
