#ai-bubble {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  z-index: 999999;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease;
}

#ai-bubble::after {
  content: attr(data-label);
  position: absolute;
  right: 76px;
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  color: #0f172a;
  font: 500 13px/1.1 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  opacity: 1;
}

#ai-bubble.is-open::after {
  opacity: 0;
}

#ai-bubble:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.34);
}

.ai-bubble-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), transparent 45%);
}

.ai-bubble-icon {
  position: relative;
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

#ai-chat {
  position: fixed;
  right: 24px;
  bottom: 100px;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 620px;
  max-height: calc(100vh - 130px);
  z-index: 999999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

#ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: linear-gradient(to bottom, rgba(255,255,255,.78), rgba(255,255,255,.56));
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #111827 0%, #334155 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  font-size: 17px;
}

.ai-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.ai-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
}

#ai-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 22px;
  cursor: pointer;
}

#ai-messages {
  flex: 1;
  padding: 16px 14px 10px;
  overflow: auto;
  background:
    radial-gradient(circle at top, rgba(255,255,255,.7), rgba(248,250,252,.75)),
    linear-gradient(to bottom, rgba(248,250,252,.88), rgba(241,245,249,.92));
}

.ai-row {
  display: flex;
  margin-bottom: 10px;
}

.ai-row.bot {
  justify-content: flex-start;
}

.ai-row.user {
  justify-content: flex-end;
}

.msg {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 22px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.msg.bot {
  background: rgba(255,255,255,.92);
  color: #0f172a;
  border-bottom-left-radius: 8px;
}

.msg.user {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  color: #fff;
  border-bottom-right-radius: 8px;
}

.msg.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 58px;
}

.msg.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aiTyping 1.2s infinite ease-in-out;
}

.msg.typing span:nth-child(2) {
  animation-delay: .15s;
}

.msg.typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes aiTyping {
  0%, 80%, 100% { transform: scale(.72); opacity: .55; }
  40% { transform: scale(1); opacity: 1; }
}

#ai-suggestions {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  overflow-x: auto;
  background: rgba(255,255,255,.6);
  border-top: 1px solid rgba(15, 23, 42, 0.05);
}

.ai-suggestion {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.92);
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

.ai-suggestion:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

#ai-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255,255,255,.86);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

#ai-input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  outline: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(248,250,252,.95);
  color: #0f172a;
  font-size: 14px;
}

#ai-send {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, #111827 0%, #334155 100%);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.ai-cta-wrap {
  padding-top: 2px;
}

.ai-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.ai-cta.primary {
  background: linear-gradient(135deg, #111827 0%, #334155 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
}

@media (max-width: 640px) {
  #ai-chat {
    right: 12px;
    left: 12px;
    bottom: 86px;
    width: auto;
    height: 72vh;
    max-height: none;
    border-radius: 24px;
  }

  #ai-bubble {
    right: 16px;
    bottom: 16px;
  }

  #ai-bubble::after {
    display: none;
  }
}