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

/* hidden属性は、displayを明示指定する.btn等のクラスと併用すると
   ブラウザ既定のスタイルより著者スタイルが優先され表示されてしまうため、
   !importantで確実に非表示にする。 */
[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; }
}

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

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

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

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

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

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

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

@media (min-width: 992px) {
  .main-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);

    /* 左右の高さを無理に揃えず、それぞれ内容の高さに合わせる */
    align-items: start;
  }

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

  .col-preview .section-card {
    /* PCでは右側プレビューを追従表示 */
    position: sticky;
    top: 20px;

    /*
      プレビュー内部に独立したスクロールバーを作らない。
      内容が長くなった場合はカード自体が自然に伸び、
      ページ全体をスクロールして閲覧する。
    */
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
}

/* ── Section Cards ────────────────────────────────────────────────── */
.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);
}

.section-card + .section-card { margin-top: 20px; }

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

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

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

.section-desc {
  font-size: 0.82rem;
  color: #888;
  margin: -6px 0 10px;
}

/* ── 基本情報フォーム ─────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

@media (min-width: 640px) {
  .form-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.form-field input[type="text"],
.form-field input[type="date"],
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  min-height: 44px;
  background: #fff;
}

.form-field textarea {
  min-height: 60px;
  resize: vertical;
  font-family: inherit;
}

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

/* 日付範囲からまとめて日程を作成するボタン */
.generate-days-btn {
  width: 100%;
  margin-top: 6px;
}

.date-range-error {
  color: #cc2222;
  font-size: 0.82rem;
  margin: 6px 0 0;
}

.date-range-status {
  color: #2f6fb0;
  font-size: 0.82rem;
  margin: 6px 0 0;
}

/* 参加者・概要（折りたたみ） */
.more-info-details {
  margin-top: 4px;
}

.more-info-details summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2f6fb0;
  padding: 8px 2px;
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
}

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

.more-info-details summary::before {
  content: '＋';
  margin-right: 6px;
  font-weight: 700;
}

.more-info-details[open] summary::before {
  content: '－';
}

.more-info-body {
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── 日程ブロック ─────────────────────────────────────────────────── */
.day-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.day-block {
  border: 1px solid #dfe6ee;
  border-radius: 10px;
  background: #f9fbfd;
  padding: 14px;
}

.day-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.day-block-title {
  font-weight: 700;
  color: #1f4f8a;
  font-size: 0.95rem;
  white-space: nowrap;
}

.day-block-date {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
}

.day-block-date label {
  font-size: 0.82rem;
  color: #666;
  white-space: nowrap;
}

.day-block-date input[type="date"] {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-height: 40px;
  font-size: 0.9rem;
}

.day-block-weekday {
  font-size: 0.82rem;
  color: #555;
  white-space: nowrap;
}

.day-remove-btn {
  margin-left: auto;
  background: none;
  border: 1px dashed #d9b7b7;
  color: #a83232;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  min-height: 36px;
}

.day-remove-btn:hover {
  background: #fdf0f0;
}

/* ── 予定カード（通常時：折りたたみ表示） ─────────────────────────── */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.item-card.is-editing {
  background: #f7faff;
  border-left: 3px solid #2f6fb0;
}

@media (min-width: 640px) {
  .item-card:not(.is-editing) {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .item-card:not(.is-editing) .item-summary {
    flex: 1 1 auto;
    min-width: 0;
  }

  .item-card:not(.is-editing) .item-card-controls {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }
}

.item-summary {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  appearance: none;
  font: inherit;
  color: inherit;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px;
}

.item-summary:hover {
  background: #f3f7fc;
}

.item-summary-time {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2f6fb0;
  margin-right: 8px;
}

.item-summary-activity {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.item-summary-sub {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 2px;
}

.editing-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  color: #2f6fb0;
  border: 1px solid #b7cfe8;
  border-radius: 999px;
  padding: 1px 10px;
  margin-bottom: 8px;
}

/* ── 予定編集フォーム ─────────────────────────────────────────────── */
.item-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 0;
}

.item-fields-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .item-fields-row.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.item-field label {
  display: block;
  font-size: 0.76rem;
  color: #777;
  margin-bottom: 4px;
}

.item-field input[type="time"],
.item-field input[type="text"],
.item-field select,
.item-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  min-height: 40px;
  background: #fff;
}

.item-field textarea {
  min-height: 40px;
  resize: vertical;
  font-family: inherit;
}

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

/* 「予定・行動」を最も目立つ入力欄にする */
.item-field-primary input[type="text"] {
  font-size: 1rem;
  font-weight: 600;
  min-height: 46px;
}

.item-card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f2f5;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #444;
  font-size: 0.78rem;
  cursor: pointer;
  min-height: 40px;
}

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

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

.icon-btn.icon-btn-primary {
  color: #2f6fb0;
  border-color: #93b6dc;
  font-weight: 700;
}

.icon-btn.icon-btn-danger {
  color: #a83232;
  border-color: #e0b0b0;
}

.icon-btn.icon-btn-danger:hover {
  background: #fdf0f0;
}

.add-item-btn {
  margin-top: 12px;
  width: 100%;
}

