/* WEBUILD ツール — 落ち着いた実務ツールのトーン。装飾よりも「迷わず操作できる」ことを優先。 */

:root {
  --ink: #1c1917;
  --ink-soft: #57534e;
  --paper: #fdfbf7;
  --card: #ffffff;
  --line: #e7e2da;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --pop: #ff6b4a;       /* ポップなセカンドカラー(強調・グラデーション用) */
  --pop-soft: #fff1ed;
  --good: #15803d;
  --good-soft: #f0fdf4;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --radius: 14px;
  --shadow-card: 0 2px 10px rgba(28, 25, 23, 0.05);
  --shadow-pop: 0 4px 14px rgba(255, 107, 74, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.topbar .brand { font-weight: 800; font-size: 15px; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--pop); }
.topbar nav a { color: var(--ink-soft); text-decoration: none; font-size: 13.5px; margin-left: 18px; }
.topbar nav a:hover { color: var(--ink); }

.wrap { max-width: 780px; margin: 0 auto; padding: 40px 24px 80px; }
.wrap.wide { max-width: 980px; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 32px 0 14px; }
.lead { color: var(--ink-soft); font-size: 14px; margin: 0 0 28px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

label { display: block; font-size: 13px; font-weight: 700; margin: 16px 0 6px; }
label:first-child { margin-top: 0; }
label .hint { font-weight: 400; color: var(--ink-soft); margin-left: 6px; }

input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--paper);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--pop), #ff8a5c); color: #fff; box-shadow: var(--shadow-pop); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 107, 74, 0.36); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-secondary:hover { background: #e0ecff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--paper); }
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-neutral { background: var(--line); color: var(--ink-soft); }
.badge-pop { background: var(--pop-soft); color: var(--pop); }

.notice { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 20px; }
.notice-good { background: var(--good-soft); color: var(--good); }
.notice-bad { background: var(--bad-soft); color: var(--bad); }

.site-list { list-style: none; padding: 0; margin: 0; }
.site-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px;
  background: var(--card);
}
.site-list .name { font-weight: 700; font-size: 14.5px; }
.site-list .meta { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.site-list a.open { color: var(--accent); text-decoration: none; font-size: 13.5px; font-weight: 700; }

.steps { display: flex; gap: 6px; margin-bottom: 28px; flex-wrap: wrap; }
.steps span {
  font-size: 12px; padding: 5px 12px; border-radius: 999px; background: var(--line); color: var(--ink-soft);
}
.steps span.active { background: var(--ink); color: #fff; }
.steps span.done { background: var(--good-soft); color: var(--good); }

.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-list li {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; background: var(--card);
}
.topic-list .t-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.topic-list .t-reason { color: var(--ink-soft); font-size: 12.5px; margin-bottom: 10px; }

.preview {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: #fff;
}
.preview h2 { font-size: 17px; border-left: 5px solid var(--accent); padding-left: 12px; margin: 26px 0 10px; }
.preview h1 { font-size: 20px; }

.small { font-size: 12.5px; color: var(--ink-soft); }
.footer-note { margin-top: 40px; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* ---- 記事編集ブロック(プレビュー画面: 画像差し替え・CTA追加) ---- */
.edit-card { border-left: 4px solid var(--pop); }
.section-card-head { margin-bottom: 4px; }
.img-edit-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.edit-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; }
.edit-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 12px; background: var(--paper);
}
.img-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-btn { cursor: pointer; }
.cta-list { margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.cta-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cta-row input { flex: 1; min-width: 140px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit; background: var(--paper); }

/* ---- 接続状態テーブル(元はsite_detail.ejsのインラインstyleだった分をクラス化) ---- */
.status-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.status-table td { padding: 8px 0; }
.status-table td.status-cell { text-align: right; }
.status-table td.status-btn { text-align: right; padding-left: 12px; }

/* ---- ベンチマークの比較バー(元はsite_insights.ejsのインラインstyleだった分をクラス化) ---- */
.bench-row { margin-bottom: 20px; }
.bench-row .bench-label { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.bench-bar-line { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bench-bar-line .bench-who { width: 88px; flex-shrink: 0; color: var(--ink-soft); }
.bench-bar-track { flex: 1; background: var(--line); border-radius: 6px; height: 14px; overflow: hidden; }
.bench-bar-fill { height: 100%; }
.bench-bar-fill.mine { background: var(--accent); }
.bench-bar-fill.benchmark { background: #a8a29e; }
.bench-bar-line .bench-val { width: 70px; text-align: right; flex-shrink: 0; }

/* ==========================================================================
   スマホ対応(iOS Safari / Android Chrome を想定。~640px以下をスマホ扱い)
   ========================================================================== */
@media (max-width: 640px) {
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .topbar nav a { margin-left: 0; margin-right: 16px; }

  .wrap, .wrap.wide {
    padding: 24px 16px 56px;
    max-width: 100%;
  }

  h1 { font-size: 19px; }
  .card { padding: 16px; }

  /* ボタン群は横並びをやめて縦に積む(誤タップ防止・指で押しやすいサイズを確保) */
  .btn-row { flex-direction: column; }
  .btn-row .btn { text-align: center; width: 100%; padding: 12px 16px; }

  /* サイト一覧の行も縦積みにして、長いサイト名やURLが見切れないようにする */
  .site-list li { flex-direction: column; align-items: flex-start; gap: 8px; }
  .site-list a.open { align-self: flex-end; }

  /* 接続状態テーブルは横に3列だと窮屈なので、ボタンを下の行に落とす */
  .status-table td.status-btn { display: block; text-align: left; padding: 4px 0 12px; }
  .status-table td.status-cell { text-align: left; }
  .status-table tr { display: block; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
  .status-table tr:last-child { border-bottom: none; }

  /* ベンチマークのバーはラベル幅を詰めて、数値が見切れないようにする */
  .bench-bar-line .bench-who { width: 56px; font-size: 12px; }
  .bench-bar-line .bench-val { width: 58px; font-size: 12px; }

  .preview { padding: 18px; }

  .steps { gap: 4px; }
  .steps span { font-size: 11px; padding: 4px 9px; }

  .img-edit-row { flex-direction: column; align-items: flex-start; }
  .edit-thumb { width: 100%; height: 160px; }
  .cta-row { flex-direction: column; align-items: stretch; }
}
