/* ==========================================================================
   HARE design - FAQチャットボット ウィジェット
   カラー: ベース #F4FAF0 / メイン #3EA300 / アクセント #FCBB40 / 文字 #4E3323
   フォント: ゴシック体
   ========================================================================== */

:root{
  --color-base: #F4FAF0;
  --color-main: #3EA300;
  --color-main-dark: #2f8300;
  --color-accent: #FCBB40;
  --color-accent-dark: #eaa726;
  --color-text: #4E3323;
  --color-white: #FFFFFF;
  --font-gothic: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --shadow-soft: 0 8px 24px rgba(78, 51, 35, 0.16);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

/* ---- デモページ（ポートフォリオサイトの背景を簡易再現） ---- */
* { box-sizing: border-box; }

body{
  margin: 0;
  font-family: var(--font-gothic);
  color: var(--color-text);
  background: var(--color-base);
  line-height: 1.8;
}

.site-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--color-white);
  border-bottom: 1px solid rgba(78,51,35,0.08);
}

.site-header .logo{
  font-weight: 700;
  font-size: 20px;
  color: var(--color-main);
  letter-spacing: 0.05em;
}

.site-header nav a{
  color: var(--color-text);
  text-decoration: none;
  margin-left: 24px;
  font-size: 14px;
}

.hero{
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 24px 64px;
  text-align: center;
}

.hero h1{
  font-size: 30px;
  margin-bottom: 16px;
  color: var(--color-text);
}

.hero p{
  font-size: 15px;
  color: var(--color-text);
  opacity: 0.85;
}

.hero .badge{
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-text);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 20px;
}

.section-note{
  max-width: 560px;
  margin: 0 auto 80px;
  padding: 24px;
  background: var(--color-white);
  border: 1px dashed rgba(62,163,0,0.35);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 13px;
  color: var(--color-text);
  opacity: 0.8;
}

/* ==========================================================================
   チャットウィジェット本体
   ========================================================================== */

#hare-chat-widget{
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: var(--font-gothic);
}

/* ---- 起動ボタン ---- */
.hare-chat-launcher{
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #0273A3;
  border: none;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  position: relative;
}

.hare-chat-launcher:hover{
  background: #025C82;
  transform: scale(1.05);
}

.hare-chat-launcher svg{
  width: 28px;
  height: 28px;
  fill: var(--color-white);
}

.hare-chat-launcher .hare-chat-dot{
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-base);
}

.hare-chat-launcher .icon-close{ display: none; }
#hare-chat-widget.is-open .hare-chat-launcher .icon-chat{ display: none; }
#hare-chat-widget.is-open .hare-chat-launcher .icon-close{ display: block; }
#hare-chat-widget.is-open .hare-chat-launcher .hare-chat-dot{ display: none; }

/* ---- チャットパネル ---- */
.hare-chat-panel{
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--color-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#hare-chat-widget.is-open .hare-chat-panel{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (max-width: 480px){
  .hare-chat-panel{
    right: -8px;
    bottom: 76px;
    width: calc(100vw - 16px);
    height: calc(100vh - 112px);
  }
}

/* ヘッダー */
.hare-chat-header{
  background: var(--color-main);
  color: var(--color-white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.hare-chat-avatar{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-white);
  color: var(--color-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.hare-chat-header-text{ flex: 1; min-width: 0; }

.hare-chat-header-text .title{
  font-size: 15px;
  font-weight: 700;
}

.hare-chat-header-text .subtitle{
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.hare-chat-close{
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.hare-chat-close svg{ width: 20px; height: 20px; fill: var(--color-white); opacity: 0.9; }

/* メッセージエリア */
.hare-chat-messages{
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hare-chat-messages::-webkit-scrollbar{ width: 6px; }
.hare-chat-messages::-webkit-scrollbar-thumb{ background: rgba(78,51,35,0.18); border-radius: 3px; }

.hare-msg{
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.hare-msg.bot{
  align-self: flex-start;
  background: var(--color-white);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(78,51,35,0.06);
}

.hare-msg.user{
  align-self: flex-end;
  background: var(--color-main);
  color: var(--color-white);
  border-bottom-right-radius: 4px;
}

.hare-msg.error{
  align-self: flex-start;
  background: #fdecec;
  color: #a13a3a;
  border: 1px solid #f3c8c8;
}

/* クイックリプライ（よくある質問チップ） */
.hare-chat-quickreplies{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px;
}

.hare-chip{
  border: 1px solid var(--color-main);
  background: var(--color-white);
  color: var(--color-main-dark);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-gothic);
  transition: background 0.15s ease, color 0.15s ease;
}

.hare-chip:hover{
  background: var(--color-main);
  color: var(--color-white);
}

/* タイピングインジケーター */
.hare-typing{
  align-self: flex-start;
  background: var(--color-white);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(78,51,35,0.06);
}

.hare-typing span{
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-main);
  opacity: 0.5;
  animation: hare-blink 1.2s infinite ease-in-out;
}
.hare-typing span:nth-child(2){ animation-delay: 0.2s; }
.hare-typing span:nth-child(3){ animation-delay: 0.4s; }

@keyframes hare-blink{
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* 相談導線（AIで解決しなかった場合の担当者への案内） */
.hare-chat-escalation{
  align-self: flex-start;
  max-width: 92%;
  background: var(--color-white);
  border: 1px solid rgba(252,187,64,0.6);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hare-chat-escalation-label{
  font-size: 12px;
  color: var(--color-text);
  opacity: 0.85;
}

.hare-chat-escalation-buttons{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hare-escalation-btn{
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-gothic);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
}

.hare-escalation-btn-line{
  background: #06C755;
  color: var(--color-white);
}

.hare-escalation-btn-form{
  background: var(--color-accent);
  color: var(--color-text);
}

.hare-escalation-btn:hover{ opacity: 0.9; }

/* 入力中サジェスト（FAQ候補） */
.hare-chat-input{
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  background: var(--color-white);
  border-top: 1px solid rgba(78,51,35,0.08);
  flex-shrink: 0;
}

.hare-chat-suggestions{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 100%;
  margin-bottom: 6px;
  background: var(--color-white);
  border: 1px solid rgba(78,51,35,0.14);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  max-height: 180px;
  overflow-y: auto;
}

.hare-chat-suggestions:empty{ display: none; }

.hare-suggestion-item{
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid rgba(78,51,35,0.06);
  background: none;
  font-family: var(--font-gothic);
  font-size: 12.5px;
  color: var(--color-text);
  cursor: pointer;
}

.hare-suggestion-item:last-child{ border-bottom: none; }

.hare-suggestion-item:hover{
  background: var(--color-base);
}

.hare-chat-input textarea{
  flex: 1;
  resize: none;
  border: 1px solid rgba(78,51,35,0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-gothic);
  font-size: 13.5px;
  color: var(--color-text);
  max-height: 96px;
  outline: none;
  background: var(--color-base);
}

.hare-chat-input textarea:focus{
  border-color: var(--color-main);
}

.hare-chat-send{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.hare-chat-send:hover{ background: var(--color-accent-dark); }
.hare-chat-send:disabled{ opacity: 0.5; cursor: not-allowed; }

.hare-chat-send svg{
  width: 18px;
  height: 18px;
  fill: var(--color-text);
  margin-left: 1px;
}

.hare-chat-footer-note{
  font-size: 10px;
  text-align: center;
  color: var(--color-text);
  opacity: 0.55;
  padding: 4px 0 10px;
  background: var(--color-white);
}
