/* RE/MAX BASE サイト内チャット
   ============================================================================
   5ページで使うため、このサイトでは例外的に共通ファイルに切り出している
   （他は各HTMLに直接書く方針。同じ300行を5枚に複製するのは避けた）。

   色はサイトのトークン（--accent など）を参照せず、この中で完結させている。
   ページごとに変数名が違うため、依存すると1ページだけ色が外れる。
   ============================================================================ */

.rbc {
  --rbc-navy: #1e2d45;
  --rbc-gold: #b8966e;
  --rbc-ink: #1a1a1a;
  --rbc-line: #e6e0d6;
  --rbc-paper: #ffffff;
  --rbc-soft: #f7f6f4;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
}

/* ---- 開くボタン ---- */
.rbc-launch {
  position: fixed; right: 24px; bottom: 96px; z-index: 9990;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 20px 0 18px;
  border: 0; border-radius: 26px;
  background: var(--rbc-navy); color: #fff;
  font-size: 0.86rem; letter-spacing: 0.06em; font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(30,45,69,0.28);
  transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease;
}
.rbc-launch:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(30,45,69,0.34); }
.rbc-launch svg { width: 19px; height: 19px; fill: currentColor; flex: none; }
.rbc-launch.is-hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }

/* ---- 本体 ---- */
.rbc-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 9991;
  width: 380px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 140px);
  display: flex; flex-direction: column;
  background: var(--rbc-paper);
  border: 1px solid var(--rbc-line); border-radius: 10px;
  box-shadow: 0 18px 50px rgba(20,25,35,0.22);
  overflow: hidden;
  opacity: 0; transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.rbc-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

.rbc-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 15px 14px 15px 18px;
  background: var(--rbc-navy); color: #fff;
}
.rbc-head-title { font-size: 0.9rem; letter-spacing: 0.06em; font-weight: 500; }
.rbc-head-sub { font-size: 0.7rem; color: rgba(255,255,255,0.66); margin-top: 2px; }
.rbc-close {
  margin-left: auto; flex: none;
  width: 40px; height: 40px; margin-right: -8px;
  border: 0; background: none; color: rgba(255,255,255,0.82);
  font-size: 1.2rem; line-height: 1; cursor: pointer; border-radius: 50%;
}
.rbc-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ---- 会話 ---- */
.rbc-log {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 16px; background: var(--rbc-soft);
  display: flex; flex-direction: column; gap: 12px;
  overscroll-behavior: contain;   /* 端まで来てもページ側をスクロールさせない */
}
.rbc-msg { max-width: 84%; font-size: 0.86rem; line-height: 1.85; white-space: pre-wrap; word-break: auto-phrase; }
.rbc-msg.bot {
  align-self: flex-start;
  background: var(--rbc-paper); color: var(--rbc-ink);
  border: 1px solid var(--rbc-line); border-radius: 3px 12px 12px 12px;
  padding: 11px 14px;
}
.rbc-msg.me {
  align-self: flex-end;
  background: var(--rbc-navy); color: #fff;
  border-radius: 12px 3px 12px 12px;
  padding: 11px 14px;
}
.rbc-msg a { color: var(--rbc-gold); text-decoration: underline; text-underline-offset: 2px; }
.rbc-msg.me a { color: #e8ddd0; }

/* 応答待ちの三点 */
.rbc-typing { align-self: flex-start; display: flex; gap: 5px; padding: 13px 15px;
  background: var(--rbc-paper); border: 1px solid var(--rbc-line); border-radius: 3px 12px 12px 12px; }
.rbc-typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9b4ab; animation: rbcDot 1.2s infinite ease-in-out; }
.rbc-typing i:nth-child(2) { animation-delay: .15s; }
.rbc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rbcDot { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---- よくある質問（最初だけ出す） ---- */
.rbc-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.rbc-chip {
  border: 1px solid var(--rbc-line); background: var(--rbc-paper);
  color: #46505e; font-family: inherit; font-size: 0.76rem;
  padding: 8px 13px; border-radius: 16px; cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.rbc-chip:hover { border-color: var(--rbc-gold); color: var(--rbc-navy); background: #fffdf9; }

/* ---- 入力 ---- */
.rbc-form { flex: none; display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--rbc-line); background: var(--rbc-paper); }
.rbc-input {
  flex: 1; min-width: 0; resize: none;
  border: 1px solid var(--rbc-line); border-radius: 6px;
  padding: 11px 12px; font-family: inherit; font-size: 0.86rem; line-height: 1.6;
  max-height: 96px; color: var(--rbc-ink); background: #fff;
}
.rbc-input:focus { outline: none; border-color: var(--rbc-gold); }
.rbc-send {
  flex: none; width: 44px; height: 44px; align-self: flex-end;
  border: 0; border-radius: 6px; background: var(--rbc-navy); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.rbc-send:disabled { opacity: .45; cursor: default; }
.rbc-send svg { width: 17px; height: 17px; fill: currentColor; }

.rbc-note {
  flex: none; padding: 0 14px 11px; background: var(--rbc-paper);
  font-size: 0.68rem; color: #8b8b8b; line-height: 1.7;
}
.rbc-note a { color: #8a6b45; text-decoration: underline; text-underline-offset: 2px; }

/* ---- スマホ ---- */
@media (max-width: 600px) {
  .rbc-launch { right: 16px; bottom: 80px; height: 48px; padding: 0 17px 0 15px; font-size: 0.8rem; }
  .rbc-panel {
    right: 0; left: 0; bottom: 0;
    width: auto; max-width: none;
    height: 82vh; max-height: none;
    border-radius: 12px 12px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rbc-launch, .rbc-panel { transition: none; }
  .rbc-typing i { animation: none; }
}
