/* web-plugin.css */

@import url("https://fonts.googleapis.com/css2?family=Urbanist:wght@400;500;600;700&display=swap");

.joaia-plugin-button {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2147483647;

  background: #f8f8f8;
  border: 0px solid transparent;
  outline: none;
  border-radius: 14px 0 0 14px;
  box-shadow:
    inset 0px 8px 15px -3px rgba(18, 66, 99, 0.2),
    inset 0px 4px 6px -4px rgba(18, 66, 99, 0.2);

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13.33px;

  padding: 8px 12px;

  font-family: "Urbanist", sans-serif;
  cursor: pointer;

  transition: background 0.2s ease;
}

.joaia-plugin-button:hover {
  background: #eeeeee;
}

.joaia-plugin-button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 4px;
}

.joaia-plugin-button-text-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 2px;
}

.joaia-plugin-button-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: "Urbanist", sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
  color: #18242c;
  text-align: center;
}

.joaia-plugin-button-icon-wrapper {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.joaia-plugin-button-icon {
  width: 17px;
  height: 19px;
}

.joaia-plugin-button-hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .joaia-plugin-button {
    border-radius: 12px 0 0 12px;
    gap: 10px;
    padding: 6px 9px;
  }

  .joaia-plugin-button-content {
    gap: 8px;
    padding: 6px 3px 3px;
  }

  .joaia-plugin-button-text {
    font-size: 14px;
  }

  .joaia-plugin-button-icon-wrapper {
    width: 26px;
    height: 26px;
  }

  .joaia-plugin-button-icon {
    width: 14px;
    height: 16px;
  }
}

.joaia-plugin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  z-index: 2147483646;
  transition: transform 0.3s ease-in-out;
  overflow: hidden;
  background: white;
  border-radius: 20px 0 0 20px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.joaia-plugin-drawer iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 20px 0 0 20px;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: contain;
}

.lucide-sparkles-icon {
  transition: transform 350ms cubic-bezier(0.25, 0.1, 0.25, 1);
  transform-origin: center;
}

.lucide-sparkles-icon:hover {
  transform: scale(1.08) rotate(4deg);
}

/* --- main spark gentle pulse --- */
.spark-main {
  transition: opacity 300ms ease;
}

.lucide-sparkles-icon:hover .spark-main {
  animation: sparkPulse 1.4s ease-in-out infinite;
}

@keyframes sparkPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}

/* --- mini sparks micro-orbit --- */
.spark-mini {
  transform-origin: center;
  opacity: 0.9;
}

.lucide-sparkles-icon .spark-mini-1 {
  animation: orbit1 2s ease-in-out infinite;
}

.lucide-sparkles-icon .spark-mini-2 {
  animation: orbit2 2.2s ease-in-out infinite;
}

/* slightly different timings for natural feel */
@keyframes orbit1 {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-1px, -2px) scale(1.08);
    opacity: 0.8;
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
}

@keyframes orbit2 {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-0.5px, 0.5px) scale(1.04);
    opacity: 0.85;
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
}

/* --- icon light reflection sweep on hover --- */
.joaia-plugin-button-icon-wrapper::before {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -60%;
  width: 45%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 35%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(255, 255, 255, 0.1) 65%,
    rgba(255, 255, 255, 0) 100%
  );
  opacity: 0;
  transform: translateX(0) skewX(-20deg);
  pointer-events: none;
  animation: joaiaIconShine 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes joaiaIconShine {
  0% {
    opacity: 0;
    transform: translateX(-140%) skewX(-20deg);
  }
  15% {
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(160%) skewX(-20deg);
  }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .joaia-plugin-button {
    transition: none;
  }

  .lucide-sparkles-icon {
    transition: none;
  }

  .spark-main {
    transition: none;
  }

  .lucide-sparkles-icon:hover .spark-main {
    animation: none;
  }

  .lucide-sparkles-icon .spark-mini-1,
  .lucide-sparkles-icon .spark-mini-2 {
    animation: none;
  }

  .joaia-plugin-button-icon-wrapper::before {
    animation: none;
  }

  .joaia-plugin-drawer {
    transition: none;
  }

  .joaia-plugin-drawer iframe {
    transition: none;
  }
}
