/* 通用盒模型重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 移除内联样式在旧版浏览器中的一些默认样式 */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
hr,
dl,
dd,
ol,
ul,
figure {
  margin: 0;
  padding: 0;
}

/* 清除列表样式 */
ul,
ol {
  list-style: none;
}

/* 清除图片、iframe、对象和嵌入元素的内边距 */
img,
iframe,
object,
embed {
  max-width: 100%;
}

html,
document,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  position: relative;
}

/* 设置统一的字体和背景 */
body {
  font-family: Arial, sans-serif;
  line-height: 1.5;
  background-color: #fff;
  color: #333;
}

.wrap-box {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.option {
  margin-bottom: 8px;
}

#media {
  width: 100%;
  height: 100%;
  max-width: 1280px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 0;
}

#startmask {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.9);
  /* display: none; */
}

#start {
  position: fixed;
  left: 50%;
  top: 50%;
  line-height: 1.6rem;
  z-index: 1000;
  transform: translate(-50%, -50%);
  padding: 16px 32px;
  font-size: 20px;
  color: white;
  border: none;
  border-radius: 10px;
  background: linear-gradient(45deg, #ff00cc, #3333ff);
  box-shadow: 0 4px 15px rgba(255, 0, 204, 0.5), 0 5px 20px rgba(51, 51, 255, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

#start:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 8px 20px rgba(255, 0, 204, 0.7), 0 10px 30px rgba(51, 51, 255, 0.7);
}

#start:active {
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow: 0 2px 10px rgba(255, 0, 204, 0.5), 0 3px 15px rgba(51, 51, 255, 0.5);
}

#loading {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loader {
  display: flex;
  justify-self: center;
  align-items: center;
  width: auto;
  height: 100px;
}

.dot {
  width: 32px;
  height: 32px;
  line-height: 32px;
  border-radius: 50%;
  background-color: #ff00cc;
  display: inline-block;
  margin: 4px;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  color: white;
  text-align: center;
}

.dot:nth-child(1) {
  animation-delay: -0.48s;
}

.dot:nth-child(2) {
  animation-delay: -0.36s;
}

.dot:nth-child(3) {
  animation-delay: -0.24s;
}

.dot:nth-child(4) {
  animation-delay: -0.12s;
}

.dot:nth-child(5) {
  animation-delay: 0s;
}

@keyframes spin {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0);
  }
}

.form-inline {
  padding: 10px 10px 0 10px;
  display: flex;
}
.form-group {
  flex: 1;
}

#message-input {
  width: 100%;
  text-indent: 10px;
}

.chat-input {
  border: 1px solid #ced4da;
  border-radius: 5px;
  resize: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  font-size: 12px;
}

.chat-input:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.chat-submit {
  height: 30px;
  margin-left: 10px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 0 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chat-submit svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

#human-talking {
  animation: breathing 2s infinite;
}

#submit-button.hidden,
#human-talking.hidden {
  display: none;
}

.bottom-btn {
  position: fixed;
  width: 60px;
  height: 100%;
  right: 0;
  top: 0;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.bottom-btn.active {
  /* bottom: 114px; */
  height: calc(100% - 300px);
}
.bottom-btn > button {
  margin: 8px;
}

.listening {
  background-color: #868686;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.listening.active {
  background-color: #007bff;
}

.force-stop {
  background-color: #007bff;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: 0.3s;
}

.listening svg,
.force-stop svg {
  width: 24px;
  height: 24px;
}

.mic-button {
  background-color: #868686;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 1;
  cursor: pointer;
}

.mic-button.recording {
  background-color: #007bff; /* 录音时的背景颜色 */
}
.mic-button.recording svg {
  animation: breathing 2s infinite;
}

@keyframes breathing {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

.mic-button.recording svg path {
  stroke: white; /* 录音时的图标颜色 */
}

.mic-button.recording svg .recording-icon {
  display: block;
}

.mic-button.recording svg .static-icon {
  display: none;
}

.mic-button:active {
  background-color: #004494;
}

.mic-button svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

.mic-button svg .recording-icon {
  display: none;
}

.mic-button svg .static-icon {
  display: block;
}

#video,
#canvas-box {
  height: 100%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0);
}
#video {
  z-index: -11000;
  left: -2000px;
}

.stop-button {
  position: fixed;
  bottom: -15%; /* 调整位置以放在麦克风按钮的上面 */
  left: 20px;
  background-color: #dc3545; /* 红色背景 */
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 1;
  cursor: pointer;
}

.stop-button:hover {
  background-color: #c82333; /* 悬停时更深的红色 */
}

.stop-button:active {
  background-color: #b11d24; /* 激活时更深的红色 */
}

.stop-button svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

#chat-container {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background-color: transparent;
  transition: transform 0.3s ease;
  transform: translateY(100%);
  z-index: 1;
}

#chat-container.show {
  transform: translateY(0);
}

