/* Oracle Agent Widget CSS - chat_widget_v2.css と同じスタイル */

/* CSS変数定義 */
.oracle-agent-widget {
  --chatbot-main-color: #2c5fb9;
  --chatbot-text-color: #222;
  --chatbot-text-color-white: #fff;
  --chatbot-header-color: #2c5fb9;
  --chatbot-header-font-color: #fff;
  --chatbot-user-message-bg: #c3d8f5;
  --chatbot-server-message-bg: #eaeaea;
  --chatbot-input-border: #8cb3d9;
  --chatbot-active-button-bg: #4a90e2;
  font-family: Noto Sans, Noto Sans JP, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

/* 閉じるボタン */
.oracle-agent-widget #chatbotClose {
  background-color: var(--chatbot-main-color);
  color: var(--chatbot-text-color-white);
  border: none;
  cursor: pointer;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

/* トグルボタン（画像アイコン用） */
#chatbotToggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* トグルボタン内の画像 */
#chatbotToggle img {
  display: block;
  max-width: var(--chatbot-toggle-image-max-width, 200px);
  height: auto;
}

/* 閉じるボタン */
.oracle-agent-widget #chatbotClose {
  color: var(--chatbot-header-font-color);
  font-size: 24px;
  line-height: 30px;
  width: 30px;
  height: 30px;
  position: absolute;
  top: 50%;
  right: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background-color 0.3s;
  z-index: 3;
  padding-top: 0;
  transform: translateY(-50%);
}

.oracle-agent-widget #chatbotClose:hover {
  background-color: hsla(0, 0%, 100%, 0.2);
}

.oracle-agent-widget #chatbotClose:focus,
#chatbotToggle:focus,
.oracle-agent-widget .custom-chat-send-button:focus {
  outline: none;
}

#chatbotToggle:focus {
  outline: none;
}

.oracle-agent-widget #chatbotClose:active {
  transform: translateY(-50%) scale(0.95);
  background-color: var(--chatbot-active-button-bg);
}

.oracle-agent-widget .custom-chat-send-button:active {
  transform: scale(0.95);
  background-color: var(--chatbot-active-button-bg);
}

#chatbotToggle:active {
  transform: scale(0.95);
  background-color: transparent;
}

/* メッセージ */
.oracle-agent-widget .chat-message {
  padding: 12px 16px;
  margin: 5px;
  border-radius: 18px;
  max-width: 85%;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: Noto Sans, Noto Sans JP, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  text-align: left;
}

.oracle-agent-widget .server-message {
  background-color: var(--chatbot-server-message-bg);
  margin-left: 5px;
  align-self: flex-start;
  border-radius: 18px 18px 18px 0;
  font-size: 14px;
  padding-top: 12px;
}

.oracle-agent-widget .user-message {
  background-color: var(--chatbot-user-message-bg);
  color: var(--chatbot-text-color);
  margin-right: 5px;
  margin-left: auto;
  border-radius: 18px 18px 0 18px;
  font-size: 14px;
  padding-top: 12px;
}

/* メッセージエリア */
.oracle-agent-widget #chatbotContent {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* 入力エリア */
.oracle-agent-widget #chatbotInputArea {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 15px;
  background-color: #fff;
  border-top: 1px solid #e9ecef;
  border-radius: 0 0 10px 10px;
  flex-shrink: 0;
  height: auto;
}

/* 入力フィールドと送信ボタン共通 */
.oracle-agent-widget .chat-input,
.oracle-agent-widget .custom-chat-send-button {
  height: 40px;
  padding: 8px 16px;
  border: 2px solid var(--chatbot-input-border);
  box-shadow: none;
  outline: none;
  box-sizing: border-box;
}

