
/* 全体の基本設定 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #333;
  background-color: #f5f7fa;
  line-height: 1.6;
}

/* ヘッダー */
.site-header {
  background-color: #ffffff;
  text-align: center;
  padding: 40px 20px;
  border-bottom: 1px solid #ddd;
}

.site-header h1 {
  margin: 0 0 12px;
  font-size: 28px;
}

.site-header p {
  margin: 0;
  color: #666;
}

/* メインエリア */
main {
  width: 100%;
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

/* 各セクション */
.upload-section,
.result-section {
  background-color: #ffffff;
  padding: 30px;
  margin-bottom: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

h2 {
  margin-top: 0;
  font-size: 22px;
}

/* ZIPファイル選択エリア */
.drop-zone {
  border: 2px dashed #8aa4c8;
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  background-color: #f8fbff;
  transition: background-color 0.2s, border-color 0.2s;
}

.drop-zone.dragover {
  background-color: #e6f0ff;
  border-color: #3478d4;
}

/* ファイル選択ボタン */
.file-button {
  display: inline-block;
  padding: 12px 24px;
  background-color: #2563eb;
  color: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.file-button:hover {
  background-color: #245fa8;
}

/* 実際のファイル入力欄は非表示 */
#file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* キーボード操作時のフォーカス表示 */
.drop-zone:focus-within {
  outline: 3px solid #3478d4;
  outline-offset: 3px;
}

/* プライバシー説明 */
.privacy-note {
  font-size: 14px;
  color: #666;
  margin-top: 16px;
}

/* ステータスメッセージ */
#status-message {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  border-left-width: 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
}

/* メッセージが空の場合は表示しない */
#status-message:empty {
  display: none;
}

/* エラー：赤 */
#status-message[data-state="error"] {
  color: #991b1b;
  background-color: #fef2f2;
  border-color: #fecaca;
  border-left-color: #dc2626;
}

/* 処理中：青 */
#status-message[data-state="loading"] {
  color: #1e40af;
  background-color: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #2563eb;
}

/* 診断完了：緑 */
#status-message[data-state="success"] {
  color: #166534;
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: #16a34a;
}

/* 一部未検査：オレンジ */
#status-message[data-state="warning"] {
  color: #92400e;
  background-color: #fffbeb;
  border-color: #fde68a;
  border-left-color: #d97706;
}

/* その他のお知らせ */
#status-message[data-state="info"] {
  color: #374151;
  background-color: #f3f4f6;
  border-color: #d1d5db;
  border-left-color: #6b7280;
}

/* 集計結果 */
.summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.summary p {
  background-color: #f1f5fa;
  padding: 16px 24px;
  border-radius: 8px;
  margin: 0;
}

/* ファイル一覧 */
#file-list {
  padding-left: 24px;
  overflow-wrap: anywhere;
}

#file-list li {
  margin-bottom: 8px;
}

/* hidden属性を確実に反映 */
[hidden] {
  display: none !important;
}

/* フッター */
footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 13px;
  color: #475569;
}

/* スマートフォン対応 */
@media (max-width: 600px) {
  .site-header {
    padding: 28px 16px;
  }

  .site-header h1 {
    font-size: 23px;
  }

  main {
    margin: 20px auto;
    padding: 0 12px;
  }

  .upload-section,
  .result-section {
    padding: 20px 16px;
  }

  h2 {
    font-size: 20px;
  }

  .drop-zone {
    padding: 30px 12px;
  }

  /* スマホでもファイル数とフォルダ数を横並びにする */
  .summary {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .summary p {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 12px 8px;
    font-size: 14px;
    text-align: center;
  }
}

/* 診断結果内の長いファイルパスを折り返す */
#result-section li {
  overflow-wrap: anywhere;
}

/* 診断結果をカード形式で表示する */
#result-section section {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #d9dee5;
  border-radius: 10px;
  background-color: #f8fafc;
}

/* カードの見出し */
#result-section section h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

/* 診断カード内のリストを整える */
#result-section section ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

/* 診断結果の項目間に余白を設ける */
#result-section section li + li {
  margin-top: 8px;
}

/* 長い文字列でもカード内に収める */
#result-section section {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 診断状態を見つけやすくする */
#result-section .diagnostic-status {
  display: block;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  margin: 12px 0;
  padding: 8px 12px;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: #334155;
  background-color: #f1f5f9;
  border-left: 3px solid #64748b;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

/* リンク切れ・画像欠落の検出件数を強調する */
#result-section .diagnostic-count {
  margin: 14px 0;
  list-style: none;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  color: #1e293b;
  overflow-wrap: anywhere;
}

/* ファイル形式別の集計：コンパクトな横並び */
#result-section .file-type-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 26px;
  width: auto;
  max-width: none;
  margin: 16px 0 4px;
  padding: 0;
  list-style: none;
}

/* 各ファイル形式と件数をセットで表示 */
#result-section .file-type-grid > li {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 4px;

  margin: 0;
  padding: 0;
  list-style: none;

  background: transparent;
  border: none;
  border-radius: 0;

  font-size: 15px;
  line-height: 1.6;
}

/* ファイル形式 */
#result-section .file-type-label {
  flex: none;
  min-width: 0;
  color: #475569;
  font-weight: 400;
}

/* 件数 */
#result-section .file-type-count {
  flex: none;
  color: #0f172a;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

/* 診断結果の補足・注意事項 */
#result-section .diagnostic-note {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;

  list-style: none;
  color: #475569;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

/* ZIP内部のファイル一覧：折りたたみ表示 */
#result-section .file-list-details {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* 折りたたみ見出し */
#result-section .file-list-details > summary {
  padding: 10px 4px;
  color: #1e293b;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  cursor: pointer;
}