#arrow {
  position: absolute;
  right: 10px;
  top: -24px;
  opacity: 0.5;
}

#arrow svg {
  width: 24px;
  height: auto;
  transition: 0.3s;
}

#arrow.active svg {
  transform: rotate(180deg);
}

.chat-history {
  padding: 8px;
  overflow-y: auto;
  /* border: 1px solid rgb(222, 222, 222); */
  max-height: 300px;
  height: auto;
  left: 0;
  width: 100%;
  bottom: 0;
}
.chat-history::before {
  content: "";
  width: 100%;
  height: 20%;
  /* background: linear-gradient(to bottom, rgba(23, 23, 23, 0.5), rgba(0, 0, 0, 0)); 从上到下的灰度渐变 */
  position: absolute;
  left: 0;
  top: 0;
  z-index: 100;
}

.chat-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 10px;
  color: #3f3f3f;
}

.chat-content {
  display: inline-block;
  line-height: 24px;
  padding: 6px;
  font-size: 12px;
  border-radius: 4px;
  background: white;
  background: linear-gradient(to right, white, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0)); /* 从上到下的灰度渐变 */
}

.chat-user {
  flex-direction: row-reverse;
}
.chat-user svg {
  color: #007bff;
}
.chat-user .chat-content {
  background: linear-gradient(to left, white, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0)); /* 从上到下的灰度渐变 */
  /* border: 1px solid rgb(137, 217, 97); */
  border: 1px solid rgb(200, 200, 200);
  position: relative;
}
.chat-user .chat-content::before {
  content: "";
  display: block;
  position: absolute;
  right: -4px;
  top: 25%;
  background: white;
  width: 4px;
  height: 4px;
  border: 1px solid rgb(200, 200, 200);
  border-bottom: none;
  border-left: none;
  transform: rotate(45deg);
}

.chat-robot .chat-content {
  border: 1px solid rgb(222, 222, 222);
  position: relative;
}
.chat-robot .chat-content::after {
  content: "";
  display: block;
  position: absolute;
  left: -4px;
  top: 25%;
  background: white;
  width: 4px;
  height: 4px;
  border: 1px solid rgb(200, 200, 200);
  border-bottom: none;
  border-left: none;
  transform: rotate(225deg);
}

.chat-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  width: 40px;
  height: 40px;
  background-color: #f3f7fb;
  margin: 4px 10px;
  font-size: 12px;
}

.chat-avatar svg {
  width: 24px;
  height: 24px;
}

/* 修改 .recording-indicator 样式 */
.recording-indicator {
  position: fixed;
  left: 50%;
  bottom: 5%;
  transform: translate(-50%, 0);
  width: 100px; /*加宽容器容纳竖条 */
  height: 60px; /* 增高容器 */
  border-radius: 8px; /* 圆角矩形 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background-color: rgb(210 206 206 / 50%);
  z-index: 1000;
}
.recording-indicator.hidden {
  display: none;
}

/* 竖条容器 */
.wave-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  border-radius: 8px;
}

/* 竖条样式 */
.wave {
  position: absolute;
  width: 1px; /* 竖条宽度 */
  background: linear-gradient(transparent, #007bff, transparent); /* 渐变透明度 */
  opacity: 0;
  animation: verticalWave 1s linear infinite;
}

/* 三个竖条层 */
.wave-1 {
  left: 10%;
  height: 45%;
  animation-delay: -0.8s;
}
.wave-2 {
  left: 30%;
  height: 58%;
  animation-delay: -0.6s;
}
.wave-3 {
  left: 50%;
  height: 100%;
  animation-delay: -0.4s;
}
.wave-4 {
  left: 70%;
  height: 58%;
  animation-delay: -0.2s;
}
.wave-5 {
  left: 90%;
  height: 45%;
  animation-delay: -0s;
}

/* 竖条动画 */
@keyframes verticalWave {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* 弹窗容器 */
#message-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 单条消息样式 */
.message {
  width: auto;
  max-width: 280px;
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  animation: slideIn 0.3s ease-out;
  opacity: 0.95;
  transition: all 0.3s;
  font-size: 12px;
}

/* 消息类型颜色 */
.message.success {
  background: #f0f9eb;
  color: #236a00;
  border: 1px solid #e1f3d8;
}
.message.error {
  background: #fef0f0;
  color: #f56c6c;
  border: 1px solid #fde2e2;
}
.message.warning {
  background: #fdf6ec;
  color: #f99500;
  border: 1px solid #faecd8;
}

/* 图标样式 */
.message::before {
  font-family: "iconfont"; /* 需引入图标字体 */
  margin-right: 12px;
  font-size: 18px;
}
.success::before {
  content: "\2714";
}
.error::before {
  content: "\26A0";
}
.warning::before {
  content: "\26A0";
}

/* 动画效果 */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 0.95;
  }
}

.message.hide {
  animation: fadeOut 0.3s ease-in forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}
