/* ── 葵チャットボット スタイル ── */

/* ランチャーボタン */
.chat-launcher {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 1000;
}
.chat-launcher__btn {
  width: auto;
  min-width: 58px;
  height: 48px;
  border-radius: 999px;
  background: #4E7363;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 1.1rem 0 0.85rem;
  box-shadow: 0 4px 20px rgba(78,115,99,0.42);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
  position: relative;
}
.chat-launcher__label {
  color: #fff;
  font-size: 0.78rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: opacity 0.18s, max-width 0.25s;
  max-width: 140px;
  overflow: hidden;
}
.chat-launcher__btn.is-open .chat-launcher__label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}
.chat-launcher__btn:hover {
  transform: scale(1.07);
  box-shadow: 0 8px 32px rgba(78,115,99,0.52);
}
.chat-launcher__btn.is-open { background: #5C5751; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }

/* アイコンラッパー：絶対配置でオーバーレイ、アイコンが切り替わる */
.chat-launcher__icon-wrap {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.chat-launcher__btn svg {
  width: 22px; height: 22px; color: #fff;
  position: absolute;
  top: 0; left: 0;
  transition: opacity 0.2s, transform 0.3s cubic-bezier(.34,1.56,.64,1);
}
.icon-chat  { opacity: 1; transform: scale(1) rotate(0deg); }
.icon-close { opacity: 0; transform: scale(0.4) rotate(-90deg); }
.chat-launcher__btn.is-open .icon-chat  { opacity: 0; transform: scale(0.4) rotate(90deg); }
.chat-launcher__btn.is-open .icon-close { opacity: 1; transform: scale(1) rotate(0deg); }
.chat-badge {
  position: absolute; top: -2px; right: -2px;
  width: 17px; height: 17px;
  background: #C0392B; border-radius: 50%;
  border: 2px solid #F5F4F0;
  font-size: 0.58rem; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: badge-pulse 2s infinite;
}
@keyframes badge-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* チャットウィンドウ */
.chat-window {
  position: fixed;
  bottom: 5.25rem;
  right: 1.75rem;
  width: 355px;
  max-height: 600px;
  background: #FAFAF8;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(26,25,22,0.17), 0 4px 16px rgba(26,25,22,0.07);
  border: 1px solid #CCC6BB;
  display: flex; flex-direction: column; overflow: hidden;
  z-index: 999;
  transform-origin: bottom right;
  transform: scale(0.88) translateY(14px);
  opacity: 0; pointer-events: none;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), opacity 0.22s ease;
}
.chat-window.is-open {
  transform: scale(1) translateY(0);
  opacity: 1; pointer-events: auto;
}

/* ヘッダー */
.chat-header {
  background: #4E7363;
  padding: 0.875rem 1.125rem;
  display: flex; align-items: center; gap: 0.7rem;
  flex-shrink: 0; position: relative; overflow: hidden;
}
.chat-header::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, transparent 55%);
  pointer-events: none;
}
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.14);
  border: 1.5px solid rgba(255,255,255,0.32);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Noto Serif JP', serif; font-size: 1rem; color: #fff;
  flex-shrink: 0; position: relative;
}
.chat-avatar__dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: #6FCF97; border-radius: 50%;
  border: 1.5px solid #4E7363;
}
.chat-header__name {
  font-family: 'Noto Serif JP', serif; font-size: 0.9375rem;
  font-weight: 600; color: #fff; letter-spacing: 0.06em; line-height: 1.3;
}
.chat-header__sub {
  font-size: 0.68rem; color: rgba(255,255,255,0.68);
  letter-spacing: 0.07em; font-family: 'Cormorant Garamond', Georgia, serif;
}

/* メッセージエリア */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 1.125rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.9rem;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #C8B89A; border-radius: 2px; }

/* メッセージ */
.chatbot-msg {
  display: flex; gap: 0.55rem; align-items: flex-end;
  animation: chatbot-msg-in 0.32s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes chatbot-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chatbot-msg--bot { align-self: flex-start; }
.chatbot-msg__mini-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #4E7363;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Noto Serif JP', serif; font-size: 0.6rem; color: #fff;
  flex-shrink: 0;
}
.chatbot-msg--bot .chatbot-msg__bubble {
  background: #EDEAE3;
  border: 1px solid #CCC6BB;
  color: #1A1916;
  border-radius: 14px 14px 14px 3px;
  padding: 0.65rem 0.85rem;
  font-size: 0.8375rem; line-height: 1.78;
  max-width: 255px;
  word-break: break-all;
  overflow-wrap: break-word;
}
.chatbot-msg--user {
  align-self: flex-end; flex-direction: row-reverse;
}
.chatbot-msg--user .chatbot-msg__bubble {
  background: #4E7363; color: #fff;
  border-radius: 14px 14px 3px 14px;
  padding: 0.65rem 0.85rem;
  font-size: 0.8375rem; line-height: 1.78;
  max-width: 230px;
  word-break: break-all;
  overflow-wrap: break-word;
}
.chatbot-msg__time {
  font-size: 0.62rem; color: #8C857E;
  letter-spacing: 0.04em; margin-top: 0.18rem;
}
.chatbot-msg--bot .chatbot-msg__time { padding-left: 32px; }
.chatbot-msg--user .chatbot-msg__time { text-align: right; }

