.gp-assistant-toggle {
  --gp-orchid-deep: #2a1b6e;
  --gp-orchid-mid: #4c2fb8;
  --gp-orchid-bright: #6f5cff;
  --gp-orchid-soft: #b7a9ff;
  --gp-orchid-lip: #8e6cff;
  --gp-orchid-center: #ffe08a;
  position: fixed;
  right: 1.35rem;
  /* Por encima de la flecha "subir" del tema */
  bottom: 6.75rem;
  z-index: 9998;
  width: 4.15rem;
  height: 4.15rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.65);
  background:
    radial-gradient(circle at 35% 28%, #7a6aff 0%, var(--gp-orchid-mid) 48%, var(--gp-orchid-deep) 100%);
  color: #fff;
  box-shadow:
    0 10px 28px rgba(42, 27, 110, 0.48),
    0 0 0 0 rgba(111, 92, 255, 0.45);
  cursor: pointer;
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  animation: gp-ai-attention 8s ease-in-out infinite;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gp-assistant-toggle:hover,
.gp-assistant-toggle:focus-visible {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 14px 34px rgba(42, 27, 110, 0.55);
  outline: none;
  animation-play-state: paused;
}

.gp-assistant-root.is-open .gp-assistant-toggle {
  animation: none;
  box-shadow: 0 8px 22px rgba(42, 27, 110, 0.35);
}

.gp-assistant-toggle__bloom {
  position: absolute;
  inset: -0.35rem;
  pointer-events: none;
}

/* Pétalos / sépalos de orquídea azul */
.gp-assistant-toggle__petal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.85rem;
  height: 1.45rem;
  margin-left: -0.42rem;
  margin-top: -1.55rem;
  border-radius: 70% 70% 40% 40%;
  background:
    linear-gradient(
      180deg,
      #efe9ff 0%,
      var(--gp-orchid-soft) 28%,
      var(--gp-orchid-bright) 62%,
      var(--gp-orchid-mid) 100%
    );
  box-shadow: inset 0 -4px 6px rgba(42, 27, 110, 0.2);
  transform-origin: 50% 125%;
  opacity: 0;
  animation: gp-ai-orchid-bloom 8s ease-in-out infinite;
}

/* Labellum (labio inferior, más ancho y ondulado) */
.gp-assistant-toggle__petal--lip {
  width: 1.35rem;
  height: 1.05rem;
  margin-left: -0.68rem;
  margin-top: -0.15rem;
  border-radius: 40% 40% 55% 55% / 35% 35% 70% 70%;
  background:
    radial-gradient(circle at 50% 30%, #fff6c8 0%, #ffd56a 22%, transparent 45%),
    linear-gradient(180deg, #c4b5ff 0%, var(--gp-orchid-lip) 45%, #5a3fd4 100%);
  transform-origin: 50% 10%;
}

.gp-assistant-toggle__petal:nth-child(1) { --gp-rot: -8deg; animation-delay: 0s; }      /* sépalo superior */
.gp-assistant-toggle__petal:nth-child(2) { --gp-rot: -52deg; animation-delay: 0.04s; }  /* pétalo izq */
.gp-assistant-toggle__petal:nth-child(3) { --gp-rot: 52deg; animation-delay: 0.04s; }   /* pétalo der */
.gp-assistant-toggle__petal:nth-child(4) { --gp-rot: -118deg; animation-delay: 0.08s; } /* sépalo izq */
.gp-assistant-toggle__petal:nth-child(5) { --gp-rot: 118deg; animation-delay: 0.08s; }  /* sépalo der */
.gp-assistant-toggle__petal--lip {
  --gp-rot: 180deg;
  animation-delay: 0.12s;
}

.gp-assistant-toggle__center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  margin: -0.28rem 0 0 -0.28rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff9df 0%, var(--gp-orchid-center) 55%, #e6a800 100%);
  box-shadow: 0 0 8px rgba(255, 224, 138, 0.75);
  opacity: 0;
  z-index: 1;
  animation: gp-ai-orchid-center 8s ease-in-out infinite;
}

.gp-assistant-root.is-open .gp-assistant-toggle__petal,
.gp-assistant-root.is-open .gp-assistant-toggle__center {
  animation: none;
  opacity: 0;
}

.gp-assistant-toggle__icon {
  position: relative;
  z-index: 2;
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  animation: gp-ai-leaf 8s ease-in-out infinite;
}

.gp-assistant-toggle__bud {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.85rem;
  height: 0.95rem;
  border-radius: 55% 55% 45% 45%;
  background:
    radial-gradient(circle at 50% 78%, #ffe08a 0 18%, transparent 19%),
    linear-gradient(180deg, #dcd6ff 0%, #8f7aff 45%, #4c2fb8 100%);
  box-shadow:
    -0.38rem 0.1rem 0 -0.08rem #9b8cff,
    0.38rem 0.1rem 0 -0.08rem #9b8cff,
    0 -0.4rem 0 -0.12rem #b7a9ff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28));
}

.gp-assistant-root.is-open .gp-assistant-toggle__icon {
  animation: none;
}

.gp-assistant-toggle__hint {
  position: absolute;
  right: calc(100% + 0.7rem);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  max-width: min(220px, 55vw);
  padding: 0.48rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #2a1b6e 0%, #4c2fb8 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  line-height: 1.2;
  box-shadow: 0 8px 22px rgba(42, 27, 110, 0.35);
  opacity: 0;
  pointer-events: none;
  animation: gp-ai-hint 8s ease-in-out infinite;
}

.gp-assistant-toggle__hint::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  background: #4c2fb8;
  transform: rotate(45deg);
  border-radius: 2px;
}

.gp-assistant-toggle:hover .gp-assistant-toggle__hint,
.gp-assistant-root.is-open .gp-assistant-toggle__hint {
  opacity: 1;
  animation: none;
}

.gp-assistant-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 12rem;
  z-index: 9999;
  width: min(380px, calc(100vw - 2rem));
  max-height: 70vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gp-assistant-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #1b4332 0%, #2a1b6e 100%);
  color: #fff;
}

.gp-assistant-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.gp-assistant-panel__disclaimer {
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  background: #f4f7f4;
  color: #444;
}

.gp-assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  min-height: 200px;
  max-height: 45vh;
}

