/* Infrico Chatbot Styles */
* {
  box-sizing: border-box;
}

/* Botón flotante del chatbot */
.infrico-chatbot-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0066cc, #004499);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 102, 204, 0.3);
  z-index: 9998;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.infrico-chatbot-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(0, 102, 204, 0.4);
}

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

/* Badge de notificación */
.infrico-chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Overlay del modal */
.infrico-chatbot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.infrico-chatbot-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal del chatbot */
.infrico-chatbot-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 420px;
  height: 600px;
  max-width: 95vw;
  max-height: 90vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.infrico-chatbot-overlay.active .infrico-chatbot-modal {
  transform: translate(-50%, -50%) scale(1);
}

/* Header del modal */
.infrico-chatbot-header {
  background: linear-gradient(135deg, #0066cc, #004499);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.infrico-chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.infrico-chatbot-logo {
  width: 32px;
  height: 32px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #0066cc;
  font-size: 16px;
}

.infrico-chatbot-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

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

.infrico-chatbot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.infrico-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.infrico-chatbot-close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Área de mensajes */
.infrico-chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
}

.infrico-chatbot-message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.infrico-chatbot-message.user {
  flex-direction: row-reverse;
}

.infrico-chatbot-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.infrico-chatbot-message.assistant .infrico-chatbot-message-avatar {
  background: linear-gradient(135deg, #0066cc, #004499);
  color: white;
}

.infrico-chatbot-message.user .infrico-chatbot-message-avatar {
  background: #e9ecef;
  color: #6c757d;
}

.infrico-chatbot-message-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
}

.infrico-chatbot-message.assistant .infrico-chatbot-message-content {
  background: white;
  border: 1px solid #e9ecef;
  border-bottom-left-radius: 6px;
}

.infrico-chatbot-message.user .infrico-chatbot-message-content {
  background: #0066cc;
  color: white;
  border-bottom-right-radius: 6px;
}

.infrico-chatbot-message-time {
  font-size: 11px;
  color: #6c757d;
  margin-top: 4px;
}

/* Tarjeta del producto */
.infrico-product-card {
  margin-bottom: 16px;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  background: white;
  overflow: hidden;
  animation: messageSlideIn 0.3s ease-out;
}

.infrico-product-card-content {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.infrico-product-card-image {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.infrico-product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.infrico-product-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.infrico-product-card-sku {
  font-size: 11px;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.infrico-product-card-name {
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.infrico-product-card-description {
  font-size: 12px;
  color: #666;
  margin: 6px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.infrico-product-card-price {
  font-size: 13px;
  font-weight: 600;
  color: #0066cc;
  display: flex;
  gap: 8px;
  align-items: center;
}

.price-sale {
  color: #0066cc;
  font-weight: 700;
}

.price-regular {
  color: #999;
  text-decoration: line-through;
  font-size: 11px;
}

.price-consultar {
  color: #666;
  font-style: italic;
}

/* Indicador de escritura */
.infrico-chatbot-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  border: 1px solid #e9ecef;
  max-width: 70%;
}

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

.infrico-chatbot-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6c757d;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.infrico-chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.infrico-chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Input del chat */
.infrico-chatbot-input-container {
  padding: 20px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.infrico-chatbot-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.infrico-chatbot-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  border: 1px solid #d0d7de;
  border-radius: 22px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.2s ease;
}

.infrico-chatbot-input:focus {
  border-color: #0066cc;
}

.infrico-chatbot-input::placeholder {
  color: #6c757d;
}

.infrico-chatbot-send-button {
  width: 44px;
  height: 44px;
  background: #0066cc;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.infrico-chatbot-send-button:hover:not(:disabled) {
  background: #004499;
  transform: scale(1.05);
}

.infrico-chatbot-send-button:disabled {
  background: #d0d7de;
  cursor: not-allowed;
  transform: none;
}

.infrico-chatbot-send-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Estados de error */
.infrico-chatbot-error {
  padding: 12px 16px;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  color: #c53030;
  font-size: 14px;
  margin: 10px 0;
}

/* Sugerencias rápidas */
.infrico-chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.infrico-chatbot-suggestion {
  padding: 6px 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.infrico-chatbot-suggestion:hover {
  background: #e9ecef;
  border-color: #0066cc;
}

/* Responsive */
@media (max-width: 768px) {
  .infrico-chatbot-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: translateY(100%);
  }
  
  .infrico-chatbot-overlay.active .infrico-chatbot-modal {
    transform: translateY(0);
  }
  
  .infrico-chatbot-button {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
  }
  
  .infrico-chatbot-button svg {
    width: 20px;
    height: 20px;
  }

  .infrico-product-card-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .infrico-product-card-image {
    width: 100%;
    height: 150px;
  }
}

/* Scrollbar personalizada */
.infrico-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.infrico-chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.infrico-chatbot-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.infrico-chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animaciones de entrada */
.infrico-chatbot-message {
  animation: messageSlideIn 0.3s ease-out;
}

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

/* Ocultar chatbot por defecto */
.infrico-chatbot-overlay {
  display: none;
}

.infrico-chatbot-overlay.active {
  display: block;
}
