/* ===============================
   PALETA CHAT VETSCANIA
   (solo afecta al widget de chat)
=================================*/

:root {
  /* Si ya existen, se respetan, solo aseguramos valores por defecto */
  --azul-petroleo: #12313f;
  --cian: #22d3c5;
  --cian-claro: #e0fffa;
  --naranja: #f97316;
  --blanco: #ffffff;
  --gris-chat: #6b7280;
  --gris-fondo-chat: #f3f6fb;
}

/* ===============================
   CONTENEDOR PRINCIPAL
=================================*/

.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  height: 500px;
  background: var(--blanco);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.25);
  transform: translateY(20px) scale(.98);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.25s cubic-bezier(.22,.8,.36,1),
    opacity 0.25s cubic-bezier(.22,.8,.36,1),
    visibility 0s linear 0.25s;
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chatbot-container.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  transition:
    transform 0.25s cubic-bezier(.22,.8,.36,1),
    opacity 0.25s cubic-bezier(.22,.8,.36,1),
    visibility 0s;
}

.chatbot-container.closing {
  transform: translateY(12px) scale(.97);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.25s cubic-bezier(.22,.8,.36,1),
    opacity 0.25s cubic-bezier(.22,.8,.36,1),
    visibility 0s linear 0.25s;
}

/* Modo expandido tipo WhatsApp web */
.chatbot-container.expanded {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  bottom: auto !important;
  right: auto !important;
  width: min(920px, 95vw) !important;
  height: min(82vh, 900px) !important;
  transform: translate(-50%, -50%) !important;
  border-radius: 18px !important;
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.45) !important;
}

/* ===============================
   HEADER
=================================*/

.chatbot-header {
  background: var(--azul-petroleo);
  color: var(--blanco);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.35);
  flex-shrink: 0;
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.chatbot-title img {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.18);
  padding: 2px;
}

.chatbot-title h3 {
  margin: 0;
  font-size: 0.96rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}

/* Botones header: expandir + cerrar */

#expand-chat,
.close-chat {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: var(--blanco);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  transition: transform 0.16s ease, background 0.16s ease;
}

#expand-chat:hover,
.close-chat:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.chatbot-container.expanded #expand-chat {
  background: rgba(255, 255, 255, 0.26);
}

/* Ocultar expandir en móvil */
@media (max-width: 640px) {
  #expand-chat {
    display: none !important;
  }
}

/* ===============================
   ÁREA DE MENSAJES
=================================*/

.chatbot-messages {
  flex: 1;
  padding: 14px;
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cian) transparent;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--cian);
  border-radius: 999px;
}

/* fila de mensaje */

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 4px 4px;
  max-width: 85%;
  animation: bubble-in 180ms cubic-bezier(.22,.8,.36,1);
}

.bot-message {
  align-self: flex-start;
  flex-direction: row;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

/* avatar */

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* burbuja */

.message-content {
  background: var(--blanco);
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

/* Bot */
.bot-message .message-content {
  border: 1px solid #d0dbe7;
  color: #0f172a;
  border-bottom-left-radius: 6px;
}

/* Usuario */
.user-message .message-content {
  background: var(--cian);
  color: #022c22;
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(34, 197, 167, 0.4);
}

/* hover sutil */
.chat-message:hover .message-content {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

/* hora del mensaje */

.msg-time {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  opacity: 0.9;
}

.bot-message .msg-time {
  color: #6b7280;
  text-align: left;
}

.user-message .msg-time {
  color: rgba(240, 253, 250, 0.96);
  text-align: right;
}

/* imágenes dentro del mensaje */

.message-content .chat-img {
  max-width: 230px;
  max-height: 230px;
  border-radius: 12px;
  display: block;
  margin-top: 4px;
}

/* ===============================
   TYPING INDICATOR
=================================*/

.hidden {
  display: none !important;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 2px 12px 8px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cian);
  animation: typing-dot 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: .2s;
}
.typing-indicator span:nth-child(3) {
  animation-delay: .4s;
}

/* ===============================
   INPUT + BOTONES
=================================*/

.chatbot-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--blanco);
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.chatbot-input input {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid #d2dce7;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
  transition: border 0.18s ease, box-shadow 0.18s ease;
}

.chatbot-input input::placeholder {
  color: #9ca3af;
}

.chatbot-input input:focus {
  border-color: var(--cian);
  box-shadow: 0 0 0 2px rgba(34, 211, 195, 0.2);
}

/* botón enviar + adjuntar */

.chatbot-input button,
.chatbot-input #attach-image {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--azul-petroleo);
  color: var(--blanco);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

#attach-image {
  display: none;
}
.chatbot-container.image-mode-active #attach-image {
  display: inline-flex;
}

.chatbot-input button:hover,
.chatbot-input #attach-image:hover {
  background: #0b2531;
  transform: translateY(-1px) scale(1.03);
}

.chatbot-input button:active,
.chatbot-input #attach-image:active {
  transform: translateY(1px) scale(0.96);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.4);
}

