/**
 * Chatbot Widget Styles
 * Widget flotante de ayuda para Clocki
 */

/* Botón flotante */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 9999;
}

.chatbot-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.chatbot-toggle:active {
  transform: scale(0.95);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.chatbot-toggle .chat-icon {
  display: block;
}

.chatbot-toggle .close-icon {
  display: none;
}

.chatbot-toggle.active .chat-icon {
  display: none;
}

.chatbot-toggle.active .close-icon {
  display: block;
}

/* Badge de notificación */
.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  border: 2px solid white;
}

/* Contenedor del chat */
.chatbot-container {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: chatbot-slide-up 0.3s ease-out;
}

.chatbot-container.open {
  display: flex;
}

@keyframes chatbot-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header del chat */
.chatbot-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-avatar svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.chatbot-avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.chatbot-header-info {
  flex: 1;
}

.chatbot-header-title {
  font-weight: 600;
  font-size: 16px;
  margin: 0;
}

.chatbot-header-subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin: 2px 0 0;
}

/* Área de mensajes */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

/* Mensajes */
.chatbot-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: message-appear 0.2s ease-out;
}

@keyframes message-appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-message.user {
  align-self: flex-end;
  background: #22c55e;
  color: white;
  border-bottom-right-radius: 4px;
}

.chatbot-message.assistant {
  align-self: flex-start;
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Indicador de escritura */
.chatbot-typing {
  align-self: flex-start;
  padding: 12px 16px;
  background: white;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: none;
}

.chatbot-typing.active {
  display: block;
}

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

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite;
}

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

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

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Sugerencias rápidas */
.chatbot-suggestions {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.chatbot-suggestion {
  padding: 6px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.chatbot-suggestion:hover {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
}

/* Input del chat */
.chatbot-input-container {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-input:focus {
  border-color: #22c55e;
}

.chatbot-input::placeholder {
  color: #94a3b8;
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #22c55e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chatbot-send:hover {
  background: #16a34a;
}

.chatbot-send:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.chatbot-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Mensaje de error */
.chatbot-error {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}

/* Responsive */
@media (max-width: 480px) {
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .chatbot-container {
    bottom: 80px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
    max-height: none;
    border-radius: 12px;
  }

  .chatbot-messages {
    padding: 12px;
  }

  .chatbot-message {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
  .chatbot-container {
    background: #1e293b;
  }

  .chatbot-messages {
    background: #0f172a;
  }

  .chatbot-message.assistant {
    background: #334155;
    color: #f1f5f9;
  }

  .chatbot-typing {
    background: #334155;
  }

  .chatbot-suggestions {
    background: #0f172a;
    border-color: #334155;
  }

  .chatbot-suggestion {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
  }

  .chatbot-input-container {
    background: #1e293b;
    border-color: #334155;
  }

  .chatbot-input {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
  }
}
