/* ===== 卡密自动发货系统 - 前台微信风格 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f0f0;
  display: flex;
  justify-content: center;
}
.hidden { display: none !important; }

/* ---------- 登录面板 ---------- */
.login-panel {
  width: 100%; max-width: 480px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #e7f3ff 0%, #f6f8fb 55%, #eefaf0 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 340px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
  padding: 30px 26px 24px;
}
.login-logo { font-size: 44px; text-align: center; }
.login-card h1 { font-size: 20px; text-align: center; margin-top: 8px; color: #1f2329; }
.login-sub { font-size: 12px; color: #9aa0a6; text-align: center; margin: 4px 0 18px; }
.tabs { display: flex; background: #f2f3f5; border-radius: 8px; padding: 3px; margin-bottom: 16px; }
.tab {
  flex: 1; border: 0; background: transparent; padding: 8px 0;
  font-size: 14px; color: #666; border-radius: 6px; cursor: pointer;
}
.tab.active { background: #fff; color: #07c160; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.field { margin-bottom: 12px; }
.field input {
  width: 100%; padding: 11px 12px; font-size: 14px;
  border: 1px solid #e0e0e0; border-radius: 8px; outline: none;
}
.field input:focus { border-color: #07c160; }
.login-tip { font-size: 12px; color: #e64340; min-height: 18px; margin-bottom: 4px; }
.login-btn {
  width: 100%; padding: 11px 0; border: 0; border-radius: 8px;
  background: #07c160; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-btn:active { background: #06ad56; }
.login-note { font-size: 11px; color: #b0b4b8; text-align: center; margin-top: 14px; line-height: 1.6; }

/* ---------- 聊天主界面 ---------- */
.chat-panel {
  width: 100%; max-width: 480px; height: 100%;
  display: flex; flex-direction: column;
  background: #ededed;
  border-left: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0;
}
.chat-header {
  background: #ededed;
  padding: 12px 16px 10px;
  text-align: center;
  border-bottom: 1px solid #e2e2e2;
  flex: none;
}
.header-title { font-size: 16px; font-weight: 600; color: #1f2329; }
.header-sub { font-size: 11px; color: #9aa0a6; margin-top: 2px; }

.chat-body {
  flex: 1; overflow-y: auto;
  padding: 12px 14px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.5) 0, transparent 30%),
    #ededed;
  scroll-behavior: smooth;
}
.chat-date { text-align: center; font-size: 11px; color: #b0b4b8; margin: 6px 0 12px; }

/* 消息行 */
.msg { display: flex; margin-bottom: 14px; align-items: flex-start; }
.msg.bot { justify-content: flex-start; }
.msg.me  { justify-content: flex-end; }

.avatar {
  width: 38px; height: 38px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex: none;
}
.msg.bot .avatar { background: #e0f2fe; margin-right: 10px; }
.msg.me  .avatar { background: #d7f5e1; margin-left: 10px; order: 2; }

.bubble {
  max-width: 72%;
  padding: 10px 12px;
  font-size: 15px; line-height: 1.6;
  color: #1f2329;
  word-break: break-all; white-space: pre-wrap;
  position: relative;
}
.msg.bot .bubble {
  background: #fff; border-radius: 4px 10px 10px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.msg.me .bubble {
  background: #95ec69; border-radius: 10px 4px 10px 10px;
}
/* 时间戳 */
.msg .time {
  display: block; font-size: 10px; color: #b0b4b8;
  margin-top: 4px;
}
.msg.bot .time { text-align: left; }
.msg.me .time { text-align: right; }

/* 正在输入 */
.typing .bubble { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 8px 14px; }
.typing .dot {
  width: 6px; height: 6px; border-radius: 50%; background: #a0a4a8;
  animation: blink 1.2s infinite;
}
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

/* 媒体消息（关键词回复的图片/视频） */
.bubble img {
  max-width: 100%; max-height: 260px;
  border-radius: 6px; display: block; margin: 2px 0;
}
.bubble video {
  max-width: 100%; max-height: 260px;
  border-radius: 6px; display: block; margin: 2px 0; background: #000;
}

/* 客服 / 公告 徽标 */
.badge {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  margin-right: 6px; vertical-align: 1px; color: #fff;
}
.badge-admin { background: #ff9800; }
.badge-broadcast { background: #8b5cf6; }

/* 快捷指令 */
.quick-bar {
  display: flex; gap: 8px;
  padding: 8px 14px;
  background: #ededed;
  overflow-x: auto; flex: none;
}
.chip {
  flex: none;
  font-size: 12px; color: #576b95;
  background: #f7f7f7; border: 1px solid #e2e2e2;
  padding: 5px 12px; border-radius: 14px;
  cursor: pointer; user-select: none;
}
.chip:active { background: #eef0f2; }

/* 输入栏 */
.chat-input-bar {
  display: flex; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: #f7f7f7; border-top: 1px solid #e2e2e2;
  flex: none;
}
.chat-input-bar input {
  flex: 1; padding: 10px 14px; font-size: 15px;
  border: 1px solid #e0e0e0; border-radius: 8px; outline: none;
  background: #fff;
}
.chat-input-bar input:focus { border-color: #07c160; }
.chat-input-bar button {
  flex: none; width: 64px; border: 0; border-radius: 8px;
  background: #07c160; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.chat-input-bar button:active { background: #06ad56; }

/* 移动端适配 */
@media (max-width: 480px) {
  .chat-panel { border: 0; }
  .bubble { max-width: 78%; }
}

/* ===== 支付宝当面付支付卡片 ===== */
.pay-bubble { min-width: 200px; text-align: center; }
.pay-title { font-size: 13px; color: #888; margin-bottom: 8px; }
.pay-qr { display: flex; justify-content: center; margin: 0 auto 8px; }
.pay-qr canvas { width: 168px; height: 168px; border-radius: 6px; background: #fff; padding: 8px; box-sizing: border-box; border: 1px solid #eee; }
.pay-amount { font-size: 20px; font-weight: 700; color: #e64340; margin-bottom: 6px; }
.pay-tip { font-size: 12px; color: #999; margin-bottom: 6px; }
.pay-status { font-size: 12px; color: #e6a23c; margin-bottom: 8px; min-height: 16px; }
.pay-actions { text-align: center; }
.pay-close { border: 1px solid #ddd; background: #fff; color: #666; font-size: 12px; border-radius: 12px; padding: 3px 14px; cursor: pointer; }
.pay-close:active { background: #f5f5f5; }
