
:root {
  --primary-bg: #ffffff;
  --secondary-bg: #f8f9fa;
  --border-color: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #adb5bd;
  --accent-color: #07C160;
  --user-bubble: #f1f3f5;
  --staff-bubble: #212529;
  --system-bubble: #f8f9fa;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);  
  --sum-color: #9A1F1D;
}


.chat-container {
  max-width: 800px;
  width: 100%;
  height: 90vh;
  max-height: 100vh;
  margin: 2rem auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--secondary-bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative; /* 为内部元素定位做准备 */
}

.chat-form {
  margin: 0; /* 移除外边距 */
  background: var(--primary-bg);
  padding: 1.25rem;
  border-radius: 0 0 var(--radius-md) var(--radius-md); /* 只保留底部圆角 */
  border: none; /* 移除边框，使用容器的边框 */
  border-top: 1px solid var(--border-color); /* 只保留顶部边框 */
  box-shadow: none; /* 移除阴影，使用容器的阴影 */
  flex-shrink: 0; /* 防止表单被压缩 */
}
.chat-container:hover {
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.chat-header {
  padding: 1.2rem 0.5rem;
  background: var(--primary-bg);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  text-align: center; /* 直接在header中居中 */
  position: relative; /* 为状态信息定位做准备 */
}

.chat-title {
  color: #be002f;
  text-align: center; /* 确保居中 */
  margin: 0; 
  padding: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-bottom: none; /* 移除标题边框 */
  display: inline-block; /* 让标题自然居中 */
}

.chat-status {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chat-status::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
}

.chat-messages {
  height: 500px;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--primary-bg);
  scroll-behavior: smooth;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  max-width: 85%;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  flex-shrink: 0;
  align-self: flex-end;
}

.message-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-bg);
  box-shadow: var(--shadow-sm);
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.message-sender {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.message-text {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  transition: var(--transition);
}

/* User Message */
.message-user {
  align-self: flex-start;
}

.message-user .message-text {
  background: var(--user-bubble);
  color: var(--text-primary);
  border-top-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* Staff Message */
.message-staff {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-staff .message-text {
  background: var(--accent-color);
  color: white;
  border-top-right-radius: var(--radius-sm);
}

.message-staff .message-header {
  flex-direction: row-reverse;
}

/* System Message */
.message-system {
  align-self: center;
  max-width: 100%;
  justify-content: center;
}

.message-system .message-content {
  align-items: center;
}

.message-system .message-text {
  background: var(--system-bubble);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  text-align: center;
}


.chat-group {
    margin-bottom: 0;
    width: 100%; 
}
.chat-group form {
    width: 100%;
    max-width: 100%;
}
.chat-group input,
.chat-group textarea {
    width: 100%;
    min-width: 0;
    padding: 0.75rem 1rem; 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    background: var(--secondary-bg);
    box-sizing: border-box; 
    transition: var(--transition);
    line-height: 1.5;
}

.chat-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.chat-group input:focus,
.chat-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.chat-submit {
  background: var(--sum-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.chat-submit:hover {
  background: #9A1F1C;
  transform: translateY(-1px);
}

.chat-case {
  padding: 1.25rem;
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--secondary-bg);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #ced4da;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #adb5bd;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 0;
    margin: 0;
    border-left: none;
    border-right: none;
  }
  
  .chat-messages {
    height: 400px;
    padding: 1rem;
  }
  
  .message {
    max-width: 90%;
  }
  
  .chat-form {
    padding: 1rem;
    margin: 1rem 0;
  }
  .chat-title {
    font-size: 1.5rem;
  }
  iframe {
    height: 400px;
  }
}

/* Animation */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.new-message {
  animation: pulse 0.5s ease;
}
  .fullscreen-iframe {
    width: 100%;
    height: 60vh; 
    border: none;
  }
.chat-form.fixedBottom {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .fixedBottom {
        padding: 0.75rem 1rem;
    }
    
    .fixedBottom .chat-group {
        margin-bottom: 0.5rem;
    }
}
  .fullscreen-iframe {
    width: 100%;
    height: 60vh; 
    border: none;
  }
/* 如果有输入框在 fixedBottom 内 */
.fixedBottom .chat-group input,
.fixedBottom .chat-group textarea {
    width: 100%;
    box-sizing: border-box;
}
/* 通知面板样式 */
.notification-panel {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    align-items: center;
}

.notification-close-btn {
    background: none;
    border: none;
    color: white;
    margin-left: 15px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.notification-close-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 客服消息样式 - 保持原来的粉红色 */
.message-staff .message-text {
    background: #07C160;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-staff .message-avatar {
    background: #ddd;
    color: #333;
}

/* 用户消息样式 - 保持原来的蓝色 */
.message-user .message-text {
    background: #e3f2fd;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-user .message-avatar {
    background: #ddd;
    color: #333;
}

/* 系统消息样式 */
.message-system .message-text {
    background: #f5f5f5;
}

.chat-case {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* 动画效果 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 图标样式 */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-bell {
    margin-right: 10px;
}

/* 消息列表滚动条 */
.message-list::-webkit-scrollbar {
    width: 6px;
}

.message-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.message-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.message-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .notification-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        padding: 12px 16px;
    }
}