/* ==========================================================
   香港留学智能客服 - WordPress 插件样式
   ========================================================== */

.hksc-fab {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hksc-primary, #1e88e5), var(--hksc-primary-dark, #0d47a1));
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(30, 136, 229, 0.4);
  font-size: 26px;
  z-index: 99998;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(30, 136, 229, 0.5);
}
.hksc-fab:focus {
  outline: none;
}
.hksc-fab-icon {
  line-height: 1;
}

/* 聊天窗口 */
.hksc-window {
  position: fixed;
  width: 380px;
  height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.hksc-window.hksc-active {
  display: flex;
}

/* 顶部 */
.hksc-header {
  background: linear-gradient(135deg, var(--hksc-primary, #1e88e5), var(--hksc-primary-dark, #1565c0));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hksc-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hksc-header .hksc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.hksc-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: white;
  line-height: 1.3;
}
.hksc-status {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hksc-status-dot {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  animation: hksc-pulse 2s infinite;
}
@keyframes hksc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hksc-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.85;
  transition: opacity 0.2s;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-close-btn:hover { opacity: 1; }

/* 消息区 */
.hksc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
  scroll-behavior: smooth;
}
.hksc-messages::-webkit-scrollbar { width: 6px; }
.hksc-messages::-webkit-scrollbar-thumb {
  background: #c1c9d2;
  border-radius: 3px;
}

.hksc-msg {
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  max-width: 100%;
}
.hksc-msg.hksc-bot { justify-content: flex-start; }
.hksc-msg.hksc-user { justify-content: flex-end; }

.hksc-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.hksc-msg.hksc-bot .hksc-msg-avatar {
  background: linear-gradient(135deg, var(--hksc-primary, #1e88e5), var(--hksc-primary-dark, #1565c0));
  color: white;
}

.hksc-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14px;
  word-wrap: break-word;
  color: #333;
}
.hksc-msg.hksc-bot .hksc-msg-bubble {
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.hksc-msg.hksc-user .hksc-msg-bubble {
  background: var(--hksc-primary, #1e88e5);
  color: white;
  border-bottom-right-radius: 4px;
}

.hksc-msg-time {
  font-size: 11px;
  color: #999;
  text-align: center;
  margin: 10px 0;
}

/* 快捷问题 */
.hksc-quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.hksc-quick-btn {
  background: #e8f0fe;
  color: var(--hksc-primary-dark, #1565c0);
  border: 1px solid #bbdefb;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-quick-btn:hover {
  background: var(--hksc-primary, #1976d2);
  color: white;
  border-color: var(--hksc-primary, #1976d2);
}

/* 输入区 */
.hksc-input-area {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.hksc-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 40px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}
.hksc-input:focus {
  border-color: var(--hksc-primary, #1e88e5);
}
.hksc-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--hksc-primary, #1e88e5);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-send-btn:hover { background: var(--hksc-primary-dark, #1565c0); }
.hksc-send-btn:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
}

/* 人工对接卡片 */
.hksc-transfer-card {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
}
.hksc-transfer-card h4 {
  color: #f57c00;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}
.hksc-transfer-btn {
  display: inline-block;
  background: #ff9800;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-transfer-btn:hover { background: #f57c00; }

/* 留言表单 */
.hksc-lead-form {
  background: #f0f7ff;
  border: 1px solid #bbdefb;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
}
.hksc-lead-form h4 {
  color: var(--hksc-primary-dark, #1565c0);
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}
.hksc-lead-form input {
  width: 100%;
  border: 1px solid #c5d8ec;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-lead-form input:focus {
  border-color: var(--hksc-primary, #1e88e5);
}
.hksc-lead-form .hksc-submit-lead {
  width: 100%;
  background: var(--hksc-primary, #1e88e5);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
  -webkit-appearance: none;
  appearance: none;
}
.hksc-lead-form .hksc-submit-lead:hover {
  background: var(--hksc-primary-dark, #1565c0);
}

/* 输入中提示 */
.hksc-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.hksc-typing span {
  width: 7px;
  height: 7px;
  background: #90a4ae;
  border-radius: 50%;
  animation: hksc-typing-bounce 1.4s infinite;
}
.hksc-typing span:nth-child(2) { animation-delay: 0.2s; }
.hksc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hksc-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* 响应式 */
@media (max-width: 480px) {
  .hksc-window {
    right: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    border-radius: 0 !important;
  }
  .hksc-fab {
    width: 54px;
    height: 54px;
    font-size: 24px;
  }
}

/* 重置可能被主题覆盖的样式 */
.hksc-window *,
.hksc-window *::before,
.hksc-window *::after {
  box-sizing: border-box;
}
.hksc-window h1,
.hksc-window h2,
.hksc-window h3,
.hksc-window h4,
.hksc-window h5,
.hksc-window p {
  margin: 0;
  padding: 0;
}
