/* VIERNES-WIDGET — robot, orbe flotante y ventana de chat. Prefijo .vw- (cáscara) y ajustes de .ovz- (el chat de oficina-ia-viernes.css)
   cuando vive en la ventana (data-modo="ventana"). Cargar DESPUÉS de oficina-ia-viernes.css. Colores solo en rgb(); claro/oscuro lo
   resuelven las variables --ovz-* del chat; el robot y el orbe llevan su propio degradado (marca: azul R&H → índigo → cian). */

[hidden].vw-orbe,
[hidden].vw-ventana {
  display: none !important;
}

/* ── robot (SVG) ── */
.vw-robot {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.vw-g-a {
  stop-color: rgb(255, 255, 255);
}

.vw-g-b {
  stop-color: rgb(186, 201, 255);
}

.vw-r-cabeza {
  stroke: rgba(255, 255, 255, 0.6);
  stroke-width: 1;
}

.vw-r-visor {
  fill: rgb(15, 23, 42);
}

.vw-ojo,
.vw-r-boca {
  fill: rgb(34, 211, 238);
}

.vw-ojo {
  filter: drop-shadow(0 0 2px rgb(34, 211, 238));
}

.vw-r-antena {
  stroke: rgb(199, 210, 254);
  stroke-width: 2;
  stroke-linecap: round;
}

.vw-r-punta {
  fill: rgb(244, 114, 182);
}

.vw-r-oreja {
  fill: rgb(129, 140, 248);
}

.vw-r-torso {
  fill: rgb(165, 180, 252);
}

.vw-r-ojos,
.vw-r-boca,
.vw-r-punta {
  transform-box: fill-box;
  transform-origin: center;
}

.vw-r-ojos {
  animation: vw-parpadeo 5.2s ease-in-out infinite;
}

.vw-r-punta {
  animation: vw-latido 2.6s ease-in-out infinite;
}

.vw-robot {
  animation: vw-flota 4.4s ease-in-out infinite;
}

[data-animo="pensando"] .vw-r-ojos {
  animation: vw-mirar 1.5s ease-in-out infinite;
}

[data-animo="pensando"] .vw-r-punta {
  animation: vw-latido 0.55s ease-in-out infinite;
}

[data-animo="respondiendo"] .vw-r-boca {
  animation: vw-habla 0.3s ease-in-out infinite alternate;
}

@keyframes vw-parpadeo {
  0%,
  91%,
  100% {
    transform: scaleY(1);
  }

  95% {
    transform: scaleY(0.12);
  }
}

@keyframes vw-latido {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}

@keyframes vw-flota {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-1.5px);
  }
}

@keyframes vw-mirar {
  0%,
  100% {
    transform: translateX(-2.4px);
  }

  50% {
    transform: translateX(2.4px);
  }
}

@keyframes vw-habla {
  from {
    transform: scale(1, 1);
  }

  to {
    transform: scale(0.8, 2.6);
  }
}

.ovz-avatar .vw-robot {
  width: 100%;
  height: 100%;
}

.ovz-avatar {
  padding: 3px;
}

.ovz-avatar-grande {
  padding: 5px;
}

/* ── orbe ── */
.vw-orbe {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99990;
  width: 58px;
  height: 58px;
  padding: 7px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 30% 22%, rgb(129, 140, 248), rgb(55, 48, 163) 62%, rgb(26, 60, 143));
  box-shadow: 0 8px 26px rgba(79, 70, 229, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.24);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.25s;
}

.vw-orbe:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 32px rgba(79, 70, 229, 0.65), inset 0 0 0 2px rgba(255, 255, 255, 0.32);
}

.vw-orbe:focus-visible {
  outline: 3px solid rgb(34, 211, 238);
  outline-offset: 3px;
}

.vw-orbe-halo {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.55);
  animation: vw-onda 3.2s ease-out infinite;
  pointer-events: none;
}

.vw-orbe[data-animo="pensando"] .vw-orbe-halo {
  border-color: rgba(34, 211, 238, 0.8);
  animation-duration: 1.1s;
}

