/* "Chat with Blooby" panel + floating button (purple-and-silver theme). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.chat-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60;
  width: 64px; height: 64px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--silver-1, #e6e8ee); background: var(--p-deep, #1f123d);
  box-shadow: 0 10px 28px rgba(7,3,16,0.6), 0 0 22px rgba(228,191,251,0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chat-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.chat-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 30px rgba(7,3,16,0.6), 0 0 30px rgba(228,191,251,0.75); }
.chat-fab:focus-visible { outline: 3px solid var(--orb, #e4bffb); outline-offset: 3px; }
.chat-fab-label {
  position: absolute; right: 74px; bottom: 18px; white-space: nowrap;
  background: var(--silver-1, #e6e8ee); color: var(--p-deep, #1f123d);
  font: 600 0.78rem/1 var(--font, sans-serif); padding: 0.45rem 0.7rem; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(7,3,16,0.5);
}
body.chat-open .chat-fab-label { display: none; }

.chat-panel {
  position: fixed; right: 1.25rem; bottom: 6.1rem; z-index: 70;
  width: min(380px, calc(100vw - 2rem)); height: min(560px, calc(100vh - 8rem));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 18px;
  background: linear-gradient(180deg, var(--p-mid, #2b1b57) 0%, var(--p-deep, #1f123d) 45%, var(--p-night, #130e24) 100%);
  border: 1px solid var(--silver-2, #c9ccd6);
  box-shadow: 0 24px 60px rgba(7,3,16,0.7), 0 0 40px rgba(147,107,223,0.35);
  color: var(--text, #f4f2fa); font-family: var(--font, sans-serif);
}
.chat-head {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line, rgba(201,204,214,0.22)); background: rgba(7,3,16,0.35);
}
.chat-head img { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 0 12px rgba(228,191,251,0.5); }
.chat-title { flex: 1; min-width: 0; }
.chat-title strong { display: block; font-family: var(--display, serif); font-weight: 600; font-size: 1.05rem; color: #fff; }
.chat-title span { display: block; font-size: 0.72rem; line-height: 1.3; color: var(--muted, #c3c6d2); }
.chat-forget {
  border: 1px solid var(--silver-3, #a9adbb); background: transparent; color: var(--silver-1, #e6e8ee);
  border-radius: 999px; padding: 0.3rem 0.65rem; font: 600 0.72rem/1.2 var(--font, sans-serif); cursor: pointer;
}
.chat-forget:hover { background: rgba(230,232,238,0.1); }
.chat-close {
  border: 0; background: transparent; color: var(--silver-1, #e6e8ee); font-size: 1.5rem; line-height: 1;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
}
.chat-close:hover { background: rgba(230,232,238,0.12); }
.chat-forget:focus-visible, .chat-close:focus-visible, .chat-send:focus-visible, .chat-input:focus-visible { outline: 2px solid var(--orb, #e4bffb); outline-offset: 2px; }

.chat-log { flex: 1; overflow-y: auto; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; scroll-behavior: smooth; }
.chat-msg { display: flex; }
.chat-msg.from-user { justify-content: flex-end; }
.chat-bubble { margin: 0; max-width: 85%; padding: 0.6rem 0.8rem; border-radius: 14px; font-size: 0.92rem; line-height: 1.45; overflow-wrap: anywhere; }
.from-blooby .chat-bubble { background: rgba(76,46,147,0.55); border: 1px solid rgba(228,191,251,0.35); border-bottom-left-radius: 4px; color: var(--text, #f4f2fa); }
.from-user .chat-bubble { background: var(--silver-1, #e6e8ee); color: var(--p-deep, #1f123d); border-bottom-right-radius: 4px; }

.chat-typing { display: flex; align-items: center; gap: 0.45rem; padding: 0 0.95rem 0.5rem; font-size: 0.75rem; color: var(--muted, #c3c6d2); }
.chat-dots { display: inline-flex; gap: 4px; }
.chat-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--orb, #e4bffb); box-shadow: 0 0 8px var(--lavender, #936bdf); animation: chatDot 1.1s ease-in-out infinite; }
.chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.45; } 40% { transform: translateY(-4px); opacity: 1; } }

.chat-form { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.65rem 0.75rem 0.4rem; border-top: 1px solid var(--line, rgba(201,204,214,0.22)); }
.chat-input {
  flex: 1; min-width: 0; resize: none; max-height: 6.5rem; padding: 0.6rem 0.75rem; border-radius: 12px;
  border: 1px solid var(--silver-3, #a9adbb); background: rgba(7,3,16,0.45); color: #fff; font: 0.92rem/1.4 var(--font, sans-serif);
}
.chat-input::placeholder { color: var(--silver-3, #a9adbb); }
.chat-send {
  padding: 0.6rem 0.95rem; border-radius: 12px; border: 1px solid var(--silver-1, #e6e8ee);
  background: var(--silver-1, #e6e8ee); color: var(--p-deep, #1f123d); font: 600 0.88rem/1.2 var(--font, sans-serif); cursor: pointer;
}
.chat-send:hover { background: var(--orb, #e4bffb); border-color: var(--orb, #e4bffb); }
.chat-send:disabled { background: rgba(201,204,214,0.16); border: 1px dashed var(--silver-3, #a9adbb); color: var(--silver-2, #c9ccd6); cursor: not-allowed; }
.chat-meta { display: flex; justify-content: flex-end; padding: 0 0.85rem; font-size: 0.68rem; color: var(--silver-3, #a9adbb); }
.chat-meta .is-over { color: var(--amber, #f2b84b); }
.chat-disclaimer { margin: 0; padding: 0.35rem 0.9rem 0.75rem; font-size: 0.72rem; line-height: 1.4; color: var(--muted, #c3c6d2); }

@media (max-width: 560px) {
  .chat-panel { right: 0.5rem; left: 0.5rem; width: auto; bottom: 5.4rem; height: calc(100vh - 6.6rem); height: calc(100dvh - 6.6rem); }
  .chat-fab { right: 0.9rem; bottom: 0.9rem; width: 58px; height: 58px; }
  .chat-fab-label { display: none; }
}
@media (prefers-reduced-motion: reduce) { .chat-dots i { animation: none; opacity: 0.8; } }
