/* CHAT EMBEBIDO — clon del widget oficial de Comuncyber (diseño dark violeta/cian) */
.cy-chat-embed {
  --cy-chat-bg: #0f1011;
  --cy-chat-panel: #141516;
  --cy-chat-border: rgba(255, 255, 255, 0.1);
  --cy-chat-text: #f7f8f8;
  --cy-chat-muted: #8a8f98;
  --cy-chat-accent: #7170ff;
  --cy-chat-accent-2: #22d3ee;
  --cy-chat-user: rgba(113, 112, 255, 0.22);
  --cy-chat-bot: rgba(255, 255, 255, 0.04);
  background: var(--cy-chat-panel);
  color: var(--cy-chat-text);
  border: 1px solid var(--cy-chat-border);
  border-radius: 18px;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: min(70vh, 540px);
  max-width: none;
  margin: 0;
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  width: min(94vw, 430px);
  z-index: 999;
  display: none;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.cy-chat-embed.cy-open { display: flex; }

.cy-chat-fab {
  position: fixed;
  bottom: 5.5rem;
  right: 1.2rem;
  z-index: 9999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cy-chat-accent), var(--cy-chat-accent-2));
  color: #fff;
  font-size: 26px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.cy-chat-fab:hover { filter: brightness(1.1); }

.cy-chat-close {
  background: transparent;
  border: none;
  color: var(--cy-chat-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 0 0.4rem;
}
.cy-chat-close:hover { color: #fff; }

.cy-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, rgba(113, 112, 255, 0.18), rgba(34, 211, 238, 0.08));
  border-bottom: 1px solid var(--cy-chat-border);
}
.cy-chat-header strong { display: block; font-size: 0.98rem; color: #fff; }
.cy-chat-header span { font-size: 0.75rem; color: var(--cy-chat-muted); }
.cy-chat-header-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}

.cy-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--cy-chat-bg);
}
.cy-chat-bubble {
  max-width: 82%;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.cy-chat-bubble.bot {
  align-self: flex-start;
  background: var(--cy-chat-bot);
  border: 1px solid var(--cy-chat-border);
  border-bottom-left-radius: 4px;
}
.cy-chat-bubble.user {
  align-self: flex-end;
  background: var(--cy-chat-user);
  border: 1px solid rgba(113, 112, 255, 0.35);
  border-bottom-right-radius: 4px;
}

.cy-chat-status { font-size: 0.75rem; color: var(--cy-chat-muted); padding: 0.2rem 1.2rem; min-height: 1rem; }
.cy-chat-status.is-error { color: #f87171; }

.cy-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 1rem 1rem;
  border-top: 1px solid var(--cy-chat-border);
  background: var(--cy-chat-panel);
}
.cy-chat-compose input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cy-chat-border);
  border-radius: 10px;
  color: var(--cy-chat-text);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-family: inherit;
}
.cy-chat-compose input::placeholder { color: var(--cy-chat-muted); }
.cy-chat-row { display: flex; gap: 0.5rem; }
.cy-chat-row textarea {
  flex: 1;
  resize: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cy-chat-border);
  border-radius: 10px;
  color: var(--cy-chat-text);
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  font-family: inherit;
}
.cy-chat-row textarea::placeholder { color: var(--cy-chat-muted); }
.cy-chat-row textarea:focus, .cy-chat-compose input:focus { outline: 2px solid var(--cy-chat-accent); border-color: transparent; }
.cy-chat-send {
  background: linear-gradient(135deg, var(--cy-chat-accent), #6366f1);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: filter 0.15s;
  font-family: inherit;
}
.cy-chat-send:hover { filter: brightness(1.1); }
.cy-chat-tg {
  font-size: 0.75rem;
  color: var(--cy-chat-accent-2);
  text-decoration: none;
  text-align: center;
}
.cy-chat-tg:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .cy-chat-embed { width: calc(100vw - 1.6rem); height: 62vh; border-radius: 14px; }
  .cy-chat-fab { width: 54px; height: 54px; font-size: 24px; }
}

/* Botón "Volver a Comuncyber" en las demos (23/08/2026, orden de Juan) */
.volver-cy {
  position: fixed;
  bottom: 1.4rem;
  left: 1.4rem;
  top: auto;
  z-index: 65;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(113, 112, 255, 0.5);
  color: #a5a4ff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  font-family: 'Inter', system-ui, sans-serif;
}
.volver-cy:hover { background: #7170ff; color: #fff; }
@media (max-width: 480px) {
  .volver-cy { font-size: 0.7rem; padding: 0.32rem 0.75rem; }
}

/* Con el chat abierto se oculta el botón flotante de WhatsApp de la plantilla (01/09/2026) */
body.cy-chat-open .wa-float { display: none !important; }
