/* Confiaserv — WhatsApp flotante (frontend).
   Botón fijo bottom-right + popover de consulta con la línea gráfica del tema. */

.cs-wa {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 9999;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
}

/* ── Toggle (botón redondo) ──────────────────────────────────────── */
.cs-wa__toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25D366;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 40px -16px rgba(37, 211, 102, 0.55), 0 6px 12px rgba(10, 25, 41, 0.18);
  transition: transform .2s ease, box-shadow .2s ease, background .2s;
  position: relative;
}
.cs-wa__toggle:hover { transform: translateY(-2px) scale(1.05); }
.cs-wa__toggle:active { transform: translateY(0) scale(0.98); }
.cs-wa__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.35), 0 20px 40px -16px rgba(37, 211, 102, 0.55);
}
.cs-wa__icon { display: block; transition: opacity .2s, transform .2s; }
.cs-wa__icon--close { position: absolute; opacity: 0; transform: rotate(-45deg) scale(0.7); width: 22px; height: 22px; }
.cs-wa[data-open="true"] .cs-wa__icon { opacity: 0; transform: rotate(45deg) scale(0.7); }
.cs-wa[data-open="true"] .cs-wa__icon--close { opacity: 1; transform: rotate(0) scale(1); }

/* Tooltip al lado del botón (solo desktop, antes de abrir) */
.cs-wa__tooltip {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: #0A1929;
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.cs-wa__tooltip::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #0A1929;
}
.cs-wa__toggle:hover .cs-wa__tooltip,
.cs-wa__toggle:focus-visible .cs-wa__tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.cs-wa[data-open="true"] .cs-wa__tooltip { display: none; }
@media (max-width: 640px) {
  .cs-wa__tooltip { display: none; }
}

/* ── Panel popover ───────────────────────────────────────────────── */
.cs-wa__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow:
    0 30px 60px -20px rgba(10, 25, 41, 0.35),
    0 0 0 1px rgba(10, 25, 41, 0.04);
  overflow: hidden;
  transform-origin: bottom right;
  animation: cs-wa-in .25s cubic-bezier(.4, 0, .2, 1);
}
.cs-wa__panel[hidden] { display: none; }

@keyframes cs-wa-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Head */
.cs-wa__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  background: #0A1929;
  color: #FFFFFF;
}
.cs-wa__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #25D366;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cs-wa__intro strong {
  display: block;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.cs-wa__intro span {
  display: block;
  font-size: 12px;
  color: rgba(246, 244, 238, 0.65);
  margin-top: 2px;
}
.cs-wa__close {
  background: rgba(246, 244, 238, 0.08);
  border: none;
  color: #FFFFFF;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.cs-wa__close:hover { background: rgba(246, 244, 238, 0.18); }

/* Body */
.cs-wa__body {
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, #F2F4F6 0%, #FFFFFF 80%);
}
.cs-wa__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4A5B6E;
  margin: 0 0 14px;
}
.cs-wa__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
  animation: cs-wa-pulse 1.6s ease-in-out infinite;
}
@keyframes cs-wa-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2); }
  50%      { box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.05); }
}
.cs-wa__msg {
  font-size: 14px;
  color: #0A1929;
  line-height: 1.5;
  margin: 0 0 16px;
}
.cs-wa__label {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4A5B6E;
  margin-bottom: 6px;
}
.cs-wa__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(10, 25, 41, 0.12);
  border-radius: 10px;
  background: #FFFFFF;
  color: #0A1929;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  min-height: 70px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: none;
}
.cs-wa__input:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
  outline: none;
}
.cs-wa__send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 20px;
  background: #25D366;
  color: #FFFFFF;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, transform .12s;
}
.cs-wa__send:hover { background: #1FBC58; color: #FFFFFF; }
.cs-wa__send:active { transform: translateY(1px); }

/* Mobile: panel responsive */
@media (max-width: 480px) {
  .cs-wa__panel { width: calc(100vw - 32px); }
}
