/* ==========================================================================
   AI Setlist Builder – Minimal catalog-only version
   ========================================================================== */

/* ---------- Root variables ---------- */
html {
  --ai-panel-w: 440px;
}

.ai-sb {
  --ai-bg: #0f1218;
  --ai-bg-surface: #141922;
  --ai-card: rgba(255, 255, 255, 0.04);
  --ai-card-hover: rgba(255, 255, 255, 0.07);
  --ai-border: rgba(255, 255, 255, 0.08);
  --ai-text: #f7f8fa;
  --ai-text-90: rgba(247, 248, 250, 0.92);
  --ai-text-80: rgba(247, 248, 250, 0.82);
  --ai-text-70: rgba(247, 248, 250, 0.72);
  --ai-text-60: rgba(247, 248, 250, 0.62);
  --ai-text-50: rgba(247, 248, 250, 0.52);
  --ai-text-40: rgba(247, 248, 250, 0.58);
  --ai-text-20: rgba(247, 248, 250, 0.34);
  --ai-green: #4cc38a;
  --ai-font: 'Inter', system-ui, -apple-system, sans-serif;
  --ai-font-hd: 'Inter', system-ui, -apple-system, sans-serif;
  --ai-shadow: 0 18px 48px rgba(1, 5, 14, 0.42);
  --ai-shadow-lg: 0 34px 74px rgba(1, 5, 14, 0.58);
  --ai-radius: 18px;
  --ai-radius-md: 14px;
  --ai-radius-sm: 10px;
  --ai-ease: .28s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Push layout (squeeze site when panel is open) ---------- */
html.ai-sb-open {
  overflow-x: hidden;
}

html.ai-sb-open .ai-sb-site-root {
  margin-right: var(--ai-panel-w);
  overflow-x: hidden;
  transition: margin-right .28s cubic-bezier(.4, 0, .2, 1);
}

html.ai-sb-open .navbar-fixed-top {
  right: var(--ai-panel-w);
  transition: right .28s cubic-bezier(.4, 0, .2, 1);
}

.ai-sb-site-root {
  transition: margin-right .28s cubic-bezier(.4, 0, .2, 1);
}

.navbar-fixed-top {
  transition: right .28s cubic-bezier(.4, 0, .2, 1);
}

@media (max-width: 768px) {
  html.ai-sb-open .ai-sb-site-root {
    margin-right: 0;
  }

  html.ai-sb-open .navbar-fixed-top {
    right: 0;
  }
}

/* ---------- FAB ---------- */
.ai-sb-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1cb783, #14a575);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(28, 183, 131, .3);
  transition: transform .2s, opacity .2s, box-shadow .2s;
}

.ai-sb-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(28, 183, 131, .45);
}

.ai-sb-fab--pulse {
  animation: ai-sb-pulse 2.5s infinite;
}

@keyframes ai-sb-pulse {

  0%,
  100% {
    box-shadow: 0 8px 24px rgba(28, 183, 131, .3);
  }

  50% {
    box-shadow: 0 8px 24px rgba(28, 183, 131, .3), 0 0 0 12px rgba(28, 183, 131, .1);
  }
}

.ai-sb-fab--hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.8);
}

/* ---------- Panel ---------- */
.ai-sb-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--ai-panel-w);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--ai-ease);
  background:
    radial-gradient(circle at top right, rgba(88, 138, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--ai-bg);
  color: var(--ai-text);
  font-family: var(--ai-font);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

.ai-sb-panel--open {
  transform: translateX(0);
}

/* ---------- Resize handle ---------- */
.ai-sb-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  width: 8px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  touch-action: none;
}

.ai-sb-resize::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 32px;
  border-radius: 3px;
  background: var(--ai-text-20);
  transition: background .15s, height .15s;
}

.ai-sb-resize:hover::before,
body.ai-sb-resizing .ai-sb-resize::before {
  background: var(--ai-green);
  height: 48px;
}

body.ai-sb-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.ai-sb-resizing * {
  cursor: col-resize !important;
}

