
/* ============================================================
   AI BUTTON & WIDGET
   ============================================================ */

/* Header AI Button */
.btn-ai {
  background: rgba(123, 97, 255, 0.15);
  border: 1px solid rgba(123, 97, 255, 0.3);
  color: #a0a0ff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.btn-ai:hover {
  background: rgba(123, 97, 255, 0.25);
  border-color: rgba(123, 97, 255, 0.5);
  color: #fff;
  box-shadow: 0 0 12px rgba(123, 97, 255, 0.4);
}

.ai-icon {
  font-size: 14px;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

/* Floating Widget */
.ai-floating-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background: linear-gradient(135deg, #4f78ff, #7b61ff);
  box-shadow: 0 8px 24px rgba(79, 120, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  text-decoration: none;
}

.ai-floating-widget:hover {
  width: 160px; /* Expand on hover */
  box-shadow: 0 12px 32px rgba(123, 97, 255, 0.6);
  transform: translateY(-4px);
}

.ai-widget-icon {
  width: 24px;
  height: 24px;
  color: #fff;
  flex-shrink: 0;
  z-index: 2;
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.ai-floating-widget:hover .ai-widget-icon {
  opacity: 0; /* Fade out icon on hover */
  transform: translate(-50%, -50%) scale(0.5); /* Shrink slightly */
}

.ai-widget-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  transition: opacity 0.3s ease 0.1s;
  pointer-events: none; /* 防止遮挡鼠标事件，虽然在 hover 时应该没问题，但保险起见 */
}

.ai-floating-widget:hover .ai-widget-label {
  opacity: 1;
}

.ai-text {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.ai-status {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #4ade80;
}

/* Pulse Animation */
.ai-widget-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.ai-floating-widget:not(:hover) .ai-widget-pulse {
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    width: 60px;
    height: 60px;
    opacity: 0.8;
    border-color: rgba(255, 255, 255, 0.6);
  }
  100% {
    width: 100px;
    height: 100px;
    opacity: 0;
    border-color: rgba(255, 255, 255, 0);
  }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .btn-ai {
    display: none; /* Hide header button on mobile to save space */
  }
  .ai-floating-widget {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }
  .ai-floating-widget:hover {
    width: 50px; /* Don't expand on touch */
  }
  .ai-widget-label {
    display: none;
  }
}
