/* Claude相談チャットBOT ウィジェット — _docs/claude-chatbot-design.md
   既存LP（css/style.css）の terra / クリーム系トンマナに合わせる。全クラス casbot- 接頭辞。 */

.casbot,
.casbot * { box-sizing: border-box; }

.casbot {
  --cb-terra: var(--terra, #c2522f);
  --cb-terra-deep: var(--terra-deep, #a8401f);
  --cb-paper: var(--paper, #fbf8f2);
  --cb-panel: var(--panel, #fffdf9);
  --cb-line: var(--line, #e2d7c3);
  --cb-tx: var(--tx, #241d14);
  --cb-tx2: var(--tx-2, #574d3c);
  --cb-on-dark: var(--on-dark, #f3ecdf);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  color: var(--cb-tx);
}

/* ---- ランチャー（起動ボタン）---- */
.casbot-launcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px 13px 17px;
  border: none;
  border-radius: 999px;
  background: var(--cb-terra);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(168, 64, 31, .35);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.casbot-launcher:hover { background: var(--cb-terra-deep); transform: translateY(-2px); box-shadow: 0 14px 32px rgba(168, 64, 31, .42); }
.casbot-launcher svg { width: 22px; height: 22px; flex: none; }
.casbot-launcher .casbot-pulse {
  position: absolute; top: -3px; right: -3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #6fa043; border: 2px solid #fff;
}
.casbot-launcher { position: relative; }
.casbot-launcher b { font-weight: 700; }
.casbot-launcher .casbot-lq { font-size: 11px; font-weight: 500; opacity: .9; display: block; margin-top: 1px; }
.casbot-launcher .casbot-ltext { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }

/* ---- 誘い文句のティーザー吹き出し ---- */
.casbot-teaser {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: 244px;
  max-width: calc(100vw - 24px);
  background: var(--cb-panel);
  border: 1px solid var(--cb-line);
  border-left: 4px solid var(--cb-terra);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(21, 17, 11, .2);
  padding: 13px 30px 13px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--cb-tx);
  cursor: pointer;
  animation: casbot-pop .3s ease;
}
.casbot-teaser b { color: var(--cb-terra); }
.casbot-teaser .casbot-teaser-x {
  position: absolute; top: 5px; right: 8px;
  border: none; background: none; cursor: pointer;
  font-size: 17px; line-height: 1; color: var(--muted, #9a8e79);
  padding: 2px;
}
.casbot-teaser .casbot-teaser-x:hover { color: var(--cb-tx); }
.casbot.is-open .casbot-teaser { display: none; }

/* ---- パネル ---- */
.casbot-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 374px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 40px);
  display: none;
  flex-direction: column;
  background: var(--cb-paper);
  border: 1px solid var(--cb-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(21, 17, 11, .28);
}
.casbot.is-open .casbot-panel { display: flex; animation: casbot-pop .22s ease; }
.casbot.is-open .casbot-launcher { display: none; }
@keyframes casbot-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- ヘッダー ---- */
.casbot-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--cb-terra), var(--cb-terra-deep));
  color: #fff;
}
.casbot-head .casbot-avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  display: grid; place-items: center;
}
.casbot-head .casbot-avatar svg { width: 22px; height: 22px; }
.casbot-htext { line-height: 1.3; }
.casbot-htext b { font-size: 15px; font-weight: 700; display: block; }
.casbot-htext span { font-size: 11.5px; opacity: .85; }
.casbot-close {
  margin-left: auto;
  background: none; border: none; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
  opacity: .85; padding: 4px;
}
.casbot-close:hover { opacity: 1; }

/* ---- 本文（メッセージ）---- */
.casbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(194, 82, 47, .05), transparent 60%),
    var(--cb-paper);
}
.casbot-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}
.casbot-msg.bot {
  align-self: flex-start;
  background: var(--cb-panel);
  border: 1px solid var(--cb-line);
  border-bottom-left-radius: 5px;
}
.casbot-msg.user {
  align-self: flex-end;
  background: var(--cb-terra);
  color: #fff;
  border-bottom-right-radius: 5px;
}

/* タイピング表示 */
.casbot-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.casbot-typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cb-tx2); opacity: .5;
  animation: casbot-blink 1.2s infinite;
}
.casbot-typing i:nth-child(2) { animation-delay: .2s; }
.casbot-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes casbot-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: .85; } }

/* サジェストチップ */
.casbot-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.casbot-chip {
  background: var(--cb-panel);
  border: 1px solid var(--cb-line);
  color: var(--cb-tx2);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.casbot-chip:hover { border-color: var(--cb-terra); color: var(--cb-terra); }

/* CTA（フォーム誘導）ボタン */
.casbot-cta {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
  margin-top: 2px;
  background: #15110b; color: #fff;
  text-decoration: none;
  padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700;
}
.casbot-cta:hover { background: var(--cb-terra); }

/* ---- フッター（入力）---- */
.casbot-foot {
  border-top: 1px solid var(--cb-line);
  padding: 10px;
  background: var(--cb-panel);
}
.casbot-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.casbot-foot textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--cb-line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px; /* 16px未満だとiOSがフォーカス時に自動ズームするため16pxに固定 */
  line-height: 1.5;
  max-height: 96px;
  background: #fff;
  color: var(--cb-tx);
}
.casbot-foot textarea:focus { outline: none; border-color: var(--cb-terra); }
.casbot-send {
  flex: none;
  width: 42px; height: 42px;
  border: none; border-radius: 12px;
  background: var(--cb-terra); color: #fff;
  cursor: pointer; display: grid; place-items: center;
  transition: background .15s;
}
.casbot-send:hover:not(:disabled) { background: var(--cb-terra-deep); }
.casbot-send:disabled { opacity: .45; cursor: default; }
.casbot-send svg { width: 19px; height: 19px; }
.casbot-note { margin: 7px 2px 0; font-size: 10.5px; color: var(--muted, #9a8e79); text-align: center; }
.casbot-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- スマホ ---- */
@media (max-width: 480px) {
  /* フローティング枠は全幅にしつつ、ランチャーは必ず右寄せ（flexで右端へ） */
  .casbot { right: 12px; bottom: 12px; left: 12px; display: flex; justify-content: flex-end; align-items: flex-end; }
  .casbot-panel {
    width: auto; left: 0; right: 0;
    height: 76vh; max-height: 76vh;
  }
}
