.cpb-chat-launch{position:fixed;right:16px;bottom:16px;z-index:99998}
.cpb-btn{background:#BEDB60;color:#fff;border:none;border-radius:999px;padding:12px 16px;box-shadow:0 4px 16px rgba(0,0,0,.2);cursor:pointer;font-weight:600;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap}
.cpb-close{background:#888888}
.cpb-window{position:fixed;right:16px;bottom:76px;width:360px;max-height:66vh;display:none;flex-direction:column;background:#fff;border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.18);overflow:hidden;z-index:99999;border:2px solid #F2F2F2}
.cpb-header{
  display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#F2F2F2;color:#fff;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif;
}
.cpb-title{display:flex;align-items:center;gap:8px}
.cpb-title h4{
  margin:0;font-size:15px;font-weight:600;color:#A6A6A6 !important;font-family: inherit;
}
.cpb-avatar{width:28px;height:28px;border-radius:999px;object-fit:cover;background:#F2F2F2;border:1px solid #BEDB60}
.cpb-body{padding:10px;overflow-y:auto;height:320px;background:#E0EEB8;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif;
}
.cpb-input{display:flex;gap:8px;padding:10px;background:#fff;border-top:1px solid #F2F2F2}
.cpb-input input{flex:1;padding:10px;border:1px solid #F2F2F2;border-radius:8px;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif;
}
.cpb-input button{
  background: #BEDB60;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpb-input button:hover {
  background: #a5c14a;
}
.cpb-input button::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-left: 8px solid #FFFFFF;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  margin-left: 2px;
}
.cpb-msg{padding:8px 10px;border-radius:10px;margin:6px 0;max-width:88%;word-wrap:break-word;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif;
}
.cpb-row{display:flex}
.cpb-row.cpb-user{justify-content:flex-end}
.cpb-row.cpb-bot{justify-content:flex-start}
.cpb-me{background:#BEDB60;border:1px solid #D5E8A0}
.cpb-bot{background:#E0EEB8;border:1px solid #D5E8A0}
.cpb-time{font-size:10px;color:#555;margin-top:2px;text-align:right}
.cpb-debug{display:none;background:#0b1220;color:#F2F2F2;padding:8px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:12px;max-height:160px;overflow:auto;border-top:2px solid #F2F2F2}

.cpb-spinner {
  display: none;
  width: 24px;
  height: 24px;
  border: 3px solid #F2F2F2;
  border-top: 3px solid #F2F2F2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 10px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cpb-spinner.active {
  display: block;
}

/* Estilos para enlaces */
.cpb-text a {
  color: #A6A6A6 !important;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.cpb-text a:hover {
  color: #888888 !important;
  text-decoration: none;
}

/* Mejoras en la estructura de mensajes */
.cpb-bubble {
  display: inline-block;
  position: relative;
  background: #FFFFFF;
}

.cpb-row.cpb-bot .cpb-bubble {
  border: 1px solid #D5E8A0;
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  margin: 4px 0;
  max-width: 85%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.cpb-row.cpb-user .cpb-bubble {
  background: #BEDB60;
  border: 1px solid #D5E8A0;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 14px;
  margin: 4px 0;
  max-width: 85%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.cpb-text {
  font-size: 14px;
  line-height: 1.4;
  color: #333333;
  word-wrap: break-word;
  margin: 0;
}

.cpb-row.cpb-user .cpb-text {
  color: #333333;
}

.cpb-time {
  font-size: 10px;
  color: #666666;
  margin-top: 4px;
  text-align: right;
  opacity: 0.7;
}

/* Animaciones suaves */
.cpb-row {
  animation: fadeInUp 0.3s ease-out;
  transform-origin: bottom;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll personalizado */
.cpb-body::-webkit-scrollbar {
  width: 6px;
}

.cpb-body::-webkit-scrollbar-track {
  background: #F2F2F2;
  border-radius: 3px;
}

.cpb-body::-webkit-scrollbar-thumb {
  background: #BEDB60;
  border-radius: 3px;
}

.cpb-body::-webkit-scrollbar-thumb:hover {
  background: #D5E8A0;
}

/* Indicador de escritura mejorado */
.cpb-spinner {
  display: none;
  margin: 8px 0 8px 14px;
  width: 40px;
  height: 24px;
  position: relative;
}

.cpb-spinner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #BEDB60;
  animation: typing 1.4s infinite ease-in-out;
  transform: translateY(-50%);
}

.cpb-spinner::after {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #BEDB60;
  animation: typing 1.4s infinite ease-in-out 0.2s;
  transform: translateY(-50%);
}

.cpb-spinner .dot3 {
  position: absolute;
  left: 24px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #BEDB60;
  animation: typing 1.4s infinite ease-in-out 0.4s;
  transform: translateY(-50%);
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(-50%) scale(1);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-50%) scale(1.2);
    opacity: 1;
  }
}

/* Mejora del input */
.cpb-input input:focus {
  outline: none;
  border-color: #BEDB60;
  box-shadow: 0 0 0 2px rgba(190, 219, 96, 0.2);
}

.cpb-input input::placeholder {
  color: #A6A6A6;
}

/* Responsividad */
@media (max-width: 400px) {
  .cpb-window {
    width: calc(100vw - 32px);
    right: 16px;
    left: 16px;
    max-height: 70vh;
  }

  .cpb-row.cpb-bot .cpb-bubble,
  .cpb-row.cpb-user .cpb-bubble {
    max-width: 90%;
  }
}