.gp-assistant-msg {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 92%;
}

.gp-assistant-msg--user {
  margin-left: auto;
  background: #eee8ff;
}

.gp-assistant-msg--bot {
  background: #f5f5f5;
}

.gp-assistant-msg--bot p {
  margin: 0 0 0.65rem;
}

.gp-assistant-msg--bot p:last-child {
  margin-bottom: 0;
}

.gp-assistant-sources {
  margin: 0.35rem 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #eef6ef;
  border: 1px solid #d7e8da;
  max-width: 92%;
}

.gp-assistant-sources__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #2d5a3d;
  margin-bottom: 0.45rem;
}

.gp-assistant-sources__list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gp-assistant-sources__link {
  display: inline-block;
  font-size: 0.82rem;
  color: #2d5a3d;
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #c5dcc9;
}

.gp-assistant-sources__link:hover {
  background: #2d5a3d;
  color: #fff;
  border-color: #2d5a3d;
}

.gp-assistant-msg--meta {
  font-size: 0.75rem;
  color: #666;
  background: transparent;
  padding: 0.25rem 0;
}

.gp-assistant-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #eee;
}

.gp-assistant-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.gp-assistant-send {
  white-space: nowrap;
}

@keyframes gp-ai-attention {
  0%, 66%, 100% {
    box-shadow:
      0 10px 28px rgba(42, 27, 110, 0.48),
      0 0 0 0 rgba(111, 92, 255, 0.45);
    transform: scale(1);
  }
  72% {
    box-shadow:
      0 12px 30px rgba(42, 27, 110, 0.5),
      0 0 0 14px rgba(111, 92, 255, 0);
    transform: scale(1.09);
  }
  78% {
    transform: scale(1.02);
  }
}

@keyframes gp-ai-orchid-bloom {
  0%, 60%, 100% {
    opacity: 0;
    transform: rotate(var(--gp-rot, 0deg)) scale(0.12) translateY(4px);
  }
  67% {
    opacity: 1;
    transform: rotate(var(--gp-rot, 0deg)) scale(1.05) translateY(0);
  }
  74% {
    opacity: 0.85;
    transform: rotate(var(--gp-rot, 0deg)) scale(1.28) translateY(-3px);
  }
  84% {
    opacity: 0;
    transform: rotate(var(--gp-rot, 0deg)) scale(1.45) translateY(-8px);
  }
}

@keyframes gp-ai-orchid-center {
  0%, 62%, 100% { opacity: 0; transform: scale(0.4); }
  68%, 76% { opacity: 1; transform: scale(1.15); }
  84% { opacity: 0; transform: scale(1.4); }
}

@keyframes gp-ai-leaf {
  0%, 62%, 100% { transform: scale(1) rotate(0deg); }
  69% { transform: scale(1.16) rotate(-6deg); }
  75% { transform: scale(1.08) rotate(5deg); }
  82% { transform: scale(1) rotate(0deg); }
}

@keyframes gp-ai-hint {
  0%, 62%, 88%, 100% { opacity: 0; transform: translateY(-50%) translateX(8px); }
  68%, 82% { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@media (max-width: 767px) {
  .gp-assistant-toggle {
    right: 1rem;
    bottom: 6.25rem;
    width: 3.85rem;
    height: 3.85rem;
  }

  .gp-assistant-panel {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 11.25rem;
  }

  .gp-assistant-toggle__hint {
    max-width: 46vw;
    font-size: 0.7rem;
    padding: 0.4rem 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gp-assistant-toggle,
  .gp-assistant-toggle__petal,
  .gp-assistant-toggle__center,
  .gp-assistant-toggle__icon,
  .gp-assistant-toggle__hint {
    animation: none !important;
  }
}
