/* 地域記事FV「おすすめの交通事故病院」ランキングリスト (Figma 202607-2 / 9727:15996, item 9728:18430)
   自己完結スタイル。sass/style.css には手を入れず、この1ファイルで完結させる。 */

.p-fv-rank {
  box-sizing: border-box;
  width: 100%;
  margin: 12px 0 0;
  padding: 24px 8px;
  background: #fffaf6;
  border: 1px dashed #faa268;
  border-radius: 10px;
  font-family: "Noto Sans JP", sans-serif;
}
.p-fv-rank *,
.p-fv-rank *::before,
.p-fv-rank *::after { box-sizing: border-box; }

/* ボックス自体は本文カラム幅いっぱい。中身(見出し・フィルタ・リスト)を
   頭打ちにして中央寄せする(広いカラムでも中身が伸び切らない)。 */
.p-fv-rank__inner {
  max-width: 720px;
  margin: 0 auto;
}

.p-fv-rank__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: #333;
  text-align: center;
  line-height: 1.4;
}

/* --- フィルター --- */
.p-fv-rank__filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.p-fv-rank__tabs {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.p-fv-rank__tab {
  /* SP は等幅にせず内容幅で折り返さない (院種名が2行にならないように)。PCで等幅に戻す。 */
  flex: 0 1 auto;
  min-width: 0;
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  background: #fff;
  border: 0.5px solid #faa268;
  border-radius: 10px 10px 0 0;
  box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.15);
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.p-fv-rank__tab.is-active {
  background: #faa268;
  color: #fff;
  font-weight: 700;
}

.p-fv-rank__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  justify-content: center;
}
.p-fv-rank__cond {
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  background: #fff;
  border: 0.5px solid #faa268;
  border-radius: 30px;
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
  line-height: 1.2;
  transition: background-color .15s, color .15s;
}
.p-fv-rank__cond.is-active {
  background: #faa268;
  color: #fff;
  font-weight: 700;
  border-color: #faa268;
}

.p-fv-rank__hr {
  margin: 12px 0;
  border: none;
  border-top: 0.5px solid #f0d3bd;
}

