:root {
  --bot-color: #2563eb; /* Color por defecto que luego se cambia desde el panel */
}

#cb-widget-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-color: var(--bot-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  transition: transform 0.3s ease;
}

#cb-widget-btn:hover {
  transform: scale(1.05);
}

#cb-chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.3s ease;
  font-family: 'Montserrat', 'Poppins', sans-serif;
}

#cb-chat-window.cb-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#cb-header {
  background-color: var(--bot-color);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
}

#cb-header-close {
  cursor: pointer;
  font-size: 20px;
  transition: opacity 0.2s;
}

#cb-header-close:hover {
  opacity: 0.7;
}

#cb-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f4f7fb;
}

.cb-msg {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 14px;
  
  /* CORRECCIÓN: ESTO EVITA QUE LAS URLS LARGAS DESBORDEN LA PANTALLA */
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.cb-bot {
  background-color: white;
  color: #334155;
  align-self: flex-start;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.cb-user {
  background-color: var(--bot-color);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cb-typing {
  font-style: italic;
  color: #94a3b8;
  background-color: transparent;
  border: none;
  box-shadow: none;
  padding: 5px 10px;
}

#cb-input-area {
  display: flex;
  padding: 15px;
  background: white;
  border-top: 1px solid #e2e8f0;
}

#cb-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 25px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}

#cb-input:focus {
  border-color: var(--bot-color);
}

#cb-send {
  background-color: var(--bot-color);
  color: white;
  border: none;
  padding: 0 20px;
  margin-left: 10px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: opacity 0.2s;
}

#cb-send:hover {
  opacity: 0.9;
}

/* Diseño de la barra de desplazamiento (Scrollbar) */
#cb-messages::-webkit-scrollbar {
  width: 6px;
}
#cb-messages::-webkit-scrollbar-track {
  background: transparent;
}
#cb-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
#cb-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}