/* ==========================================================================
   予約表作成ツール 専用CSS
   すべてのカスタムクラスは rm- プレフィックスを付け、既存Bizroute CSSと
   衝突しないようにする。
   ========================================================================== */

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  background: #f3f5f8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #1f2937;
  line-height: 1.6;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* スマホの固定操作バーに隠れないよう、本文末尾に余白を確保 */
@media (max-width: 991px) {
  body { padding-bottom: 64px; }
}

/* ── パンくず ──────────────────────────────────────────────────────── */
.rm-breadcrumb {
  max-width: 1120px;
  margin: 14px auto 0;
  padding: 0 16px;
}

/* ── SEO Header ───────────────────────────────────────────────────── */
.rm-seo-header {
  max-width: 1120px;
  margin: 10px auto 16px;
  padding: 0 16px;
}

.rm-seo-header h1 {
  font-size: 1.55rem;
  line-height: 1.4;
  margin-bottom: 8px;
}

.rm-seo-lead {
  color: #444;
  margin-bottom: 4px;
  line-height: 1.75;
}

.rm-seo-lead-sub {
  color: #6b7280;
  font-size: 0.82rem;
  margin: 0 0 10px;
}

/* ── Main Layout ──────────────────────────────────────────────────── */
.rm-main-container {
  max-width: 1120px;
  margin: 0 auto 48px;
  padding: 0 16px;
}

.rm-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 992px) {
  .rm-main-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
    align-items: start;
  }

  .rm-col-preview {
    align-self: start;
    min-width: 0;
  }

  .rm-col-preview .rm-section-card {
    /* PCでは右側プレビューを追従表示。内部に独立したスクロールバーは作らず、
       内容が長い場合はページ全体をスクロールして閲覧する */
    position: sticky;
    top: 20px;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
}

/* ── Section Cards ────────────────────────────────────────────────── */
.rm-section-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #e4e9f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rm-setting-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eef1f5;
}

.rm-setting-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.rm-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f4f8a;
  margin: 0 0 10px;
}

/* ── フォーム部品 ─────────────────────────────────────────────────── */
.rm-form-field {
  margin-bottom: 14px;
}

.rm-form-field:last-child { margin-bottom: 0; }

.rm-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.rm-field-row .rm-form-field { margin-bottom: 0; }

.rm-form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.rm-form-field input[type="text"],
.rm-form-field input[type="date"],
.rm-form-field input[type="time"],
.rm-form-field input[type="number"],
.rm-form-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  min-height: 42px;
  background: #fff;
  color: #111827;
}

.rm-form-field input:focus,
.rm-form-field select:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.rm-inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rm-inline-field input[type="date"] { flex: 1 1 auto; }

.rm-checkbox-field { margin-bottom: 10px; }

.rm-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: #1f2937;
  cursor: pointer;
  min-height: 32px;
}

.rm-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2f6fb0;
}

.rm-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 4px 0 12px;
  line-height: 1.6;
}

.rm-error-text {
  font-size: 0.82rem;
  color: #b91c1c;
  font-weight: 600;
  margin: -6px 0 12px;
}

.rm-privacy-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 12px 0 0;
  line-height: 1.6;
}

.rm-break-fields { margin-top: 10px; }

/* 席・枠の名称（折りたたみ） */
.rm-details {
  margin: 4px 0 14px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  overflow: hidden;
}

.rm-details summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  color: #2f6fb0;
  padding: 10px 12px;
  list-style: none;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.rm-details summary::-webkit-details-marker { display: none; }

.rm-details summary::before {
  content: '▶';
  font-size: 0.68rem;
  transition: transform 0.15s;
}

.rm-details[open] summary::before { transform: rotate(90deg); }

.rm-details-body {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 480px) {
  .rm-details-body { grid-template-columns: minmax(0, 1fr); }
}

.rm-seat-name-field label {
  font-size: 0.78rem;
  color: #777;
}

/* ── ボタン群 ─────────────────────────────────────────────────────── */
.rm-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #333;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  min-height: 44px;
}