/* --- リスト --- */
.p-fv-rank__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.p-fv-rank__item {
  background: #fff;
  border: 0.4px solid #c5c4c1;
  border-radius: 20px;
  overflow: hidden;
}
.p-fv-rank__item.is-rank1 { border-color: #debf22; }
.p-fv-rank__item.is-rank2 { border-color: #c5c4c1; }
.p-fv-rank__item.is-rank3 { border-color: #c06b47; }
.p-fv-rank__item.is-extra { display: none; }
.p-fv-rank.is-expanded .p-fv-rank__item.is-extra { display: block; }
.p-fv-rank__item.is-filtered-out { display: none !important; }

/* カード全体が1つのボタン(アンカー)。badge / thumb / body / detail を横一列に。 */
/* SP: 本体行(バッジ/サムネ/本文/詳細) + 自由タグを下段に折り返す (Figma SP 9734:18985)。
   PCでは折り返さず自由タグは本文列の中に入れる (Figma PC 9728:18430)。 */
.p-fv-rank__link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  text-decoration: none;
  color: inherit;
}

.p-fv-rank__badge {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #b8b8b8;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}
.is-rank1 .p-fv-rank__badge { background: #e3b325; }
.is-rank2 .p-fv-rank__badge { background: #b6b6b6; }
.is-rank3 .p-fv-rank__badge { background: #c06b47; }

/* サムネ列: 画像の下に「★★★★★ + 点数」 */
.p-fv-rank__thumb {
  flex: 0 0 auto;
  width: 79px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.p-fv-rank__thumb-img {
  width: 79px;
  height: 50px;
  border-radius: 4px;
  overflow: hidden;
  background: #eee;
  display: block;
}
.p-fv-rank__thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.p-fv-rank__stars-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
}
.p-fv-rank__stars {
  position: relative;
  display: inline-block;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0;
}
.p-fv-rank__stars-gray { color: #d8d8d8; }
.p-fv-rank__stars-gold {
  position: absolute;
  top: 0;
  left: 0;
  color: #f5a623;
  overflow: hidden;
  white-space: nowrap;
}
.p-fv-rank__star-num {
  font-size: 11px;
  font-weight: 700;
  color: #dc2a2a;
  line-height: 1;
  white-space: nowrap;
}

/* 本文列: 院名・アクセス・自由タグを縦積み (自由タグはこの列の中)。
   flex-grow で余白を吸収し、「詳細」ボタンを各行そろえて右側に配置する
   (Figma 9728:18430 では本文が固定幅・ボタンが固定x=445で揃う)。 */
.p-fv-rank__body {
  /* 残り幅を吸収して詳細ボタンを内容幅で右そろえにする(SP=行高いっぱい/PC=中央)。
     flex-basis:0 で内容幅を主張させず、長いアクセス文もこの列内で折り返す(本体行を崩さない)。 */
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.p-fv-rank__name {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}
.p-fv-rank__station {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 12px;
  background: #fff;
  border: 0.7px solid #faa268;
  border-radius: 10px;
}
.p-fv-rank__station-ico { width: 18px; height: 16px; flex: 0 0 auto; }
.p-fv-rank__station-text {
  font-size: 12px;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}
.p-fv-rank__taglist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
/* SP: 自由タグは下段に全幅で1行 (等分配置)。PCでは本文列内(--pc)に入れる。 */
.p-fv-rank__taglist--pc { display: none; }
.p-fv-rank__taglist--sp {
  flex-basis: 100%;
  width: 100%;
  margin-top: 4px;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: space-between;
  overflow: hidden;
}
.p-fv-rank__taglist--sp .p-fv-rank__tag {
  flex: 0 0 auto;
  text-align: center;
}
.p-fv-rank__tag {
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  background: #f0fbf9;
  border-radius: 10px;
  line-height: 20px;
  white-space: nowrap;
}

/* 詳細ボタン: Figma では opacity 60% の淡いオレンジ (実測 ≒ rgb(255,157,104))。
   要素全体の opacity ではなく背景/枠を rgba で 60% にし、白文字はくっきり残す。 */
.p-fv-rank__detail {
  /* 内容幅で右そろえ。SPは行の高さいっぱいに伸ばす(Figma 9734:18985 実測 幅≒55px)。PCは中央(下で上書き)。 */
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(255, 122, 0, 0.6);
  border-radius: 10px;
  background: linear-gradient(0deg, rgba(255, 92, 4, 0.6) 57%, rgba(255, 123, 0, 0.6) 99%);
}
.p-fv-rank__detail-arrow { font-size: 15px; line-height: 1; }

/* --- もっと見る --- */
.p-fv-rank__more {
  display: block;
  margin: 12px auto 0;
  padding: 4px 21px;
  font-size: 14px;
  color: #333;
  background: #fff;
  border: 0.5px solid #faa268;
  border-radius: 30px;
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
}
.p-fv-rank__more-ico { margin-left: 4px; font-size: 11px; }
.p-fv-rank__more-close { display: none; }
.p-fv-rank.is-expanded .p-fv-rank__more-open { display: none; }
.p-fv-rank.is-expanded .p-fv-rank__more-close { display: inline; }

/* アンカー先の院カードがスティッキーヘッダに隠れないよう余白を確保 */
.p-city-clinic-list__card[id^="fv-card-"] { scroll-margin-top: 90px; }

/* PC: サイズを Figma 9728:18430 の実寸へ */
@media (min-width: 768px) {
  .p-fv-rank { padding: 28px 20px; }
  .p-fv-rank__title { font-size: 20px; }
  .p-fv-rank__tab { flex: 1 0 0; font-size: 15px; padding: 7px 12px; }
  .p-fv-rank__link { flex-wrap: nowrap; gap: 12px; padding: 6px 24px; }
  .p-fv-rank__badge { width: 46px; height: 46px; font-size: 18px; }
  .p-fv-rank__thumb { width: 127px; }
  .p-fv-rank__thumb-img { width: 103px; height: 62px; }
  .p-fv-rank__stars { font-size: 13px; }
  .p-fv-rank__stars-row { gap: 6px; }
  .p-fv-rank__star-num { font-size: 13px; }
  /* PC: 本文が伸びてボタンは内容幅・右そろえ、自由タグは本文列内に表示 */
  .p-fv-rank__body { flex: 1 1 0; }
  .p-fv-rank__detail { flex: 0 0 auto; align-self: center; min-width: 88px; font-size: 15px; }
  .p-fv-rank__taglist--pc { display: flex; }
  .p-fv-rank__taglist--sp { display: none; }
}

/* =====================================================================
   件数見出し + 絞り込みタブ (Figma 202607-2 / 9734:19087, 9734:19094, 9734:19099)
   既存クラス(.tabs-btn/.tags-btn 等)は clinic-list.js 依存のため維持し、
   sass/style.css の旧スタイルを .p-region-* スコープで上書きする。
   ===================================================================== */

/* --- 件数見出し (9734:19087) --- */
.p-region-count {
  background: #fbf9f7;
  padding: 12px 16px;
}
/* SP: 見出し(全幅) の下に [件数 ....... 日付] を左右振り分け (Figma SP 9734:19114)。
   PC: 見出しの右に件数を並べ、日付は下段 (Figma 9734:19087)。 */
.p-region-count__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 4px;
}
.p-region-count__title {
  margin: 0;
  flex-basis: 100%;
  font-size: 20px;
  font-weight: 700;
  color: #faa268;
  line-height: 1.3;
}
.p-region-count__count { display: inline-flex; align-items: baseline; flex-shrink: 0; }
.p-region-count__num {
  font-family: "Roboto", "Noto Sans JP", sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: #faa268;
}
.p-region-count__unit { font-size: 12px; color: #333; margin-left: 2px; }
.p-region-count__date {
  margin: 0;
  margin-left: auto; /* SP: 件数と同じ行で右端へ */
  font-size: 12px;
  color: #333;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .p-region-count__title { flex-basis: auto; } /* PC: 見出しの右に件数 */
  .p-region-count__date { flex-basis: 100%; margin-left: 0; } /* PC: 日付は下段・左 */
}

/* 帯は全幅。sass/style.css の !important 付き旧スタイルを同等の力で上書きする。 */
.p-region-filter { margin: 0; }

/* 症状タブ (9734:19094): 白背景・等幅4タブ・アクティブはオレンジ字＋下線 */
.p-region-filter .hospital-upper {
  background: #fff;
  border-bottom: 1px solid #f0d3bd;
}
.p-region-filter .hospital-upper .tabs-btn {
  flex: 1 0 0 !important;
  width: auto !important;
  height: 52px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  background: #fff !important;
  color: #333 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}
.p-region-filter #all-symptoms-radio:checked ~ .all-symptoms-label,
.p-region-filter #flogging-radio:checked ~ .flogging-label,
.p-region-filter #bruise-radio:checked ~ .bruise-label,
.p-region-filter #trauma-radio:checked ~ .trauma-label {
  color: #faa268 !important;
  background: #fff !important;
  border-bottom: 2px solid #faa268 !important;
  font-size: 16px !important;
}

/* 院種ラベル (9734:19099): 帯背景 #fce1c6・等幅ピル・アクティブ #faa268(sass既存) */
.p-region-filter .hospital-category {
  background: #fce1c6 !important;
}
.p-region-filter .hospital-category .tags-btn {
  flex: 1 1 0 !important;
  width: auto !important;
  max-width: 220px;
  height: 32px !important;
  padding: 0 6px !important;
  font-size: 15px !important;
  cursor: pointer;
}

/* SP: ラベル文字が等幅ピルからはみ出すのでフォントを縮める。 */
@media (max-width: 767px) {
  .p-region-filter .hospital-upper .tabs-btn { font-size: 14px !important; }
  .p-region-filter .hospital-category .tags-btn { font-size: 12px !important; padding: 0 4px !important; }
  .p-region-filter #all-symptoms-radio:checked ~ .all-symptoms-label,
  .p-region-filter #flogging-radio:checked ~ .flogging-label,
  .p-region-filter #bruise-radio:checked ~ .bruise-label,
  .p-region-filter #trauma-radio:checked ~ .trauma-label { font-size: 14px !important; }
}