/* 選択肢 */
.chatbot-choices {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0 0.2rem;
  animation: chatbot-msg-in 0.38s cubic-bezier(.34,1.56,.64,1) both;
}
.chatbot-choice-btn {
  background: #FAFAF8;
  border: 1.5px solid #CCC6BB;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem; font-family: 'Noto Sans JP', sans-serif;
  color: #1A1916;
  text-align: left; cursor: pointer; line-height: 1.55;
  transition: border-color 0.16s, background 0.16s, color 0.16s;
  letter-spacing: 0.02em;
}
.chatbot-choice-btn:hover { border-color: #8B7355; background: #EDE4D6; color: #8B7355; }
.chatbot-choice-btn.is-selected { border-color: #4E7363; background: rgba(78,115,99,0.09); color: #4E7363; pointer-events: none; }
.chatbot-choice-btn:disabled { opacity: 0.45; pointer-events: none; }

/* 結果カード */
.chatbot-result-card {
  background: #EDE4D6;
  border: 1.5px solid #C8B89A;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  font-size: 0.8rem; line-height: 1.82;
  max-width: 255px; margin-left: 32px;
  animation: chatbot-msg-in 0.4s cubic-bezier(.34,1.56,.64,1) both;
}
.chatbot-result-card__eyebrow {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.62rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: #8B7355;
  margin-bottom: 0.3rem; display: block;
}
.chatbot-result-card__title {
  font-family: 'Noto Serif JP', serif;
  font-size: 1rem; font-weight: 600;
  color: #1A1916; letter-spacing: 0.06em;
  margin-bottom: 0.55rem; line-height: 1.4;
}
.chatbot-result-card__body {
  color: #5C5751; font-size: 0.8rem;
  line-height: 1.82;
}
.chatbot-result-card__symptoms {
  margin-top: 0.55rem;
  display: flex; flex-wrap: wrap; gap: 0.3rem;
}
.chatbot-symptom-tag {
  background: rgba(139,115,85,0.1);
  border: 1px solid #C8B89A;
  border-radius: 20px;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem; color: #8B7355;
  letter-spacing: 0.03em;
}
.chatbot-result-card__look {
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: rgba(255,255,255,0.55);
  border-radius: 8px;
  font-size: 0.75rem; color: #5C5751;
  border-left: 2px solid #C8B89A;
}
.chatbot-result-card__look strong {
  color: #8B7355; font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; display: block; margin-bottom: 0.15rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
}
.chatbot-result-card__btn {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; margin-top: 0.8rem;
  padding: 0.6rem 1rem;
  background: #4E7363; color: #fff;
  border-radius: 8px; font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.04em; text-decoration: none;
  transition: background 0.18s; cursor: pointer; border: none;
  font-family: 'Noto Sans JP', sans-serif;
}
.chatbot-result-card__btn:hover { background: #3D5F51; }
.chatbot-result-card__btn--tel {
  background: transparent;
  color: #4E7363;
  border: 1.5px solid #4E7363;
  margin-top: 0.4rem;
  text-decoration: none;
}
.chatbot-result-card__btn--tel:hover { background: rgba(78,115,99,0.08); }
.chatbot-result-card__btn--line {
  background: #06C755;
  color: #fff;
  border: none;
  margin-top: 0.4rem;
  text-decoration: none;
}
.chatbot-result-card__btn--line:hover { background: #05a847; }

/* タイピング */
.chatbot-typing-wrap {
  display: flex; gap: 0.55rem; align-items: flex-end;
  animation: chatbot-msg-in 0.28s ease both;
}
.chatbot-typing-dots {
  background: #EDEAE3; border: 1px solid #CCC6BB;
  border-radius: 14px 14px 14px 3px;
  padding: 0.65rem 0.85rem;
  display: flex; gap: 4px; align-items: center;
}
.chatbot-typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: #8C857E;
  animation: chatbot-typing-dot 1.2s infinite;
}
.chatbot-typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.chatbot-typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes chatbot-typing-dot {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* 区切り */
.chatbot-divider {
  text-align: center; font-size: 0.62rem; color: #8C857E;
  letter-spacing: 0.12em; font-family: 'Cormorant Garamond', Georgia, serif;
  position: relative;
}
.chatbot-divider::before, .chatbot-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 28%; height: 1px; background: #CCC6BB;
}
.chatbot-divider::before { left: 0; }
.chatbot-divider::after  { right: 0; }

/* 入力エリア */
.chat-input-area {
  padding: 0.75rem 0.875rem;
  border-top: 1px solid #CCC6BB;
  background: #FAFAF8;
  display: flex; gap: 0.45rem; align-items: flex-end;
  flex-shrink: 0;
}
.chat-input {
  flex: 1; background: #EDEAE3;
  border: 1px solid #CCC6BB; border-radius: 11px;
  padding: 0.55rem 0.8rem; font-size: 0.8375rem;
  font-family: 'Noto Sans JP', sans-serif; color: #1A1916;
  resize: none; outline: none; line-height: 1.5;
  transition: border-color 0.16s;
  max-height: 72px; min-height: 38px;
}
.chat-input::placeholder { color: #8C857E; }
.chat-input:focus { border-color: #C8B89A; }
.chat-send {
  width: 36px; height: 36px; border-radius: 9px;
  background: #4E7363; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.16s, transform 0.16s; flex-shrink: 0;
}
.chat-send:hover { background: #3D5F51; transform: scale(1.06); }
.chat-send svg { width: 15px; height: 15px; color: #fff; }
.chat-footer {
  padding: 0.35rem 0.875rem 0.65rem;
  text-align: center; font-size: 0.58rem; color: #8C857E;
  letter-spacing: 0.06em; background: #FAFAF8; flex-shrink: 0;
}

@media (max-width: 420px) {
  .chat-window { width: calc(100vw - 2rem); right: 1rem; bottom: 4.75rem; }
  .chat-launcher { right: 1rem; bottom: 1rem; }
}
