/**
 * Estilos para el Widget de Chat con IA (Ollama)
 * Car Center Premium
 */

.ollama-chat-widget {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Botón flotante */
.ollama-toggle-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ollama-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.15);
}

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

.ollama-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid white;
}

/* Ventana de chat */
.ollama-chat-window {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 540px;
  max-height: calc(100vh - 190px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

/* Header */
.ollama-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ollama-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ollama-title {
  font-size: 16px;
  font-weight: 600;
}

.ollama-status {
  font-size: 12px;
  opacity: 0.9;
}

.ollama-status.online::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  margin-right: 6px;
  box-shadow: 0 0 5px #2ecc71;
}

.ollama-status.offline::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3498db;
  margin-right: 6px;
  box-shadow: 0 0 5px #3498db;
}

.ollama-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.ollama-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mensajes */
.ollama-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ollama-messages::-webkit-scrollbar {
  width: 6px;
}

.ollama-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ollama-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.ollama-message {
  display: flex;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

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

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

.ollama-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ollama-message.user .ollama-message-avatar {
  background: #667eea;
  color: white;
}

.ollama-message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.ollama-message.bot .ollama-message-content {
  background: white;
  color: #2d3748;
  border: 1px solid #e2e8f0;
}

.ollama-message.user .ollama-message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.ollama-message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ollama-message-content li {
  margin: 4px 0;
}

/* Indicador de escritura */
.ollama-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.ollama-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e0;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

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

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

.ollama-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ollama-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ollama-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ollama-send-btn:active {
  transform: scale(0.95);
}

.ollama-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Armonización con el botón de WhatsApp para que nunca se solapen */
.whatsapp-btn {
  position: fixed !important;
  right: 28px !important;
  bottom: 28px !important;
  z-index: 1200 !important;
  background: #25d366;
  color: #fff !important;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  font-size: 2.2rem;
  transition: all 0.3s ease;
  text-decoration: none !important;
}

.whatsapp-btn:hover {
  background: #128c7e !important;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
  transform: scale(1.08);
}

/* Responsive */
@media (max-width: 600px) {
  .whatsapp-btn {
    right: 16px !important;
    bottom: 16px !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 1.6rem !important;
  }

  .ollama-chat-widget {
    bottom: 76px !important;
    right: 16px !important;
  }

  .ollama-toggle-btn {
    width: 48px;
    height: 48px;
  }

  .ollama-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    bottom: 60px;
    right: 0;
  }

  .ollama-message-content {
    max-width: 85%;
  }
}
