/* Simulated online customer service chat */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #eef1f6;
  color: #333;
}
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 24px rgba(0,0,0,.08);
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: #fff;
  flex-shrink: 0;
}
.chat-header__brand { display: flex; align-items: center; gap: 10px; }
.chat-header__logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.chat-header__title { font-size: 16px; font-weight: 600; }
.chat-header__status { font-size: 12px; opacity: .85; margin-top: 2px; }
.chat-header__status.is-online::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  background: #4ade80; border-radius: 50%; margin-right: 5px;
}
.chat-header__actions button {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.chat-header__actions button:hover { background: rgba(255,255,255,.25); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
}
.chat-msg { margin-bottom: 16px; display: flex; gap: 10px; }
.chat-msg--system { justify-content: center; }
.chat-msg--system .chat-msg__bubble {
  background: #e8edf5; color: #666; font-size: 12px;
  padding: 6px 14px; border-radius: 12px;
}
.chat-msg--agent { flex-direction: row; }
.chat-msg--user { flex-direction: row-reverse; }
.chat-msg__avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: #2563eb; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.chat-msg--user .chat-msg__avatar { background: #94a3b8; }
.chat-msg__content { max-width: 72%; }
.chat-msg__name { font-size: 12px; color: #999; margin-bottom: 4px; }
.chat-msg--user .chat-msg__name { text-align: right; }
.chat-msg__bubble {
  padding: 10px 14px; border-radius: 4px 12px 12px 12px;
  background: #fff; line-height: 1.6; font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  word-break: break-word;
}
.chat-msg--user .chat-msg__bubble {
  background: #2563eb; color: #fff;
  border-radius: 12px 4px 12px 12px;
}
.chat-msg__bubble p { margin-bottom: 8px; }
.chat-msg__bubble p:last-child { margin-bottom: 0; }
.chat-msg__bubble ul { margin: 6px 0 6px 18px; }
.chat-msg__bubble li { margin-bottom: 4px; }

.chat-typing {
  display: flex; gap: 4px; padding: 12px 16px;
  background: #fff; border-radius: 12px; width: fit-content;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.chat-typing span {
  width: 7px; height: 7px; background: #94a3b8; border-radius: 50%;
  animation: typing 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-quick {
  padding: 8px 16px; background: #fff; border-top: 1px solid #eee;
  display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0;
}
.chat-quick button {
  border: 1px solid #2563eb; color: #2563eb; background: #fff;
  padding: 6px 14px; border-radius: 16px; font-size: 13px; cursor: pointer;
}
.chat-quick button:hover { background: #eff6ff; }

.chat-footer {
  padding: 12px 16px; background: #fff; border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.chat-footer__tip {
  font-size: 12px; color: #999; margin-bottom: 8px; text-align: center;
}
.chat-footer__row { display: flex; gap: 10px; align-items: flex-end; }
.chat-footer textarea {
  flex: 1; resize: none; border: 1px solid #ddd; border-radius: 6px;
  padding: 10px 12px; font-size: 14px; line-height: 1.4;
  min-height: 42px; max-height: 100px; font-family: inherit;
}
.chat-footer textarea:focus { outline: none; border-color: #2563eb; }
.chat-footer__send {
  background: #2563eb; color: #fff; border: none;
  padding: 10px 20px; border-radius: 6px; cursor: pointer;
  font-size: 14px; white-space: nowrap;
}
.chat-footer__send:disabled { background: #94a3b8; cursor: not-allowed; }
.chat-footer__phone {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 10px; font-size: 13px; color: #666;
}
.chat-footer__phone a { color: #2563eb; text-decoration: none; font-weight: 600; }

.chat-connecting {
  position: fixed; inset: 0; background: rgba(255,255,255,.92);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; z-index: 100;
}
.chat-connecting.is-hidden { display: none; }
.chat-connecting__spinner {
  width: 40px; height: 40px; border: 3px solid #e5e7eb;
  border-top-color: #2563eb; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.chat-connecting__text { margin-top: 16px; color: #666; font-size: 14px; }

@media (max-width: 600px) {
  .chat-page { max-width: 100%; height: 100%; box-shadow: none; }
  .chat-msg__content { max-width: 80%; }
}
