.chat-container {
  height: 100vh;
  max-height: calc(100vh - 80px); /* 减少了顶部区域的空间预留 */
  display: flex;
  flex-direction: column;
}

.message-container {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch; /* 为iOS设备提供平滑滚动 */
}

.user-message {
  background-color: #dcf8c6;
  border-radius: 10px 0 10px 10px;
  align-self: flex-end;
  word-break: break-word; /* 确保长单词正确换行 */
  max-width: 80%; /* 在小屏幕上限制消息宽度 */
  margin-bottom: 8px;
}

.support-message {
  background-color: #f1f0f0;
  border-radius: 0 10px 10px 10px;
  align-self: flex-start;
  word-break: break-word;
  max-width: 80%;
}

.system-message {
  background-color: #ffe6cc;
  border-radius: 10px;
  align-self: center;
  text-align: center;
  margin: 5px auto;
  font-size: 0.85rem;
}

.language-selector {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 100;
}

/* FAQ Section Styles */
.faq-section {
  background-color: white;
  transition: all 0.3s ease;
}

.faq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background-color: #f8f9fa;
  cursor: pointer;
}

.faq-toggle-icon {
  transition: transform 0.3s ease;
}

.faq-header:hover {
  background-color: #f1f3f5;
}

.faq-content {
  border-top: 1px solid #e9ecef;
}

.faq-search {
  padding: 10px;
  border-bottom: 1px solid #e9ecef;
}

.faq-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 0;
}

.faq-item:hover {
  background-color: #f7fafc;
}

.faq-question {
  font-weight: 500;
  margin-bottom: 4px;
}

.faq-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
/* Style for the auto-reply label */
.auto-reply-message .text-xs {
  color: #3498db; /* Blue text for the "Auto-reply" label */
  font-weight: 500;
}

/* FAQ section styling */
.faq-item {
  border-bottom: 1px solid #eee;
  padding: 6px;
  cursor: pointer;
}

.faq-question {
  font-weight: 500;
  padding: 4px 0;
}

.faq-answer {
  display: none;
  padding: 8px;
  background-color: #f9f9f9;
  border-radius: 4px;
  margin-top: 4px;
}

.faq-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.auto-reply-toggle {
  font-size: 12px;
  padding: 4px 8px;
  background-color: #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
}

.auto-reply-toggle:hover {
  background-color: #cbd5e0;
}
.media-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: #f0f0f0;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  border: 1px solid #ddd;
}

.media-upload-label:hover {
  background-color: #e0e0e0;
}

.media-preview {
  margin-bottom: 10px;
  position: relative;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  background-color: #fff;
}

.preview-content {
  max-width: 100%;
  overflow: hidden;
}

.preview-content img {
  max-width: 200px;
  max-height: 150px;
  display: block;
}

.preview-content video,
.preview-content audio {
  max-width: 100%;
  display: block;
}

.remove-media {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

.message-media {
  max-width: 100%;
  max-height: 200px;
  margin-top: 5px;
  border-radius: 5px;
  overflow: hidden;
}

.message-media:hover {
  opacity: 0.7
}

.message-media img {
  max-width: 100%;
  max-height: 200px;
  display: block;
  cursor: pointer;
}

.message-getImg{
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}

.modal-content-box{
    position: relative;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
}

/* 图片 */
.modal-content {
    margin: auto;
    display: block;
    max-height: 90%;
    max-width: 100%;
}

/* 关闭按钮 */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}
 
.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}
 
.left-btn{
    position: absolute;
    width:70px;
    height:70px;
    top:50%;
    transform: translateY(-100%);
    left:0;
    background-color:rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor:pointer
}

.right-btn{
    position: absolute;
    width:70px;
    height:70px;
    top:50%;
    transform: translateY(-100%);
    right:0;
    font-size: 20px;
    background-color:rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor:pointer
}

.btn{
  width: 30px;
  height: 70px;
  margin:0 auto;
  font-size: 20px;
  text-align: center;
  line-height: 70px;
}

.left-btn:hover{
  background-color:rgba(255, 255, 255, 0.6);
}
.right-btn:hover{
  background-color:rgba(255, 255, 255, 0.6);
}

.message-media video,
.message-media audio {
  max-width: 100%;
  display: block;
}

.file-info {
  display: flex;
  align-items: center;
  background: #f0f0f0;
  padding: 8px;
  border-radius: 4px;
  margin-top: 5px;
}

.file-icon {
  margin-right: 8px;
  color: #3498db;
}

.file-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Loading Media Styles */
.message-media.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin: 8px 0;
  width: 200px;
  height: 150px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #3498db;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 8px;
}

.loading-text {
  font-size: 14px;
  color: #666;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.message-media.error {
  padding: 10px;
  background-color: rgba(255, 0, 0, 0.1);
  border-left: 3px solid #ff3333;
  color: #ff3333;
  border-radius: 4px;
  font-size: 14px;
  margin: 8px 0;
}
/* 移动端优化 */
@media (max-width: 640px) {
  .faq-controls {
    flex-direction: column;
    gap: 8px;
  }
  .chat-container {
    height: calc(100vh - 20px);
    max-height: none;
    border-radius: 0;
  }

  main.container {
    padding: 0;
    max-width: 100%;
  }

  .bg-white {
    border-radius: 0;
    box-shadow: none;
  }

  .user-message, .support-message {
    max-width: 85%;
    padding: 8px 12px;
  }

   .left-btn{
    position: absolute;
    width:40px;
    height:40px;
    top:50%;
    transform: translateY(-100%);
    left:10px;
    background-color:rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor:pointer
}

.right-btn{
    position: absolute;
    width:40px;
    height:40px;
    top:50%;
    transform: translateY(-100%);
    right:10px;
    font-size: 20px;
    background-color:rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor:pointer
}

.btn{
  width: 25px;
  height: 40px;
  margin:0 auto;
  font-size: 20px;
  text-align: center;
  line-height: 40px;
}

  #message-input {
    font-size: 16px; /* 防止iOS自动缩放 */
  }

  .message-form-container {
    position: sticky;
    bottom: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 8px;
  }

  /* 修复iOS视口高度问题 */
  @supports (-webkit-touch-callout: none) {
    .chat-container {
      height: -webkit-fill-available;
    }
  }
  .message-media.loading {
    width: 150px;
    height: 120px;
    padding: 10px;
  }

  .loading-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
  }

  .loading-text {
    font-size: 12px;
  }

  .preview-content img {
    max-width: 150px;
    max-height: 100px;
  }

  .media-upload-label {
    width: 32px;
    height: 32px;
  }
  /* Mobile FAQ optimizations */
  .faq-section {
    margin-bottom: 8px;
  }

  .faq-list {
    max-height: 150px;
  }

  .faq-item {
    padding: 6px;
  }

  .auto-reply-toggle {
    font-size: 11px;
    padding: 3px 6px;
  }
}