.empty-day-note {
  font-size: 0.85rem;
  color: #888;
  padding: 10px 4px;
}

/* ── サンプル案内バナー ───────────────────────────────────────────── */
.sample-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: #fffaf0;
  border: 1px solid #ead9a7;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: #765b15;
}

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

.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;
}

.btn:hover {
  background: #eef2f7;
}

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

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

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

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

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

/* 危険操作は控えめなテキストリンク風にする */
.text-danger-btn {
  background: none;
  border: none;
  color: #a83232;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 4px;
  min-height: 44px;
}

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

.btn-text {
  background: none;
  border: none;
  color: #2f6fb0;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 32px;
  white-space: nowrap;
}

.btn-text:hover {
  color: #1f4f8a;
}

.reset-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ── 表示スタイル：選択カード ─────────────────────────────────────── */
.style-card-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .style-card-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.style-card {
  display: block;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: #fff;
  min-height: 44px;
}

.style-card:hover {
  border-color: #93b6dc;
}

.style-card.is-active {
  border-color: #2f6fb0;
  background: #eaf2fb;
}

.style-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.style-card-head input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.style-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1f2937;
}

.style-card-desc {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 2px;
}

.style-card-fields {
  display: block;
  font-size: 0.76rem;
  color: #9aa4b2;
}

/* 表示項目の詳細設定（折りたたみ） */
.display-options-details {
  margin-top: 12px;
}

.display-options-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2f6fb0;
  padding: 8px 2px;
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

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

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

/* ── 表示設定チェックボックス ─────────────────────────────────────── */
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: #333;
  cursor: pointer;
  min-height: 32px;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ── 保存インジケーター ───────────────────────────────────────────── */
.save-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-indicator {
  font-size: 0.78rem;
  color: #6b7280;
  min-height: 1.2em;
}

.save-indicator.is-error {
  color: #a83232;
  font-weight: 600;
}

/* ── プレビュー ───────────────────────────────────────────────────── */
.preview-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
  text-align: center;
}

.preview-meta {
  font-size: 0.85rem;
  color: #555;
  text-align: center;
  margin-bottom: 4px;
}

.preview-meta + .preview-meta {
  margin-top: -2px;
}

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

.preview-day {
  margin-top: 18px;
}

.preview-day:first-of-type {
  margin-top: 14px;
}

.day-heading {
  font-size: 0.98rem;
  font-weight: 700;
  color: #1f4f8a;
  background: #eaf2fb;
  border-left: 4px solid #2f6fb0;
  padding: 6px 10px;
  margin: 0 0 8px;
}

.preview-day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.preview-day-table th,
.preview-day-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.preview-day-table th {
  background: #f2f6fb;
  color: #1f4f8a;
  font-weight: 700;
  white-space: nowrap;
}

.preview-day-table thead {
  display: table-header-group;
}

.type-tag {
  display: inline-block;
  padding: 1px 8px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font-size: 0.74rem;
  color: #4b5563;
  white-space: nowrap;
  margin-right: 6px;
}

/* ── スマートフォン固定操作バー ───────────────────────────────────── */
.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);
}

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

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

/* ── SEOコンテンツ ────────────────────────────────────────────────── */
.seo-content {
  /* 上のフォーム(.main-container)と幅・左端を揃える */
  max-width: 1120px;
  margin: 40px auto 60px;
  padding: 0 16px;
  line-height: 1.8;
  color: #374151;
}

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

.seo-content h2:first-of-type {
  margin-top: 0;
}

.seo-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: #1f4f8a;
  border-left: 3px solid #a9c8e8;
  padding-left: 8px;
}

.seo-content p,
.seo-content li {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #374151;
}

.seo-content p {
  margin: 0 0 12px;
}

.seo-content ul,
.seo-content ol {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.seo-content li {
  margin-bottom: 4px;
}

.seo-content ol.im-steps {
  list-style: none;
  counter-reset: im-step;
  padding: 0;
  margin: 0 0 14px;
}

.seo-content ol.im-steps li {
  position: relative;
  padding: 8px 0 10px 34px;
  margin-bottom: 0;
  border-bottom: 1px solid #f3f4f6;
}

.seo-content ol.im-steps li:last-child {
  border-bottom: none;
}

.seo-content ol.im-steps li h3 {
  margin: 0 0 4px;
  border-left: none;
  padding-left: 0;
  font-size: 0.98rem;
}

.seo-content ol.im-steps li p {
  margin: 0;
}

.seo-content ol.im-steps li::before {
  counter-increment: im-step;
  content: counter(im-step);
  position: absolute;
  left: 0;
  top: 8px;
  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;
}

.seo-content .im-note-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 0 0 14px;
}

.seo-content .im-note-box p:last-child {
  margin-bottom: 0;
}

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

.faq-box h3 {
  margin-top: 0;
}

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

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

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

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

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

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

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

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

  .main-grid {
    display: block;
  }

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

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

  .preview-day-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .day-heading {
    break-after: avoid;
    page-break-after: avoid;
    background: none;
    color: #111;
  }

  .preview-day {
    break-inside: auto;
  }

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