body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  display: flex;
  height: 100vh;
}
.sidebar {
  width: 280px;
  background-color: #2c3e50;
  color: white;
  padding: 15px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.toggle-sidebar {
  display: none;
  position: fixed;
  right: 10px; /* Changed from left to right */
  top: 10px;
  z-index: 20;
  background-color: #3498db;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.toggle-sidebar-open {
  right: 290px; /* Position when sidebar is open */
  transition: right 0.3s ease;
}
.logo {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #3a506b;
}

.agent-info {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #3a506b;
}

.customer-list {
  flex: 1;
  overflow-y: auto;
}

.customer-item {
  padding: 10px;
  margin-bottom: 8px;
  background-color: #34495e;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
}

.customer-item:hover,
.customer-item.active {
  background-color: #4a6b8a;
}

.customer-item .customer-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.customer-item .last-message {
  font-size: 12px;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: white;
  flex: 1;
}

.chat-header {
  background-color: #3498db;
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  -webkit-overflow-scrolling: touch; /* 为iOS设备添加惯性滚动 */
}

.message {
  margin-bottom: 15px;
  display: flex;
}

.message-content {
  max-width: 80%;
  padding: 10px;
  border-radius: 15px;
  overflow-wrap: break-word;
  position: relative;
}

.message-timestamp {
  font-size: 11px;
  color: #777;
  margin-top: 5px;
  text-align: right;
}

.support-message {
  justify-content: flex-end;
}

.support-message .message-content {
  background-color: #3498db;
  color: white;
}

.support-message .message-timestamp {
  text-align: right;
  color: rgba(255, 255, 255, 0.7);
}

.customer-message {
  justify-content: flex-start;
}

.customer-message .message-content {
  background-color: #f0f0f0;
  color: #333;
}

.customer-message .message-timestamp {
  text-align: right;
  color: rgba(0, 0, 0, 0.5);
}

.system-message {
  justify-content: center;
}

.system-message .message-content {
  background-color: #fff3cd;
  color: #856404;
  font-style: italic;
  text-align: center;
  max-width: 80%;
}

.error-message .error-content {
  background-color: #ffebee;
  border-left: 4px solid #f44336;
  margin: 8px 0;
  padding: 8px 12px;
  color: #b71c1c;
  font-weight: 500;
}

.chat-input {
  display: flex;
  padding: 10px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
}

.chat-input textarea {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-right: 10px;
  resize: none;
  height: 40px;
  max-height: 120px;
}

.chat-input button {
  padding: 10px 15px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  height: 60px;
}

.chat-input button:hover {
  background-color: #2980b9;
}

.connection-status {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background-color: #f8d7da;
  color: #721c24;
  padding: 5px 10px;
  text-align: center;
  display: none;
  z-index: 5;
}

.disconnected {
  opacity: 0.6;
}

.busy {
  position: relative;
}

.busy:after {
  content: "•";
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 20px;
  color: #e74c3c;
}

.chat-input {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
}

.input-actions {
  display: flex;
  margin-top: 10px;
}

.chat-input textarea {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  height: 40px;
  max-height: 120px;
}

.chat-input button {
  padding: 10px 15px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  height: 40px;
  margin-left: 10px;
}

.media-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  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: 85%;
    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;
}

.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: 768px) {
  .message-media.loading {
    width: 150px;
    height: 120px;
    padding: 10px;
  }
   .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;
}

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

  .loading-text {
    font-size: 12px;
  }
  .toggle-sidebar-open {
    right: 10px; /* Keep in same position on mobile */
  }
  body {
    flex-direction: column;
    height: 100%;
    position: fixed;
    width: 100%;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    width: 100%;
    max-width: 100%;
    height: 100%;
    z-index: 10;
    transform: translateX(0);
    transition: transform 0.3s ease;
    overflow-y: auto;
    right: 0; /* Position sidebar on the right */
    left: auto; /* Override default left positioning */
  }

  .sidebar-hidden {
    transform: translateX(-100%);
  }

  .main-content {
    width: 100%;
    margin-left: 0;
    height: 100%;
    position: fixed;
    overflow: hidden;
  }

  .toggle-sidebar {
    display: flex; /* 移动设备上显示 */
  }

  .chat-header {
    padding: 10px 15px;
  }

  .chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-input {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
  }

  .chat-input textarea {
    height: 36px;
    padding: 8px;
  }

  .chat-input button {
    padding: 8px 12px;
    height: 52px;
  }

  .message-content {
    max-width: 90%;
  }

  .customer-name, .session-id {
    font-size: 14px;
  }

  .customer-item {
    padding: 8px;
  }

  .logo {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
  }
  .media-preview {
    margin-bottom: 8px;
  }

  .input-actions {
    margin-top: 8px;
  }

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

  .chat-input textarea {
    height: 36px;
  }

  .chat-input button,
  .media-upload-label {
    height: 36px;
  }
}
