/* /labs/publication-analytics 専用スタイル */

/* ---------- 旧インラインstyleからの移設 ---------- */

.list-title {
  color: #111;
  all: unset;
  font-size: 20px;
  font-weight: bold;
}

.recommend-desc {
  font-size: 14px;
}

.openchat-item-lower {
  line-height: 1.2rem;
}

body > .google-auto-placed {
  margin: 0 1rem;
  width: auto !important;
}

/* ---------- 冒頭リード・レジェンド ---------- */

.rb-lead {
  font-size: 15px;
  line-height: 1.8;
  color: #3d4043;
  margin: 0.5rem 0 0 0;
}

.rb-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}

.rb-dot--gone {
  background-color: #d9333f;
}

.rb-dot--back {
  background-color: #06c755;
}

/* ---------- プリセットチップ ---------- */

/* mvp.css の section{display:flex;justify-content:center} を打ち消す
   （効いたままだと子がfit-content幅で中央寄せになり、ラベル・チップの左端がバラバラに崩れる） */
.rb-presets-outer,
.rb-panel {
  display: block;
}

.rb-presets-outer {
  margin-top: 1.25rem;
}

.rb-presets-title {
  all: unset;
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #5b6066;
  margin-bottom: 8px;
}

/* 全チップを常時表示（横スクロールは「気づかれない」ため折り返す） */
.rb-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* キーワード＝プリセットと並ぶ主役の絞り込み */
.rb-presets-outer .rb-search {
  margin-top: 10px;
}

.rb-preset {
  all: unset;
  box-sizing: border-box;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #ededf0;
  border-radius: 999px;
  font-size: 13px;
  color: #3d4043;
  background-color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
  font-family: var(--font-family);
}

.rb-preset:hover {
  background-color: #f7faf8;
}

.rb-preset:focus-visible {
  outline: 2px solid #06c755;
  outline-offset: 1px;
}

.rb-preset.is-active {
  background-color: #06c75514;
  border-color: #06c755;
  color: #111;
  font-weight: bold;
}

/* ---------- 詳細設定（プロ向け・普段は閉じる折りたたみ） ---------- */

.rb-advanced {
  margin: 12px 0 0; /* mvp.css の details{margin:1.3rem 0} を上書き */
  border: 1px solid #ededf0;
  border-radius: 12px;
  background-color: #fff;
}

.rb-advanced > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: bold;
  color: #5b6066;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.rb-advanced > summary::-webkit-details-marker {
  display: none;
}

/* シェブロン（閉: ▾向き手前 / 開: ▴） */
.rb-advanced > summary::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid #8a9097;
  border-bottom: 2px solid #8a9097;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.rb-advanced[open] > summary::before {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.rb-advanced-sub {
  font-weight: normal;
  font-size: 12px;
  color: #8a9097;
}

/* ---------- フィルタパネル ---------- */

.rb-panel {
  border: 1px solid #ededf0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  background-color: #fff;
}

/* 詳細設定の中ではパネルの枠を外す（二重枠回避） */
.rb-advanced .rb-panel {
  border: none;
  border-radius: 0;
  margin-top: 0;
  padding: 4px 16px 16px;
}

.rb-field {
  margin-bottom: 14px;
}

.rb-field:last-of-type {
  margin-bottom: 0;
}

.rb-field-label {
  font-size: 13px;
  font-weight: bold;
  color: #111;
  margin-bottom: 6px;
}

.rb-field-hint {
  font-size: 12px;
  color: #8a9097;
  margin: 6px 0 0 0;
  line-height: 1.6;
}

@media screen and (min-width: 512px) {
  .rb-field {
    display: grid;
    grid-template-columns: 9.5em 1fr;
    align-items: start;
    gap: 12px;
  }

  .rb-field-label {
    margin-bottom: 0;
    padding-top: 13px;
  }
}

/* セグメントコントロール */

.rb-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.rb-seg-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #ededf0;
  border-radius: 8px;
  cursor: pointer;
  background-color: #fff;
  transition: background-color 0.15s, border-color 0.15s;
  padding: 2px 4px;
  box-sizing: border-box;
}

.rb-seg-item input[type='radio'] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.rb-seg-text {
  font-size: 13px;
  color: #3d4043;
  text-align: center;
  line-height: 1.3;
}

.rb-seg-item:hover {
  background-color: #f7faf8;
}

.rb-seg-item.is-selected {
  background-color: #06c75514;
  border: 1.5px solid #06c755;
  padding: 1.5px 3.5px;
}

.rb-seg-item.is-selected .rb-seg-text {
  font-weight: bold;
  color: #111;
}

.rb-seg-item:has(input:focus-visible) {
  outline: 2px solid #06c755;
  outline-offset: 1px;
}

/* 期間（消えた時期）。mvp.css の input{padding:.4rem .8rem} 等は自前指定で打ち消す */

