/* ==========================================================================
   Antbeatz AI Producer Assistant Widget
   Floating launcher pill + desktop drawer + mobile bottom sheet
   ========================================================================== */

.ab-ai-launcher {
  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--gold-2, #ffd24a);
  background: linear-gradient(135deg, var(--gold, #f5b400), var(--gold-2, #ffd24a));
  color: var(--ink-dark, #08080a);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55), 0 0 24px rgba(245, 180, 0, 0.28);
  transition: transform var(--dur-fast, 0.15s), filter var(--dur-fast, 0.15s), opacity var(--dur-fast, 0.15s);
}

.ab-ai-launcher:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.ab-ai-launcher[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.ab-ai-launcher .ab-ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-dark, #08080a);
  box-shadow: 0 0 0 3px rgba(8, 8, 10, 0.16);
}

.ab-ai-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: min(540px, calc(100dvh - 120px));
  z-index: 96;
  display: flex;
  flex-direction: column;
  background: var(--surface, #111114);
  border: 1px solid var(--gold-border, rgba(245, 180, 0, 0.45));
  border-radius: var(--radius-xl, 10px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--dur-base, 0.25s) var(--ease-out, ease), transform var(--dur-base, 0.25s) var(--ease-out, ease);
}

.ab-ai-panel.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.ab-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2, #17171c);
  border-bottom: 1px solid var(--line, rgba(244, 241, 232, 0.14));
}

.ab-ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ab-ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green, #00e676);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.7);
  flex-shrink: 0;
}

.ab-ai-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink, #f4f1e8);
}

.ab-ai-subtitle {
  font-size: 11px;
  color: var(--muted, #9a97a8);
}

.ab-ai-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line, rgba(244, 241, 232, 0.14));
  background: transparent;
  color: var(--muted, #9a97a8);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast, 0.15s), border-color var(--dur-fast, 0.15s), background var(--dur-fast, 0.15s);
}

.ab-ai-close:hover {
  color: var(--ink, #f4f1e8);
  border-color: var(--gold-border, rgba(245, 180, 0, 0.45));
  background: var(--gold-tint, rgba(245, 180, 0, 0.08));
}

.ab-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

.ab-ai-msg {
  max-width: 90%;
  padding: 11px 13px;
  border-radius: var(--radius-lg, 6px);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.ab-ai-msg.bot {
  align-self: flex-start;
  background: var(--surface-2, #17171c);
  border: 1px solid var(--line, rgba(244, 241, 232, 0.14));
  color: var(--ink, #f4f1e8);
}

.ab-ai-msg.user {
  align-self: flex-end;
  background: var(--gold, #f5b400);
  color: var(--ink-dark, #08080a);
  font-weight: 700;
}

.ab-ai-msg-text p {
  margin: 0 0 6px;
}

.ab-ai-msg-text p:last-child {
  margin-bottom: 0;
}

.ab-ai-inline-link {
  color: var(--gold-2, #ffd24a);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ab-ai-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.ab-ai-beat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md, 4px);
  background: rgba(245, 180, 0, 0.08);
  border: 1px solid var(--gold-border, rgba(245, 180, 0, 0.45));
  color: var(--gold-2, #ffd24a);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--dur-fast, 0.15s), transform var(--dur-fast, 0.15s);
}

.ab-ai-beat-link:hover {
  background: rgba(245, 180, 0, 0.18);
  transform: translateX(2px);
}

.ab-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
}

.ab-ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold, #f5b400);
  opacity: 0.35;
  animation: ab-ai-bounce 1s infinite ease-in-out;
}

.ab-ai-typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.ab-ai-typing span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes ab-ai-bounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.ab-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--line, rgba(244, 241, 232, 0.14));
  background: rgba(8, 8, 10, 0.45);
}

.ab-ai-chip {
  padding: 6px 10px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--line-strong, rgba(244, 241, 232, 0.28));
  background: var(--surface-2, #17171c);
  color: var(--ink, #f4f1e8);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--dur-fast, 0.15s), color var(--dur-fast, 0.15s), background var(--dur-fast, 0.15s);
}

.ab-ai-chip:hover {
  border-color: var(--gold, #f5b400);
  color: var(--gold-2, #ffd24a);
  background: var(--gold-tint, rgba(245, 180, 0, 0.08));
}

.ab-ai-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2, #17171c);
  border-top: 1px solid var(--line, rgba(244, 241, 232, 0.14));
}

.ab-ai-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-md, 4px);
  border: 1px solid var(--line, rgba(244, 241, 232, 0.14));
  background: var(--bg, #08080a);
  color: var(--ink, #f4f1e8);
  font-size: 16px;
  line-height: 1.25;
  outline: none;
}

.ab-ai-input::placeholder {
  color: var(--muted, #9a97a8);
}

.ab-ai-input:focus {
  border-color: var(--gold, #f5b400);
}

.ab-ai-send {
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-md, 4px);
  background: var(--gold, #f5b400);
  color: var(--ink-dark, #08080a);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
}

.ab-ai-send:hover {
  filter: brightness(1.08);
}

.ab-ai-send:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 820px), (max-height: 560px) {
  .ab-ai-launcher {
    right: 14px;
    bottom: calc(136px + env(safe-area-inset-bottom, 0px));
    padding: 10px 14px;
    font-size: 10px;
  }

  .ab-ai-panel {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    height: min(78dvh, 620px);
    max-height: calc(100dvh - 84px);
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

/* Keep Ask AI visible and clear of cart subtotal/checkout & modal footer */
body:has(.cart-drawer.open) .ab-ai-launcher {
  bottom: calc(168px + env(safe-area-inset-bottom, 0px));
}

body.modal-open .ab-ai-launcher {
  bottom: calc(156px + env(safe-area-inset-bottom, 0px));
}

@media (prefers-reduced-motion: reduce) {
  .ab-ai-launcher,
  .ab-ai-panel,
  .ab-ai-beat-link {
    transition: none;
  }

  .ab-ai-typing span {
    animation: none;
    opacity: 0.8;
  }
}
