/* DJ Web Player — Assistant IA Widget */

/* ── Bouton flottant ─────────────────────────────────────────────────────── */
.cdj-asst-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f1b2d 100%);
  border: 2px solid #2a6496;
  box-shadow: 0 4px 20px rgba(0,0,0,.55), 0 0 0 0 rgba(42,100,150,.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  padding: 0;
}
.cdj-asst-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,.65), 0 0 0 6px rgba(42,100,150,.18);
  border-color: #4fc3f7;
}
.cdj-asst-toggle:active { transform: scale(.96); }
.cdj-asst-toggle svg { width: 34px; height: 34px; }

/* Pastille notification */
.cdj-asst-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid #0f1b2d;
  display: none;
}
.cdj-asst-badge.visible { display: block; }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.cdj-asst-panel {
  position: fixed;
  bottom: 90px;
  right: 22px;
  width: 340px;
  max-height: 520px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,.7), 0 0 0 1px rgba(79,195,247,.08);
  display: flex;
  flex-direction: column;
  z-index: 8999;
  overflow: hidden;
  transform: scale(.92) translateY(12px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s ease;
}
.cdj-asst-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.cdj-asst-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 11px;
  background: linear-gradient(90deg, #0f1b2d 0%, #0d1117 100%);
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}
.cdj-asst-avatar-sm {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.cdj-asst-header-info { flex: 1; min-width: 0; }
.cdj-asst-header-title {
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
  letter-spacing: .02em;
}
.cdj-asst-header-sub {
  font-size: 10px;
  color: #4fc3f7;
  margin-top: 1px;
}
.cdj-asst-close {
  background: none;
  border: none;
  color: #6e7681;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.cdj-asst-close:hover { color: #e6edf3; background: #21262d; }

/* Zone messages */
.cdj-asst-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.cdj-asst-messages::-webkit-scrollbar { width: 4px; }
.cdj-asst-messages::-webkit-scrollbar-track { background: transparent; }
.cdj-asst-messages::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

/* Bulles de message */
.cdj-asst-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  gap: 3px;
}
.cdj-asst-msg.user { align-self: flex-end; align-items: flex-end; }
.cdj-asst-msg.assistant { align-self: flex-start; align-items: flex-start; }

.cdj-asst-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.cdj-asst-msg.user .cdj-asst-bubble {
  background: #1e3a5f;
  color: #d1e8ff;
  border-bottom-right-radius: 3px;
}
.cdj-asst-msg.assistant .cdj-asst-bubble {
  background: #161b22;
  color: #c9d1d9;
  border: 1px solid #21262d;
  border-bottom-left-radius: 3px;
}

/* Markdown dans les bulles assistant */
.cdj-asst-bubble strong { color: #e6edf3; font-weight: 600; }
.cdj-asst-bubble em { color: #b0c4de; }
.cdj-asst-bubble code {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 11.5px;
  color: #f0883e;
}
.cdj-asst-bubble ul, .cdj-asst-bubble ol {
  margin: 4px 0;
  padding-left: 18px;
}
.cdj-asst-bubble li { margin: 2px 0; }
.cdj-asst-bubble p { margin: 0 0 6px; }
.cdj-asst-bubble p:last-child { margin-bottom: 0; }

/* Typing indicator */
.cdj-asst-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}
.cdj-asst-typing span {
  width: 6px;
  height: 6px;
  background: #4fc3f7;
  border-radius: 50%;
  animation: cdj-asst-bounce .9s infinite;
}
.cdj-asst-typing span:nth-child(2) { animation-delay: .15s; }
.cdj-asst-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cdj-asst-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Message d'accueil */
.cdj-asst-welcome {
  text-align: center;
  padding: 12px 8px;
  color: #6e7681;
  font-size: 12px;
  line-height: 1.6;
}
.cdj-asst-welcome strong { color: #4fc3f7; display: block; margin-bottom: 4px; font-size: 13px; }

/* Suggestions rapides */
.cdj-asst-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}
.cdj-asst-sug {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 20px;
  color: #8b949e;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.cdj-asst-sug:hover { border-color: #4fc3f7; color: #4fc3f7; background: #0f1b2d; }

/* Zone de saisie */
.cdj-asst-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid #21262d;
  background: #0d1117;
  flex-shrink: 0;
}
.cdj-asst-input {
  flex: 1;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 13px;
  padding: 8px 10px;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color .15s;
  outline: none;
}
.cdj-asst-input:focus { border-color: #2a6496; }
.cdj-asst-input::placeholder { color: #484f58; }

.cdj-asst-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #1e3a5f;
  border: 1px solid #2a6496;
  color: #4fc3f7;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.cdj-asst-send:hover:not(:disabled) { background: #2a6496; }
.cdj-asst-send:active:not(:disabled) { transform: scale(.92); }
.cdj-asst-send:disabled { opacity: .4; cursor: not-allowed; }

/* Responsive mobile */
@media (max-width: 420px) {
  .cdj-asst-panel { width: calc(100vw - 16px); right: 8px; bottom: 80px; }
  .cdj-asst-toggle { bottom: 16px; right: 16px; }
}
