/* 画面全体を覆う */
.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background: rgba(0, 0, 0, 0.4); /* 半透明 */

  display: none;
  justify-content: center;
  align-items: center;

  z-index: 999999999;
}

.chat-overlay.active {
  display: flex;
}

#chat-container {
  position: static !important;
  z-index: auto !important;
}

#chat-options-fixed {
  display: block;
  flex-shrink: 0;
  position: static;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 10px;
  z-index: 10;
}

.chat-box {
  width: 450px;
  position: relative;
  background: #fff;
  border-radius: 8px;
  display: flex;

  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
 /* overflow: hidden;  ← ここで使う！ */
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #4a90e2;
  color: #fff;
  padding: 10px 14px;
  font-weight: bold;
}

.chat-title{
  font-size: 14px;
}

#chat-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 18px;

  width: 32px;
  height: 32px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: all 0.2s ease;
}

#chat-close:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.1);
}





#chat-area {
  display: block;
  /*height: 440px;*/
  padding: 10px;
  flex: 1;
  overflow-y: auto;
  background: #fafafa;
  width: auto;
}

/*.user-message,
.bot-message {
  margin-bottom: 10px;
  padding: 8px 15px;
  border-radius: 12px;
  max-width: 80%;
  line-height: 1.4;
}*/

.user-message {
  background: #d1eaff;
  margin:10px 10px;
  padding: 10px;
}

/*.bot-message {
  background: #f1f1fd;
}*/

.chat-input {
  display: flex;
  border: 2px solid #d8f5f5;
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border: 1px solid transparent; /* 通常時は見えない */
}

.chat-input input:focus {
  outline: none;
  border-color: #4a90e2;         /* フォーカス色 */
}

.chat-input button {
  padding: 10px;
  border: none;
  background: #4a90e2;
  color: #fff;
  cursor: pointer;
}

.bot-message p {
  white-space: pre-line;
}


/***  チャットボットボタンを横長に　***/

#chat-toggle {
  position: absolute;

  right: 16%;
  top: 5%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 10px 14px;
  max-width: calc(100vw - 48px);

  background: #4a90e2;
  color: #fff;

  border: none;
  border-radius: 999px;

  font-size: 14px;
  cursor: pointer;

  z-index: 999999999999;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  transition: opacity 0.2s ease
}

@media (max-width: 1020px) {
 #chat-toggle{
  font-size: 10px;
  top: 30px;
  right: 30px;
 }
}
 
/* #chat-toggle.hide {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px); /* 少し下に逃がすと自然 */
/*}*/

.chat-text {
  white-space: nowrap;
}


.chat-icon {
  font-size: 22px;
  line-height: 1;

}


#chat-toggle:hover {
  opacity: 0.9;
}

@media (max-width: 480px) {
  .chat-text {
    display: none;
  }

}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.options {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.options.hide {
  opacity: 0;
  pointer-events: none;
}

.options button {
  padding: 6px 8px;
  min-width: 90px;

  border-radius: 6px;        /* ← 角丸を弱く */
  border: 1px solid #999;
  background: #4a90e2;
  color: #fff;

  font-size: 12px;
  cursor: pointer;

  transition: background 0.2s, color 0.2s;
}

.options button:hover {
  background: #fff;
  color: #033c75;
}






/** チャットボタンの固定 **/
.site-header {
  position: relative;
  top: 0;
  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: space-between; /* ←重要 */
}

.chat-header-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);

  background: #0d6efd;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
}




/** リンクボタン　**/

.link-button {
  display: inline-block;
  margin: 8px 0;

  padding: 8px 8px;
  border-radius: 6px;

  background: #0066ff;
  border: 1px solid #ccc;
  color: #fff;

  font-size: 13px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.link-button:hover {
  background: #fff;
  color: #2200ff;
  border-color: #2200ff;
  transform: translateY(-1px);
}

.link-button::after {
  font-family: 'Font Awesome 5 Free';
  content: '\f35d';
  font-size: 0.9em;
  margin: 0px 3px;
  font-weight: 900;
}

/***　キャラクター　***/
/*.chat-character {
  text-align: center;
  padding: 6px 0;
  background: #fafafa;
  display: none;
}*/

/*.chat-character img {
  width: 64px;
  height: 64px;
}
*/

/* =========================
   ボットメッセージ＋キャラ
========================= */
.guide-message{
  align-items: flex-start !important;
}

.bot-message {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px;
  margin-bottom: 10px;
}

/* ガイド専用の余白 */
.bot-message.guide-message {
  margin-bottom: 24px;  /* ← 好みで調整 */
}

/* ガイド内のボタン間隔 */
.bot-message.guide-message .options {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  
}

/* キャラクター */
.bot-avatar {
  width: 96px;
  flex-shrink: 0;
  /*align-self: flex-start;*/
  margin-top: 6px;
}

.bot-avatar img {
  width: 96px;
  height: 96px;
  display: block;
  object-fit: contain;
  /*max-height: none;*/
}

.guide-message .bot-avatar{
  align-items: flex-start;
}

/* 吹き出し */
.bot-bubble {
  width: 80%;
  background: #dce2f9;
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.4;
  height: auto;
  /*display: flex !important;
  flex-direction: column;*/
}

.guide-message .bot-bubble{
  max-height: 600px;
  overflow-y: auto;
}

.bot-bubble .link-button {
  margin-top: 8px;     /* ← 回答との間隔 */
  align-self: flex-start; /* 左揃え（自然） */
}


.bot-bubble p {
  margin: 0;
  font-size: small;
  white-space: pre-line;
  line-height: 1.5;
  padding-bottom: 10px;
}

/*** 戻るボタン　*/


.back-button:hover {
  background: #fff;
  color: #20b2aa;
  border: 1px solid #20b2aa;
  transform: translateY(-1px);
}


/***ボタン横並びに***/

.button-wrap{
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.back-button{
  padding: 8px 8px;
  margin: 8px 0;
  border: none;
  background: #20b2aa;
  color: #fff;;
  border-radius: 5px;
  cursor: pointer;
  font-family: sans-serif;
  font-weight: 400;
  font-size: 12px;
  transition: all 0.2s ease;
}

.back-button::before {
  font-family: 'Font Awesome 5 Free';
  content: '\f3e5';
  font-size: 0.9em;
  margin: 0px 3px;
  font-weight: 900;
}

.chattext{
  color: #d32f2f;
  font-weight: 900;
  text-decoration: underline;
  line-height: 1.3rem;
}

.chat-lh{
  line-height: 1.2rem;
}

