:root {
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --secondary: #64748b;
  --accent: #f43f5e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --input-bg: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0, transparent 50%),
    radial-gradient(at 50% 0%, rgba(139, 92, 246, 0.1) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(244, 63, 94, 0.1) 0, transparent 50%);
}

.chat-container {
  width: 92%;
  max-width: 600px;
  height: 85vh;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
  position: relative;
}

.chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.status-badge {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 8px #10b981;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}


/* 消息气泡样式 */
.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  position: relative;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 2px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px -3px rgba(59, 130, 246, 0.3);
}

/* 用户气泡的小尖角 */
.message.user::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: -6px;
  width: 12px;
  height: 12px;
  background: #3b82f6;
  clip-path: polygon(0 0, 0% 100%, 100% 100%);
}

.message.admin {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 管理员气泡的小尖角 */
.message.admin::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -6px;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.message-text {
  word-break: break-word;
}

.message-time {
  font-size: 0.65rem;
  margin-top: 4px;
  opacity: 0.5;
  display: block;
  text-align: right;
}

.message.admin .message-time {
  text-align: left;
}

.chat-input-area {
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 10px;
  align-items: center;
}

input#message-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
  color: white;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input#message-input:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

button#send-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

button#send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

button#send-btn:active {
  transform: translateY(0);
}

/* 手机端适配优化 */
@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: flex-start; /* 移动端靠顶显示 */
  }

  .chat-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border: none;
    max-width: none;
  }

  .chat-header {
    padding: 8px 12px;
  }

  .chat-messages {
    padding: 10px;
    gap: 8px; /* 缩小气泡间距 */
  }

  .message {
    max-width: 90%; /* 气泡占用更多宽度 */
    padding: 8px 12px; /* 缩小气泡内边距 */
    font-size: 0.9rem;
    margin-bottom: 0;
  }

  .message-time {
    font-size: 0.6rem;
    margin-top: 2px;
  }

  .chat-input-area {
    padding: 8px 12px;
    gap: 8px;
  }

  input#message-input {
    padding: 8px 12px;
    border-radius: 8px;
  }

  button#send-btn {
    padding: 8px 16px;
  }

  .faq-container {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 12px;
  }

  .faq-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .burn-notice {
    padding: 6px;
    font-size: 0.7rem;
    margin-bottom: 8px;
  }
}

/* --- 后台管理端专用高级 UI --- */
.admin-layout {
  display: flex;
  width: 98%;
  max-width: 1400px;
  height: 92vh;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
}

.rooms-list {
  width: 280px;
  background: rgba(0, 0, 0, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.rooms-header {
  padding: 18px 20px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--primary);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(59, 130, 246, 0.05);
}

#rooms-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.room-item {
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.room-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.room-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.room-id {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.8rem;
  color: #e2e8f0;
  font-weight: 700;
  display: block;
}

.room-preview {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-item.active .room-id {
  color: var(--primary);
}

.room-item.active .room-preview {
  color: #94a3b8;
}

/* 后台聊天窗覆盖样式 */
.admin-layout .chat-container {
  flex: 1;
  width: auto;
  max-width: none;
  height: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.admin-layout .chat-header {
  padding: 15px 25px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#active-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
}

#admin-shred-btn {
  transition: all 0.3s;
  background: rgba(244, 63, 94, 0.08) !important;
  border: 1px solid rgba(244, 63, 94, 0.2) !important;
  color: #f43f5e !important;
}

/* --- 后台管理端输入区域美化 --- */
.admin-layout .chat-input-area {
  padding: 20px 30px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(15px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  gap: 20px;
}

#admin-message-input {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
  border-radius: 16px !important;
  padding: 15px 25px !important;
  font-size: 1rem !important;
  color: #f8fafc !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#admin-message-input:focus {
  background: rgba(0, 0, 0, 0.5) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1px);
}

#admin-send-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
  padding: 0 35px !important;
  height: 54px;
  border-radius: 16px !important;
  font-size: 1rem !important;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3) !important;
}

#admin-send-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4) !important;
  filter: brightness(1.1);
}

#admin-send-btn:active {
  transform: translateY(0) scale(0.98);
}

/* 优化管理端滚动条 */
.admin-layout ::-webkit-scrollbar {
  width: 6px;
}
.admin-layout ::-webkit-scrollbar-track {
  background: transparent;
}
.admin-layout ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.admin-layout ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.1);
}

.empty-chat::before {
  content: "🛡️";
  font-size: 4rem;
  filter: grayscale(1) opacity(0.2);
}

/* 调整管理端的消息显示 */
.admin-layout .message.admin {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.admin-layout .message.user {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  box-shadow: none;
}


/* 提示信息 */
.burn-notice {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent);
  padding: 8px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.75rem;
  margin-bottom: 10px;
  border: 1px solid rgba(244, 63, 94, 0.2);
}

/* FAQ 样式 */
.faq-container {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 15px;
  animation: fadeIn 0.6s ease-out;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.faq-title {
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.faq-title::before {
  content: "💡";
}

.faq-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-btn {
  background: rgba(59, 130, 246, 0.08);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.faq-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: white;
  transform: translateX(4px);
}

.faq-btn::after {
  content: "→";
  position: absolute;
  right: 14px;
  opacity: 0;
  transition: all 0.3s;
}

.faq-btn:hover::after {
  opacity: 1;
  right: 10px;
}

