/* イーウーパスポート AIチャットBOT v3.1 */

#iyu-chat-wrap * {
  box-sizing: border-box;
  margin: 0;
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

/* フローティングボタン群 */
#iyu-float-btns {
  position: fixed;
  bottom: 32px;
  right: 24px;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 14px;
  z-index: 9998;
}
#iyu-chat-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #C0392B;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(192,57,43,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  overflow: visible;
  padding: 0;
  flex-shrink: 0;
}
#iyu-chat-btn:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(192,57,43,.4); }
#iyu-chat-btn > img { width: 62px; height: 62px; object-fit: cover; border-radius: 50%; }
#iyu-ai-label {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: #C0392B;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 10px 10px 0 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(192,57,43,.3);
  animation: iyu-fadein .4s ease;
  pointer-events: none;
}
#iyu-ai-label::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 10px;
  border: 6px solid transparent;
  border-top-color: #C0392B;
  border-bottom: none;
}
@keyframes iyu-fadein { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
#iyu-chat-btn .iyu-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #C0392B; color: #fff;
  font-size: 10px; width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; border: 2px solid #fff; z-index: 1;
}
#iyu-line-float-btn {
  width: 56px; height: 56px;
  border-radius: 50%; background: #06C755;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(6,199,85,.35);
  text-decoration: none; transition: transform .2s; flex-shrink: 0;
}
#iyu-line-float-btn:hover { transform: scale(1.08); }
#iyu-line-float-btn svg { width: 28px; height: 28px; fill: #fff; }

/* =============================
   チャットウィンドウ
   ============================= */
#iyu-chat-window {
  position: fixed;
  bottom: 108px;
  right: 16px;
  width: min(370px, calc(100vw - 24px));
  height: 600px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 44px rgba(0,0,0,.22);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
}
#iyu-chat-window.open { display: flex; }

@media (max-width: 480px) {
  #iyu-chat-window {
    bottom: 16px;
    right: 8px;
    left: 8px;
    width: auto;
    height: calc(100vh - 110px);
    max-height: 580px;
    border-radius: 16px;
  }
  #iyu-float-btns { bottom: 20px; right: 14px; gap: 10px; }
  #iyu-chat-btn { width: 56px; height: 56px; }
  #iyu-chat-btn > img { width: 56px; height: 56px; }
  #iyu-line-float-btn { width: 50px; height: 50px; }

  /* スマホ：メッセージ+ボタンエリアをスクロール可能にする */
  .iyu-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
  .iyu-quick-replies {
    flex-shrink: 0;
    max-height: 45vh;
    overflow-y: auto;
  }
  .iyu-menu-list {
    padding-bottom: 12px;
  }
}

/* =============================
   ヘッダー
   ============================= */
#iyu-chat-window .iyu-header {
  background: #C0392B;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.iyu-header-title {
  flex: 1;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
}
.iyu-header-icons {
  display: flex; align-items: center; gap: 14px;
}
.iyu-header-icon {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.9);
  display: flex; align-items: center; padding: 0;
  transition: color .15s;
}
.iyu-header-icon:hover { color: #fff; }

/* =============================
   メッセージエリア（白背景）
   ============================= */
.iyu-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: #ffffff;
}
.iyu-messages::-webkit-scrollbar { width: 3px; }
.iyu-messages::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 2px; }

.iyu-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 88%; }
.iyu-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.iyu-msg.bot  { align-self: flex-start; }

.iyu-msg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: #f5d5d2;
  border: 2px solid #eee;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.iyu-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.iyu-msg-avatar.user-avatar {
  background: #eee;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ふきだし */
.iyu-msg-bubble {
  padding: 12px 15px;
  font-size: 14px;
  line-height: 1.8;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}
.iyu-msg.bot .iyu-msg-bubble {
  background: #f1f1f1;
  color: #222;
  border-radius: 0 16px 16px 16px;
}
.iyu-msg.user .iyu-msg-bubble {
  background: #C0392B;
  color: #fff;
  border-radius: 16px 0 16px 16px;
}

/* タイピング */
.iyu-typing { display: flex; gap: 5px; align-items: center; padding: 4px 0; }
.iyu-typing span {
  width: 8px; height: 8px; border-radius: 50%; background: #bbb;
  animation: iyu-bounce .9s infinite;
}
.iyu-typing span:nth-child(2) { animation-delay: .18s; }
.iyu-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes iyu-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-7px)} }

/* =============================
   初期メニューボタン（縦並び・左のUIに合わせる）
   ============================= */
.iyu-menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 8px;
  width: 100%;
}
.iyu-menu-btn {
  width: 100%;
  background: #fff;
  border: 1.5px solid #C0392B;
  color: #C0392B;
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 2px 8px rgba(192,57,43,.1);
  letter-spacing: .01em;
}
.iyu-menu-btn:hover {
  background: #C0392B;
  color: #fff;
  box-shadow: 0 4px 12px rgba(192,57,43,.25);
  transform: translateY(-1px);
}

/* =============================
   クイックリプライ（会話中）
   ============================= */
.iyu-quick-replies {
  padding: 8px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #fff;
}
.iyu-qr-btn {
  background: #fff;
  border: 1.5px solid #C0392B;
  color: #C0392B;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 99px;
  cursor: pointer;
  transition: all .15s;
  white-space: normal;
  word-break: keep-all;
  font-family: inherit;
  line-height: 1.5;
}
.iyu-qr-btn:hover { background: #C0392B; color: #fff; }

/* =============================
   相談バナー（横並び2択）
   ============================= */
.iyu-banner-label {
  padding: 10px 16px 6px;
  font-size: 12px;
  color: #888;
  text-align: center;
}
.iyu-banner-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
}
.iyu-line-banner {
  flex: 1;
  background: #06C755;
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .15s;
  box-shadow: 0 3px 8px rgba(6,199,85,.25);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}
.iyu-line-banner:hover { opacity: .9; transform: translateY(-1px); }

.iyu-zoom-banner {
  flex: 1;
  background: #2D8CFF;
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .15s;
  box-shadow: 0 3px 8px rgba(45,140,255,.25);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}
.iyu-zoom-banner:hover { opacity: .9; transform: translateY(-1px); }

/* =============================
   入力エリア（左のUIに合わせる）
   ============================= */
.iyu-input-area {
  background: #fff;
  border-top: 1px solid #e8e8e8;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.iyu-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 64px;
  min-height: 42px;
  line-height: 1.5;
  background: #fff;
  color: #333;
  transition: border-color .15s;
}
.iyu-input:focus { border-color: #C0392B; }
.iyu-input::placeholder { color: #aaa; }
.iyu-send-btn {
  height: 42px;
  padding: 0 28px;
  border-radius: 6px;
  background: #C0392B;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  flex-shrink: 0;
  transition: background .15s;
  white-space: nowrap;
}
.iyu-send-btn:hover { background: #a93226; }
.iyu-send-btn:disabled { background: #dab8b6; cursor: not-allowed; }