.rm-btn:hover { background: #eef2f7; }

.rm-btn-small {
  padding: 9px 14px;
  min-height: 42px;
  font-size: 0.85rem;
  flex: none;
}

.rm-btn-primary {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.rm-btn-primary:hover { background: #245a91; }

.rm-btn-outline {
  background: #fff;
  border-color: #2f6fb0;
  color: #2f6fb0;
}

.rm-btn-outline:hover { background: #eaf2fb; }

.rm-btn-text-danger {
  background: none;
  border: none;
  color: #a83232;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 4px;
  min-height: 44px;
}

.rm-btn-text-danger:hover { color: #7a1f1f; }

/* ── プレビュー ───────────────────────────────────────────────────── */
.rm-preview-store {
  font-size: 0.98rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  margin: 0 0 2px;
}

.rm-preview-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
  text-align: center;
}

.rm-preview-date {
  font-size: 0.9rem;
  color: #555;
  text-align: center;
  margin: 0 0 16px;
}

.rm-preview-empty {
  color: #888;
  font-size: 0.88rem;
  text-align: center;
  padding: 30px 0;
}

.rm-preview-actions {
  justify-content: center;
  margin-top: 18px;
}

/* ── 予約表 ───────────────────────────────────────────────────────── */
.rm-table-scroll {
  overflow-x: auto;
}

.rm-reservation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.rm-reservation-table th,
.rm-reservation-table td {
  border: 1px solid #cbd5e1;
  vertical-align: middle;
}

.rm-reservation-table th {
  background: #f2f6fb;
  color: #1f4f8a;
  font-weight: 700;
  padding: 8px 6px;
  text-align: center;
}

.rm-reservation-table th.rm-time-col {
  width: 64px;
}

.rm-time-cell {
  text-align: center;
  font-weight: 600;
  color: #1f4f8a;
  white-space: nowrap;
  background: #fafbfd;
}

.rm-break-cell {
  text-align: center;
  color: #6b7280;
  background: #eef0f3;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.rm-cell-input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  color: #111827;
  resize: none;
  padding: 4px 6px;
  display: block;
  overflow: hidden;
}

.rm-cell-input:focus {
  outline: 2px solid #2f6fb0;
  outline-offset: -2px;
  background: #f7faff;
}

/* 行の高さ */
.rm-reservation-table[data-row-height="compact"] .rm-time-cell,
.rm-reservation-table[data-row-height="compact"] .rm-break-cell { padding: 4px 6px; }
.rm-reservation-table[data-row-height="compact"] .rm-cell-input { min-height: 26px; }

.rm-reservation-table[data-row-height="standard"] .rm-time-cell,
.rm-reservation-table[data-row-height="standard"] .rm-break-cell { padding: 8px 8px; }
.rm-reservation-table[data-row-height="standard"] .rm-cell-input { min-height: 40px; }

.rm-reservation-table[data-row-height="relaxed"] .rm-time-cell,
.rm-reservation-table[data-row-height="relaxed"] .rm-break-cell { padding: 14px 8px; }
.rm-reservation-table[data-row-height="relaxed"] .rm-cell-input { min-height: 68px; }

/* ── 備考欄 ───────────────────────────────────────────────────────── */
.rm-remarks {
  margin-top: 16px;
}

.rm-remarks-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1f4f8a;
  margin: 0 0 6px;
}

.rm-remarks-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 56px;
}

.rm-remarks-input:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

/* ── スマートフォン固定操作バー ───────────────────────────────────── */
.rm-mobile-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e4e9f0;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.1);
}

.rm-mobile-action-bar .rm-btn {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

@media (min-width: 992px) {
  .rm-mobile-action-bar { display: none; }
}

/* ── 解説エリア ───────────────────────────────────────────────────── */
.rm-doc-section {
  max-width: 1120px;
  margin: 40px auto 60px;
  padding: 0 16px;
  line-height: 1.8;
  color: #374151;
}

.rm-doc-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 14px;
  color: #111827;
  border-left: 4px solid #2f6fb0;
  padding-left: 10px;
}

.rm-doc-section h2:first-of-type { margin-top: 0; }

.rm-doc-section h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 16px 0 8px;
  color: #1f4f8a;
}

.rm-doc-section p,
.rm-doc-section li {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #374151;
}

.rm-doc-section p { margin: 0 0 12px; }

.rm-doc-section ul { margin: 0 0 12px; padding-left: 1.4em; }

.rm-doc-section li { margin-bottom: 4px; }

.rm-steps {
  list-style: none;
  counter-reset: rm-step;
  padding: 0;
  margin: 0 0 14px;
}

.rm-steps li {
  position: relative;
  padding: 10px 0 12px 34px;
  border-bottom: 1px solid #f3f4f6;
}

.rm-steps li:last-child { border-bottom: none; }

.rm-steps li::before {
  counter-increment: rm-step;
  content: counter(rm-step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rm-doc-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 0 0 14px;
}

.rm-doc-box p:last-child,
.rm-doc-box ul:last-child { margin-bottom: 0; }

.rm-faq-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: #fff;
}

.rm-faq-item h3 { margin-top: 0; }

.rm-faq-item p:last-child { margin-bottom: 0; }

