﻿/* ==========================================================================
   仿 LiveChat 移动端极简客服系统样式表 (style.css)
   ========================================================================== */

:root {
  --primary-blue: #0066ff;
  --primary-blue-hover: #0052cc;
  --bg-page: #f7f9fc;
  --bg-outer-gradient: radial-gradient(circle at 50% 25%, #cde4ff 0%, #a4cdff 100%);
  --bubble-agent: #ffffff;
  --bubble-user: #0066ff;
  --text-primary: #1e2024;
  --text-secondary: #8c9099;
  --shadow-bubble: 0 3px 12px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.07);
  --shadow-pill: 0 8px 24px rgba(0, 0, 0, 0.09);
  --online-green: #00c853;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background: var(--bg-outer-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
}

/* ==========================================================================
   页面主容器与 PC 模拟框架适配
   ========================================================================== */
#app {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 手机外壳容器（PC 预览时呈手机形态，移动端填满全屏） */
.phone-wrapper {
  width: 100%;
  height: 100%;
  max-width: 440px;
  background-color: var(--bg-page);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 40, 100, 0.18);
}

@media (min-width: 769px) {
  .phone-wrapper {
    height: 92vh;
    max-height: 880px;
    border-radius: 40px;
    border: 8px solid #ffffff;
    box-shadow: 0 25px 70px rgba(10, 45, 110, 0.22);
  }
}

/* ==========================================================================
   顶部导航区 & 悬浮胶囊卡片
   ========================================================================== */
.header-bar {
  position: relative;
  width: 100%;
  padding: 16px 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

/* 左侧按钮组（返回 + 三点菜单） */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333333;
  transition: background-color 0.2s;
}

.icon-btn:active {
  background: rgba(0, 0, 0, 0.12);
}

/* 顶部居中客服胶囊悬浮卡片 */
.agent-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 14px;
  background: #ffffff;
  border-radius: 40px;
  padding: 6px 20px 6px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-pill);
  z-index: 20;
  user-select: none;
}

.pill-avatars {
  position: relative;
  display: flex;
  align-items: center;
}

.pill-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
}

.pill-avatar.overlap {
  margin-left: -14px;
}

.online-dot {
  position: absolute;
  top: 0;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: var(--online-green);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 200, 83, 0.4);
}

.pill-info {
  display: flex;
  flex-direction: column;
}

.pill-name {
  font-size: 15px;
  font-weight: 700;
  color: #111111;
  line-height: 1.2;
}

.pill-status {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ==========================================================================
   排队横幅通知（置于顶部下方）
   ========================================================================== */
.queue-banner {
  margin: 30px 18px 0;
  padding: 10px 16px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: var(--shadow-bubble);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInDown 0.3s ease-out;
  transition: all 0.3s ease;
}

.queue-banner.connected {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
}

.queue-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #d4dae2;
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.queue-banner.connected .queue-spinner {
  display: none;
}

.queue-connected-icon {
  display: none;
  color: var(--online-green);
  flex-shrink: 0;
}

.queue-banner.connected .queue-connected-icon {
  display: block;
}

.queue-text {
  font-size: 13px;
  color: #333333;
  line-height: 1.4;
  font-weight: 500;
}

/* ==========================================================================
   聊天消息滚动区
   ========================================================================== */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-scroll-area::-webkit-scrollbar {
  width: 4px;
}
.chat-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

/* 客服消息行 */
.msg-row-agent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 88%;
  animation: fadeInUp 0.35s ease-out forwards;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-bubble-agent {
  background: var(--bubble-agent);
  color: var(--text-primary);
  padding: 13px 16px;
  border-radius: 18px;
  box-shadow: var(--shadow-bubble);
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

/* 用户消息行 */
.msg-row-user {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  animation: fadeInUp 0.35s ease-out forwards;
}

.msg-bubble-user {
  background: var(--bubble-user);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 80%;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.25);
  word-break: break-word;
}

/* 系统居中提示 */
.msg-row-system {
  width: 100%;
  text-align: center;
  margin: 12px 0 6px;
  animation: fadeIn 0.4s ease;
}

.system-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 特殊卡片消息（还原参考图底部带星标的输入卡片） */
.msg-row-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  animation: fadeInUp 0.4s ease-out forwards;
  margin-top: 6px;
}

.card-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}

.card-box {
  flex: 1;
  background: #ffffff;
  border-radius: 22px;
  padding: 20px 18px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.55;
  margin-bottom: 14px;
}

.card-input-box {
  width: 100%;
  height: 76px;
  background: #eef1f5;
  border: 1px solid #dbe1e8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #333333;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  display: block;
}

.card-input-box:focus {
  border-color: var(--primary-blue);
  background: #ffffff;
}

.card-submit-btn {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s, transform 0.1s;
}

.card-submit-btn:active {
  background: var(--primary-blue-hover);
  transform: scale(0.99);
}

.card-submitted-tip {
  color: #00c853;
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
  display: none;
}

/* 打字中动画气泡 (Typing Indicator) */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #999999;
  border-radius: 50%;
  animation: bounce 1.3s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

/* ==========================================================================
   底部输入栏
   ========================================================================== */
.chat-input-bar {
  width: 100%;
  background: #ffffff;
  padding: 10px 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.03);
}

.chat-input-bar.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.input-field {
  flex: 1;
  height: 42px;
  background: #f1f3f6;
  border: 1px solid transparent;
  border-radius: 21px;
  padding: 0 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  color: #222222;
  transition: all 0.2s;
}

.input-field:focus {
  background: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:active {
  background: var(--primary-blue-hover);
  transform: scale(0.95);
}

/* ==========================================================================
   底部版权文字
   ========================================================================== */
.footer-bar {
  width: 100%;
  text-align: center;
  padding: 10px 0 16px;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.footer-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

/* ==========================================================================
   PC 端访问限制拦截遮罩
   ========================================================================== */
.pc-block-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  z-index: 99999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  text-align: center;
}

.pc-block-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
  color: var(--primary-blue);
}

.pc-block-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.pc-block-desc {
  font-size: 15px;
  color: #666666;
  max-width: 420px;
  line-height: 1.6;
  margin-bottom: 30px;
}

.pc-switch-btn {
  padding: 10px 22px;
  border: 1px solid #d4dae2;
  border-radius: 20px;
  background: #f7f9fc;
  color: #555555;
  font-size: 13px;
  cursor: pointer;
}

/* ==========================================================================
   动画定义
   ========================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}
