/* QORA chat widget — vanilla, no deps, on-brand reds.
   Loaded only on qora.html. Self-contained so it survives a style.css refactor. */

#qora-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 16px;
  border-radius: 999px;
  background: #ff5b5b;
  color: #0a0a0f;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 91, 91, 0.35),
              0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
#qora-chat-launcher:hover {
  transform: translateY(-2px);
  background: #ff7777;
  box-shadow: 0 14px 36px rgba(255, 91, 91, 0.45),
              0 2px 8px rgba(0, 0, 0, 0.4);
}
#qora-chat-launcher:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
#qora-chat-launcher .qc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0a0a0f;
  box-shadow: 0 0 0 0 rgba(10, 10, 15, 0.5);
  animation: qc-pulse 2.4s infinite;
}
@keyframes qc-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(10, 10, 15, 0.6); }
  60%  { box-shadow: 0 0 0 10px rgba(10, 10, 15, 0); }
  100% { box-shadow: 0 0 0 0 rgba(10, 10, 15, 0); }
}

#qora-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  width: min(380px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #14141c;
  border: 1px solid rgba(255, 91, 91, 0.25);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55),
              0 2px 8px rgba(0, 0, 0, 0.5);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #f4f4f7;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
#qora-chat-panel.qc-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.qc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 91, 91, 0.14), rgba(108, 60, 224, 0.08));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.qc-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
}
.qc-header__title .qc-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  flex-shrink: 0;
  background: #0a0a0f;
  /* subtle ring so the dark icon still reads against the dark header */
  box-shadow: 0 0 0 1px rgba(255, 91, 91, 0.35);
}
.qc-header__title .qc-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.qc-header__sub {
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(244, 244, 247, 0.55);
  margin-top: 2px;
}
.qc-close {
  background: transparent;
  border: none;
  color: rgba(244, 244, 247, 0.7);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.qc-close:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.qc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.qc-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: qc-fadein 0.25s ease;
}
@keyframes qc-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qc-msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}
.qc-msg--user {
  align-self: flex-end;
  background: rgba(255, 91, 91, 0.18);
  border: 1px solid rgba(255, 91, 91, 0.3);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.qc-msg--system {
  align-self: center;
  background: transparent;
  color: rgba(244, 244, 247, 0.5);
  font-size: 0.78rem;
  font-style: italic;
}

.qc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.qc-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 91, 91, 0.08);
  border: 1px solid rgba(255, 91, 91, 0.3);
  color: #ffb3b3;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qc-chip:hover {
  background: rgba(255, 91, 91, 0.18);
  border-color: rgba(255, 91, 91, 0.5);
  color: #fff;
}

.qc-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}
.qc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.qc-input {
  flex: 1;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f4f4f7;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.qc-input:focus {
  border-color: rgba(255, 91, 91, 0.55);
  background: rgba(255, 255, 255, 0.08);
}
.qc-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: #ff5b5b;
  color: #0a0a0f;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.qc-send:hover { background: #ff7777; }
.qc-send:active { transform: scale(0.94); }
.qc-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.qc-send svg { width: 18px; height: 18px; }

.qc-progress {
  height: 3px;
  background: rgba(255, 91, 91, 0.12);
  position: relative;
  overflow: hidden;
}
.qc-progress__bar {
  position: absolute;
  inset: 0 100% 0 0;
  background: linear-gradient(90deg, #ff5b5b, #ff7e5b);
  transition: right 0.3s ease;
}

.qc-typing {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
}
.qc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(244, 244, 247, 0.5);
  animation: qc-bounce 1.2s infinite;
}
.qc-typing span:nth-child(2) { animation-delay: 0.15s; }
.qc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes qc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

.qc-error {
  background: rgba(255, 91, 91, 0.12);
  border: 1px solid rgba(255, 91, 91, 0.35);
  color: #ffb3b3;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
}

.qc-summary {
  background: rgba(108, 60, 224, 0.08);
  border: 1px solid rgba(108, 60, 224, 0.3);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  color: rgba(244, 244, 247, 0.85);
}
.qc-summary strong { color: #fff; }
.qc-summary dl { margin: 6px 0 0; display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; }
.qc-summary dt { color: rgba(244, 244, 247, 0.55); }
.qc-summary dd { margin: 0; color: #f4f4f7; word-break: break-word; }

@media (max-width: 480px) {
  #qora-chat-panel {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    max-height: 76vh;
  }
  #qora-chat-launcher {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #qora-chat-launcher .qc-dot,
  .qc-typing span,
  .qc-msg { animation: none; }
  #qora-chat-panel { transition: opacity 0.15s; }
}