/* 関連ページ */
.rm-related-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rm-related-link-list li {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.rm-related-link-list a {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.rm-related-link-list a:hover { text-decoration: underline; }

.rm-related-link-list .rm-note {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 400;
  margin-top: 2px;
}

/* ── レスポンシブ ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .rm-field-row { grid-template-columns: minmax(0, 1fr); }
  .rm-section-card { padding: 14px 14px 16px; }
}

/* ── 印刷 ─────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }

  body {
    background: #fff;
    padding-bottom: 0;
  }

  .rm-main-grid { display: block; }

  .rm-col-preview .rm-section-card {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .rm-table-scroll { overflow: visible; }

  .rm-reservation-table th,
  .rm-reservation-table td { border: 1px solid #333; }

  .rm-reservation-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .rm-reservation-table thead {
    display: table-header-group;
  }

  .rm-cell-input {
    color: #000;
  }

  @page {
    size: A4 portrait;
    margin: 15mm;
  }
}

/* ========================================================================== 
   2026-08 UX調整：JSを変更せずに設定欄とプレビューの視認性を改善
   ========================================================================== */

/* 設定欄の小見出し */
.rm-setting-subtitle {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  margin: 2px 0 10px;
  letter-spacing: 0.02em;
}

/* 営業時間・休憩時間を「開始 ～ 終了」として一まとまりに見せる */
.rm-time-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 14px;
}

.rm-time-range .rm-form-field {
  margin-bottom: 0;
}

.rm-time-range-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding-top: 22px;
  color: #64748b;
  font-weight: 700;
}

.rm-field-help {
  display: block;
  margin-top: 5px;
  color: #6b7280;
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.5;
}

/* 詳細設定を1つの折りたたみに集約 */
.rm-advanced-details {
  margin: 2px 0 14px;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: #fbfcfe;
  overflow: hidden;
}

.rm-advanced-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 13px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #2f6fb0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rm-advanced-details > summary::-webkit-details-marker { display: none; }

.rm-advanced-details > summary::before {
  content: '▶';
  font-size: 0.68rem;
  transition: transform 0.15s;
}

.rm-advanced-details[open] > summary::before { transform: rotate(90deg); }

.rm-advanced-body {
  padding: 2px 13px 14px;
  border-top: 1px solid #edf1f5;
}

/* 「枠の名前」「休憩時間」「表示設定」を見た目でも区切る */
.rm-advanced-group {
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px dashed #dde4ec;
}

.rm-advanced-group:first-child {
  padding-top: 12px;
  margin-top: 0;
  border-top: none;
}

.rm-advanced-group .rm-setting-subtitle {
  margin-bottom: 10px;
}

.rm-advanced-group .rm-checkbox-field {
  margin-bottom: 6px;
}

/* プレビュー見出しと操作を同じ段に */
.rm-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.rm-preview-toolbar .rm-section-title {
  margin: 0;
  text-align: left !important;
}

.rm-preview-toolbar .rm-btn-row {
  flex-wrap: nowrap;
  margin-left: auto;
}

.rm-preview-toolbar .rm-btn {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.84rem;
}

.rm-preview-guide {
  margin: -2px 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f6f9fc;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* 予約内容クリアはプレビュー寄りに見えるよう補助配置 */
.rm-preview-secondary-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.rm-preview-secondary-actions .rm-btn {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

/* 設定初期化は控えめに */
.rm-settings-reset-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

/* 解説の利用例表 */
.rm-example-table-wrap {
  overflow-x: auto;
  margin: 10px 0 14px;
}

.rm-example-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rm-example-table th,
.rm-example-table td {
  border: 1px solid #e2e8f0;
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

.rm-example-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
}

@media (max-width: 640px) {
  .rm-time-range {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
  }

  .rm-time-range-separator {
    padding-top: 22px;
  }

  .rm-preview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .rm-preview-toolbar .rm-btn-row {
    width: 100%;
    margin-left: 0;
  }

  .rm-preview-toolbar .rm-btn {
    flex: 1 1 0;
  }
}

@media (max-width: 420px) {
  .rm-time-range {
    grid-template-columns: minmax(0, 1fr);
  }

  .rm-time-range-separator {
    min-height: auto;
    padding: 0;
    margin: -3px 0;
  }
}

@media print {
  .rm-preview-toolbar,
  .rm-preview-guide,
  .rm-preview-secondary-actions {
    display: none !important;
  }
}


/* ── 2026-08 最終調整：印刷・PDF保存を1操作に統合 ─────────────── */
.rm-preview-toolbar .rm-btn-row {
  justify-content: flex-end;
}

.rm-preview-toolbar #printBtn {
  min-width: 132px;
}

@media (max-width: 640px) {
  .rm-preview-toolbar #printBtn {
    width: 100%;
    min-width: 0;
  }
}
