/* =========================================================
   WIDGET DEL AGENTE — mascota BIA
   Usa las variables de marca ya definidas en styles.css
   (--navy, --navy-deep, --blue, --orange, --paper, --white, --ink)
   ========================================================= */

#bia-agent-widget{
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 9999;
  font-family:'Inter', system-ui, sans-serif;
}

.bia-launcher{
  position:relative;
  width: 92px;
  height: 92px;
  border:none;
  background:transparent;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
}

.bia-launcher:focus-visible{
  outline: 3px solid var(--orange);
  outline-offset: 6px;
  border-radius: 50%;
}

/* anillo tipo baliza */
.bia-beacon{
  position:absolute;
  inset:0;
  border-radius:50%;
  background: var(--orange);
  opacity:.35;
  animation: bia-ping 2.6s cubic-bezier(.4,0,.3,1) infinite;
}
@keyframes bia-ping{
  0%   { transform:scale(.72); opacity:.45; }
  70%  { transform:scale(1.28); opacity:0; }
  100% { transform:scale(1.28); opacity:0; }
}

.bia-base{
  position:absolute;
  inset:6px;
  border-radius:50%;
  background: linear-gradient(155deg, var(--blue) 0%, var(--navy-deep) 100%);
  box-shadow: 0 18px 40px rgba(3,22,46,.45), inset 0 2px 4px rgba(255,255,255,.25), inset 0 -6px 10px rgba(0,0,0,.35);
}

/* franja de cinta de precaución al pasar el cursor */
.bia-base::before{
  content:"";
  position:absolute;
  inset:-3px;
  border-radius:50%;
  padding:3px;
  background: repeating-conic-gradient(var(--orange) 0deg 14deg, var(--navy-deep) 14deg 28deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  opacity:0;
  transition: opacity .25s ease;
}
.bia-launcher:hover .bia-base::before,
.bia-launcher:focus-visible .bia-base::before{ opacity:1; }

.bia-char-wrap{
  position:absolute;
  left:50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: 78px;
  aspect-ratio: 1023 / 1218;
  animation: bia-float 3.2s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes bia-float{
  0%,100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
  50%     { transform: translateX(-50%) translateY(-5px) rotate(-2deg); }
}

.bia-launcher:hover .bia-char-wrap,
.bia-launcher:focus-visible .bia-char-wrap{
  animation: bia-float-hover 1.1s ease-in-out infinite;
}
@keyframes bia-float-hover{
  0%,100% { transform: translateX(-50%) translateY(0) rotate(0deg) scale(1.06); }
  50%     { transform: translateX(-50%) translateY(-7px) rotate(3deg) scale(1.06); }
}

.bia-char-wrap img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,.35));
}