/* botón enviar específico (por si quieres diferenciarlo) */
#send-message {
  background: var(--azul-petroleo);
}

/* chip de archivo adjunto */

.attachment-chip {
  display: none;
  align-items: center;
  gap: 8px;
  background: #edf7f6;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 195, 0.32);
  padding: 4px 8px;
  max-width: 50%;
}

.chip-thumb {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.chip-name {
  font-size: 0.78rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-remove {
  border: none;
  background: transparent;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
}

/* ===============================
   SUGERENCIAS
=================================*/

.chatbot-suggestions {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 8px 10px 10px;
  flex-shrink: 0;
}

.suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.chatbot-suggestions p {
  margin: 0;
  font-size: 0.78rem;
  color: #111827;
  font-weight: 500;
}

.close-suggestions-btn {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: #9ca3af;
}

.close-suggestions-btn:hover {
  color: var(--azul-petroleo);
}

.suggestion-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-btn {
  border-radius: 999px;
  border: 1px solid #d1d9e2;
  background: var(--blanco);
  padding: 6px 10px;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.suggestion-btn:hover {
  background: var(--cian);
  color: #022c22;
  transform: translateX(3px);
}

/* ===============================
   IMAGE REQUEST (CARD)
=================================*/

.image-request {
  background: #ffffff;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  padding: 10px 10px 12px;
  margin-top: 8px;
}

.image-request.hidden {
  display: none;
}

.ir-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ir-header h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--azul-petroleo);
}

.ir-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
}

.ir-reason {
  margin: 4px 0;
  font-size: 0.82rem;
  color: #4b5563;
}

.ir-instructions {
  margin: 4px 0 8px 16px;
  padding-left: 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.ir-dropzone {
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
}

.ir-dropzone.dragover {
  background: #f4fbfa;
  border-color: var(--cian);
}

.ir-link {
  border: none;
  background: transparent;
  text-decoration: underline;
  color: var(--azul-petroleo);
  cursor: pointer;
}

.ir-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ir-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: #edf7f6;
  padding: 4px 10px;
}

.ir-chip img {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
}

.ir-chip .del {
  border: none;
  background: var(--azul-petroleo);
  color: var(--blanco);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
}

.ir-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.ir-btn {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  cursor: pointer;
}

.ir-btn.primary {
  background: var(--cian);
  color: #022c22;
}

.ir-btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ir-btn.ghost {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #4b5563;
}

/* ===============================
   BOT INFO BOXES (NARANJA IMPORTANTE)
=================================*/

.bot-note,
.bot-tip,
.bot-emergency {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-top: 6px;
}

.bot-note {
  background: #fff7ed;
  border-left: 4px solid var(--naranja);
}

.bot-tip {
  background: #ecfeff;
  border-left: 4px solid var(--cian);
}

.bot-emergency {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

/* ===============================
   BOTÓN FLOTANTE DEL ASISTENTE
   (Cian, como pediste)
=================================*/

.chatbot-button {
  position: fixed;
  bottom: 25px;
  right: 25px;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cian);
  color: #022c22;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(34, 197, 167, 0.55);
  z-index: 9998;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.chatbot-button:hover {
  background: var(--azul-petroleo);
  color: var(--blanco);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.55);
}

.chatbot-button i {
  font-size: 1rem;
}

/* pequeño idle para que respire */
.chatbot-button:not(.new-message):not(:hover) {
  animation: chat-idle 4s ease-in-out infinite;
}

.chatbot-button.new-message {
  animation: chat-pulse 1.5s ease-out infinite;
}

/* ===============================
   RESPONSIVE CHAT
=================================*/

@media (max-width: 576px) {
  .chatbot-container {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: calc(100dvh - 56px) !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .chatbot-messages {
    padding: 12px;
  }

  .chat-message {
    max-width: 92%;
  }

  .message-content .chat-img {
    max-width: 70vw;
    max-height: 40vh;
  }

  .chatbot-input {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .chatbot-button {
    bottom: 16px;
    right: 16px;
  }
}

/* ===============================
   ANIMACIONES
=================================*/

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing-dot {
  0%, 80%, 100% {
    opacity: .25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes chat-idle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes chat-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 167, 0.7);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(34, 197, 167, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 167, 0);
  }
}

.message-content ul {
  list-style: none;
  padding-left: 0;
}

.message-content ul li {
  position: relative;
  padding-left: 22px;
}

.message-content ul li::before {
  content: "•";
  color: var(--naranja);
  font-size: 1.4rem;
  position: absolute;
  left: 0;
  top: -2px;
}

/* ===============================
   OCULTAR BOTÓN AL LLEGAR AL FOOTER
=================================*/

.chatbot-button.hide-assistant {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(20px) scale(0.8) !important;
  transition: all 0.3s ease !important;
}

/* Asegurar que el botón tenga transición por defecto */
.chatbot-button {
  transition: all 0.3s ease !important;
}