/* ═══════════════════════════════════════════
   Flight Price Predictor — Dark Theme
   PI-27-flightTrend の style.css のパレットとカード構成を継承。
   ただし Web フォントは読み込まない（/w/{token} から外部へリクエストを
   出すと Referer ヘッダにトークンが載るため。static/vendor の Chart.js と
   同じ理由）。
   ═══════════════════════════════════════════ */

:root {
  --bg-primary: #06060f;
  --bg-secondary: #0d0d1a;
  --bg-card: rgba(15, 15, 35, 0.85);
  --bg-card-hover: rgba(25, 25, 55, 0.92);
  --bg-input: rgba(255, 255, 255, 0.06);

  --accent-primary: #6366f1;
  --accent-secondary: #06b6d4;
  --accent-tertiary: #8b5cf6;

  --status-buy: #10b981;
  --status-wait: #f59e0b;
  --status-watch: #3b82f6;
  --status-nodata: #64748b;
  --status-danger: #ef4444;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #a5b4fc;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --border-subtle: 1px solid rgba(255, 255, 255, 0.07);

  --font-body: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
               "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ─── ヘッダー ─── */
.app-header {
  background: linear-gradient(180deg, var(--bg-secondary), transparent);
  border-bottom: var(--border-subtle);
}
.header-content {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 0;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.3rem; }
.logo-accent {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { color: var(--text-secondary); font-size: .85rem; margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.status-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius-full);
  background: var(--bg-input); font-size: .78rem; color: var(--text-secondary);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-buy); box-shadow: 0 0 8px var(--status-buy);
}
.status-dot.off { background: var(--text-muted); box-shadow: none; }

/* ─── タブ ─── */
.nav-tabs {
  display: flex; gap: 4px; overflow-x: auto;
  border-bottom: var(--border-subtle);
}
.nav-tab {
  flex: none; padding: 12px 18px; font: inherit; font-size: .9rem;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active { color: var(--text-accent); border-bottom-color: var(--accent-primary); }

.tab-content { display: none; padding: 24px 0 60px; }
.tab-content.active { display: block; }

/* ─── カード ─── */
.card {
  background: var(--bg-card); border: var(--border-subtle);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-card); margin-bottom: 20px;
}

.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 26px 0 12px;
}
.section-header h2 { font-size: 1.02rem; font-weight: 600; }
.section-sub { color: var(--text-muted); font-size: .8rem; }

