/* ============================================================
   Copiloto Trabajo Rápido — widget compartido
   Se carga en index, login, onboarding y dashboard.
   z-index 40: por encima del contenido (35) y por debajo del
   wizard de onboarding (90) y el topbar (50).
   ============================================================ */

.copilot-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

/* ---------- Botón / robot ---------- */
.copilot-btn {
  pointer-events: auto;
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 58%, #eaf4ff 0%, #ffffff 68%);
  box-shadow: 0 8px 22px rgba(10, 102, 194, 0.24), 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: grid;
  place-items: center;
  animation: copilotFloat 3.4s ease-in-out infinite;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.copilot-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 30px rgba(10, 102, 194, 0.3), 0 1px 3px rgba(0, 0, 0, 0.12); }
.copilot-btn:active { transform: translateY(0) scale(0.98); }
.copilot-btn:focus-visible { outline: 2px solid var(--li-blue); outline-offset: 3px; }

/* Halo pulsante que avisa que hay algo nuevo */
.copilot-btn-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(10, 102, 194, 0.16);
  animation: copilotPulse 2.6s ease-out infinite;
  pointer-events: none;
}
.copilot-btn-pulse[hidden] { display: none; }

.copilot-btn-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.copilot-btn-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Punto de aviso (badge) */

/* ---------- Globo de texto ---------- */
.copilot-bubble {
  pointer-events: auto;
  position: relative;
  max-width: 300px;
  background: #fff;
  border: 1px solid var(--li-border);
  border-radius: 16px;
  padding: 13px 34px 13px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--li-text);
  text-align: left;
  box-shadow: var(--shadow-pop);
  animation: copilotBubbleIn 0.35s ease;
}
/* Colita apuntando al robot */
.copilot-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid var(--li-border);
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}
.copilot-bubble[hidden] { display: none; }
.copilot-bubble p { margin: 0; }
/* CTA dentro del globo */
.copilot-bubble .copilot-cta {
  display: inline-block;
  margin-top: 8px;
  font-weight: 700;
  color: var(--li-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 13px;
}
.copilot-bubble .copilot-cta:hover { color: var(--li-blue-dark); }

.copilot-bubble-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 0;
  background: var(--li-bg);
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--li-text-secondary);
  display: grid;
  place-items: center;
}
.copilot-bubble-close:hover { background: var(--li-border); }
.copilot-bubble-close:focus-visible { outline: 2px solid var(--li-blue); outline-offset: 1px; }

/* ---------- Texto del copiloto (accesibilidad) ---------- */

/* ---------- Animaciones ---------- */
@keyframes copilotFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes copilotPulse {
  0%   { transform: scale(0.9);  opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes copilotBubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Oculto cuando hay modal abierto ---------- */
body.has-overlay .copilot-widget { display: none; }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .copilot-widget { bottom: 78px; left: 12px; gap: 8px; }
  .copilot-btn { width: 56px; height: 56px; }
  .copilot-bubble { max-width: 250px; font-size: 13px; padding: 12px 32px 12px 14px; }
  .copilot-bubble::after { left: 20px; }
}

/* ---------- Respeta movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .copilot-btn,
  .copilot-btn-pulse,
  .copilot-bubble { animation: none !important; }
  .copilot-btn:hover { transform: none; }
}
