*{
  box-sizing: border-box;
}
html{
  height: 100%;
}
body{
  height: 100%;
  margin: 0;
  font-family: "Noto Sans JP", sans-serif;
  font-optical-sizing: auto;
}

/* 全体のレイアウト */
#chatbot-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ヘッダー部分 */
#chatbot-header {
  background-color: var(--main-color);
  color: white;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#chatbot-header #chatbot-logo {
  width: 48px;
  height: 48px;
}
#chatbot-header .chatbot-center-logo{
  height: 48px;
}
#chatbot-header button {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* チャットメッセージ表示エリア */
#chatbot-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

#chatbot-messages::-webkit-scrollbar {
  width: 6px;
  background: transparent;
}

#chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chatbot-messages::-webkit-scrollbar-thumb {
  background: gray;
  border-radius: 3px;
}

#chatbot-messages {
  scrollbar-width: thin;
  scrollbar-color: gray transparent;
}

/* メッセージを囲うラッパー */
.message-wrap {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
}

.bot-wrap {
  justify-content: flex-start;
}

.user-wrap {
  justify-content: flex-end;
}

/* アイコンの共通スタイル */
.chat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ボットアイコンのスタイル */
.bot-icon {
  margin-right: 12px;
  background-image: var(--bot-icon-url); /* CSS変数からURLを読み込む */
}

/* ユーザーアイコンのスタイル */
.user-icon {
  margin-left: 12px;
  background-image: var(--user-icon-url); /* CSS変数からURLを読み込む */
}

/* 開始メッセージ */
#chatbot-messages .opening_statement .bot-message{
  max-width: none;
}
#chatbot-messages .opening_statement .privacy-policy{
  text-align: right;
}
#chatbot-messages .opening_statement .privacy-policy a{
  font-size: 13px;
  color: #aaa;
  text-decoration: none;
}

/* 入力フォーム */
#chatbot-input textarea {
  overflow: hidden;
  padding: 12px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 1.5em;
  resize: none;
  width: 100%;
  max-height: 50vh;
  font-size: 15px;
  line-height: 1.25;
}
#chatbot-input textarea::placeholder {
  color: #aaa;
}
#chatbot-input-button{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
#chatbot-input-button button#reset-btn {
  background-color: #F44336;
  width: 40vw;
}
#chatbot-input-button button#send-btn {
  background-color: #007bff;
  width: 30vw;
}
#chatbot-input-button button#reset-btn,#chatbot-input-button button#send-btn {
  margin: 10px 0 0;
  padding: 10px 16px;
  border: none;
  color: white;
  font-size: 14px;
  border-radius: 100vw;
  cursor: pointer;
}

@media screen and (max-width: 640px) {
  #chatbot-container {
  font-size: 16px;
  }
  #chatbot-header {
  padding: 12px;
  }
  #chatbot-messages {
  padding: 12px;
  }
  #chatbot-input {
  padding: 12px;
  }
}

/* マークダウンスタイル */
.bot-message pre {
  background-color: #f0f0f0;
  padding: 10px;
  border-radius: 5px;
  overflow-x: auto;
}
.bot-message p { margin: 0; }
.bot-message p + p { margin-top: 8px; }
.bot-message code {
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  font-size: 0.9em;
  background-color: #f0f0f0;
  padding: 2px 4px;
  border-radius: 3px;
}
.bot-message table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
}
.bot-message th, .bot-message td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}
.bot-message th { background-color: #f2f2f2; }
.bot-message blockquote {
  border-left: 3px solid #ccc;
  padding-left: 10px;
  color: #666;
  margin: 10px 0;
}
.bot-message a {
  color: #0066cc;
  text-decoration: none;
  word-break: break-all;
}
.bot-message a:hover { text-decoration: underline; }
.bot-message img {
  max-width: 100%;
  height: auto;
}
.bot-message ul, .bot-message ol { padding-left: 20px; }
.bot-message li{ margin: 4px 0; }

.spinner {
  border: 4px solid rgba(0,0,0,0.1);
  border-left-color: #007bff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  margin: auto;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-wrap .bot-message {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 固定ボタンのスタイルを追加 */
.fixed-button-wrap {
  margin-top: 10px;
  opacity: 0;
  transition: opacity 0.5s ease;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  border-radius: 50vw;
}
.fixed-button-wrap.is-visible {
  opacity: 1;
}
.fixed-button {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--main-color);
  text-decoration: none;
  font-size: 14px;
  border: none;
  border-radius: 50vw;
  cursor: pointer;
  transition: opacity 0.3s;
  color: var(--close-btn-color);
}
.fixed-button:hover {
  opacity: 0.8;
}
.message-content-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
}