/* LaperaPro Chat Widget */
:root{
  /* Paleta LaperaPro (verde/limón) */
  --laperapro-accent: #A5C742;      /* verde corporativo (theme-color) */
  --laperapro-accent-2: #FCEE21;    /* amarillo limón */
  --laperapro-accent-deep: #7AC943; /* verde alternativo del gradiente */
  --laperapro-ink: #0b1410;         /* texto oscuro */
  --laperapro-bg: rgba(255,255,255,.14);
  --laperapro-bg-strong: rgba(255,255,255,.20);
}

#laperapro-chat-container{
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2147483647;
  font-family: Arial, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Pop-up contextual */
.laperapro-trigger-pop{
  position: absolute;
  right: 0;
  bottom: 92px;
  width: min(300px, 78vw);
  background: rgba(255,255,255,.96);
  color: var(--laperapro-ink);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
  padding: 10px 12px;
  display: none;
}
.laperapro-trigger-pop::after{
  content:"";
  position:absolute;
  right: 18px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,.96);
  border-right: 1px solid rgba(0,0,0,.08);
  border-bottom: 1px solid rgba(0,0,0,.08);
  transform: rotate(45deg);
}
.laperapro-trigger-pop .txt{ font-size:14px; line-height:1.35; font-weight:600; }
.laperapro-trigger-pop .actions{ display:flex; gap:8px; justify-content:flex-end; margin-top:8px; }
.laperapro-trigger-pop button{ appearance:none; border:0; border-radius:999px; padding:8px 12px; cursor:pointer; font-weight:800; font-size:13px; }
.laperapro-trigger-pop .btn-open{
  background: linear-gradient(90deg, var(--laperapro-accent), var(--laperapro-accent-2));
  color:#fff;
}
.laperapro-trigger-pop .btn-close{ background: rgba(0,0,0,.06); color: var(--laperapro-ink); }

/* Burbuja */
#laperapro-chat-bubble{
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  position: relative;
}
#laperapro-chat-bubble::before{
  content:"";
  position:absolute;
  inset:0;
  padding: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    rgba(252,238,33,.95),
    rgba(165,199,66,.92),
    rgba(122,201,67,.92)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events:none;
}
#laperapro-chat-bubble img{
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  display:block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
  background: transparent;
}

/* Ventana */
#laperapro-chat-window{
  position:absolute;
  bottom: 95px;
  right: 0;
  width: 350px;
  height: 450px;
  background: var(--laperapro-bg);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  transform-origin: bottom right;
  transition: transform .2s ease, opacity .2s ease;
}
#laperapro-chat-window::before{
  content:"";
  position:absolute;
  inset:0;
  padding: 2px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(57,255,134,.85), rgba(17,211,106,.75));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events:none;
}
.laperapro-hidden{ transform: scale(.9); opacity: 0; pointer-events:none; }

.laperapro-chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 14px 16px;
  background: linear-gradient(90deg, var(--laperapro-accent), var(--laperapro-accent-2));
  color:#fff;
}
.laperapro-chat-header h3{ margin:0; font-size:1.05rem; font-weight:800; }
.laperapro-chat-close{ background:none; border:none; color:#fff; font-size:1.8rem; line-height:1; cursor:pointer; }

.laperapro-chat-messages{
  flex: 1 1 auto;
  padding: 14px;
  overflow-y:auto;
  background: var(--laperapro-bg);
}
.laperapro-message{
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  max-width: 85%;
  line-height: 1.35;
  word-break: break-word;
}
.laperapro-message-user{
  background: rgba(255,255,255,.88);
  color: var(--laperapro-ink);
  margin-left:auto;
  border: 1px solid rgba(0,0,0,.16); /* usuario: borde fino gris */
}
.laperapro-message-bot{
  background: rgba(255,255,255,.98);
  color: var(--laperapro-ink);
  margin-right:auto;
  border: 1px solid var(--laperapro-accent); /* bot: borde fino verde/limón */
}

.laperapro-chat-input-area{
  display:flex;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: var(--laperapro-bg-strong);
  align-items:center;
}
.laperapro-chat-input-area input{
  flex:1 1 auto;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  padding: 0 14px;
  font-size: 16px;
  outline:none;
  background: rgba(255,255,255,.9);
}
.laperapro-chat-send{
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(90deg, var(--laperapro-accent), var(--laperapro-accent-2));
  color:#fff;
}
.laperapro-chat-send svg{ width: 22px; height: 22px; display:block; }

@media (max-width: 768px){
  #laperapro-chat-container{ bottom: 15px; right: 15px; }
  #laperapro-chat-bubble{ width: 70px; height: 70px; }
  #laperapro-chat-bubble img{ width: 52px; height: 52px; }
  #laperapro-chat-window{
    /* En móvil debe posicionarse respecto a la pantalla (no al contenedor) */
    position: fixed !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: 520px !important;
    height: min(70vh, 520px) !important;
    transform: none !important;
  }
  .laperapro-trigger-pop{
    position: fixed !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    margin: 0 auto;
    width: min(360px, calc(100vw - 24px));
  }
}