@keyframes vw-onda {
  0% {
    transform: scale(0.92);
    opacity: 0.9;
  }

  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

.vw-orbe-punto {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgb(244, 114, 182);
  border: 2px solid rgb(255, 255, 255);
}

.vw-orbe[data-aviso="1"] .vw-orbe-punto {
  display: block;
}

.vw-orbe-rotulo {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 10px;
  border-radius: 99px;
  background: rgb(30, 27, 75);
  color: rgb(255, 255, 255);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.vw-orbe:hover .vw-orbe-rotulo,
.vw-orbe:focus-visible .vw-orbe-rotulo {
  opacity: 1;
}

body.h-bubbles-hidden .vw-orbe {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.3);
}

/* ── ventana ── */
.vw-ventana {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  width: 420px;
  height: min(680px, calc(100vh - 48px));
  min-width: 340px;
  min-height: 420px;
  max-width: calc(100vw - 24px);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(99, 102, 241, 0.4);
  animation: vw-entra 0.22s ease-out;
}

@keyframes vw-entra {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.vw-ventana[data-amp="1"] {
  width: min(980px, calc(100vw - 48px));
  height: calc(100vh - 48px);
}

.vw-ventana[data-min="1"] {
  height: auto;
  min-height: 0;
}

.vw-asa {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  touch-action: none;
}

.vw-asa::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(255, 255, 255, 0.7);
  border-left: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 3px 0 0 0;
}

.vw-ventana[data-amp="1"] .vw-asa,
.vw-ventana[data-min="1"] .vw-asa {
  display: none;
}

.vw-cuerpo {
  display: flex;
  flex: 1;
  min-height: 0;
}

.vw-cuerpo > .ovz-raiz {
  flex: 1;
  min-width: 0;
}

/* botones de la cabecera */
.ovz-cab-acciones {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ovz-cab-acciones:empty {
  display: none;
}

.vw-ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: rgb(255, 255, 255);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

.vw-ctl:hover {
  background: rgba(255, 255, 255, 0.3);
}

.vw-ctl:focus-visible {
  outline: 3px solid rgb(34, 211, 238);
  outline-offset: 2px;
}

/* ── el chat dentro de la ventana ── */
.ovz-raiz[data-modo="ventana"] {
  gap: 0;
  height: 100%;
  background: var(--ovz-fondo);
}

.ovz-raiz[data-modo="ventana"] .ovz-cab {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 64px auto;
  gap: 0 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(120deg, rgb(26, 60, 143), rgb(79, 70, 229) 60%, rgb(14, 165, 233)) top / 100% 64px no-repeat, var(--ovz-fondo);
}

.ovz-raiz[data-modo="ventana"] .ovz-cab > .ovz-avatar {
  align-self: center;
  width: 42px;
  height: 42px;
  margin-left: 16px;
  background: rgba(255, 255, 255, 0.16);
}

.ovz-raiz[data-modo="ventana"] .ovz-cab-txt {
  align-self: center;
  flex: none;
}

.ovz-raiz[data-modo="ventana"] .ovz-cab-txt h3 {
  color: rgb(255, 255, 255);
}

.ovz-raiz[data-modo="ventana"] .ovz-cab-txt p {
  color: rgba(255, 255, 255, 0.82);
}

.ovz-raiz[data-modo="ventana"] .ovz-cab-acciones {
  align-self: center;
  margin-right: 12px;
}

.ovz-raiz[data-modo="ventana"] .ovz-cab-der {
  grid-column: 1 / -1;
  width: auto;
  padding: 8px 14px;
  gap: 8px;
  border-bottom: 1px solid var(--ovz-borde);
  background: var(--ovz-superficie);
}

.ovz-raiz[data-modo="ventana"] .ovz-cab-der .ovz-btn {
  margin-left: auto;
  min-height: 30px;
  padding: 3px 10px;
  font-size: 12px;
}

.ovz-raiz[data-modo="ventana"] .ovz-avisos {
  padding: 6px 12px 0;
}

.ovz-raiz[data-modo="ventana"] .ovz-lado-alternar {
  display: inline-flex;
  justify-content: center;
  margin: 6px 12px 0;
}

.ovz-raiz[data-modo="ventana"] .ovz-cuerpo {
  display: block;
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ovz-raiz[data-modo="ventana"] .ovz-chat {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.ovz-raiz[data-modo="ventana"] .ovz-log {
  flex: 1;
  height: auto;
  min-height: 0;
  padding: 14px;
}

.ovz-raiz[data-modo="ventana"] .ovz-lado {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: block;
  width: min(310px, 90%);
  overflow-y: auto;
  border-radius: 0;
  border-width: 0 0 0 1px;
  background: var(--ovz-fondo);
  box-shadow: -12px 0 28px rgba(15, 23, 42, 0.25);
  transform: translateX(104%);
  visibility: hidden;
  transition: transform 0.22s ease-out, visibility 0.22s;
}

.ovz-raiz[data-modo="ventana"] .ovz-lado[data-abierto="1"] {
  transform: none;
  visibility: visible;
}

.ovz-raiz[data-modo="ventana"] .ovz-sugs {
  flex-direction: column;
  align-items: stretch;
}

.ovz-raiz[data-modo="ventana"] .ovz-sug {
  text-align: left;
  border-radius: 12px;
}

.ovz-raiz[data-modo="ventana"] .ovz-compositor {
  padding: 10px 12px 12px;
}

.ovz-raiz[data-modo="ventana"] .ovz-msg {
  max-width: 100%;
}

.vw-ventana[data-min="1"] .ovz-raiz > :not(.ovz-cab),
.vw-ventana[data-min="1"] .ovz-cab-der {
  display: none;
}

.vw-ventana[data-min="1"] .ovz-cab {
  grid-template-rows: 64px;
}

/* chips de puesto en la bienvenida y casa vacía de la pestaña */
.ovz-puestos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.ovz-puesto-btn {
  min-height: 30px;
  padding: 3px 12px;
  border-radius: 99px;
  font-size: 12px;
}

.ovz-puesto-on {
  background: var(--ovz-acento);
  border-color: var(--ovz-acento);
  color: var(--ovz-sobre-acento);
}

.ovz-casa-vacia {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--oia-gris, rgb(100, 116, 139));
  text-align: center;
}

.ovz-casa-vacia p {
  margin: 0;
}

/* ── móvil: la ventana ocupa toda la pantalla ── */
@media (max-width: 640px) {
  .vw-ventana {
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--ovz-fondo, rgb(255, 255, 255));
  }

  .vw-asa,
  .vw-ctl-amp {
    display: none;
  }

  .vw-orbe {
    right: 16px;
  }

  .vw-ctl {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vw-robot,
  .vw-r-ojos,
  .vw-r-punta,
  .vw-r-boca,
  .vw-orbe-halo,
  .vw-ventana {
    animation: none !important;
  }

  .vw-orbe,
  .ovz-raiz[data-modo="ventana"] .ovz-lado {
    transition: none;
  }
}
