/**
 * Estilos del Asistente Virtual Inteligente (Chatbot Gemini)
 * Laboratorio Sarandí
 */

/* Botón Flotante Lanzador */
.lab-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 3px solid #10b981;
  color: #1e6b4e;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.45), 0 0 0 4px rgba(52, 211, 153, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 3px;
  overflow: visible;
}

.lab-chat-launcher:hover {
  transform: scale(1.12) translateY(-3px);
  background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
  box-shadow: 0 14px 36px rgba(16, 185, 129, 0.55), 0 0 0 6px rgba(52, 211, 153, 0.25);
  border-color: #059669;
}

.lab-launcher-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(19, 57, 16, 0.2));
  transition: transform 0.25s ease;
}

.lab-chat-launcher:hover .lab-launcher-img {
  transform: scale(1.08) rotate(4deg);
}

.lab-chat-launcher svg {
  width: 28px;
  height: 28px;
  color: #1e6b4e;
}

.lab-chat-launcher .badge-pulse {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background-color: #34d399;
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Tooltip sobre el botón flotante */
.lab-chat-tooltip {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  background: #ffffff;
  color: #133910;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid #d1fae5;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: floatTooltip 4s ease-in-out infinite;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lab-chat-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  transform: rotate(45deg);
  border-right: 1px solid #d1fae5;
  border-bottom: 1px solid #d1fae5;
}

@keyframes floatTooltip {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Contenedor del Diálogo de Chat */
.lab-chat-container {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 570px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(19, 57, 16, 0.18), 0 0 0 1px rgba(16, 185, 129, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lab-chat-container.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Cabecera del Chat */
.lab-chat-header {
  background: linear-gradient(135deg, #1e6b4e 0%, #133910 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lab-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lab-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border: 2px solid #34d399;
}

.lab-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lab-chat-title-group h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  line-height: 1.2;
}

.lab-chat-title-group .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #a7f3d0;
  margin-top: 3px;
}

.lab-chat-title-group .status-dot {
  width: 7px;
  height: 7px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.lab-chat-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
}

.lab-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Área de Mensajes */
.lab-chat-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8faf9;
  scroll-behavior: smooth;
}

.lab-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.lab-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(30, 107, 78, 0.2);
  border-radius: 10px;
}

/* Burbujas de Mensaje */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  font-size: 13.5px;
  line-height: 1.5;
  animation: fadeInMsg 0.25s ease forwards;
}

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

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
}

.chat-msg.bot .chat-bubble {
  background: #ffffff;
  color: #1f2937;
  border-bottom-left-radius: 4px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-msg.bot .chat-bubble strong {
  color: #133910;
}

.chat-msg.bot .chat-bubble a {
  color: #1e6b4e;
  font-weight: 700;
  text-decoration: underline;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #1e6b4e 0%, #10b981 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(30, 107, 78, 0.25);
}

.chat-time {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
  padding: 0 4px;
}
.chat-msg.user .chat-time {
  align-self: flex-end;
}

/* Indicador de "Escribiendo..." */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid #e5e7eb;
  width: fit-content;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Atajos y Sugerencias Rápidas */
.lab-chat-suggestions {
  padding: 10px 14px 4px;
  background: #f8faf9;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid #eef4f0;
}
.lab-chat-suggestions::-webkit-scrollbar {
  display: none;
}

.lab-chat-chip {
  background: #ffffff;
  border: 1px solid #d1fae5;
  color: #1e6b4e;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.lab-chat-chip:hover {
  background: #1e6b4e;
  color: #ffffff;
  border-color: #1e6b4e;
  transform: translateY(-1px);
}

/* Barra de Entrada de Texto */
.lab-chat-input-area {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lab-chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  color: #1f2937;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #ffffff;
}

.lab-chat-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.lab-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e6b4e 0%, #10b981 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.lab-chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(30, 107, 78, 0.35);
}

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

/* Responsividad para Móviles (<= 480px) */
@media (max-width: 480px) {
  .lab-chat-launcher {
    bottom: 16px;
    right: 16px;
    width: 62px;
    height: 62px;
    padding: 2px;
  }

  .lab-chat-tooltip {
    display: flex !important;
    bottom: 78px;
    right: 16px;
    font-size: 11.5px;
    padding: 7px 12px;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  }

  .lab-chat-tooltip::after {
    right: 20px;
  }

  .lab-chat-container {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .lab-chat-header {
    padding: 14px 16px;
    border-radius: 0;
  }
}
