/* YouTube バズ動画調査ツール — 白基調・シンプルなツールUI */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1f2328;
  --text-sub: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* --- ヘッダー --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 18px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.app-header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}
.title-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.manual-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.manual-link:hover { text-decoration: underline; }

.meter { min-width: 280px; }
.meter-label { font-size: 13px; color: var(--text-sub); }
.meter-label span { color: var(--text); font-weight: 600; }
.meter-bar {
  margin: 4px 0;
  height: 8px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width .3s ease;
}
.meter-fill.low { background: var(--danger); }
.meter-note { font-size: 11px; color: var(--text-sub); }

/* --- レイアウト --- */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
}

/* --- 検索フォーム --- */
.mode-toggle {
  display: flex;
  gap: 22px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.mode-toggle label { font-weight: 600; cursor: pointer; }

.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 22px;
}
.radio-row, .range-row { display: flex; align-items: center; gap: 12px; }
.radio-row { flex-wrap: wrap; }
.radio-row label { font-weight: 500; cursor: pointer; }
.range-row input { width: auto; flex: 1; min-width: 0; }

/* --- ボタン --- */
button {
  cursor: pointer;
  font-family: inherit;
  border-radius: 7px;
  font-size: 14px;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 22px;
  font-weight: 600;
}
button.primary:hover { background: var(--accent-dark); }
button.primary:disabled { background: #9db4e8; cursor: default; }
button.ghost {
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 16px;
  color: var(--text);
}
button.ghost:hover { background: #f0f2f5; }
.cost {
  font-size: 12px;
  font-weight: 400;
  opacity: .85;
  margin-left: 6px;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 12px 0 0;
}

/* --- 結果 --- */
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
#result-count { font-weight: 600; }
.results-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sort-label {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sort-label select {
  width: auto;
  padding: 6px 9px;
  font-size: 13px;
}
.mobile-tabs { display: none; }
.rtab {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  padding: 9px 10px;
  font-weight: 600;
  color: var(--text-sub);
}
.rtab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.results-body {
  display: grid;
  grid-template-columns: 8fr 2fr;
  gap: 22px;
}
.results-body h2 {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0 0 10px;
}

/* 動画カード */
.video-card {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.video-card:last-child { border-bottom: none; }
.video-card .thumb {
  width: 160px;
  min-width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef0f3;
}
.video-card .info { flex: 1; min-width: 0; }
.video-card .vtitle {
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}
.video-card .vtitle:hover { color: var(--accent); }
.video-card .vmeta {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.buzz-badge {
  display: inline-block;
  background: #eef4ff;
  color: var(--accent-dark);
  font-weight: 700;
  border-radius: 5px;
  padding: 1px 8px;
  font-size: 12px;
}
.tag-short {
  background: #fff1f0;
  color: #d4380d;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 11px;
}

/* チャンネルカード */
.channel-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.channel-card .ctitle {
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
}
.channel-card .ctitle:hover { color: var(--accent); }
.channel-card ul {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-sub);
}

.loading {
  text-align: center;
  padding: 30px;
  color: var(--text-sub);
}
.empty { color: var(--text-sub); font-size: 13px; padding: 8px 0; }

.hidden { display: none !important; }

@media (max-width: 760px) {
  .results-body { grid-template-columns: 1fr; }
  .video-card .thumb { width: 120px; min-width: 120px; height: 68px; }
  .mobile-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
  .results-body.show-videos .col-channels { display: none; }
  .results-body.show-channels .col-videos { display: none; }
  .col-videos > h2, .col-channels > h2 { display: none; }
}