/* ---------- Header ---------- */
.ai-sb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--ai-border);
  flex-shrink: 0;
  background: rgba(20, 25, 34, 0.9);
  backdrop-filter: blur(14px);
}

.ai-sb-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ai-sb-header__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #fbfcff, #dbe4f3);
  color: #111723;
  box-shadow: 0 14px 28px rgba(7, 11, 18, 0.28);
}

.ai-sb-header__title {
  font-family: var(--ai-font-hd);
  font-weight: 700;
  font-size: 15px;
  margin: 0;
  letter-spacing: -0.02em;
  color: #fff;
}

.ai-sb-header__sub {
  font-size: 9px;
  color: var(--ai-text-40);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.ai-sb-header__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-sb-header__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--ai-text-40);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color .12s;
}

.ai-sb-header__close:hover {
  color: var(--ai-text);
}

/* ---------- Body + Surfaces ---------- */
.ai-sb-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ai-sb-surfaces {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.ai-sb-surface {
  display: none;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.ai-sb-surface--active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#aiSbChatSurface {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ---------- Chat scroll ---------- */
.ai-sb-chat-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 0 24px;
}

.ai-sb-chat-scroll::-webkit-scrollbar {
  width: 4px;
}

.ai-sb-chat-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ai-sb-chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* ---------- Conversation ---------- */
.ai-sb-conversation {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  padding: 0 22px;
  min-height: 0;
}

/* ---------- Welcome ---------- */
.ai-sb-welcome {
  flex: 0 0 auto;
  padding: 18px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
}

.ai-sb-welcome__hero {
  width: 100%;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    rgba(7, 10, 16, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ai-sb-welcome__icon {
  width: 56px;
  height: 56px;
  margin: 18px 0 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: #d8e1ef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.ai-sb-welcome__heading {
  font-family: var(--ai-font-hd);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.05;
  margin: 0 0 12px;
  max-width: 320px;
  letter-spacing: -.02em;
  color: #fff;
}

.ai-sb-welcome__text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ai-text-60);
  margin: 0 0 20px;
  max-width: 420px;
}

/* ---------- Starters ---------- */
.ai-sb-starter-sections {
  display: grid;
  gap: 14px;
  width: 100%;
  margin-top: 18px;
}

.ai-sb-starter-group {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.ai-sb-starter-group__label {
  margin-bottom: 10px;
  color: var(--ai-text-40);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ai-sb-starters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.ai-sb-starter {
  width: 100%;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.4;
  font-family: var(--ai-font);
  color: var(--ai-text-80);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background .15s, border-color .15s;
}

.ai-sb-starter::after {
  content: '\f054';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 9px;
  color: var(--ai-text-40);
  transition: color .15s;
}

.ai-sb-starter:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.ai-sb-starter:hover::after {
  color: var(--ai-text-60);
}

/* ---------- Messages ---------- */
.ai-sb-chat-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-sb-msg--user {
  align-self: flex-end;
  max-width: min(78%, 540px);
  padding: 14px 16px;
  border-radius: 20px 20px 8px 20px;
  background: linear-gradient(180deg, rgba(252, 253, 255, 0.98), rgba(241, 245, 252, 0.98));
  color: #0f141d;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  box-shadow: none;
}

.ai-sb-msg--ai {
  align-self: flex-start;
  max-width: min(92%, 700px);
  padding: 16px 18px;
  border-radius: 8px 20px 20px 20px;
  background: rgba(18, 23, 32, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  line-height: 1.68;
  color: var(--ai-text-90);
  box-shadow: none;
}

.ai-sb-msg--ai p {
  margin: 0 0 10px;
}

.ai-sb-msg--ai p:last-child {
  margin: 0;
}

/* ---------- Message actions ---------- */
.ai-sb-message-actions {
  display: flex;
  gap: 6px;
  margin-top: 0;
}

.ai-sb-msg--ai+.ai-sb-message-actions {
  justify-content: flex-start;
}

.ai-sb-message-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--ai-text-40);
  font-size: 11px;
  font-weight: 700;
}

.ai-sb-chat-entry:hover .ai-sb-message-action,
.ai-sb-chat-entry:focus-within .ai-sb-message-action {
  color: var(--ai-text-70);
  background: rgba(255, 255, 255, 0.03);
}

/* ---------- Response meta ---------- */
.ai-sb-response-meta {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.ai-sb-response-meta__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-sb-response-meta__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ai-text-60);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ai-sb-response-meta__badge--state-success {
  background: rgba(54, 179, 126, .16);
  color: #8ff0b7;
}

.ai-sb-response-meta__badge--state-empty,
.ai-sb-response-meta__badge--state-invalid-response,
.ai-sb-response-meta__badge--state-timeout {
  background: rgba(255, 184, 77, .16);
  color: #ffd27f;
}

.ai-sb-response-meta__badge--state-unavailable,
.ai-sb-response-meta__badge--state-misconfigured,
.ai-sb-response-meta__badge--state-error,
.ai-sb-response-meta__badge--state-unauthorized,
.ai-sb-response-meta__badge--state-rate-limited {
  background: rgba(255, 107, 107, .16);
  color: #ffb0b0;
}

.ai-sb-response-meta__line {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ai-text-50);
}

.ai-sb-response-meta__label {
  color: var(--ai-text-90);
  font-weight: 700;
}

.ai-sb-response-meta__line--warning {
  color: #ffd27f;
}

.ai-sb-response-meta__line--unmet {
  color: #ffb0b0;
}

/* ---------- Typing indicator ---------- */
.ai-sb-typing {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  color: var(--ai-text-40);
  font-size: 12px;
}

.ai-sb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ai-text-40);
  animation: ai-sb-dot 1.4s infinite ease-in-out;
}

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

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