/* ─── サマリーカード ─── */
.summary-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px;
}
.summary-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--bg-card); border: var(--border-subtle);
  border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-card);
}
.card-icon {
  flex: none; width: 44px; height: 44px; border-radius: var(--radius-md);
  display: grid; place-items: center; font-size: 1.25rem;
}
.icon-green  { background: linear-gradient(135deg, #10b981, #059669); }
.icon-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.icon-amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.icon-cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.card-body { display: flex; flex-direction: column; min-width: 0; }
.card-label {
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted);
}
.card-value { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
.card-value.green { color: var(--status-buy); }
.card-detail {
  font-size: .76rem; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── ルート比較 ─── */
.route-comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.route-card {
  background: var(--bg-card); border: var(--border-subtle);
  border-radius: var(--radius-lg); padding: 20px; text-align: center;
  box-shadow: var(--shadow-card);
}
.route-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.route-badge {
  padding: 5px 14px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .85rem; background: var(--bg-input);
}
.route-badge.origin { background: rgba(245, 158, 11, .18); color: #fbbf24; }
.route-badge.dest   { background: rgba(6, 182, 212, .18); color: #67e8f9; }
.route-arrow { color: var(--text-muted); }
.route-price { font-size: 1.9rem; font-weight: 700; color: var(--status-buy); }
.route-price.muted { color: var(--text-muted); }
.route-detail { font-size: .8rem; color: var(--text-secondary); }

/* ─── テーブル ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left; padding: 10px 12px; color: var(--text-muted);
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: var(--border-subtle); font-weight: 600;
}
td { padding: 11px 12px; border-bottom: 1px solid rgba(255, 255, 255, .04); }
tbody tr:hover { background: var(--bg-card-hover); }
.rank {
  display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--bg-input);
  font-size: .75rem; font-weight: 700;
}
.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1a1a1a; }
.rank-2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #1a1a1a; }
.rank-3 { background: linear-gradient(135deg, #d97706, #92400e); }
.price-cell { color: var(--status-buy); font-weight: 600; }

/* ─── 判定 ─── */
.verdict {
  border-radius: var(--radius-lg); padding: 20px;
  border: var(--border-subtle); border-left: 4px solid var(--status-watch);
  background: var(--bg-card); margin-bottom: 14px;
}
.verdict-buy_now { border-left-color: var(--status-buy); }
.verdict-wait { border-left-color: var(--status-wait); }
.verdict-watch { border-left-color: var(--status-watch); }
.verdict-insufficient_data { border-left-color: var(--status-nodata); }
.verdict-headline { font-size: 1.6rem; font-weight: 700; }
.verdict-buy_now .verdict-headline { color: var(--status-buy); }
.verdict-wait .verdict-headline { color: var(--status-wait); }
.verdict-watch .verdict-headline { color: #93c5fd; }
.verdict-insufficient_data .verdict-headline { color: var(--text-secondary); }
.verdict-why { color: var(--text-secondary); font-size: .9rem; }
.verdict-evidence { margin-top: 8px; font-size: .78rem; color: var(--text-muted); }
.verdict-date { margin-top: 8px; font-weight: 600; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin-top: 14px; }
.facts dt { color: var(--text-muted); font-size: .8rem; }
.facts dd { font-size: .92rem; }

/* ─── バッジ・注記 ─── */
.badge {
  display: inline-block; margin-left: 8px; padding: 2px 9px;
  border-radius: var(--radius-full); font-size: .68rem; font-weight: 700;
  vertical-align: middle; background: var(--bg-input); color: var(--text-secondary);
}
.badge-nearby { background: rgba(139, 92, 246, .2); color: #c4b5fd; }
.badge-model  { background: rgba(100, 116, 139, .25); color: #cbd5e1; }
.badge-buy_now { background: rgba(16, 185, 129, .18); color: #6ee7b7; }
.badge-wait { background: rgba(245, 158, 11, .18); color: #fcd34d; }
.badge-watch { background: rgba(59, 130, 246, .18); color: #93c5fd; }
.badge-insufficient_data { background: rgba(100, 116, 139, .25); color: #cbd5e1; }

/* 実測がまだ無いことを、価格のすぐ隣で必ず知らせる帯。 */
.model-notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(100, 116, 139, .12); border: 1px solid rgba(148, 163, 184, .25);
  border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 18px;
  font-size: .84rem; color: var(--text-secondary);
}
.savings {
  background: rgba(16, 185, 129, .12); border: 1px solid rgba(16, 185, 129, .35);
  color: #6ee7b7; border-radius: var(--radius-md);
  padding: 10px 14px; font-weight: 600; margin-bottom: 14px;
}

/* ─── 航空会社の複数選択 ─── */
.airline-actions { display: flex; gap: 8px; margin: 12px 0; }
.airline-choices {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}
.airline-choice {
  display: flex; align-items: center; gap: 9px; margin: 0;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: var(--border-subtle);
  cursor: pointer; font-size: .88rem;
}
.airline-choice:hover { background: var(--bg-card-hover); }
.airline-choice.checked { border-color: rgba(99, 102, 241, .55); }
.airline-choice input { width: auto; margin: 0; accent-color: var(--accent-primary); }
.airline-choice span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.airline-choice .meta { flex: none; font-size: .72rem; }
.airline-save { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

.hint { color: var(--text-muted); font-size: .82rem; }
.meta { color: var(--text-secondary); font-size: .82rem; }
.error { color: #fca5a5; font-size: .9rem; }

/* ─── フォーム ─── */
label { display: block; margin-bottom: 14px; font-size: .88rem; }
label > span { display: block; margin-bottom: 5px; color: var(--text-secondary); }
input, select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem;
  color: var(--text-primary); background: var(--bg-input);
  border: var(--border-subtle); border-radius: var(--radius-sm);
}
input:focus, select:focus { outline: 2px solid var(--accent-primary); outline-offset: 1px; }
input::placeholder { color: var(--text-muted); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 12px; }

button {
  font: inherit; font-size: .9rem; padding: 10px 18px;
  border-radius: var(--radius-sm); cursor: pointer; color: #fff;
  border: none; background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
}
button:disabled { opacity: .55; cursor: default; }
button.ghost {
  background: var(--bg-input); color: var(--text-primary); border: var(--border-subtle);
}
button.danger { background: none; border: 1px solid var(--status-danger); color: #fca5a5; }
button.small, a.small { font-size: .8rem; padding: 6px 12px; }
a.ghost {
  display: inline-block; text-decoration: none; background: var(--bg-input);
  color: var(--text-primary); border: var(--border-subtle);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: .8rem;
}

/* ─── グラフ ─── */
.chart-wrapper { position: relative; height: 320px; }
.chart-switch { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chart-switch button { background: var(--bg-input); color: var(--text-secondary); border: var(--border-subtle); }
.chart-switch button.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
  color: #fff;
}

/* ─── モニター一覧（トップ） ─── */
.watch-list { list-style: none; }
.watch-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, .05);
}
.watch-link { font-weight: 600; text-decoration: none; color: var(--text-primary); }
.watch-list .meta { flex: 1; }

.share-row { display: flex; gap: 8px; margin: 10px 0 16px; }
.share-row input { font-size: .82rem; }

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 8px; }
  .card-value { font-size: 1.3rem; }
}
