/* Quantum YiJing Academy Assistant - v3.7.1 */

.qy-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  min-width: 132px;
  height: 58px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0b3e8a 0%, #1768c4 58%, #2586e8 100%);
  box-shadow: 0 14px 34px rgba(12, 71, 145, .28), 0 0 0 1px rgba(255,255,255,.16) inset;
  color: #fff;
  cursor: pointer;
  font-size: 0;
  font-family: Arial, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  animation: qy-chat-float 4s ease-in-out infinite;
}

.qy-chat-launcher::before {
  content: "✦";
  display: inline-block;
  margin-right: 9px;
  font-size: 23px;
  line-height: 1;
  vertical-align: middle;
  text-shadow: 0 0 14px rgba(255,255,255,.8);
}

.qy-chat-launcher::after {
  content: "Ask QY AI";
  display: inline-block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
  vertical-align: middle;
}

.qy-chat-launcher:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
  box-shadow: 0 18px 40px rgba(12, 71, 145, .36), 0 0 0 1px rgba(255,255,255,.18) inset;
}

.qy-chat-launcher:focus-visible,
.qy-chat-close:focus-visible,
.qy-chat-send:focus-visible,
.qy-chat-enquire-button:focus-visible,
.qy-enquiry-submit:focus-visible,
.qy-enquiry-cancel:focus-visible,
.qy-chat-input:focus-visible,
.qy-enquiry-input:focus-visible {
  outline: 3px solid rgba(37, 134, 232, .28);
  outline-offset: 2px;
}

.qy-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 100px;
  z-index: 9999;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 130px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d9e6f5;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 42, 76, .24);
  color: #17243a;
  font-family: Arial, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.qy-chat-panel.qy-chat-open {
  display: flex;
}

.qy-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 18px;
  background: linear-gradient(135deg, #082b63, #1768c4);
  color: #fff;
  border-bottom: 3px solid #d3a62c;
}

.qy-chat-title-wrap { min-width: 0; }
.qy-chat-title { margin: 0; font-size: 17px; line-height: 1.2; font-weight: 800; }
.qy-chat-subtitle { margin-top: 4px; font-size: 10px; line-height: 1.3; opacity: .85; letter-spacing: .3px; }

.qy-chat-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(255,255,255,.11);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.qy-chat-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 38%);
}

.qy-chat-messages {
  min-height: 160px;
  overflow: visible;
  padding: 18px;
  background: transparent;
}

.qy-chat-message {
  max-width: 86%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.55;
}

.qy-chat-message-ai {
  margin-right: auto;
  border: 1px solid #dfeaf7;
  border-bottom-left-radius: 5px;
  background: #fff;
  color: #20334c;
  box-shadow: 0 4px 14px rgba(34, 78, 126, .06);
}

.qy-chat-message-user {
  margin-left: auto;
  border-bottom-right-radius: 5px;
  background: #1768c4;
  color: #fff;
}

.qy-chat-status {
  min-height: 18px;
  padding: 0 16px;
  color: #60758d;
  font-size: 11px;
}

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

.qy-chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #ccdced;
  border-radius: 12px;
  background: #fff;
  color: #17243a;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.qy-chat-send {
  min-width: 68px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: #1768c4;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.qy-chat-send:disabled,
.qy-enquiry-submit:disabled,
.qy-enquiry-cancel:disabled {
  opacity: .55;
  cursor: wait;
}

.qy-chat-actions {
  padding: 0 12px 9px;
  background: #fff;
}

.qy-chat-enquire-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c8d9ed;
  border-radius: 11px;
  background: #eef6ff;
  color: #0b4c99;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.qy-chat-enquire-button:hover {
  background: #e2f0ff;
  border-color: #9fc2e8;
  transform: translateY(-1px);
}

.qy-chat-note {
  padding: 0 14px 11px;
  background: #fff;
  color: #75869a;
  font-size: 10px;
  line-height: 1.45;
}

.qy-chat-enquiry-wrap {
  padding: 16px;
  background: #f8fbff;
}

.qy-enquiry-form,
.qy-enquiry-success {
  padding: 16px;
  border: 1px solid #dce8f5;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(31, 76, 127, .07);
}

.qy-enquiry-heading {
  color: #0b3d7a;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 800;
}

.qy-enquiry-helper {
  margin: 6px 0 15px;
  color: #687d94;
  font-size: 11px;
  line-height: 1.5;
}

.qy-enquiry-field {
  display: block;
  margin: 0 0 11px;
}

.qy-enquiry-label {
  display: block;
  margin: 0 0 5px;
  color: #38516d;
  font-size: 11px;
  font-weight: 800;
}

.qy-enquiry-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid #ccdced;
  border-radius: 10px;
  background: #fff;
  color: #17243a;
  font: inherit;
  font-size: 13px;
}

.qy-enquiry-message {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

.qy-enquiry-select { cursor: pointer; }

.qy-enquiry-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.qy-enquiry-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 12px;
  color: #536a83;
  font-size: 11px;
  line-height: 1.45;
}

.qy-enquiry-consent input {
  margin-top: 2px;
  flex: 0 0 auto;
}

.qy-enquiry-status {
  min-height: 18px;
  margin-bottom: 8px;
  color: #60758d;
  font-size: 11px;
  line-height: 1.4;
}

.qy-enquiry-error { color: #a32626; }

.qy-enquiry-buttons {
  display: flex;
  gap: 8px;
}

.qy-enquiry-cancel,
.qy-enquiry-submit {
  min-height: 41px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.qy-enquiry-cancel {
  flex: 1;
  border: 1px solid #cad9e9;
  background: #fff;
  color: #49647f;
}

.qy-enquiry-submit {
  flex: 1.25;
  border: 0;
  background: #1768c4;
  color: #fff;
}

.qy-enquiry-success-title {
  margin-bottom: 9px;
  color: #1768c4;
  font-size: 17px;
  font-weight: 800;
}

.qy-enquiry-success-text {
  color: #415a74;
  font-size: 13px;
  line-height: 1.6;
}

.qy-enquiry-return {
  width: 100%;
  margin-top: 16px;
}

.qy-chat-form[hidden],
.qy-chat-actions[hidden],
.qy-chat-note[hidden],
.qy-chat-enquiry-wrap[hidden] {
  display: none !important;
}

@keyframes qy-chat-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (max-width: 560px) {
  .qy-chat-launcher {
    right: 14px;
    bottom: 14px;
    min-width: 60px;
    width: 60px;
    height: 60px;
    padding: 0;
  }

  .qy-chat-launcher::before {
    margin-right: 0;
    font-size: 25px;
  }

  .qy-chat-launcher::after { content: ""; }

  .qy-chat-panel {
    right: 10px;
    bottom: 84px;
    width: calc(100vw - 20px);
    height: min(680px, calc(100vh - 98px));
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qy-chat-launcher { animation: none; }
  .qy-chat-launcher,
  .qy-chat-enquire-button { transition: none; }
}