.ai-sb-typing__label {
  width: 100%;
  font-size: 12px;
  color: rgba(220, 227, 241, 0.78);
  margin-top: 2px;
}

@keyframes ai-sb-dot {

  0%,
  80%,
  100% {
    opacity: .4;
    transform: scale(1);
  }

  40% {
    opacity: 1;
    transform: scale(1.3);
  }
}

/* ---------- Setlist card ---------- */
.ai-sb-setlist {
  max-width: min(100%, 720px);
  margin-top: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--ai-radius);
  overflow: hidden;
  width: 100%;
}

.ai-sb-setlist__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--ai-card);
  border-bottom: 1px solid var(--ai-border);
}

.ai-sb-setlist__name {
  font-family: var(--ai-font-hd);
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  color: var(--ai-text);
}

.ai-sb-setlist__meta {
  font-size: 10px;
  color: var(--ai-text-40);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-sb-setlist__meta i {
  margin-right: 3px;
}

.ai-sb-setlist__actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

/* Setlist summary row */
.ai-sb-setlist__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ai-border);
  font-size: 12px;
  color: var(--ai-text-60);
}

.ai-sb-setlist__summary-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-sb-setlist__summary-item i {
  font-size: 10px;
  opacity: 0.6;
}

/* ---------- Song row ---------- */
.ai-sb-song {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ai-border);
  transition: background .12s;
  position: relative;
  cursor: pointer;
}

.ai-sb-song:last-child {
  border-bottom: none;
}

.ai-sb-song:hover {
  background: var(--ai-card);
}

.ai-sb-song.ai-sb-song--dragging {
  background: var(--ai-card-hover);
  box-shadow: var(--ai-shadow-lg);
  z-index: 5;
  transform: scale(1.05);
}

.ai-sb-song__grip {
  color: var(--ai-text-20);
  cursor: grab;
  padding: 4px 2px;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-sb-song__grip:hover {
  color: var(--ai-text-40);
}

.ai-sb-song__grip:active {
  cursor: grabbing;
}

.ai-sb-song__num {
  font-size: 12px;
  font-weight: 400;
  font-family: monospace;
  color: var(--ai-text-20);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 3px;
}

.ai-sb-song__body {
  flex: 1;
  min-width: 0;
}

.ai-sb-song__title {
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ai-text);
  transition: color .12s;
}

.ai-sb-song:hover .ai-sb-song__title {
  color: #fff;
}

