:host {
  display: block;
  font-size: 16px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  overflow-y: auto;
  z-index: 1000;
}

/* 全屏模式下的overlay样式 */
.fullscreen-overlay {
  padding: 0;
  /* 改为基于父组件的全屏 */
  position: absolute;
  width: 100%;
  height: 100%;
}

.modal-container {
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 5vh auto auto auto;
}

/* 全屏模式样式 - 改为基于父组件 */
.modal-container.fullscreen {
  width: 100%;
  max-width: none;
  height: 100%;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

/* 确保内容区域也使用 flex 布局并占满剩余空间 */
.modal-container.fullscreen>div:not(.modal-header):not(.initial-upload) {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  /* 防止内容溢出 */
  height: 100%;
}

/* PC端布局 */
.pc-layout {
  width: 80%;
  max-width: 800px;
  /* height: 80vh; */
  /* max-height: 700px; */
  min-width: 320px;
  min-height: 400px;
}

.video-preview.placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #eaeaea;
}

.placeholder-status {
  color: #00000066;
}

.placeholder-status p {
  font-size: 16px;
}

.waiting-message p {
  margin: 0;
  font-size: 16px;
  color: white;
  font-weight: 500;
}

.recording-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.video-container {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
}

.video-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stop-recording-button {
  width: 100%;
  height: 100%;
  font-size: 16px;
  background: #f44336;
  border-radius: 6px;
  color: white;
  border: none;
  cursor: pointer;
}

.stop-recording-button:hover {
  background: #d32f2f;
}

.play-audio-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  min-height: 50px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  /* 防止头部被压缩 */
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left > div {
  font-size: 16px;
}

.header-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-title-group > div:first-child {
  font-size: 16px;
}

.header-disclaimer {
  font-size: 11px;
  color: #999;
  line-height: 1;
}

.header-icon {
  width: 24px;
  height: 24px;
}

.close-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.close-button:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.close-button span {
  font-size: 24px;
  line-height: 1;
  color: #999;
}

.close-button:hover span {
  color: #666;
}

.chat-container {
  background-image: url(https://pub.pincaimao.com/static/web/images/login/bg_login_m.png);
  background-size: 100%;
  height: 100%;
  border-radius: 0px 0px 8px 8px;
}

.chat-history {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
  height: 60vh;
  min-height: 400px;
  max-height: 900px;
}

.node-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 16px;
  padding: 4px 0;
  color: #8c8c8c;
  font-size: 13px;
  line-height: 20px;
}

.node-status-spinner {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  margin-top: 4px;
  border: 1.5px dotted #a3a3a3;
  border-right-color: transparent;
  border-radius: 50%;
  animation: chat-node-status-spin 1.2s linear infinite;
}

.node-status-text {
  min-width: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

@keyframes chat-node-status-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 添加全屏模式下的样式 */
.fullscreen .chat-history {
  height: auto;
  flex: 1 1 auto;
}

.message-input {
  padding: 16px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: center;
}

.message-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s ease;
}

.message-input input:focus {
  border-color: #bbb;
}

/* 消息样式 */
.message {
  margin-bottom: 16px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.message-content {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 8px;
  word-break: break-word;
}

.message-content p {
  margin: 0;
  word-break: break-word;
}

.user-message {
  display: flex;
  justify-content: flex-end;
}

.agent-message {
  display: flex;
  justify-content: flex-start;
}

.user-message .message-content {
  background-color: #007bff;
  color: white;
}

.agent-message .message-content {
  background-color: #f1f1f1;
}

.message-time {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  display: block;
}

/** 结束对话按钮 */
.cancel-button {
  width: 150px;
  height: 38px;
  background: #0d75fb;
  color: #fff;
  border: none;
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 6px;
}

.cancel-button.disabled {
  background: #d9d9d9;
  cursor: not-allowed;
}

/* 发送按钮样式 */
.send-button {
  width: 38px;
  height: 38px;
  border-radius: 16px;
  background: #0d75fb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.send-button img {
  width: 24px;
  height: 24px;
}

.send-button:hover {
  background: #0a62d6;
}

.send-button.disabled {
  background: #d9d9d9;
  cursor: not-allowed;
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #999;
  text-align: center;
}

.loading-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.98);
  z-index: 1;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-container p {
  margin-top: 16px;
  color: #666;
  font-size: 14px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1890ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 修改 messages-wrapper 的样式 */
.messages-wrapper {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  /* 当内容少时，将内容放在底部 */
  justify-content: flex-end;
}

/* 当有很多消息时，取消固定在底部 */
.messages-wrapper.has-overflow {
  justify-content: flex-start;
}

.suggested-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.suggested-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: #f3f4f6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: background-color 0.2s;
}

