/* Chatbot flotante */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px !important;
  z-index: 1000;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chatbot-container2 {
  position: fixed;
  bottom: 60px;
  right: 20px !important;
  z-index: 1000;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6a61a, #e89611);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(246, 166, 26, 0.4);
  font-size: 1.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.chatbot-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(246, 166, 26, 0.6);
}

.chatbot-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 350px;
  max-width: 90vw;
  height: 500px;
  min-width: 300px;
  min-height: 400px;
  max-height: 80vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e0e0;
}

.chatbot-header {
  background: linear-gradient(135deg, #f6a61a, #e89611);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.chatbot-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.chatbot-header .btn-close:hover {
  opacity: 1;
}

.chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8f9fa;
  scrollbar-width: thin;
  scrollbar-color: #f6a61a #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #f6a61a;
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #e89611;
}

.message {
  margin-bottom: 16px;
  animation: fadeInUp 0.3s ease;
}

.message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
}

.bot-message .message-content {
  background: white;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
  background: #f6a61a;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
}

.message-time {
  font-size: 0.75rem;
  color: #666;
  margin-top: 4px;
  opacity: 0.7;
}

.bot-message .message-time {
  text-align: left;
}

.user-message .message-time {
  text-align: right;
}

.chatbot-input {
  padding: 16px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.chatbot-input .form-control {
  border-radius: 20px;
  border: 1px solid #ddd;
  padding-left: 16px;
}

.chatbot-input .form-control:focus {
  border-color: #f6a61a;
  box-shadow: none;
}

.chatbot-input .btn {
  border-radius: 20px;
  padding: 8px 16px;
  background: #f6a61a;
  border-color: #f6a61a;
}

.chatbot-input .btn:hover {
  background: #e89611;
  border-color: #e89611;
}

/* Animación */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 16px;
  color: #666;
  font-style: italic;
}

.typing-dots {
  display: flex;
  margin-left: 8px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
  margin: 0 2px;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

/* Dark mode support */
body.dark-mode .chatbot-window {
  background: #232323;
  border-color: #444;
}

body.dark-mode .chatbot-messages {
  background: #181818;
}

body.dark-mode .bot-message .message-content {
  background: #333;
  color: #f1f1f1;
}

body.dark-mode .chatbot-input {
  background: #232323;
  border-color: #444;
}

body.dark-mode .chatbot-input .form-control {
  background: #333;
  border-color: #555;
  color: #f1f1f1;
}

body.dark-mode .chatbot-input .form-control::placeholder {
  color: #f1f1f1;
}

body.dark-mode .chatbot-input .form-control:focus {
  background: #333;
  border-color: #f6a61a;
  color: #f1f1f1;
}

/* Indicador de redimensionamiento en esquina superior izquierda */
.chatbot-resize-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  cursor: nw-resize;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: color 0.2s ease;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.chatbot-resize-handle:hover {
  color: rgba(255, 255, 255, 1);
  background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .chatbot-resize-handle {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chatbot-resize-handle:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.2);
}

/* Estados de redimensionamiento */
.chatbot-window.resizing {
  transition: none;
  user-select: none;
}

.chatbot-window.resizing * {
  pointer-events: none;
}

.chatbot-resize-handle:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 40px);
    height: 70vh;
    bottom: 80px;
    right: 20px;
  }

  #chatbot-container {
    bottom: 10px;
    right: 10px;
  }
}

.card {
  border-color: #f6a61a;
}

@media (max-width: 991.98px) {
  .chatbot-container {
    right: 5px !important;
    bottom: 10px !important;
  }
  .chatbot-container2 {
    right: 5px !important;
    bottom: 10px !important;
  }
}