.ai-sb-song__artist {
  font-size: 12px;
  color: var(--ai-text-40);
  margin: 2px 0 0;
}

.ai-sb-song__role {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ai-text-40);
}

/* Song row tiers */
.ai-sb-song__tier1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.ai-sb-song__tier1 .ai-sb-song__role {
  margin-top: 0;
}

.ai-sb-song__tier2 {
  display: none;
  margin-top: 8px;
}

.ai-sb-song:focus-within .ai-sb-song__tier2,
.ai-sb-song.ai-sb-song--expanded .ai-sb-song__tier2 {
  display: block;
}

@media (hover: hover) {
  .ai-sb-song:hover .ai-sb-song__tier2 {
    display: block;
  }
}

/* Badges */
.ai-sb-song__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.ai-sb-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
}

.ai-sb-badge--theme {
  background: rgba(34, 197, 94, .15);
  color: #4ade80;
}

.ai-sb-badge--bpm {
  background: rgba(251, 146, 60, .15);
  color: #fb923c;
}

.ai-sb-badge--key {
  background: rgba(96, 165, 250, .15);
  color: #60a5fa;
}

.ai-sb-badge--scripture {
  background: rgba(248, 113, 113, .15);
  color: #f87171;
}

.ai-sb-badge--familiarity {
  background: rgba(247, 201, 107, 0.14);
  color: #f9ddb0;
  border: 1px solid rgba(247, 201, 107, 0.2);
}

.ai-sb-song__insight {
  color: var(--ai-text-60);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0 0;
}

.ai-sb-song__notes {
  font-size: 11px;
  color: var(--ai-text-40);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.4;
}

/* Hover actions */
.ai-sb-song__hover-actions {
  display: none;
  position: absolute;
  right: 8px;
  top: 8px;
  gap: 4px;
  align-items: center;
}

.ai-sb-song:hover .ai-sb-song__hover-actions {
  display: flex;
}

.ai-sb-song:focus .ai-sb-song__hover-actions,
.ai-sb-song:focus-within .ai-sb-song__hover-actions {
  display: flex;
}

.ai-sb-song:focus {
  outline: 2px solid rgba(28, 183, 131, .65);
  outline-offset: 2px;
}

.ai-sb-song__act {
  background: rgba(255, 255, 255, .1);
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
  cursor: pointer;
  color: var(--ai-text-60);
  font-family: var(--ai-font);
  transition: background .12s, color .12s;
}

.ai-sb-song__act:hover {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.ai-sb-song__act--danger:hover {
  background: rgba(239, 68, 68, .2);
  color: #ef4444;
}

/* ---------- Setlist footer ---------- */
.ai-sb-setlist__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 16px;
  background: var(--ai-card);
  border-top: 1px solid var(--ai-border);
}

.ai-sb-setlist__foot-btn {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ai-text-40);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--ai-font);
  transition: color .12s;
}

.ai-sb-setlist__foot-btn:hover {
  color: #fff;
}

/* ---------- Followups + Suggestions ---------- */
.ai-sb-followups {
  max-width: min(92%, 700px);
  margin-top: 10px;
}

.ai-sb-followups__label {
  margin-bottom: 8px;
  color: var(--ai-text-40);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ai-sb-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.ai-sb-suggestion {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--ai-text-70);
  font-size: 12px;
  font-family: var(--ai-font);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.ai-sb-suggestion:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

/* ---------- Explanation ---------- */
.ai-sb-explanation {
  max-width: min(92%, 700px);
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(76, 136, 255, 0.06);
  border: 1px solid rgba(125, 176, 255, 0.1);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ai-text-80);
}

/* ---------- Buttons ---------- */
.ai-sb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--ai-radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--ai-font);
  cursor: pointer;
  border: none;
  transition: background .12s, color .12s, transform .1s;
  text-decoration: none;
}

.ai-sb-btn--primary {
  background: #fff;
  color: #000;
}

.ai-sb-btn--primary:hover {
  background: rgba(255, 255, 255, .9);
  color: #000;
  text-decoration: none;
  transform: scale(1.02);
}

