#chatbot-icon {
  position: fixed;
	right: 0;
	bottom: 1rem;
	height: 4rem;
	border-radius: .25rem 0 0 .25rem;
  padding: 0 0.5rem;
	background: #0073aa;
	color: #fff;
	display: none;
	justify-content: center;
	align-items: center;
	font-weight: bold;
	cursor: pointer;
	z-index: 9999;
}

/* コンポーネント内は 1em = 16px の基準に固定（グローバルには影響しない） */
#chatbot-modal {
  position: fixed;
  right: 1.25em;          /* 20px */
  bottom: 2.5em;        /* 90px */
  width: 28.75em;         /* 460px */
  height: 45em;           /* 720px */
  max-width: calc(100vw - 2.5em);
  max-height: calc(100vh - 5em);
  font-size: 16px;
  background: #fff;
  border-radius: 0.25em;  /* 4px */
  box-shadow: 0 0 0.75em rgba(0,0,0,0.25); /* 12px */
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

#chatbot-modal.hidden { display: none; }

.chatbot-modal-header {
  padding: 0.625em 0.9375em;
  background: #0073aa;
  color: #fff;
  display: flex;
  justify-content: space-between;
  border-radius: 0.25em 0.25em 0 0;
}

#chatbot-close { padding: 0.5em; }

#chatbot-messages {
  padding: 0.75em;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.message {
  display: flex;
  align-items: center;
  max-width: 80%;
  padding: 0.5em 0.75em;
  border-radius: 0.5em;
  white-space: pre-wrap;
  word-wrap: break-word;
  align-self: flex-start;
}


.message.bot {
  background: #eef2f7;
  color: #222;
}

.message.user {
  background: #0073aa;
  color: #fff;
  align-self: flex-end;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-self: flex-start;
  max-width: 80%;
}

.choice-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5em 0.75em;
  border-radius: 0.5em;
	background-color: #007BFF73;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.choice-btn:hover { background-color: #007BFF; }
.choice-btn:focus { background-color: #007BFF73; }

#chatbot-input-area {
  display: flex;
  gap: 0.5em;
  padding: 0.75em;
  align-items: flex-end;
}

#chatbot-input {
  flex-grow: 1;
  border-radius: 0.25em;
  margin: 0;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.75rem;
  line-height: 1.4;
  min-height: 2.6rem;
  max-height: 13.6rem;
  box-sizing: border-box;
}

.attach-btn {
  border: none;
  border-radius: 0.25em;
  background: #eef2f7;
  color: #0073aa;
	padding: 0.7em 1.5em; 
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.attach-btn.active { display: inline-flex; }
.attach-btn:hover { background: #e3e8f0; }
.attach-btn:active { background: #d6dce6; }

#chatbot-file.hidden { display: none; }

#chatbot-send { 
	background-color: #007BFF73;
	padding: 0.7em 1.5em; 
	line-height: 1;
  white-space: nowrap;
}
#chatbot-send:hover { background-color: #007BFF; }
#chatbot-send:focus { background-color: #007BFF73; }

/* ローディング(タイピング)表示 - bot/user共通 */
.message.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.message .dots {
  display: inline-flex;
  gap: 0.25em;
}
.message .dots span {
  width: 0.375em;
  height: 0.375em;
  display: inline-block;
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  animation: chatbot-blink 1.2s infinite ease-in-out;
}
.message.user .dots span { background: rgba(255,255,255,0.8); }
.message .dots span:nth-child(2) { animation-delay: 0.2s; }
.message .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-blink {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-0.125em); }
}

/* 送信不可の見た目 */
#chatbot-send[disabled],
#chatbot-attach.disabled,
#chatbot-input[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  white-space: nowrap;
}
