/* ============================================
   components.css - ボタン・カード・表・バッジ 等
   ============================================ */

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.98rem;
  border: 2px solid transparent;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: var(--navy-light); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.18); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover { background: var(--accent-soft); }

.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- カード ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.2s;
}
.card.hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.card .card-icon {
  font-size: 1.7rem;
  margin-bottom: 12px;
}
.card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* リンクカード(トップの導線) */
.link-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.2s, border-color 0.2s;
}
.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.link-card .card-icon { font-size: 1.9rem; }
.link-card .go {
  margin-top: auto;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- バッジ / チップ ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.badge.up { background: var(--up-soft); color: var(--up); }
.badge.down { background: var(--down-soft); color: var(--down); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: var(--surface-2); color: var(--text-muted); }

/* リスクメーター(●●●○○) */
.meter {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
.meter .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}
.meter .dot.on { background: var(--accent); }
.meter.risk .dot.on { background: var(--down); }
.meter.growth .dot.on { background: var(--up); }

/* ---------- テーブル ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table.data {
  min-width: 560px;
  font-size: 0.92rem;
}
table.data th,
table.data td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data thead th {
  background: var(--surface-2);
  font-size: 0.82rem;
  color: var(--text-muted);
  position: sticky;
  top: 0;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data td.ticker {
  font-weight: 800;
  color: var(--accent);
  font-family: var(--mono);
}

/* ---------- フォーム ---------- */
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.field .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}
input[type="text"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.range-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.range-row output {
  min-width: 92px;
  text-align: right;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--accent);
}

/* チェックボックス行 */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- ツールバー(検索/フィルタ) ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 22px;
}
.toolbar .grow { flex: 1 1 220px; }
.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.18s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- ETF カード ---------- */
.etf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.etf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.16s, box-shadow 0.2s;
}
.etf-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.etf-card .etf-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.etf-card .etf-ticker {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--accent);
  line-height: 1;
}
.etf-card .etf-name {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.etf-card .fav {
  font-size: 1.3rem;
  color: var(--border);
  transition: color 0.2s, transform 0.15s;
}
.etf-card .fav:hover { transform: scale(1.15); }
.etf-card .fav.on { color: var(--warn); }
.etf-card .etf-desc {
  font-size: 0.92rem;
  color: var(--text);
}
.etf-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.etf-stats .k { color: var(--text-muted); }
.etf-stats .v { font-weight: 700; }
.etf-card .etf-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ---------- 比較テーブル ---------- */
.compare-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.compare-bar .slots { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.compare-bar .slot {
  background: rgba(255, 255, 255, 0.15);
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.compare-bar .slot button { color: rgba(255,255,255,0.7); font-size: 1rem; }
.compare-bar .slot.empty { opacity: 0.45; }

/* ---------- 用語カード(アコーディオン) ---------- */
.term-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.term-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  text-align: left;
}
.term-head .term-title {
  font-weight: 800;
  font-size: 1.05rem;
}
.term-head .term-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.term-head .chevron {
  margin-left: auto;
  transition: transform 0.25s;
  color: var(--text-muted);
}
.term-card.open .chevron { transform: rotate(180deg); }
.term-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.term-card.open .term-body { max-height: 640px; }
.term-body-inner {
  padding: 0 18px 18px;
  color: var(--text);
  font-size: 0.94rem;
}
.formula {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.88rem;
  overflow-x: auto;
}
.related-terms {
  margin-top: 10px;
  font-size: 0.82rem;
}
.related-terms a {
  color: var(--accent);
  text-decoration: underline;
  margin-right: 8px;
}

/* ---------- 統計ハイライト(数字を大きく) ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.stat .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat .stat-value {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  font-family: var(--mono);
  line-height: 1.1;
}
.stat .stat-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- 注意書き ---------- */
.notice {
  border-left: 4px solid var(--warn);
  background: var(--warn-soft);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
}
.notice.info {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- 2カラム比較(ETF vs 個別株) ---------- */
.vs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.vs-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.vs-col h3 { font-size: 1.3rem; margin-bottom: 6px; }
.vs-col .tag { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.pro-list li, .con-list li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 8px;
  font-size: 0.92rem;
}
.pro-list li::before { content: "○"; position: absolute; left: 4px; color: var(--up); font-weight: 700; }
.con-list li::before { content: "×"; position: absolute; left: 4px; color: var(--down); font-weight: 700; }
.mini-head { font-weight: 700; margin: 16px 0 8px; font-size: 0.95rem; }

/* ---------- 診断 ---------- */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  max-width: 680px;
  margin-inline: auto;
}
.quiz-progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}
.quiz-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--up));
  transition: width 0.35s;
}
.quiz-q { font-size: 1.25rem; font-weight: 800; margin-bottom: 20px; }
.quiz-options { display: grid; gap: 12px; }
.quiz-opt {
  text-align: left;
  padding: 15px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
  transition: all 0.16s;
}
.quiz-opt:hover { border-color: var(--accent); background: var(--accent-soft); }

.result-type {
  text-align: center;
  padding: 12px 0 20px;
}
.result-type .rt-icon { font-size: 3rem; }
.result-type .rt-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  margin: 8px 0;
}

/* 結果チャートのミニバー */
.bar-row { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.88rem; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- グラフ枠 ---------- */
.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.chart-box canvas { max-width: 100%; }

/* トースト */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  font-size: 0.9rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .big { font-size: 2.5rem; margin-bottom: 8px; }