.ai-sb-btn--secondary {
  background: rgba(255, 255, 255, .1);
  color: var(--ai-text);
  border: none;
}

.ai-sb-btn--secondary:hover {
  background: rgba(255, 255, 255, .2);
}

.ai-sb-btn--sm {
  padding: 5px 10px;
  font-size: 10px;
}

.ai-sb-btn--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

.ai-sb-btn--icon.ai-sb-btn--primary {
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.ai-sb-btn--icon.ai-sb-btn--primary:hover {
  transform: scale(1.1);
}

.ai-sb-btn--full {
  width: 100%;
  justify-content: center;
}

.ai-sb-btn[disabled],
.ai-sb-message-action[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Composer ---------- */
.ai-sb-composer {
  position: relative;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--ai-border);
  background: rgba(20, 25, 34, 0.92);
  flex-shrink: 0;
  overflow: visible;
  z-index: 4;
  min-height: 0;
}

.ai-sb-composer__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* WT global override for input */
.ai-sb input[type=text].ai-sb-composer__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ai-border) !important;
  border-radius: 14px !important;
  border-top: 1px solid var(--ai-border) !important;
  border-left: 1px solid var(--ai-border) !important;
  border-right: 1px solid var(--ai-border) !important;
  padding: 10px 42px 10px 14px !important;
  min-height: 0;
  height: 44px;
  font-size: 13px !important;
  line-height: 1.35 !important;
  font-family: var(--ai-font) !important;
  color: var(--ai-text) !important;
  background: rgba(8, 11, 17, 0.9) !important;
  background-color: rgba(8, 11, 17, 0.9) !important;
  outline: none;
  box-sizing: border-box;
  box-shadow: none !important;
  transition: border-color .15s, background .15s;
}

.ai-sb input[type=text].ai-sb-composer__input::placeholder {
  color: var(--ai-text-40) !important;
  opacity: 1;
}

.ai-sb input[type=text].ai-sb-composer__input:focus {
  border-color: rgba(255, 255, 255, .28) !important;
  background: #111 !important;
  background-color: #111 !important;
}

.ai-sb-composer__send {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: var(--ai-text-80);
  border: 1px solid var(--ai-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background .12s, color .12s, opacity .12s, border-color .12s;
}

.ai-sb-composer__send:hover:not(:disabled) {
  background: rgba(255, 255, 255, .2);
  color: #fff;
  border-color: rgba(255, 255, 255, .2);
}

.ai-sb-composer__send:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.ai-sb-composer__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ai-text-20);
}

.ai-sb-composer__status {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ai-sb-composer__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ai-green);
}

/* ---------- Song Detail Drawer ---------- */
.ai-sb-detail {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: var(--ai-bg);
  z-index: 10;
  transform: translateX(100%);
  transition: transform var(--ai-ease);
  display: flex;
  flex-direction: column;
}

.ai-sb-detail.ai-sb-detail--open {
  transform: translateX(0);
}

.ai-sb-detail__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--ai-border);
  background: var(--ai-bg-surface);
  flex-shrink: 0;
}

.ai-sb-detail__back {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--ai-text-60);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
}

.ai-sb-detail__back:hover {
  background: var(--ai-card);
  color: var(--ai-text);
}

.ai-sb-detail__title {
  font-family: var(--ai-font-hd);
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  flex: 1;
}

.ai-sb-detail__body {
  flex: 1;
  overflow-y: auto;
}

.ai-sb-detail__tabs {
  display: flex;
  border-bottom: 1px solid var(--ai-border);
  background: var(--ai-bg-surface);
}

.ai-sb-detail__tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--ai-font);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ai-text-60);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}

.ai-sb-detail__tab--active {
  color: #fff;
  border-bottom-color: #fff;
}

.ai-sb-detail__tab:hover {
  color: var(--ai-text-80);
}

.ai-sb-detail__content {
  padding: 16px;
}

.ai-sb-detail__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--ai-border);
}

.ai-sb-detail__row:last-child {
  border-bottom: none;
}

