/* =====================================================
   Floating WhatsApp mini-chat
   ===================================================== */

.wsp-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 14px 18px 14px 14px;
  background: var(--noche);
  color: var(--cream);
  border-radius: var(--r-pill);
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.4);
  border: 1px solid oklch(0.30 0.02 30);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.wsp-fab:hover { transform: translateY(-2px); }
.wsp-fab.wsp-hidden { display: none; }
.wsp-fab .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--cream);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.wsp-fab .avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.55); }
.wsp-fab .avatar::after {
  content: "";
  position: absolute;
  bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  background: oklch(0.7 0.18 145);
  border: 2px solid var(--noche);
  border-radius: 50%;
}
.wsp-fab .label { display: flex; flex-direction: column; gap: 1px; line-height: 1.1; }
.wsp-fab .label b { font-weight: 500; }
.wsp-fab .label span {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: oklch(0.7 0.18 145);
}

/* ----- Chat panel ------ */
.wsp-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 48px);
  background: var(--cream);
  border-radius: 22px;
  box-shadow: 0 24px 64px -20px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.wsp-panel.wsp-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.wsp-head {
  background: oklch(0.42 0.07 145);
  color: var(--cream);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wsp-head .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--noche);
  overflow: hidden;
  position: relative;
}
.wsp-head .avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.55); }
.wsp-head .avatar::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  width: 11px; height: 11px;
  background: oklch(0.78 0.18 145);
  border: 2px solid oklch(0.42 0.07 145);
  border-radius: 50%;
}
.wsp-head .info { flex: 1; line-height: 1.15; }
.wsp-head .info b { font-size: 0.95rem; font-weight: 500; }
.wsp-head .info span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 2px;
}
.wsp-head button {
  background: transparent;
  border: 0;
  color: var(--cream);
  font-size: 1.4rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
}
.wsp-head button:hover { background: rgba(255,255,255,0.15); }

.wsp-body {
  flex: 1;
  padding: 18px 14px 14px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 25% 20%, oklch(0.94 0.02 145) 0, transparent 40%),
    radial-gradient(circle at 75% 80%, oklch(0.94 0.02 80) 0, transparent 40%),
    var(--cream);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wsp-bubble {
  max-width: 80%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  background: var(--paper);
  align-self: flex-start;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  position: relative;
  animation: bubble-in 0.3s var(--ease);
}
.wsp-bubble.user {
  align-self: flex-end;
  background: oklch(0.85 0.10 145);
}
.wsp-bubble .name {
  font-size: 0.7rem;
  color: var(--terracota);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.wsp-bubble .time {
  font-size: 0.62rem;
  color: var(--ink-mute);
  margin-left: 6px;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.wsp-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 3px;
  padding: 10px 14px;
  background: var(--paper);
  border-radius: 14px;
}
.wsp-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-mute);
  animation: typing 1s infinite;
}
.wsp-typing span:nth-child(2) { animation-delay: 0.15s; }
.wsp-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.wsp-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--hairline);
  background: var(--cream-2);
}
.wsp-replies button {
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink);
  padding: 7px 11px;
  border-radius: 18px;
  font-size: 0.78rem;
  transition: all 0.2s var(--ease);
}
.wsp-replies button:hover {
  background: oklch(0.42 0.07 145);
  color: var(--cream);
  border-color: oklch(0.42 0.07 145);
}

.wsp-foot {
  padding: 10px 12px;
  background: var(--cream-2);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wsp-foot .send {
  background: oklch(0.42 0.07 145);
  color: var(--cream);
  border: 0;
  padding: 11px 14px;
  border-radius: var(--r-pill);
  font-size: 0.88rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: background 0.2s var(--ease);
}
.wsp-foot .send:hover { background: oklch(0.46 0.08 145); }
.wsp-foot .hint {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: center;
}

/* mobile */
@media (max-width: 480px) {
  .wsp-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 80vh;
    border-radius: 22px 22px 0 0;
  }
  .wsp-fab { bottom: 16px; right: 16px; }
}
