/* HGZY lightweight chat widget */
.hgzy-chat-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hgzy-chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: linear-gradient(140deg, #e11d48, #dc2626);
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .25s ease;
}

.hgzy-chat-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.4);
}

.hgzy-chat-toggle:active {
  transform: translateY(1px);
}

.hgzy-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 24px));
  max-height: min(620px, 78vh);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(.96) translateY(8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .22s ease;
}

.hgzy-chat-root.is-open .hgzy-chat-panel {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.hgzy-chat-header {
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hgzy-chat-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.hgzy-chat-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: .85;
}

.hgzy-chat-close {
  background: transparent;
  color: #f8fafc;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.hgzy-chat-close:hover {
  background: rgba(148, 163, 184, .25);
}

.hgzy-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.hgzy-chat-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.hgzy-chat-chip:hover {
  border-color: #94a3b8;
}

.hgzy-chat-messages {
  background: #fff;
  padding: 12px;
  overflow-y: auto;
  min-height: 260px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hgzy-chat-msg {
  max-width: 88%;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.hgzy-chat-msg.user {
  align-self: flex-end;
  background: #dc2626;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.hgzy-chat-msg.bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 6px;
}

.hgzy-chat-status {
  font-size: 12px;
  color: #64748b;
  min-height: 16px;
  padding: 0 12px 8px;
}

.hgzy-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.hgzy-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  min-width: 0;
}

.hgzy-chat-input:focus {
  outline: 2px solid #fecaca;
  border-color: #f87171;
}

.hgzy-chat-send {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #dc2626;
  cursor: pointer;
}

.hgzy-chat-send:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 700px) {
  .hgzy-chat-root {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .hgzy-chat-panel {
    right: 0;
    left: 0;
    width: auto;
    max-height: 70vh;
    border-radius: 16px;
    transform-origin: bottom center;
  }

  .hgzy-chat-messages {
    min-height: 220px;
    max-height: 48vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hgzy-chat-panel,
  .hgzy-chat-toggle {
    transition: none;
  }
}
