/* ==========================================================
   Coico.com.ar: coquita.css
   Mascota interactiva Coquita (esquina inferior izquierda).
   Convive sin choques con Cuaderno de Campo (inferior derecha)
   y barra inferior de Encuesta. 100% paleta Coico.
   ========================================================== */

.coquita-root {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, bottom 0.25s ease;
}

.coquita-root.coquita-raised {
  bottom: 92px;
}

.coquita-root.coquita-oculta-modal {
  opacity: 0;
  transform: translateY(14px) scale(0.92);
  pointer-events: none;
}

/* ---------- Globito editorial de dialogo ---------- */
.coquita-globo {
  position: relative;
  pointer-events: auto;
  max-width: 276px;
  margin-bottom: 8px;
  margin-left: 6px;
  padding: 12px 30px 12px 14px;
  background: var(--papel, #FAF6EF);
  color: var(--tinta, #3C3834);
  border: 1.5px solid var(--bosque, #467355);
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 10px 28px rgba(42, 34, 26, 0.14), 0 2px 6px rgba(42, 34, 26, 0.06);
  font-size: 13.8px;
  line-height: 1.42;
  font-weight: 500;
  letter-spacing: -0.005em;
  transform-origin: bottom left;
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  transition: opacity 0.24s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.coquita-globo.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.coquita-globo[hidden] {
  display: none;
}

/* Flechita organica hacia Coquita */
.coquita-globo::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 13px;
  height: 13px;
  background: var(--papel, #FAF6EF);
  border-right: 1.5px solid var(--bosque, #467355);
  border-bottom: 1.5px solid var(--bosque, #467355);
  transform: rotate(45deg);
  border-radius: 0 0 2px 0;
}

.coquita-globo-texto {
  margin: 0;
}

.coquita-globo-cerrar {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--tinta-suave, #6B645C);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.coquita-globo-cerrar:hover,
.coquita-globo-cerrar:focus-visible {
  background: rgba(70, 115, 85, 0.12);
  color: var(--bosque, #467355);
  outline: none;
}

/* ---------- Escenario del personaje ---------- */
.coquita-escena {
  position: relative;
  display: flex;
  align-items: flex-end;
  pointer-events: auto;
}

.coquita-actor {
  position: relative;
  width: 96px;
  height: 96px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: block;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-tap-highlight-color: transparent;
}

.coquita-actor:hover {
  transform: translateY(-3px) scale(1.04);
}

.coquita-actor:active {
  transform: scale(0.95);
}

.coquita-actor:focus-visible {
  outline: 2px solid var(--coico, #C45770);
  outline-offset: 4px;
  border-radius: 16px;
}

.coquita-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 1.5px rgba(250, 246, 239, 0.85)) drop-shadow(0 5px 10px rgba(42, 34, 26, 0.16));
  transform-origin: bottom center;
  user-select: none;
  pointer-events: none;
}

/* ---------- Animaciones por pose ---------- */
.coquita-root[data-pose="saludo"] .coquita-img {
  animation: coq-breathe 4.2s ease-in-out infinite;
}

.coquita-root[data-pose="risa"] .coquita-img {
  animation: coq-hop 0.62s cubic-bezier(0.22, 1, 0.36, 1) 2;
}

.coquita-root[data-pose="curiosa"] .coquita-img {
  animation: coq-tilt 3.4s ease-in-out infinite;
}

.coquita-root[data-pose="asombrada"] .coquita-img {
  animation: coq-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) 1;
}

.coquita-root[data-pose="dormida"] .coquita-img {
  animation: coq-sleep 4.6s ease-in-out infinite;
}

@keyframes coq-breathe {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-1.2deg); }
}

@keyframes coq-hop {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.04) rotate(2deg); }
  75% { transform: translateY(-2px) scale(0.98) rotate(-1deg); }
}

@keyframes coq-tilt {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(3.2deg) translateY(-1.5px); }
}

@keyframes coq-pop {
  0% { transform: scale(0.9); }
  55% { transform: scale(1.09) translateY(-5px); }
  100% { transform: scale(1); }
}

@keyframes coq-sleep {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(1px) scaleY(0.975); }
}

/* ---------- Zzz flotantes cuando esta dormida ---------- */
.coquita-zzz {
  position: absolute;
  top: 2px;
  right: 4px;
  pointer-events: none;
  display: none;
  color: var(--bosque, #467355);
  font-weight: 700;
  line-height: 1;
}

.coquita-root[data-pose="dormida"] .coquita-zzz {
  display: block;
}

.coquita-zzz span {
  position: absolute;
  right: 0;
  font-size: 12px;
  opacity: 0;
  animation: coq-zzz-float 2.8s ease-out infinite;
  text-shadow: 0 1px 4px rgba(250, 246, 239, 0.95);
}

.coquita-zzz span:nth-child(2) {
  font-size: 10px;
  right: -7px;
  animation-delay: 0.9s;
}

.coquita-zzz span:nth-child(3) {
  font-size: 14px;
  right: 5px;
  animation-delay: 1.8s;
}

@keyframes coq-zzz-float {
  0% { opacity: 0; transform: translate(0, 6px) scale(0.75); }
  30% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(9px, -18px) scale(1.1); }
}

/* ---------- Boton discreto para dormir / minimizar ---------- */
.coquita-mute {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1.5px solid rgba(70, 115, 85, 0.35);
  border-radius: 50%;
  background: var(--papel, #FAF6EF);
  color: var(--tinta-suave, #6B645C);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(42, 34, 26, 0.12);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.15s ease, border-color 0.15s ease;
}

.coquita-escena:hover .coquita-mute,
.coquita-escena:focus-within .coquita-mute,
.coquita-root.coquita-minimizada .coquita-mute {
  opacity: 1;
  transform: scale(1);
}

.coquita-mute:hover,
.coquita-mute:focus-visible {
  color: var(--coico, #C45770);
  border-color: var(--coico, #C45770);
  outline: none;
}

/* ---------- Estado minimizado / dormida voluntariamente ---------- */
.coquita-root.coquita-minimizada .coquita-actor {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(250, 246, 239, 0.92);
  border: 1.5px solid rgba(70, 115, 85, 0.32);
  box-shadow: 0 4px 14px rgba(42, 34, 26, 0.12);
  padding: 4px;
}

.coquita-root.coquita-minimizada .coquita-mute {
  display: none;
}

/* ---------- Responsive mobile ---------- */
@media (max-width: 760px) {
  .coquita-root {
    bottom: 12px;
    left: 10px;
  }

  .coquita-root.coquita-raised {
    bottom: 86px;
  }

  .coquita-actor {
    width: 74px;
    height: 74px;
  }

  .coquita-globo {
    max-width: min(244px, calc(100vw - 104px));
    padding: 10px 28px 10px 12px;
    font-size: 13px;
    margin-left: 2px;
  }

  .coquita-mute {
    opacity: 0.85;
    transform: scale(1);
    width: 22px;
    height: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coquita-img,
  .coquita-zzz span {
    animation: none !important;
  }
}
