:root {
  --unnoba-chat-color: #004990;
}

#unnoba-chatbot {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 340px;
  height: 460px;
  background: #A8A9AB;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: "Segoe UI", sans-serif;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

#unnoba-chatbot.hidden {
  display: block;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
}

.chat-header {
  background-color: var(--unnoba-chat-color);
  color: white;
  padding: 12px 16px;
  font-weight: bold;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.chat-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.chat-log {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: #f8f9fb;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.chat-log::-webkit-scrollbar {
  width: 6px;
}

.chat-log::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

.user-msg,
.bot-msg {
  padding: 0 1em;
  border-radius: 20px;
  max-width: 80%;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.user-msg {
  padding: 1em 1em;
  align-self: flex-end;
  background-color: #dcf8c6;
  color: #1a1a1a;
  box-shadow: 0 4px 10px rgba(72, 176, 112, 0.25);
}

.bot-msg {
  align-self: flex-start;
  background-color: #ffffff;
  border-left: 4px solid var(--unnoba-chat-color);
  color: #1a1a1a;
  box-shadow: 0 4px 10px rgba(0, 73, 144, 0.2);
}

.bot-msg .bot-name {
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--unnoba-chat-color);
}

.chat-input-wrapper {
  display: flex;
  border-top: 1px solid #ccc;
  background: #fff;
}

.chat-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 15px;
  border: none;
  border-radius: 0 0 0 16px;
  outline: none;
}

.chat-input::placeholder {
  color: #aaa;
}

.chat-send-btn {
  background-color: var(--unnoba-chat-color);
  color: white;
  border: none;
  padding: 0 20px;
  font-size: 16px;
  border-radius: 0 0 16px 0;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-send-btn:hover {
  background-color: #003270;
}

#unnoba-chatbot-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 9999;
}

#unnoba-chatbot-toggle img {
  width: 64px;
  height: 64px;
  display: block;
}

/* Formatos enriquecidos en respuestas */
.bot-msg a {
  color: var(--unnoba-chat-color);
  text-decoration: underline;
}

.bot-msg strong {
  font-weight: bold;
}

.bot-msg ul {
  margin: 0;
  padding-left: 18px;
}

.bot-msg li {
  margin-bottom: 4px;
}

/* Iconos */
.chat-header-buttons {
  display: flex;
  gap: 6px;
}

.chat-header-buttons button {
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.chat-header-buttons button:hover {
  background-color: rgba(255,255,255,0.2);
}

.bot-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-loader {
  display: flex;
  gap: 4px;
}

.typing-loader span {
  width: 6px;
  height: 6px;
  background: #555;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.4s infinite ease-in-out;
}

.typing-loader span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-loader span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.loader-text {
  font-size: 12px;
  font-style: italic;
  color: #777;
}