/* Racine AIチャットボット ウィジェット
 * 色は index.html のブランドトークンに合わせてある（--rose-deep / --milk / --shell / --brown）。
 * HPのCSSには一切触れず、この中だけで完結させている（#rcb-root 配下のみを指定） */

#rcb-root {
  --rcb-primary: #B2786D;      /* 濃ローズ（HPの --rose-deep） */
  --rcb-primary-dark: #A06459; /* ホバー時（HPのCTA帯グラデ終端色） */
  --rcb-bg: #FBF7F2;           /* 乳白（HPの --milk） */
  --rcb-user-bubble: #F5EAE3;  /* 桜貝（HPの --shell） */
  --rcb-gold: #E2CDB9;         /* 金茶（HPの --gold） */
  --rcb-text: #4A3A33;         /* 焦茶（HPの --brown） */
  position: fixed;
  right: 20px;
  bottom: 20px;
  font-family: 'Zen Kaku Gothic New', "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: .03em;
}

/* ---- FABボタン ---- */
#rcb-fab {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--rcb-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(178, 120, 109, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background .15s ease;
}
#rcb-fab:hover { background: var(--rcb-primary-dark); transform: scale(1.06); }

/* ---- チャットウィンドウ ---- */
#rcb-window {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: var(--rcb-bg);
  border-radius: 18px;
  box-shadow: 0 10px 34px rgba(74, 58, 51, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* ★必須: 上の display:flex は ID指定なので、ブラウザ標準の [hidden]{display:none} より
   優先度が高い。この1行が無いと hidden 属性が効かず、最初からチャットが開いた状態で
   表示されてしまう（2026-08-13に実際に発生）。閉じた状態を保つための指定。 */
#rcb-window[hidden] {
  display: none;
}

.rcb-header {
  background: var(--rcb-primary);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rcb-title { font-size: 14px; font-weight: 500; letter-spacing: .1em; }
.rcb-close {
  border: none;
  background: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.rcb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  /* 回答が来たとき「直前の質問が上に来る位置」までスクロールする処理が、
     子要素の offsetTop をこの要素からの距離として測るために必要。
     これが無いと基準がページ全体になり、位置がずれる。 */
  position: relative;
}

/* ---- メッセージバブル ---- */
.rcb-msg { margin-bottom: 10px; display: flex; }
.rcb-msg-user { justify-content: flex-end; }
.rcb-msg-bot { justify-content: flex-start; }
.rcb-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--rcb-text);
  word-break: break-word;
}
.rcb-msg-bot .rcb-bubble { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(74,58,51,.10); }
.rcb-msg-user .rcb-bubble { background: var(--rcb-user-bubble); border-bottom-right-radius: 4px; }

/* 入力中インジケータ */
.rcb-typing .rcb-bubble span {
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: #aaa;
  animation: rcb-blink 1.2s infinite;
}
.rcb-typing .rcb-bubble span:nth-child(2) { animation-delay: .2s; }
.rcb-typing .rcb-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes rcb-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---- CTAバナー ---- */
.rcb-banner-wrap { justify-content: flex-start; }
.rcb-banner {
  display: block;
  width: 88%;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--rcb-primary);
  color: #fff;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 12px rgba(74,58,51,.16);
  transition: opacity .15s ease;
}
.rcb-banner:hover { opacity: .88; }
.rcb-banner-label { display: block; font-size: 14px; font-weight: 600; }
.rcb-banner-sub { display: block; font-size: 11.5px; margin-top: 3px; opacity: .9; }

/* ---- クイック返信 ---- */
.rcb-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.rcb-suggestion {
  border: 1px solid var(--rcb-gold);
  background: #fff;
  color: var(--rcb-primary-dark);
  font-family: inherit;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s ease;
}
.rcb-suggestion:hover { background: var(--rcb-user-bubble); }

/* ---- 免責・入力欄 ---- */
.rcb-disclaimer {
  font-size: 10px;
  color: #8A7568;
  text-align: center;
  padding: 4px 10px 2px;
  background: #fff;
}
.rcb-inputbar {
  display: flex;
  gap: 8px;
  padding: 8px 10px 10px;
  background: #fff;
  border-top: 1px solid #F0E6DD;
}
.rcb-input {
  flex: 1;
  border: 1px solid #E7DCD3;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  resize: none;
  outline: none;
  font-family: inherit;
}
.rcb-input:focus { border-color: var(--rcb-primary); }
.rcb-send {
  border: none;
  background: var(--rcb-primary);
  color: #fff;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: .08em;
  cursor: pointer;
}
.rcb-send:disabled { opacity: .5; cursor: default; }

/* ---- スマホ ---- */
@media (max-width: 480px) {
  #rcb-window {
    width: calc(100vw - 16px);
    right: -12px;
    height: 72vh;
  }
}
