/* ===== Chatbot flotante "Globy" ===== */

#globy-toggle {
  position: fixed;
  right: 24px;
  bottom: 16px;
  width: 58px;
  height: 90px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 9998;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  filter: drop-shadow(0 6px 14px rgba(142, 68, 236, 0.35));
  animation: globyFloat 3.6s ease-in-out infinite;
  transition: transform 0.2s ease, filter 0.2s ease;
}

#globy-toggle:hover {
  transform: scale(1.06);
  filter: drop-shadow(0 8px 18px rgba(142, 68, 236, 0.45));
}

#globy-toggle .globy-balloon-icon {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes globyFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(-2deg); }
}

#globy-toggle .globy-badge {
  position: absolute;
  top: 4px;
  right: -2px;
  background: var(--color-acento, #FFD700);
  color: #333;
  font-size: 0.65rem;
  font-weight: 800;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

#globy-window {
  position: fixed;
  right: 20px;
  bottom: 114px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: inherit;
}

#globy-window.open {
  display: flex;
  animation: globyIn 0.22s ease;
}

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

.globy-header {
  background: linear-gradient(135deg, var(--color-primario, #FF69B4) 0%, #764ba2 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.globy-header .globy-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.globy-header .globy-title {
  flex: 1;
  min-width: 0;
}

.globy-header .globy-title strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
}

.globy-header .globy-title span {
  font-size: 0.75rem;
  opacity: 0.9;
}

.globy-header .globy-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  opacity: 0.85;
}

.globy-header .globy-close:hover {
  opacity: 1;
}

.globy-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-fondo-claro, #fcf5f7);
}

.globy-msg {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-line;
  word-wrap: break-word;
}

.globy-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--color-texto, #333);
  border-bottom-left-radius: 4px;
  box-shadow: var(--sombra-caja, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.globy-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--color-primario, #FF69B4) 0%, #764ba2 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.globy-typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  box-shadow: var(--sombra-caja, 0 4px 12px rgba(0, 0, 0, 0.08));
  display: flex;
  gap: 4px;
}

.globy-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bbb;
  animation: globyBlink 1s infinite ease-in-out;
}

.globy-typing span:nth-child(2) { animation-delay: 0.15s; }
.globy-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes globyBlink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.globy-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  background: var(--color-fondo-claro, #fcf5f7);
}

.globy-quick-btn {
  border: 1.5px solid var(--color-primario, #FF69B4);
  color: var(--color-primario, #FF69B4);
  background: #fff;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.globy-quick-btn:hover {
  background: var(--color-primario, #FF69B4);
  color: #fff;
}

.globy-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #eee;
  background: #fff;
}

.globy-input-row input {
  flex: 1;
  border: 1.5px solid #eee;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}

.globy-input-row input:focus {
  border-color: var(--color-primario, #FF69B4);
}

.globy-input-row button {
  background: linear-gradient(135deg, var(--color-primario, #FF69B4) 0%, #764ba2 100%);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.globy-input-row button:hover {
  filter: brightness(1.05);
}

@media (max-width: 480px) {
  #globy-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 104px;
  }

  #globy-toggle {
    right: 14px;
    bottom: 10px;
  }
}
