/* Widget de chat — Catalina (Futuraria)
   Paleta ENIA/Futuraria: verde lima #d2ff02 + violeta #854be8 */

#catalina-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#catalina-chat-widget * {
  box-sizing: border-box;
}

/* ── Orbe flotante (estilo ENIA) ─────────────────────────── */
.catalina-chat-launcher {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #d2ff02 0%, #854be8 100%);
  box-shadow: 0 4px 24px rgba(210, 255, 2, 0.3), 0 0 60px rgba(133, 75, 232, 0.15);
  animation: catalina-orb-spin 8s linear infinite;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Anillo giratorio alrededor del orbe */
.catalina-chat-launcher::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #d2ff02, #854be8, #d2ff02);
  z-index: -1;
  animation: catalina-orb-spin 4s linear infinite;
  opacity: 0.6;
}

.catalina-chat-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(210, 255, 2, 0.45), 0 0 80px rgba(133, 75, 232, 0.25);
  animation-play-state: paused;
}

.catalina-chat-launcher svg {
  width: 28px;
  height: 28px;
  color: #000;
}

@keyframes catalina-orb-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Ventana de chat ─────────────────────────────────────── */
.catalina-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: #111;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #222;
}

/* Header */
.catalina-chat-header {
  background: linear-gradient(135deg, rgba(210, 255, 2, 0.12) 0%, rgba(133, 75, 232, 0.15) 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #222;
}

.catalina-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d2ff02 0%, #854be8 100%);
  color: #000;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.catalina-chat-header-info {
  flex: 1;
  min-width: 0;
}

.catalina-chat-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.catalina-chat-status {
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #999;
}

.catalina-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d2ff02;
  display: inline-block;
}

.catalina-chat-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  opacity: 0.7;
}

.catalina-chat-close:hover {
  opacity: 1;
  color: #d2ff02;
}

/* Mensajes */
.catalina-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0a0a0a;
}

.catalina-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.catalina-msg-bot {
  background: #1a1a1a;
  border: 1px solid #222;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  color: #fff;
}

.catalina-msg-user {
  background: #d2ff02;
  color: #000;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.catalina-msg-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}

.catalina-msg-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #854be8;
  animation: catalina-bounce 1.2s infinite;
}

.catalina-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.catalina-msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes catalina-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Input — texto SIEMPRE visible (bug corregido: color explícito) */
.catalina-chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #222;
  background: #111;
}

.catalina-chat-input {
  flex: 1;
  border: 1px solid #333;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: #fff;                 /* texto blanco sobre fondo oscuro — visible */
  caret-color: #d2ff02;        /* cursor verde lima */
  background: #0a0a0a;         /* fondo oscuro explícito */
  outline: none;
  resize: none;
  max-height: 100px;
}

.catalina-chat-input::placeholder {
  color: #666;                 /* placeholder gris, distinguible */
}

.catalina-chat-input:focus {
  border-color: #d2ff02;
}

.catalina-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d2ff02;
  color: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.catalina-chat-send:hover {
  background: #ddff3f;
}

.catalina-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.catalina-chat-send svg {
  width: 18px;
  height: 18px;
}

/* Responsive */
@media (max-width: 480px) {
  .catalina-chat-window {
    width: calc(100vw - 32px);
    right: -8px;
  }
}
