/* =========================================================
   WaveFlow — Chat widget (PoC)  ·  estética "Marea de Precisión"
   ========================================================= */

.wfchat {
  --wf-accent: #33F0D1;
  --wf-bg: #0d1620;
  --wf-panel: #11202b;
  --wf-line: rgba(120, 170, 175, 0.18);
  --wf-text: #ECF1F0;
  --wf-muted: #9fb2b6;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  font-family: "Sora", system-ui, -apple-system, sans-serif;
}

/* ---------- FAB ---------- */
.wfchat__fab {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: linear-gradient(180deg, #9bfbe9, var(--wf-accent));
  box-shadow: 0 10px 30px rgba(51, 240, 209, 0.35);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
}
.wfchat__fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 38px rgba(51, 240, 209, 0.45); }
.wfchat__fab-ic, .wfchat__fab-x {
  position: absolute;
  font-size: 26px;
  line-height: 1;
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.wfchat__fab-x { opacity: 0; transform: rotate(-90deg) scale(0.6); font-size: 20px; color: #06231f; font-weight: 700; }
.wfchat.is-open .wfchat__fab-ic { opacity: 0; transform: rotate(90deg) scale(0.6); }
.wfchat.is-open .wfchat__fab-x { opacity: 1; transform: rotate(0) scale(1); }

/* ---------- Panel ---------- */
.wfchat__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 360px;
  max-width: calc(100vw - 28px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--wf-bg);
  border: 1px solid var(--wf-line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.wfchat.is-open .wfchat__panel { opacity: 1; transform: none; pointer-events: auto; }

/* head */
.wfchat__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(30, 122, 122, 0.35), transparent 60%),
    var(--wf-panel);
  border-bottom: 1px solid var(--wf-line);
}
.wfchat__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px;
  background: linear-gradient(180deg, #9bfbe9, var(--wf-accent));
  flex: 0 0 auto;
}
.wfchat__head-txt { display: flex; flex-direction: column; line-height: 1.25; }
.wfchat__head-txt strong { color: var(--wf-text); font-size: 0.98rem; font-weight: 600; }
.wfchat__head-txt small { color: var(--wf-muted); font-size: 0.72rem; display: flex; align-items: center; gap: 6px; }
.wfchat__dot { width: 7px; height: 7px; border-radius: 50%; background: #4ee29a; box-shadow: 0 0 8px #4ee29a; }

/* body */
.wfchat__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background:
    radial-gradient(60% 50% at 100% 0%, rgba(30, 122, 122, 0.10), transparent 60%);
}
.wfchat__body::-webkit-scrollbar { width: 7px; }
.wfchat__body::-webkit-scrollbar-thumb { background: rgba(120, 170, 175, 0.25); border-radius: 99px; }

.wfchat__msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 300;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: wf-pop 0.2s ease;
}
@keyframes wf-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.wfchat__msg--bot {
  align-self: flex-start;
  background: var(--wf-panel);
  border: 1px solid var(--wf-line);
  color: var(--wf-text);
  border-bottom-left-radius: 5px;
}
.wfchat__msg--user {
  align-self: flex-end;
  background: linear-gradient(180deg, #9bfbe9, var(--wf-accent));
  color: #06231f;
  font-weight: 400;
  border-bottom-right-radius: 5px;
}
.wfchat__msg a { color: var(--wf-accent); }
.wfchat__msg--user a { color: #06231f; text-decoration: underline; }

/* typing */
.wfchat__typing { display: flex; gap: 4px; align-items: center; }
.wfchat__typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--wf-muted);
  animation: wf-blink 1.2s infinite ease-in-out;
}
.wfchat__typing span:nth-child(2) { animation-delay: 0.2s; }
.wfchat__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wf-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

/* whatsapp handoff */
.wfchat__wa-wrap { background: transparent; border: 0; padding: 0; max-width: 100%; }
.wfchat__wa {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
  background: #25d366; color: #06231f; font-weight: 500;
  padding: 9px 15px; border-radius: 12px; font-size: 0.88rem;
}
.wfchat__wa:hover { filter: brightness(1.05); }

/* chips */
.wfchat__chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 14px 10px; }
.wfchat__chip {
  background: transparent;
  border: 1px solid var(--wf-line);
  color: var(--wf-text);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.wfchat__chip:hover { border-color: var(--wf-accent); color: var(--wf-accent); background: rgba(51, 240, 209, 0.06); }

/* form */
.wfchat__form {
  display: flex;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--wf-line);
  background: var(--wf-panel);
}
.wfchat__input {
  flex: 1;
  background: var(--wf-bg);
  border: 1px solid var(--wf-line);
  border-radius: 999px;
  color: var(--wf-text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 15px;
  outline: none;
  transition: border-color 0.18s ease;
}
.wfchat__input:focus { border-color: var(--wf-accent); }
.wfchat__input::placeholder { color: var(--wf-muted); }
.wfchat__send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: linear-gradient(180deg, #9bfbe9, var(--wf-accent));
  color: #06231f;
  font-size: 1.05rem;
  display: grid; place-items: center;
  transition: transform 0.15s ease;
}
.wfchat__send:hover { transform: scale(1.06); }

/* foot */
.wfchat__foot {
  text-align: center;
  font-size: 0.68rem;
  color: var(--wf-muted);
  padding: 7px 10px 9px;
  background: var(--wf-panel);
}
.wfchat__foot a { color: var(--wf-muted); }
.wfchat__foot a:hover { color: var(--wf-accent); }

@media (max-width: 480px) {
  .wfchat { right: 14px; bottom: 14px; }
  .wfchat__panel { height: calc(100vh - 100px); }
}
