/* ============ 客服聊天窗样式 ============ */
:root {
  --h2o-yellow: #ffe600;
  --h2o-ink: #161616;
  --h2o-grey: #54585a;
  --h2o-bg: #ffffff;
  --h2o-panel-w: 360px;
}

.h2o-chat { font-family: 'Arial', 'Helvetica Neue', Helvetica, sans-serif; }

/* ---- 悬浮气泡 ---- */
.h2o-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--h2o-yellow);
  color: var(--h2o-ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.15s ease;
}
.h2o-chat-launcher:hover { transform: scale(1.06); }

.h2o-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 10px;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  padding: 0 5px;
}

/* ---- 面板 ---- */
.h2o-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 82vh;
  display: none;
  flex-direction: column;
  background: var(--h2o-bg);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  z-index: 9999;
}
.h2o-chat-panel.open { display: flex; }

.h2o-chat-header {
  background: var(--h2o-ink);
  color: var(--h2o-yellow);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.h2o-chat-title { font-weight: bold; font-size: 16px; }

.h2o-chat-close {
  background: none;
  border: none;
  color: var(--h2o-yellow);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.h2o-chat-msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background: #f4f4f4;
  min-height: 320px;
  max-height: 60vh;
}

.h2o-chat-msg { margin-bottom: 10px; display: flex; flex-direction: column; }
.h2o-chat-msg--visitor { align-items: flex-end; }
.h2o-chat-msg--agent { align-items: flex-start; }
.h2o-chat-msg--system { align-items: center; }

.h2o-chat-bubble {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}
.h2o-chat-msg--visitor .h2o-chat-bubble { background: var(--h2o-yellow); color: var(--h2o-ink); border-bottom-right-radius: 2px; }
.h2o-chat-msg--agent .h2o-chat-bubble { background: #fff; color: #333; border: 1px solid #ddd; border-bottom-left-radius: 2px; }
.h2o-chat-msg--system .h2o-chat-bubble { background: #ececec; color: #666; font-size: 13px; text-align: center; }

.h2o-chat-time { font-size: 11px; color: #999; margin-top: 3px; }

/* 已撤回消息(访客端实时显示) */
.h2o-chat-msg--deleted .h2o-chat-bubble {
  background: #ececec !important;
  color: #9a9a9a !important;
  font-style: italic;
  font-size: 13px;
  border: none !important;
}

/* 客服正在输入 */
.h2o-chat-typing {
  padding: 4px 14px 8px;
  font-size: 12px;
  color: #999;
  font-style: italic;
}

/* ---- 首次引导(输入联系方式)---- */
.h2o-chat-intro {
  background: linear-gradient(180deg, #ffffff 0%, #fffdf2 100%);
  border-radius: 14px;
  padding: 26px 22px;
  text-align: center;
  max-width: 100%;
  box-sizing: border-box;
}
.h2o-chat-intro-badge {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--h2o-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 4px 14px rgba(255, 230, 0, 0.45);
}
.h2o-chat-intro-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--h2o-ink);
  margin: 0 0 8px;
  letter-spacing: -0.2px;
}
.h2o-chat-intro-sub {
  font-size: 13.5px;
  color: #5a5a5a;
  line-height: 1.55;
  margin: 0 0 18px;
}
.h2o-chat-intro-name,
.h2o-chat-intro-email {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #dcdcdc;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #fff;
}
.h2o-chat-intro-name:focus,
.h2o-chat-intro-email:focus {
  border-color: var(--h2o-yellow);
  box-shadow: 0 0 0 3px rgba(255, 230, 0, 0.28);
}
.h2o-chat-intro-btn {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--h2o-ink);
  background: var(--h2o-yellow);
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.h2o-chat-intro-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 230, 0, 0.45);
}
.h2o-chat-intro-note {
  font-size: 11.5px;
  color: #9a9a9a;
  margin: 14px 0 0;
}

/* ---- 输入行 ---- */
.h2o-chat-input {
  display: flex;
  border-top: 1px solid #e5e5e5;
  padding: 10px;
  background: #fff;
  gap: 8px;
}
.h2o-chat-attach {
  width: 40px;
  flex-shrink: 0;
  border: 1px solid #d5d5d5;
  border-radius: 8px;
  background: #f7f7f7;
  font-size: 18px;
  font-weight: 700;
  color: #666;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.h2o-chat-attach:hover { background: var(--h2o-yellow); color: var(--h2o-ink); border-color: var(--h2o-yellow); }

.h2o-chat-input-text {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.h2o-chat-input-text:focus { border-color: var(--h2o-ink); }
.h2o-chat-send {
  background: var(--h2o-yellow);
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: bold;
  color: var(--h2o-ink);
  cursor: pointer;
}
.h2o-chat-send:disabled, .h2o-chat-input-text:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 内联模式(客服中心页) ---- */
.h2o-chat--inline { width: 100%; }
.h2o-chat-panel--inline {
  position: static;
  width: 100%;
  max-height: none;
  display: flex;
  box-shadow: none;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
}
.h2o-chat-panel--inline .h2o-chat-msgs { max-height: 420px; }

/* ---- FAQ ---- */
.h2o-faq { max-width: 820px; margin: 0 auto; }
.h2o-faq-item {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 14px 18px;
}
.h2o-faq-item summary {
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
  color: var(--h2o-ink);
  outline: none;
}
.h2o-faq-item p { margin: 10px 0 4px; color: #444; font-size: 14px; line-height: 1.6; }

/* ---- 工单表单 ---- */
.h2o-ticket-form {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 24px;
}
.h2o-ticket-form label { display: block; font-weight: bold; font-size: 14px; margin: 14px 0 6px; color: #333; }
.h2o-ticket-form input,
.h2o-ticket-form select,
.h2o-ticket-form textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.h2o-ticket-form textarea { min-height: 120px; resize: vertical; }
.h2o-ticket-form button {
  margin-top: 18px;
  background: var(--h2o-yellow);
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-weight: bold;
  color: var(--h2o-ink);
  cursor: pointer;
  font-size: 15px;
}
.h2o-ticket-success {
  margin-top: 16px;
  padding: 14px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  color: #1b5e20;
  display: none;
}
.h2o-ticket-error {
  margin-top: 16px;
  padding: 14px;
  background: #fdecea;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  color: #b71c1c;
  display: none;
}

/* ---- 移动端 ---- */
@media (max-width: 480px) {
  .h2o-chat-panel { right: 8px; left: 8px; width: auto; bottom: 84px; max-height: 75vh; }
  .h2o-chat-launcher { right: 16px; bottom: 16px; }
}