.suggested-question:hover {
  background-color: #e5e7eb;
}

.arrow-right {
  margin-left: 8px;
}

.loading-suggestions {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.loading-spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 添加上传按钮样式 */
.upload-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.upload-button:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.upload-button svg {
  width: 20px;
  height: 20px;
}

/* 隐藏原生文件输入框 */
.file-input {
  display: none;
}

/* 添加文件名显示区域样式 */
.selected-file {
  font-size: 12px;
  color: #666;
  margin-left: 8px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0 4px;
  background: white;
}

.input-wrapper input {
  border: none;
  flex: 1;
  padding: 8px;
  outline: none;
}

.input-wrapper:focus-within {
  border-color: #bbb;
}

/* 文件预览区域样式 */
.file-preview {
  padding: 8px 16px;
  border-top: 1px solid #eee;
  background-color: #f9f9f9;
}

.recording-section {
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px 0px 20px;
  border-radius: 14px 14px 0 0;
  flex: 0 0 auto;
}

/* 隐藏输入区后使用紧凑提示，避免保留输入框的大块空白。 */
.chat-readonly-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  padding: 4px 0 14px;
  color: #666;
  font-size: 12px;
  line-height: 1.6;
}

.chat-readonly-hint svg {
  flex-shrink: 0;
}

.recording-section .video-preview {
  width: 100%;
  height: 200px;
  max-width: 400px;
  position: relative;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
}

.recording-section video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 修改 recording-status 样式 */
.recording-status {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  z-index: 0;
}

.recording-status .recording-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: red;
  border-radius: 50%;
  margin-right: 5px;
  animation: blink 1s infinite;
}

.recording-status.warning {
  color: #ff4d4f;
  animation: blink 1s infinite;
}

@keyframes blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