.rb-dates {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rb-date-input {
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #ededf0;
  border-radius: 8px;
  font-size: 15px;
  color: #111;
  background-color: #fff;
  font-family: var(--font-family);
  -webkit-appearance: none;
  appearance: none;
}

.rb-date-input:focus {
  border-color: #06c755;
  outline: none;
}

.rb-dates-sep {
  flex: none;
  color: #8a9097;
}

/* キーワード検索 */

.rb-search {
  position: relative;
  display: flex;
}

.rb-search input[type='search'] {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0 38px 0 12px;
  border: 1px solid #ededf0;
  border-radius: 8px;
  font-size: 16px; /* iOSズーム回避 */
  color: #111;
  background-color: #fff;
  font-family: var(--font-family);
}

.rb-search input[type='search']::-webkit-search-cancel-button {
  display: none; /* 自作×との二重×回避 */
}

.rb-search input[type='search']:focus {
  border-color: #06c755;
}

.rb-search input[type='search']::placeholder {
  color: #8a9097;
  font-size: 13px;
}

.rb-search-clear {
  all: unset;
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  color: #8a9097;
  cursor: pointer;
}

.rb-search-clear:hover {
  background-color: #f4f5f6;
}

.rb-search-clear.is-hidden {
  display: none;
}

/* ライブサマリーバー */

.rb-summary {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid #06c755;
  background-color: #f7faf8;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  color: #3d4043;
  line-height: 1.7;
}

.rb-summary-count {
  font-weight: bold;
  color: #111;
  white-space: nowrap;
}

/* ---------- ローディング（初回・2回目以降で共通。常に結果の先頭） ---------- */

#rb-loading {
  margin-top: 12px;
}

.rb-loading-text {
  font-size: 13px;
  color: #8a9097;
  margin: 8px 0 0;
}

/* 細いプログレスバー */
.rb-progress {
  position: relative;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background-color: #ededf0;
}

.rb-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background-color: #06c755;
  border-radius: 2px;
  animation: rb-progress-slide 1.1s ease-in-out infinite;
}

@keyframes rb-progress-slide {
  0% {
    left: -40%;
  }

  100% {
    left: 100%;
  }
}

/* 2回目以降: 旧リストのstale表示 */
#analytics-results.is-stale {
  opacity: 0.5;
  pointer-events: none;
}

/* 初回: スケルトン */
.rb-skeleton {
  margin-top: 1rem;
}

.rb-skel-card {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #ededf0;
}

.rb-skel-img {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
}

.rb-skel-lines {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.rb-skel-line {
  height: 12px;
  border-radius: 4px;
}

.rb-skel-line.short {
  width: 55%;
}

.rb-skel-img,
.rb-skel-line {
  background: linear-gradient(90deg, #f4f5f6 25%, #ededf0 37%, #f4f5f6 63%);
  background-size: 400% 100%;
  animation: rb-shimmer 1.4s ease infinite;
}

@keyframes rb-shimmer {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

/* エラー表示 */
.rb-error {
  text-align: center;
  padding: 2rem 0;
  font-size: 14px;
  color: #5b6066;
}

.rb-retry {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  margin-top: 8px;
  border: 1px solid #06c755;
  border-radius: 999px;
  color: #06c755;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  font-family: var(--font-family);
}

.rb-retry:hover {
  background-color: #06c75514;
}

/* ---------- 結果フラグメント ---------- */

.rb-count {
  display: inline-block;
  font-size: 13px;
  white-space: pre-wrap;
  color: #111;
  margin-top: 4px;
}

.rb-empty {
  text-align: center;
  color: #5b6066;
  padding: 1.5rem 0;
}

/* select要素ページネーション（旧インラインstyleの移設） */
.rb-results-inner .page-select {
  margin-top: 1.75rem;
  padding-bottom: 0.85rem;
}

/* ---------- 結果カード ---------- */

.rb-card-footer {
  line-height: 1.5;
}

.rb-badge-row {
  margin-top: 3px;
}

.rb-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.rb-badge--gone {
  color: #d9333f;
  background-color: #fdf1f2;
}

.rb-badge--back {
  color: #06c755;
  background-color: #e9faf0;
}

.rb-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  font-size: 13px;
  color: #5b6066;
  margin-top: 4px;
}

.rb-meta-diff {
  color: #8a9097;
}

.rb-meta-sep {
  color: #8a9097;
}

.rb-meta .openchat-item-mui-chip-inner {
  margin-left: 2px;
}

.rb-change-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  margin-top: 4px;
}

.rb-change-label {
  font-weight: bold;
  color: #5b6066;
  white-space: nowrap;
}

.rb-change-label--caused {
  color: #d9333f;
}

.rb-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rb-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12px;
  color: #5b6066;
  background-color: #f4f5f6;
  white-space: nowrap;
}

.rb-change-none {
  font-size: 13px;
  color: #8a9097;
}

.rb-timeline {
  font-size: 12px;
  color: #8a9097;
  margin-top: 4px;
}

/* ---------- ページャ（ピル型に整える） ---------- */

.rb-pager .rb-pager-btn a {
  border: 1px solid #ededf0;
  border-radius: 999px;
  height: 44px;
  transition: background-color 0.15s;
}

.rb-pager .rb-pager-btn a:hover {
  background-color: #f7faf8;
}

.rb-pager .rb-pager-btn.prev a {
  border: 1px solid #ededf0;
  background-color: #fff;
}