.ai-sb-detail__label {
  color: var(--ai-text-40);
  font-size: 12px;
}

.ai-sb-detail__value {
  font-weight: 600;
  text-align: right;
  max-width: 55%;
  color: var(--ai-text);
}

.ai-sb-detail__themes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ai-sb-detail__pre {
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.7;
  padding: 12px;
  color: var(--ai-text-80);
  background: rgba(0, 0, 0, .2);
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius-sm);
}

/* ---------- Add Song Overlay ---------- */
.ai-sb-add-song {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ai-bg);
  border-top: 1px solid var(--ai-border);
  z-index: 11;
  max-height: 60%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .4);
}

.ai-sb-add-song__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ai-border);
}

.ai-sb-add-song__header h4 {
  margin: 0;
  font-size: 13px;
  font-family: var(--ai-font-hd);
  font-weight: 700;
  color: var(--ai-text);
}

.ai-sb-add-song__close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ai-text-60);
  cursor: pointer;
}

.ai-sb-add-song__close:hover {
  color: var(--ai-text);
}

.ai-sb-add-song__search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ai-border);
}

.ai-sb-add-song__search i {
  color: var(--ai-text-40);
  font-size: 12px;
}

.ai-sb-add-song__search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: var(--ai-font);
  background: transparent;
  color: var(--ai-text);
}

.ai-sb-add-song__search input::placeholder {
  color: var(--ai-text-40);
}

.ai-sb-add-song__results {
  flex: 1;
  overflow-y: auto;
}

.ai-sb-add-song__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ai-border);
  cursor: pointer;
  transition: background .1s;
}

.ai-sb-add-song__item:hover {
  background: var(--ai-card);
}

.ai-sb-add-song__item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ai-text);
}

.ai-sb-add-song__item-artist {
  font-size: 12px;
  color: var(--ai-text-40);
  margin-left: 8px;
}

/* ---------- Toast ---------- */
.ai-sb-toast {
  position: fixed;
  bottom: 100px;
  right: 32px;
  z-index: 10001;
  background: #fff;
  color: #000;
  padding: 12px 20px;
  border-radius: var(--ai-radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--ai-font);
  box-shadow: var(--ai-shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

.ai-sb-toast.ai-sb-toast--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------- Animations ---------- */
@keyframes ai-sb-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-sb-animate {
  animation: ai-sb-fade-up .3s ease-out both;
}

/* ---------- Focus styles ---------- */
.ai-sb-message-action:focus-visible,
.ai-sb-message-action:focus-visible {
  box-shadow: 0 0 0 3px rgba(117, 170, 255, 0.32);
  outline: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .ai-sb-panel {
    width: min(100vw, 520px);
  }

  .ai-sb-chat-scroll {
    padding-top: 16px;
  }

  .ai-sb-conversation {
    padding: 0 18px;
  }
}

@media (max-width: 768px) {
  .ai-sb-song__hover-actions {
    display: flex;
    position: static;
    margin-left: auto;
    padding-top: 8px;
  }

  .ai-sb-panel {
    width: 100vw;
  }

  .ai-sb-resize {
    display: none;
  }

  .ai-sb-fab {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .ai-sb-toast {
    right: 16px;
    bottom: 80px;
    left: 16px;
    text-align: center;
  }

  .ai-sb-conversation {
    padding: 0 16px;
  }

  .ai-sb-chat-scroll {
    padding-top: 14px;
    padding-bottom: 20px;
  }

  .ai-sb-welcome__hero {
    padding: 18px;
  }

  .ai-sb-welcome__heading {
    font-size: 24px;
  }

  .ai-sb-msg--user,
  .ai-sb-msg--ai,
  .ai-sb-followups,
  .ai-sb-setlist,
  .ai-sb-explanation {
    max-width: 100%;
  }

  .ai-sb-header__actions {
    gap: 4px;
  }

  .ai-sb-header__left {
    gap: 8px;
  }

  .ai-sb-header__title {
    font-size: 13px;
  }

  .ai-sb-header__sub {
    display: none;
  }
}