* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  color: #2f2f2f;
  font-family: Arial, sans-serif;
  font-size: 16px;
}

.flexbox {
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  animation: fade-in 0.7s ease-in-out;
}

.chat-button.hidden {
  display: none;
}

.chat-button {
  height: 56px;
  min-width: 140px;
  padding: 8px 20px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: white;
  border-radius: 28px;
  cursor: pointer;
  position: fixed;
  bottom: 20px;
  right: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  border: 2px solid rgb(84, 215, 237);
}

/* 吹き出しの三角形 */
.chat-button::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 30px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid white;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.chat-button::before {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 29px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid rgb(84, 215, 237);
  z-index: -1;
}

.chat-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(84, 215, 237, 0.4);
}

.chat-button-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.chat-button-text {
  font-size: 16px;
  font-weight: 600;
  color: rgb(84, 215, 237);
  white-space: nowrap;
}

.notification-badge {
  display: none;
  background: #000;
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  align-content: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
}

h1,
h2,
h3,
h4,
h5,
h6,
button {
  padding: 0;
  margin: 0;
}

/* p,
ul,
ol,
li {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
} */

html,
body,
.flexbox {
  width: 100%;
  height: 100%;
}

.chat-box {
  background-color: #fff;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
}

.chat-box-header,
.chat-box-body,
.chat-box-footer {
  width: 100%;
  box-sizing: border-box;
}

.chat-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgb(84, 215, 237);
  height: 64px;
  padding: 20px 15px;
  border-bottom: solid 1px #cfcfcf;
  position: relative;
}

.company-ad {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
}

.company-ad img {
  width: 40px;
  height: 40px;
  margin-right: 10px;
}

.chat-box-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

#chatMessages {
  width: 100%;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.message {
  width: 90%;
  padding: 16px 18px;
  margin: 5px 0;
  overflow: visible;
  border-radius: 16px;
  transition: all 0.3s ease-in-out;
  word-break: break-all;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
}

.message.hide {
  height: 0;
}

.my-message {
  background: linear-gradient(135deg, rgb(84, 215, 237) 0%, rgb(70, 200, 225) 100%);
  color: white;
  align-self: flex-end;
  box-shadow: 0 2px 12px rgba(84, 215, 237, 0.3);
  margin-right: 8px;
}

/* ユーザーメッセージの吹き出し三角 */
.my-message::after {
  content: "";
  position: absolute;
  right: -8px;
  bottom: 16px;
  width: 0;
  height: 0;
  border-left: 10px solid rgb(70, 200, 225);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.other-message {
  background: white;
  border: 1px solid rgba(84, 215, 237, 0.2);
  color: #2f2f2f;
  margin-left: 8px;
}

/* ボットメッセージの吹き出し三角 */
.other-message::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 20px;
  width: 0;
  height: 0;
  border-right: 10px solid white;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.other-message::after {
  content: "";
  position: absolute;
  left: -9px;
  top: 20px;
  width: 0;
  height: 0;
  border-right: 10px solid rgba(84, 215, 237, 0.2);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  z-index: -1;
}

.profile,
.my-profile,
.other-profile {
  margin: 8px 0 4px 0;
  overflow: hidden;
  transition: height 0.3s ease-in-out;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.profile.hide,
.my-profile.hide,
.other-profile.hide {
  height: 0;
}

img {
  display: inline-block;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.my-profile {
  color: #666;
  align-self: flex-end;
}

.other-profile {
  color: rgb(84, 215, 237);
}

.chat-box-footer {
  padding: 20px 15px;
  border-top: solid 1px #cfcfcf;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

#chatInput {
  color: #2f2f2f;
  font-family: "Raleway", sans-serif;
  font-size: 16px;
  background-color: #d2d2d259;
  width: 100%;
  max-height: 120px;
  border: none;
  padding: 10px 15px;
  resize: none;
  border-radius: 13px;
  transition: 0.3s background-color;
  outline: none;
}

#chatInput:focus {
  background-color: #efefef;
}

#chatInput::-webkit-scrollbar {
  width: 0 !important;
}

#send {
  background: none;
  border: none;
  margin-left: 10px;
  padding: 5px;
  cursor: pointer;
  border-radius: 50%;
}

button::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

button {
  outline: none;
}

h3 > small {
  color: #afafaf;
  font-weight: normal;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reset-button,
.fullscreen-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  width: 32px;
  height: 32px;
  color: #2f2f2f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.reset-button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(180deg);
}

.fullscreen-button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

/* 最大表示 */
.flexbox.fullscreen {
  position: fixed !important;
  left: 20px !important;
  top: 20px !important;
  width: calc(100vw - 40px) !important;
  height: calc(100vh - 40px) !important;
  max-width: calc(100vw - 40px) !important;
  max-height: calc(100vh - 40px) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.flexbox.fullscreen .chat-box {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.close-button {
  cursor: pointer;
  font-size: 18px;
  color: #2f2f2f;
}

.close-button img {
  width: 20px;
  height: 20px;
}

.loading-gif {
  margin: 0;
  padding: 0;
  margin-left: 17px;
  width: 65px;
  height: 35px;
  background-color: #e2e2e2;
  margin-top: 0;
  border-radius: 80px;
}

pre,
code {
  margin: 0;
  text-wrap: wrap;
  background: #fff;
  border-radius: 3px;
}

/* ol {
  margin: 0;
} */

#sendId {
  border: 0;
  background-color: transparent;
  margin-left: 5px;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
table,
th,
td {
  border: 1px solid #000;
  word-wrap: break-word;
}
th,
td {
  padding: 8px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  background-color: #f2f2f2;
}
th:nth-child(1) {
  width: 50px;
}
tr:nth-child(even) {
  background-color: #f9f9f9;
}
tr:hover {
  background-color: #f1f1f1;
}

/* 関連質問 */
.related-questions {
  margin-top: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8f4f8 100%);
  border-radius: 12px;
  border: 1px solid rgba(84, 215, 237, 0.2);
}

.related-questions h4 {
  font-size: 13px;
  margin-bottom: 12px;
  color: #555;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.related-questions h4::before {
  content: "💡";
  font-size: 16px;
}

.suggestion-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-btn {
  background: white;
  border: 1px solid rgba(84, 215, 237, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.suggestion-btn::before {
  content: "→";
  position: absolute;
  right: 16px;
  opacity: 0;
  transition: all 0.3s;
  color: rgb(84, 215, 237);
  font-weight: bold;
}

.suggestion-btn:hover {
  background: white;
  border-color: rgb(84, 215, 237);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(84, 215, 237, 0.2);
  padding-right: 40px;
}

.suggestion-btn:hover::before {
  opacity: 1;
  right: 16px;
}

.suggestion-btn:active {
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(84, 215, 237, 0.15);
}
