/**
 * Floating AI Button Styles — glossy red/blue launcher matching WEB-CRM-Frontend.
 */

.floating-ai-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  height: 56px;
  padding-right: 0;
  box-sizing: border-box;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  background: var(--ai-brand-body-light);
  box-shadow: 0 16px 30px rgba(16, 24, 40, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.67),
    inset 0 0 0 1px rgba(16, 24, 40, 0.06);
  transition: padding-right 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
  animation: fadeInScale 0.32s ease-out;
  user-select: none;
  -webkit-user-select: none;
}

.floating-ai-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(115% 90% at 24% 120%, var(--ai-brand-glow-red), transparent 54%),
    radial-gradient(115% 90% at 78% 120%, var(--ai-brand-glow-blue), transparent 54%);
}

.floating-ai-sheen {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 3px;
  height: 46%;
  pointer-events: none;
  border-radius: 999px 999px 60% 60%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), transparent);
}

.floating-ai-mark {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-ai-mark img {
  width: 40px;
  height: 40px;
  display: block;
  pointer-events: none;
}

.floating-ai-mark--reveal {
  transform: scale(0.85) rotate(-45deg);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.floating-ai-button.expanded .floating-ai-mark--reveal {
  transform: scale(1) rotate(0deg);
}

.floating-ai-labelwrap {
  position: relative;
  z-index: 1;
  overflow: hidden;
  max-width: 0;
  transition: max-width 0.42s cubic-bezier(0.22, 0.61, 0.24, 1);
}

.floating-ai-text {
  display: block;
  font: 600 14px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
  letter-spacing: -0.2px;
  white-space: nowrap;
  background-image: var(--ai-brand-ramp);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.floating-ai-button.expanded {
  padding-right: 20px;
}

.floating-ai-button.expanded .floating-ai-labelwrap {
  max-width: 160px;
}

.floating-ai-button.expanded .floating-ai-text {
  animation: glFlow 3s linear infinite;
}

.floating-ai-button:focus {
  outline: none;
  box-shadow: 0 16px 30px rgba(16, 24, 40, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.67),
    inset 0 0 0 1px rgba(16, 24, 40, 0.06), 0 0 0 3px var(--ai-accent-tint-strong);
}

@keyframes glFlow {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -200% 0;
  }
}

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

@media (max-width: 768px) {
  .floating-ai-button {
    bottom: 16px;
    right: 16px;
    max-width: calc(100% - 32px);
  }
}

body.ai-drawer-open .floating-ai-button,
body:has(#ai-assistant-drawer) .floating-ai-button {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.9);
}

@media (prefers-reduced-motion: reduce) {
  .floating-ai-button,
  .floating-ai-labelwrap,
  .floating-ai-mark--reveal {
    transition: none;
    animation: none;
  }
  .floating-ai-button.expanded .floating-ai-text {
    animation: none;
  }
}