/* 入力フィールド */
.oracle-agent-widget .chat-input {
  flex: 1;
  min-width: 0;
  margin-bottom: 0 !important;
  border-radius: 24px;
  font-size: 14px;
  font-family: Noto Sans, Noto Sans JP, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

.oracle-agent-widget .chat-input:focus {
  border-color: var(--chatbot-input-border);
}

/* 送信ボタン */
.oracle-agent-widget .custom-chat-send-button {
  flex-shrink: 0;
  width: auto;
  padding: 8px 20px;
  background-color: var(--chatbot-user-message-bg);
  color: var(--chatbot-text-color);
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oracle-agent-widget .custom-chat-send-button:disabled {
  background-color: var(--chatbot-user-message-bg);
  color: var(--chatbot-text-color);
  border: none;
  opacity: 1;
  filter: none;
}

.oracle-agent-widget .custom-chat-send-button svg {
  width: 20px;
  height: 20px;
}

/* メインウィジェットコンテナ */
.oracle-agent-widget.chatbot-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  height: 500px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ヘッダー */
.oracle-agent-widget #chatbotHeader {
  background-color: var(--chatbot-header-color);
  color: var(--chatbot-text-color-white);
  padding: 15px;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  font-weight: 600;
  font-size: 14px;
  font-family: Noto Sans, Noto Sans JP, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

/* 星評価 */
.oracle-agent-widget .star {
  font-size: 18px;
  cursor: pointer;
}

.oracle-agent-widget .star.unselected {
  color: #fff;
  text-shadow: 1px 1px #000;
}

.oracle-agent-widget .star.selected {
  color: #fc0;
  text-shadow: 1px 1px #000;
}

/* 初期メッセージ */
.oracle-agent-widget .chat-message.initial-message {
  margin-bottom: 10px;
  clear: both;
  padding: 0;
}

.oracle-agent-widget .chat-message.initial-message .formatted-text {
  display: inline-block;
  background-color: #eaeaea;
  padding: 8px 0;
  border-radius: 18px;
  max-width: 100%;
  word-wrap: break-word;
  margin: 0;
  white-space: pre-wrap;
  font-size: 14px;
  font-family: Noto Sans, Noto Sans JP, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

/* Wordlinkスタイル */
.oracle-agent-widget .wordlink {
  display: inline-block;
  padding: 6px 12px;
  background-color: #C3D8F5;
  color: black;
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid #98b7e1;
  cursor: pointer;
  margin: 5px 2px 2px;
  font-size: 14px;
  transition: background-color 0.3s;
}

.oracle-agent-widget .wordlink:hover {
  background-color: #a8c8f0;
}

/* 選択肢ボタン（バルーン内） */
.oracle-agent-widget .choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
}

.oracle-agent-widget .choice-btn {
  display: inline-block;
  padding: 8px 16px;
  background-color: #C3D8F5;
  color: black;
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid #98b7e1;
  cursor: pointer;
  font-size: 14px;
  font-family: Noto Sans, Noto Sans JP, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  transition: background-color 0.3s;
}

.oracle-agent-widget .choice-btn:hover {
  background-color: #a8c8f0;
}

.oracle-agent-widget .choice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* リンクスタイル */
.oracle-agent-widget .link-button {
  color: var(--chatbot-main-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.oracle-agent-widget .link-button:hover {
  text-decoration: underline;
}

/* フィードバックボタン */
.oracle-agent-widget .feedback-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.oracle-agent-widget .feedback-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #888;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oracle-agent-widget .feedback-btn svg {
  width: 20px;
  height: 20px;
}

.oracle-agent-widget .feedback-btn .icon-filled {
  display: none;
}

.oracle-agent-widget .feedback-btn:hover {
  color: #2c5fb9;
}

.oracle-agent-widget .feedback-btn.selected {
  color: #2c5fb9;
}

.oracle-agent-widget .feedback-btn.selected .icon-outlined {
  display: none;
}

.oracle-agent-widget .feedback-btn.selected .icon-filled {
  display: inline;
}

/* スマートフォン用のメディアクエリ */
@media (max-width: 768px) {
  .oracle-agent-widget .server-message,
  .oracle-agent-widget .user-message,
  .oracle-agent-widget .chat-input,
  .oracle-agent-widget .custom-chat-send-button,
  .oracle-agent-widget .chat-message.initial-message .formatted-text {
    font-size: 18px;
  }

  .oracle-agent-widget.chatbot-widget {
    width: 345px;
  }

  #wrap .oracle-agent-widget #chatbotHeader {
    padding-right: 50px;
  }

  #wrap .oracle-agent-widget #chatbotClose {
    background: transparent;
    top: 55%;
    transform: translateY(-50%);
    padding-top: 0;
  }

  #chatbotToggle {
    font-size: 16px;
  }
}