.bia-lid{
  position:absolute;
  width: 17.4%;
  height: 13.6%;
  left: 18.6%;
  top: 39.2%;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: linear-gradient(#ffffff, #d7d7d7);
  transform: scaleY(0);
  transform-origin: top center;
}
.bia-lid.right{
  left: 57.0%;
  top: 37.5%;
  width: 15.9%;
  height: 15.1%;
}
.bia-launcher.blink .bia-lid{
  animation: bia-blink .22s ease-in-out;
}
@keyframes bia-blink{
  0%   { transform: scaleY(0); }
  45%  { transform: scaleY(1); }
  100% { transform: scaleY(0); }
}

.bia-launcher.pressed .bia-char-wrap{
  animation: bia-bounce .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes bia-bounce{
  0%   { transform: translateX(-50%) translateY(0) scale(1); }
  35%  { transform: translateX(-50%) translateY(-16px) scale(1.12) rotate(-6deg); }
  60%  { transform: translateX(-50%) translateY(2px) scale(.96) rotate(4deg); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

.bia-tip{
  position:absolute;
  right: 104px;
  bottom: 30px;
  background: var(--ink);
  color: var(--white);
  font-size: 13.5px;
  font-weight:500;
  padding: 9px 14px;
  border-radius: 10px;
  white-space:nowrap;
  box-shadow: 0 12px 28px rgba(3,22,46,.35);
  opacity:0;
  transform: translateX(6px);
  pointer-events:none;
  transition: opacity .2s ease, transform .2s ease;
}
.bia-tip::after{
  content:"";
  position:absolute;
  right:-6px; top:50%; transform:translateY(-50%);
  border-width:6px 0 6px 6px;
  border-style:solid;
  border-color: transparent transparent transparent var(--ink);
}
.bia-launcher:hover .bia-tip{ opacity:1; transform:translateX(0); }

.bia-badge{
  position:absolute;
  top:2px; right:2px;
  min-width:22px; height:22px;
  background: var(--orange);
  border: 2px solid var(--navy-deep);
  border-radius:50%;
  color:#fff;
  font-size:11px;
  font-weight:700;
  display:flex; align-items:center; justify-content:center;
  padding: 0 4px;
}

/* =============== Panel de chat =============== */
.bia-panel{
  position:absolute;
  right:0;
  bottom: 108px;
  width: 340px;
  max-width: calc(100vw - 40px);
  max-height: 480px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(3,22,46,.45);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  opacity:0;
  transform: translateY(14px) scale(.97);
  pointer-events:none;
  transition: opacity .22s ease, transform .22s ease;
}
.bia-panel.open{
  opacity:1;
  transform:translateY(0) scale(1);
  pointer-events:auto;
}

.bia-panel__head{
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--white);
  padding: 14px 16px;
  display:flex;
  align-items:center;
  gap:10px;
}
.bia-panel__head img{ width:34px; height:34px; object-fit:contain; }
.bia-panel__head .t{ flex:1; }
.bia-panel__head .t strong{
  font-family:'Barlow Condensed', sans-serif;
  font-weight:700;
  font-size:16px;
  letter-spacing:.03em;
  text-transform:uppercase;
  display:block;
}
.bia-panel__head .t span{
  font-size:11.5px;
  color: var(--orange);
}
.bia-panel__head button{
  background:none; border:none; color:var(--white);
  font-size:18px; cursor:pointer; line-height:1; padding:4px;
  opacity:.7;
}
.bia-panel__head button:hover{ opacity:1; }

.bia-panel__body{
  flex:1;
  overflow-y:auto;
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  background: var(--paper);
}
.msg{
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height:1.45;
}
.msg.bot{
  align-self:flex-start;
  background:linear-gradient(180deg,#ffffff 0%, #f4f8fd 100%);
  color:#0e2137;
  border:1px solid #cfd9e7;
  border-bottom-left-radius:3px;
  box-shadow: 0 10px 22px rgba(3,22,46,.08);
  font-weight:500;
}
.msg.user{
  align-self:flex-end;
  background: var(--blue);
  color:#fff;
  border-bottom-right-radius:3px;
}
.bia-panel__foot{
  display:flex;
  gap:8px;
  padding: 10px;
  border-top: 1px solid #dde3ee;
  background:#fff;
}
.bia-panel__foot input{
  flex:1;
  border:1px solid #ccd5e3;
  border-radius: 10px;
  padding: 9px 11px;
  font-size:13.5px;
  font-family:inherit;
}
.bia-panel__foot input:focus{ outline:2px solid var(--orange); outline-offset:1px; }
.bia-panel__foot button{
  background: var(--navy-deep);
  color:#fff;
  border:none;
  border-radius:10px;
  padding: 0 14px;
  font-weight:600;
  cursor:pointer;
  font-size:13px;
}
.bia-panel__foot button:hover{ background:#000; }

@media (max-width: 480px){
  #bia-agent-widget{ right:16px; bottom:16px; }
  .bia-launcher{ width:78px; height:78px; }
  .bia-char-wrap{ width:66px; }
}

@media (prefers-reduced-motion: reduce){
  .bia-char-wrap, .bia-beacon, .bia-launcher:hover .bia-char-wrap{ animation:none !important; }
}


/* visibility enhancement for greeting and chat text */
.bia-panel__body, .bia-panel__body .msg, .bia-panel__foot input { color:#0e2137; }
.bia-panel__foot input::placeholder{ color:#6d7b8f; opacity:1; }
.bia-panel__head{ box-shadow: inset 0 -1px 0 rgba(255,255,255,.08); }
