/**
 * restriction_check.css — 一覧の「規制チェック」（入口・進捗・バッジ・説明モーダル）
 *
 * - バッジの色は watch.css の .status-badge（8種）に合わせる。watch.css 全体は読み込まない。
 * - 「通常」は件数が多いので、一覧では控えめな見た目にしている（画面を見ながら調整する前提）。
 * - 確認待ち・確認中・取得失敗・判定不能・未確認は、確定した8種と見分けられる破線の見た目。
 */

/* === 入口（メタ情報・解析欄の「動画ページ」の右） === */
.rc-trigger {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #ffc107;
  color: #2b2b2b;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: bold;
  line-height: 1.5;
  cursor: pointer;
  font-family: inherit;
}
.rc-trigger:hover { background: #ffb300; }
.rc-trigger:focus-visible { outline: 2px solid #2b2b2b; outline-offset: 2px; }
.rc-trigger:disabled { opacity: 0.7; cursor: progress; }

/* === パネル（対象範囲・進捗・集計） === */
.rc-panel {
  margin-top: 0;
  font-size: 0.8125rem;
  color: #333;
}
.rc-scope {
  margin: 0;
  color: #555;
}
.rc-status:empty { display: none; }
.rc-status {
  margin-top: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #fff;
  border: 1px solid #cfe2ff;
  border-radius: 6px;
}
.rc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; }
.rc-target { margin: 0.2rem 0 0; font-size: 0.75rem; color: #555; }
.rc-muted { color: #6c757d; font-size: 0.75rem; }
.rc-bar {
  height: 6px;
  margin: 0.45rem 0 0.2rem;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}
.rc-bar > span {
  display: block;
  height: 100%;
  background: #ffc107;
  transition: width 0.2s ease;
}
.rc-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  margin-top: 0.5rem;
}
.rc-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: #333;
  cursor: pointer;
}
.rc-count:hover .rc-badge { filter: brightness(0.95); }
.rc-count.is-active { font-weight: bold; }
.rc-count.is-active .rc-badge { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0d6efd; }
.rc-count:focus-visible { outline: 2px solid #0056b3; outline-offset: 2px; border-radius: 3px; }
.rc-filter-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.6rem;
  background: #eef4ff;
  border: 1px solid #b6d0ff;
  border-radius: 4px;
}
.rc-btn-unfilter { margin-left: auto; padding: 0.15rem 0.7rem; }
.rc-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.rc-btn {
  padding: 0.3rem 0.7rem;
  background: #fff;
  color: #333;
  border: 1px solid #adb5bd;
  border-radius: 4px;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.rc-btn:hover { background: #f1f3f5; }
.rc-btn-stop { border-color: #dc3545; color: #b02a37; }
.rc-btn-retry { border-color: #c79100; background: #fff8e1; }
.rc-note, .rc-message {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: #6c757d;
}
.rc-message { color: #333; }

/* === バッジ（カードのタイトル前・集計・モーダル共通） === */
.rc-badge {
  display: inline-block;
  padding: 0 6px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  line-height: 1.6;
  color: #fff;
  white-space: nowrap;
  vertical-align: 1px;
  cursor: pointer;
}
button.rc-badge:focus-visible { outline: 2px solid #0056b3; outline-offset: 1px; }

.rc-badge--normal { background: #eaf6ed; color: #1e7e34; border-color: #b7dfc2; }
.rc-badge--private { background: #343a40; }
.rc-badge--deleted { background: #6c757d; }
.rc-badge--copyright { background: #800000; }
.rc-badge--device { background: #ffc107; color: #333; }
.rc-badge--paid { background: #dc3545; }
.rc-badge--premium { background: #6f42c1; }
.rc-badge--admission { background: #dc3545; }

.rc-badge--queued,
.rc-badge--checking,
.rc-badge--cancelled { background: #fff; color: #6c757d; border: 1px dashed #adb5bd; font-weight: normal; }
.rc-badge--checking { animation: rc-pulse 1s ease-in-out infinite alternate; }
.rc-badge--failed { background: #fff; color: #b02a37; border: 1px dashed #dc3545; }
.rc-badge--undetermined { background: #fff; color: #495057; border: 1px dashed #6c757d; }

@keyframes rc-pulse { from { opacity: 1; } to { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .rc-badge--checking { animation: none; }
}

/* カード内の位置: タイトルの直前（PC: .rank-title-pc / スマホ: .rank-title） */
.rank-title > .rc-badge,
.rank-title-pc > .rc-badge { margin-right: 6px; }

/* デバイス制限のカード: 薄い黄色の背景＋左端の黄色線（PC・スマホ共通。線は inset の影でレイアウトを動かさない） */
.rank-item.rc-card-device {
  background-color: #fff8e1;
  box-shadow: inset 4px 0 0 #ffc107;
}
.rank-item.rc-card-device:hover { background-color: #fff3cd; }

/* 結果での絞り込み: 対象外のカードを隠す（既存の is-tag-filter-hidden とは別。両方の条件を満たすカードだけ出る） */
.rank-item.rc-status-hidden { display: none !important; }

/* === 動画検索（キーワード・タグ） ===
 * 入口は「メタ情報・解析」ダイアログの「公式で確認」の右。進捗・集計は並び順の行の下、一覧の上。
 * バッジは .video-title-row（タイトル＋解析ボタンの横並び）の先頭に入る。 */
/* 入口の大きさは隣の「公式で確認」（search.css の .official-confirm-btn）に揃える */
.rc-trigger--search,
.rc-trigger--entity {
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}
.rc-panel--search .rc-status { margin: 0 0 8px; }
.video-title-row > .rc-badge { flex-shrink: 0; margin-top: 1px; }
.video-card.rc-card-device {
  background-color: #fff8e1;
  box-shadow: inset 4px 0 0 #ffc107, 0 1px 4px rgba(0, 0, 0, 0.06);
}
.video-card.rc-card-device:hover { background-color: #fff3cd; }
.video-card.rc-status-hidden { display: none !important; }

/* === ユーザー投稿動画・シリーズ・マイリスト ===
 * 入口は上部の「公式で確認」の右。進捗・集計は並び順・絞り込みの下、動画一覧の上。
 * カード・バッジは検索と同じ .video-card。このCSSは入口を出すときだけ読み込まれる。
 * シリーズ・マイリストの右上の枠（entity_detail.css で絶対配置）は、PCでは2つ横並びにして本文側の余白を広げ、
 * スマホ（600px以下）では本文の下に普通に並べる（右上に2つ置くとタイトル・投稿者名・サムネイルに重なるため）。 */
.user-profile-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.entity-detail-header-series .entity-detail-actions,
.entity-detail-header-mylist .entity-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
@media (min-width: 601px) {
  .entity-detail-header-series .entity-detail-info,
  .entity-detail-header-mylist .entity-detail-info { padding-right: 230px; }
}
@media (max-width: 600px) {
  .entity-detail-header-series .entity-detail-actions,
  .entity-detail-header-mylist .entity-detail-actions {
    position: static;
    margin-top: 8px;
  }
  .entity-detail-header-series .entity-detail-title,
  .entity-detail-header-mylist .entity-detail-title { padding-right: 0; }
}
.rc-panel--entity .rc-status { margin: 0 0 10px; }

/* === リアルタイムランキング ===
 * 入口は「メタ情報・解析」（折り畳み）の中。カードは .rtr-item、バッジは .rtr-title の先頭。
 * 既存の検索・絞り込みは style.display で隠すため、結果での絞り込みはクラスで重ねる。 */
.rtr-meta-actions { margin: 0.75rem 0 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rtr-title > .rc-badge { margin-right: 6px; vertical-align: 2px; }
.rtr-item.rc-card-device {
  background-color: #fff8e1;
  box-shadow: inset 4px 0 0 #ffc107, 0 1px 2px rgba(0, 0, 0, 0.04);
}
.rtr-item.rc-card-device:hover { background-color: #fff3cd; }
.rtr-item.rc-status-hidden { display: none !important; }

/* === 説明モーダル（watch の「視聴ステータスについて」と同じ内容） === */
.rc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-modal-overlay[hidden] { display: none; }
.rc-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90vw;
  max-height: 90vh;
  overflow: auto;
}
.rc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  font-size: 1rem;
}
.rc-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.rc-modal-close:hover, .rc-modal-close:focus-visible { color: #333; }
.rc-modal-body { padding: 12px 20px 16px; }
.rc-modal-context {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 0.85rem;
}
.rc-modal-context-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: bold; }
.rc-modal-context-line { margin: 4px 0 0; color: #555; font-size: 0.8rem; }
.rc-modal-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.9rem;
}
.rc-modal-row:last-of-type { border-bottom: none; }
.rc-modal-row .rc-badge {
  flex-shrink: 0;
  min-width: 80px;
  padding: 4px 12px;
  font-size: 0.85rem;
  text-align: center;
  cursor: default;
}
.rc-modal-row.is-current { background: #fff8e1; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 4px; }
.rc-modal-context .rc-badge { cursor: default; }
.rc-modal-note { margin: 8px 0 0; font-size: 0.75rem; color: #6c757d; }

/* === 画面下の小さな進捗（パネルが画面外のときだけ） === */
.rc-float {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 40px);
  padding: 6px 8px 6px 14px;
  background: rgba(33, 37, 41, 0.92);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  font-size: 0.8125rem;
}
.rc-float[hidden] { display: none; }
.rc-float-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-float-btn {
  flex-shrink: 0;
  padding: 2px 10px;
  background: #ffc107;
  color: #2b2b2b;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}
.rc-float-close { background: transparent; color: #fff; padding: 2px 6px; font-weight: normal; }

@media (max-width: 768px) {
  /* 下端は「ページ設定」「↑」ボタンが使うので、スマホでは画面上端に横いっぱいで出す */
  .rc-float {
    top: 8px;
    bottom: auto;
    left: 8px;
    right: 8px;
    max-width: none;
    justify-content: space-between;
    font-size: 0.75rem;
  }
  .rank-title > .rc-badge { font-size: 10px; padding: 0 4px; margin-right: 4px; }
  .video-title-row > .rc-badge { font-size: 10px; padding: 0 4px; }
  .rtr-title > .rc-badge { font-size: 10px; padding: 0 4px; margin-right: 4px; }
}