/* マウスを重ねたとき */
#result-section .file-list-details > summary:hover {
  color: #1d4ed8;
}

/* キーボード操作時のフォーカス表示 */
#result-section .file-list-details > summary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
  border-radius: 4px;
}

/* 開いたときの余白 */
#result-section .file-list-details[open] > summary {
  margin-bottom: 12px;
}

/* 表示件数の案内 */
#result-section .file-list-details #file-list-notice {
  margin: 8px 0 16px;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

/* 長いファイル名も折り返す */
#result-section .file-list-details #file-list {
  overflow-wrap: anywhere;
}

/* 診断レポートのダウンロードボタン */
#result-section > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;
  margin: 22px 0 4px;
  padding: 12px 20px;

  background-color: #ffffff;
  color: #1d4ed8;
  border: 1px solid #2563eb;
  border-radius: 8px;

  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;

  cursor: pointer;
}

/* マウスを重ねたとき */
#result-section > button:hover {
  background-color: #eff6ff;
}

/* キーボード操作時 */
#result-section > button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

/* 非表示のときは表示しない */
#result-section > button[hidden] {
  display: none;
}

/* Notionページ候補の一覧を開閉するボタン */
#result-section .page-candidates-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  margin: 12px 0 4px;
  padding: 8px 4px;

  background: transparent;
  border: none;
  border-radius: 4px;

  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  text-align: left;

  cursor: pointer;
}

/* 開閉状態を矢印で示す */
#result-section .page-candidates-toggle::before {
  content: "▶";
  display: inline-block;
  font-size: 11px;
  transition: transform 0.15s ease;
}

/* 開いているときは矢印を下向きにする */
#result-section .page-candidates-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

/* マウスを重ねたとき */
#result-section .page-candidates-toggle:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* キーボード操作時 */
#result-section .page-candidates-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

/* 候補がない場合は表示しない */
#result-section .page-candidates-toggle[hidden] {
  display: none;
}

/* 動きを減らす設定に対応 */
@media (prefers-reduced-motion: reduce) {
  #result-section .page-candidates-toggle::before {
    transition: none;
  }
}

/* ページ候補：件数と開閉ボタンの余白を詰める */
#result-section li.diagnostic-count:has(.page-candidates-toggle) {
  margin-bottom: 0;
}

/* 開閉ボタンと一覧を近づける */
#result-section .page-candidates-toggle {
  margin: 4px 0 0;
  padding: 4px 0;
}

/* ページ候補のファイル名一覧 */
#result-section li.diagnostic-count:has(.page-candidates-toggle) ~ li {
  margin: 0 0 0 18px;
  padding: 5px 0;

  list-style: disc outside;
  border-left: none;

  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* ツールの説明 */
.upload-intro {
  margin-bottom: 20px;
}

.upload-intro p {
  margin: 0 0 10px;
  line-height: 1.8;
}

.upload-intro p:last-child {
  margin-bottom: 0;
}

/* 読み込み条件と検査の制限 */
.upload-conditions {
  margin: 20px 0;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.upload-conditions p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.8;
}

/* 診断結果の上に表示する完了・注意メッセージ */
#result-section > #status-message[data-state="success"],
#result-section > #status-message[data-state="warning"] {
  margin-top: 0;
  margin-bottom: 36px;
}

/* 診断カードの外にある「ファイル選択へ戻る」ボタン */
#result-section + .back-to-upload-button {
  display: flex;
  align-items: center;
  justify-content: center;

  width: fit-content;
  max-width: calc(100% - 32px);
  min-height: 44px;
  margin: 24px auto 40px;
  padding: 12px 20px;

  background-color: #ffffff;
  color: #1d4ed8;
  border: 1px solid #2563eb;
  border-radius: 8px;

  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;

  cursor: pointer;
}

/* マウスを重ねたとき */
#result-section + .back-to-upload-button:hover {
  background-color: #eff6ff;
}

/* キーボード操作時 */
#result-section + .back-to-upload-button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

/* 読み込み前・読み込み中・エラー時は非表示 */
#result-section + .back-to-upload-button[hidden] {
  display: none;
}

/* 著作権表示 */
.copyright {
  margin: 20px 0 0;
  color: #475569;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  text-align: center;
}

/* 不具合・改善要望の報告リンク */
.feedback-link {
  margin: 20px 0 12px;
  text-align: center;
}

.feedback-link a {
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* マウスを重ねたとき */
.feedback-link a:hover {
  color: #1e40af;
}

/* キーボード操作時 */
.feedback-link a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 4px;
  border-radius: 2px;
}

/* スマホ用：文字を少し小さく、余白を広めに */
@media (max-width: 600px) {

  /* 全体の文字サイズ */
  body {
    font-size: 15px;
  }

  /* 診断結果の見出し */
  #result-section > h2 {
    font-size: 19px;
  }

  /* 診断カード */
  #result-section section {
    margin: 24px 0;
    padding: 20px 16px;
  }

  /* 診断カードの見出し */
  #result-section section h3 {
    margin-bottom: 16px;
    font-size: 17px;
  }

  /* 強調する件数 */
  #result-section .diagnostic-count {
    font-size: 17px;
  }

  /* 診断項目同士の間隔 */
  #result-section section li + li {
    margin-top: 12px;
  }

  /* ファイル形式の集計はコンパクトに */
  #result-section .file-type-grid > li {
    font-size: 14px;
  }

  /* ZIP内部のファイル一覧 */
  #result-section #file-list {
    font-size: 14px;
    line-height: 1.7;
  }

  #result-section #file-list li {
    margin-bottom: 12px;
  }
}
