/* 哈佛币代售网站 · 客户在线聊天 */
:root {
  --chat-brand: #ff5000;
  --chat-brand-dark: #e84800;
  --chat-bg: #f5f6f8;
  --chat-line: #eceef2;
  --chat-text: #243044;
  --chat-muted: #8b97a8;
}

.chat-launcher[hidden],
.chat-panel[hidden] {
  display: none !important;
}

.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 17px 11px 13px;
  border: 1px solid rgba(255, 80, 0, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--chat-brand);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(255, 80, 0, 0.2), 0 2px 8px rgba(20, 30, 50, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(255, 80, 0, 0.26), 0 2px 8px rgba(20, 30, 50, 0.1);
}

.chat-launcher-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b1a, #ff4d00);
  color: #fff;
}

.chat-launcher-icon svg { width: 18px; height: 18px; }

.chat-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 25, 45, 0.24);
  font-family: inherit;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 14px 16px;
  background: linear-gradient(135deg, #ff5a12, #ff8a2a);
  color: #fff;
}

.chat-head-main { display: flex; align-items: center; gap: 10px; min-width: 0; }

.chat-head-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 15px;
  font-weight: 800;
}

.chat-head-main strong { display: block; font-size: 14px; letter-spacing: 0.2px; }

.chat-status { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: rgba(255, 255, 255, 0.82); font-size: 10.5px; }

.chat-status i { width: 6px; height: 6px; border-radius: 50%; background: #8ef0b0; box-shadow: 0 0 0 2px rgba(142, 240, 176, 0.2); }

.chat-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chat-close:hover { background: rgba(255, 255, 255, 0.26); }

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 10px;
  background: var(--chat-bg);
  overscroll-behavior: contain;
}

.chat-day {
  margin: 4px 0 14px;
  color: #a4adba;
  font-size: 10px;
  text-align: center;
}

.chat-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }

.chat-row.from-customer { flex-direction: row-reverse; }

.chat-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  color: #8a94a4;
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.08);
}

.chat-row.from-customer .chat-avatar { background: #ffe2d3; color: var(--chat-brand); }

.chat-bubble-wrap { max-width: 78%; min-width: 0; }

.chat-bubble {
  padding: 9px 12px;
  border: 1px solid var(--chat-line);
  border-radius: 4px 13px 13px 13px;
  background: #fff;
  color: var(--chat-text);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-row.from-customer .chat-bubble {
  border-color: transparent;
  border-radius: 13px 4px 13px 13px;
  background: linear-gradient(135deg, #ff6b1a, #ff5000);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 80, 0, 0.16);
}

.chat-time { margin-top: 4px; color: #a4adba; font-size: 9.5px; text-align: right; }

.chat-row.from-admin .chat-time { text-align: left; }

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 220px;
  padding: 30px 20px;
  color: #98a2b1;
  text-align: center;
}

.chat-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #fff2e9;
  color: var(--chat-brand);
  font-size: 24px;
}

.chat-empty strong { color: #566174; font-size: 13px; }

.chat-empty p { margin-top: 6px; font-size: 11.5px; line-height: 1.7; }

.chat-error {
  flex: none;
  padding: 7px 14px;
  border-top: 1px solid #ffe0d6;
  background: #fff6f2;
  color: #d84a1b;
  font-size: 11px;
}

.chat-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--chat-line);
  background: #fff;
}

.chat-composer input {
  min-width: 0;
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #e4e8ee;
  border-radius: 10px;
  outline: none;
  background: #f8f9fb;
  color: var(--chat-text);
  font-family: inherit;
  font-size: 12.5px;
}

.chat-composer input:focus { border-color: #ffb28a; background: #fff; box-shadow: 0 0 0 3px rgba(255, 80, 0, 0.08); }

.chat-send {
  height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff6b1a, #ff5000);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.chat-send:disabled { opacity: 0.55; cursor: default; }

.chat-open { overflow: hidden; }

@media (max-width: 640px) {
  .chat-launcher {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 9px 14px 9px 10px;
  }

  .chat-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    z-index: 300;
  }

  .chat-header { padding-top: calc(14px + env(safe-area-inset-top)); }

  .chat-composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
