/* FlyingFish — Lalia chat widget. Scoped under .ffl- to avoid theme collisions. */

.ffl-root {
  --ffl-teal: #0aa3a3;
  --ffl-emerald: #10b981;
  --ffl-cyan: #06b6d4;
  --ffl-blue: #0369a1;
  --ffl-ink: #0f2430;
  --ffl-muted: #5b7280;
  --ffl-line: rgba(15, 36, 48, .1);
  --ffl-grad: linear-gradient(135deg, var(--ffl-emerald), var(--ffl-cyan) 55%, var(--ffl-blue));
  position: fixed;
  right: 30px;   /* mirror the theme WhatsApp float (left:30px; bottom:30px) so both align */
  bottom: 30px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
.ffl-root *, .ffl-root *::before, .ffl-root *::after { box-sizing: border-box; }

/* Launcher bubble */
.ffl-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(3, 105, 161, .28), 0 2px 8px rgba(0, 0, 0, .08);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ffl-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(3, 105, 161, .34); }
.ffl-launcher:focus-visible { outline: 3px solid var(--ffl-cyan); outline-offset: 2px; }
.ffl-launcher-avatar {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ffl-grad);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.ffl-launcher-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.ffl-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
  animation: ffl-pulse 2s infinite;
}
@keyframes ffl-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.ffl-launcher-text { text-align: left; }
.ffl-launcher-text b { display: block; color: var(--ffl-ink); font-weight: 700; font-size: 14px; }
.ffl-launcher-text span { display: block; color: var(--ffl-muted); font-size: 12px; }

/* Panel */
.ffl-panel {
  position: absolute;
  right: 0; bottom: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 580px;
  max-height: calc(100vh - 40px);
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(3, 37, 65, .34);
  overflow: hidden;
  transform-origin: bottom right;
}
.ffl-root.ffl-open .ffl-panel { display: flex; animation: ffl-in .22s cubic-bezier(.2, .8, .2, 1); }
.ffl-root.ffl-open .ffl-launcher { display: none; }
@keyframes ffl-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.ffl-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  background: var(--ffl-grad);
  color: #fff;
}
.ffl-header img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .55); }
.ffl-header-meta { flex: 1; min-width: 0; }
.ffl-header-meta b { font-size: 15px; font-weight: 700; }
.ffl-header-meta span { display: block; font-size: 12px; opacity: .92; }
.ffl-header-meta span::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #c6f6d5; margin-right: 6px; vertical-align: middle;
}
.ffl-close, .ffl-reset {
  border: 0; background: rgba(255, 255, 255, .18); color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1;
}
.ffl-close:hover, .ffl-reset:hover { background: rgba(255, 255, 255, .3); }
.ffl-reset { font-size: 16px; }

/* Messages */
.ffl-log { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.ffl-msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.ffl-msg.bot { align-self: flex-start; background: #fff; color: var(--ffl-ink); border: 1px solid var(--ffl-line); border-bottom-left-radius: 5px; }
.ffl-msg.user { align-self: flex-end; background: var(--ffl-teal); color: #fff; border-bottom-right-radius: 5px; }
.ffl-msg a { color: var(--ffl-blue); font-weight: 600; text-decoration: underline; }
.ffl-msg.user a { color: #fff; }
.ffl-msg p { margin: 0 0 8px; } .ffl-msg p:last-child { margin: 0; }
.ffl-msg ul { margin: 6px 0; padding-left: 18px; } .ffl-msg li { margin: 2px 0; }
.ffl-msg code { background: rgba(15, 36, 48, .07); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

.ffl-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid var(--ffl-line); border-radius: 16px; border-bottom-left-radius: 5px; }
.ffl-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ffl-muted); opacity: .5; animation: ffl-bounce 1.2s infinite; }
.ffl-typing span:nth-child(2) { animation-delay: .15s; } .ffl-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ffl-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Suggested prompts */
.ffl-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 14px 12px; }
.ffl-chip {
  border: 1px solid var(--ffl-cyan); background: rgba(6, 182, 212, .08); color: var(--ffl-blue);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; transition: background .15s;
}
.ffl-chip:hover { background: rgba(6, 182, 212, .18); }

/* Composer */
.ffl-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ffl-line); background: rgba(255, 255, 255, .6); }
.ffl-composer textarea {
  flex: 1; resize: none; max-height: 110px; min-height: 22px;
  border: 1px solid var(--ffl-line); border-radius: 12px; padding: 10px 12px;
  font: inherit; color: var(--ffl-ink); background: #fff; outline: none;
}
.ffl-composer textarea:focus { border-color: var(--ffl-cyan); }
.ffl-send {
  flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: var(--ffl-grad); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.ffl-send:disabled { opacity: .45; cursor: default; }
.ffl-send svg { width: 18px; height: 18px; }
.ffl-footnote { text-align: center; font-size: 11px; color: var(--ffl-muted); padding: 0 12px 8px; background: rgba(255, 255, 255, .6); }

@media (max-width: 480px) {
  /* keep the launcher level with the WhatsApp float (bottom:30px) on mobile too */
  .ffl-root { right: 16px; bottom: 30px; }
  /* full-screen panel; JS (VisualViewport) pins it to the visible area above the keyboard,
     and 100dvh is the fallback so the header is never pushed off the top. */
  .ffl-panel {
    position: fixed; left: 0; top: 0; right: auto; bottom: auto;
    width: 100vw; height: 100vh; height: 100dvh;
    max-width: none; max-height: none; border-radius: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ffl-root *, .ffl-dot { animation: none !important; transition: none !important; }
}