.recording-section .stop-recording-button {
  background-color: #f44336;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

.recording-section .stop-recording-button:hover {
  background-color: #d32f2f;
}

.fullscreen {
  width: 100vw;
  border-radius: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.recording-controls {
  margin-top: 10px;
  height: 53px;
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: center;
}

.recording-controls .waiting-message {
  text-align: center;
  color: white;
  font-size: 16px;
  background-color: #0d75fb;
  border-radius: 6px;
  width: 95%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.recording-controls .waiting-message.loading {
  background: #faad14;
}

.recording-controls .waiting-message p {
  margin: 0;
  font-size: 16px;
  color: white;
  font-weight: 500;
}

.recording-controls .stop-recording-button {
  background-color: #dc3545;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

.recording-controls .stop-recording-button:hover {
  background-color: #c82333;
}

/* 添加禁用状态的样式 */
.recording-controls .stop-recording-button.disabled {
  background: #ccc;
  cursor: not-allowed;
}

.recording-controls .stop-recording-button.disabled:hover {
  background: #ccc;
}

/* 添加进度条和数字进度的样式 */
.progress-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin-top: 10px;
  padding: 0 5px;
}

.progress-bar-container {
  height: 4px;
  background-color: #e5e5e5;
  border-radius: 2px;
  overflow: hidden;
  margin-right: 10px;
  width: 75px;
}

.progress-bar {
  height: 100%;
  background-image: linear-gradient(111deg, #4a9fff 0%, #1058ff 100%);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
}

/* 重新设计文本输入区域样式 */
.text-input-area {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0px 16px 16px 16px;
  border-radius: 8px;
  border: none;
  /* 确保容器本身没有边框 */
}

/* 修改文本输入框样式 */
.text-answer-input {
  flex: 1;
  min-height: 80px;
  padding: 12px 12px 0px 12px;
  border: 1px solid #ddd;
  border-radius: 8px 8px 0 0;
  resize: none;
  font-size: 16px;
  background-color: #fff;
  border-bottom: none;
  outline: none;
  /* 移除默认的焦点轮廓 */
}

/* 修改工具栏样式 */
.input-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 12px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

/* 当输入框获得焦点时，修改边框颜色 */
.text-answer-input:focus {
  border-color: rgb(74, 144, 226);
  border-bottom: none;
}

.text-answer-input:focus+.input-toolbar {
  border-color: rgb(74, 144, 226);
  border-top: none;
}

/* 左侧工具按钮区域 */
.toolbar-actions {
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
}

.toolbar-actions:hover {
  background-color: #f0f0f0;
}

/* 修改工具按钮样式，确保居中 */
.toolbar-button {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 确保按钮内部的内容也居中 */
.toolbar-button>div,
.toolbar-button>svg {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 发送按钮样式 */
.submit-text-button {
  padding: 6px 16px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.submit-text-button:hover:not(.disabled) {
  background-color: #3a7bc8;
}

.submit-text-button.disabled {
  background-color: #b3b3b3;
  cursor: not-allowed;
}

/* 语音输入按钮样式 */
.toolbar-button.recording {
  background-color: rgba(255, 0, 0, 0.1);
  color: #ff3b30;
  animation: pulse 1.5s infinite;
}

.toolbar-button.converting {
  background-color: rgba(0, 122, 255, 0.1);
  color: #007aff;
}

.toolbar-button .recording-time {
  font-size: 12px;
  margin-left: 4px;
}

.converting-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
}

.converting-indicator svg {
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(255, 0, 0, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
  }
}

/* 响应式布局 */
@media screen and (max-width: 768px) {
  .pc-layout {
    width: 95%;
  }

  .modal-overlay {
    padding: 0;
  }

  .modal-container.fullscreen {
    /* 移动端也基于父组件尺寸 */
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 16px 16px 0 0;
    /* 保留安全区域支持 */
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  }
}

/* 工作区样式 */
.workspace-section {
  width: 100%;
  padding: 0px 16px 16px;
}

.workspace-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  position: relative;
}

.workspace-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: white;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.workspace-button:hover {
  border-color: #4096ff;
  color: #4096ff;
  box-shadow: 0 2px 4px rgba(64, 150, 255, 0.1);
}

.workspace-button svg {
  flex-shrink: 0;
}

/* 结束面试按钮样式 */
.workspace-button.end-interview-button {
  background: #ff4d4f;
  color: white;
  border-color: #ff4d4f;
}

.workspace-button.end-interview-button:hover:not(:disabled) {
  background: #ff7875;
  border-color: #ff7875;
  color: white;
  box-shadow: 0 2px 4px rgba(255, 77, 79, 0.2);
}

.workspace-button.end-interview-button:disabled {
  background: #d9d9d9;
  border-color: #d9d9d9;
  color: #999;
  cursor: not-allowed;
  box-shadow: none;
}

/* 数字人容器样式 */
.digital-human-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 80px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
  position: absolute;
  right: 0px;
}


/* 历史会话抽屉样式 */
.history-drawer-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.loading-conversations,
.empty-conversations {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #999;
}

.loading-conversations .loading-spinner-small {
  margin-bottom: 12px;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 0 8px 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.conversation-item:hover {
  background: #f5f5f5;
}

.conversation-item.active {
  background: #e6f7ff;
  border-color: #1890ff;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-title {
  font-size: 14px;
  font-weight: 500;
  color: #262626;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8c8c8c;
}

.conversation-time {
  flex-shrink: 0;
}

.message-count {
  flex-shrink: 0;
}

.conversation-status {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.conversation-status.completed {
  background: #f6ffed;
  color: #52c41a;
}

.conversation-status.running {
  background: #fff7e6;
  color: #fa8c16;
}

.current-indicator {
  flex-shrink: 0;
  color: #1890ff;
  margin-left: 8px;
}