/* LaperaPro Chat Widget (basado en LaraIA) */
:root{
  /* Paleta LaperaPro (verde/limón) */
  --laperapro-accent: #A5C742;      /* verde corporativo (theme-color) */
  --laperapro-accent-2: #FCEE21;    /* amarillo limón */
  --laperapro-accent-deep: #7AC943; /* verde alternativo del gradiente */
  --laperapro-ink: #0b1410;         /* texto oscuro */
  --laperapro-bg: rgba(255,255,255,.14);
  --laperapro-bg-strong: rgba(255,255,255,.20);
}

/* Contenedor flotante */
#laperapro-chat-container{
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2147483647;
  font-family: Arial, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Pop-up contextual (tooltip) */
.laperapro-trigger-pop{
  position: absolute;
  right: 0;
  bottom: 92px;
  width: min(300px, 78vw);
  background: rgba(255,255,255,.96);
  color: var(--laperapro-ink);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
  padding: 10px 12px;
  display: none;
}
.laperapro-trigger-pop::after{
  content:"";
  position:absolute;
  right: 18px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,.96);
  border-right: 1px solid rgba(0,0,0,.08);
  border-bottom: 1px solid rgba(0,0,0,.08);
  transform: rotate(45deg);
}
.laperapro-trigger-pop .txt{
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}
.laperapro-trigger-pop .actions{
  display:flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.laperapro-trigger-pop button{
  appearance:none;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  cursor:pointer;
  font-weight: 800;
  font-size: 13px;
}
.laperapro-trigger-pop .btn-open{
  background: linear-gradient(90deg, var(--laperapro-accent), var(--laperapro-accent-2));
  color:#fff;
}
.laperapro-trigger-pop .btn-close{
  background: rgba(0,0,0,.06);
  color: var(--laperapro-ink);
}

/* Burbuja con logo */
#laperapro-chat-bubble{
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  position: relative;
}
#laperapro-chat-bubble::before{
  content:"";
  position:absolute;
  inset:0;
  padding: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    rgba(252,238,33,.95),
    rgba(165,199,66,.92),
    rgba(122,201,67,.92)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events:none;
}
#laperapro-chat-bubble img{
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  display:block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
  background: transparent;
}

/* Ventana */
#laperapro-chat-window{
  position:absolute;
  bottom: 95px;
  right: 0;
  width: 350px;
  height: 450px;
  background: var(--laperapro-bg);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  transform-origin: bottom right;
  transition: transform .2s ease, opacity .2s ease;
}
#laperapro-chat-window::before{
  content:"";
  position:absolute;
  inset:0;
  padding: 2px;
  border-radius: 12px;
  background: linear-gradient(135deg,
    rgba(57,255,134,.85),
    rgba(17,211,106,.75)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events:none;
}
.laperapro-hidden{ transform: scale(.9); opacity: 0; pointer-events:none; }

.laperapro-chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(90deg, var(--laperapro-accent), var(--laperapro-accent-2));
  color:#fff;
}
.laperapro-chat-header h3{ margin:0; font-size: 1.05rem; font-weight: 800; }
.laperapro-chat-close{
  background:none; border:none; color:#fff;
  font-size: 1.8rem; line-height:1; cursor:pointer;
}

.laperapro-chat-messages{
  flex: 1 1 auto;
  padding: 14px;
  overflow-y:auto;
  background: var(--laperapro-bg);
}
.laperapro-message{
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  max-width: 85%;
  line-height: 1.35;
  word-break: break-word;
}
.laperapro-message-user{
  background: rgba(255,255,255,.88);
  color: var(--laperapro-ink);
  margin-left:auto;
  border: 1px solid rgba(0,0,0,.16); /* usuario: borde fino gris */
}
.laperapro-message-bot{
  background: rgba(255,255,255,.98);
  color: var(--laperapro-ink);
  margin-right:auto;
  border: 1px solid var(--laperapro-accent); /* bot: borde fino verde/limón */
}

.laperapro-chat-input-area{
  display:flex;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: var(--laperapro-bg-strong);
  align-items:center;
}
.laperapro-chat-input-area input{
  flex:1 1 auto;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  padding: 0 14px;
  font-size: 16px;
  outline:none;
  background: rgba(255,255,255,.9);
}
.laperapro-chat-send{
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(90deg, var(--laperapro-accent), var(--laperapro-accent-2));
  color:#fff;
}
.laperapro-chat-send svg{ width: 22px; height: 22px; display:block; }

/* Responsive móvil */
@media (max-width: 768px){
  #laperapro-chat-container{ bottom: 15px; right: 15px; }
  #laperapro-chat-bubble{ width: 70px; height: 70px; }
  #laperapro-chat-bubble img{ width: 52px; height: 52px; }
  #laperapro-chat-window{
    /* En móvil debe posicionarse respecto a la pantalla (no al contenedor) */
    position: fixed !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: 520px !important;
    height: min(70vh, 520px) !important;
    transform: none !important;
  }
  .laperapro-trigger-pop{
    position: fixed !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    margin: 0 auto;
    width: min(360px, calc(100vw - 24px));
  }
}

