/* Habillage de l'assistant IA - Ma Chanson Perso
   Charge apres chat.css (voir includes/chat-widget.php). Ne modifie pas le fonctionnement du bot. */

/* ---------- Bouton flottant : vinyle ---------- */
.chat-open {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--nuit-2, #16122e), var(--nuit-2, #16122e)) padding-box,
    var(--degrade, linear-gradient(100deg, #ff5e8a 0%, #ff8a5e 55%, #ffb454 100%)) border-box;
  transition: transform .25s ease, box-shadow .25s ease;
  animation: mcp-appel 10s ease-in-out infinite;
}
.chat-open:hover {
  background:
    linear-gradient(#211a42, #211a42) padding-box,
    var(--degrade, linear-gradient(100deg, #ff5e8a 0%, #ff8a5e 55%, #ffb454 100%)) border-box;
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(255, 94, 138, .28);
}
.mcp-vinyle {
  width: 38px; height: 38px; flex: none;
  animation: mcp-tourne 6s linear infinite;
}
.chat-open:hover .mcp-vinyle { animation-play-state: paused; }

@keyframes mcp-tourne { to { transform: rotate(360deg); } }
@keyframes mcp-appel {
  0%, 88%, 100% { box-shadow: 0 8px 28px rgba(0,0,0,.35), 0 0 0 0 rgba(255, 94, 138, 0); }
  92% { box-shadow: 0 8px 28px rgba(0,0,0,.35), 0 0 0 8px rgba(255, 94, 138, .25); }
  96% { box-shadow: 0 8px 28px rgba(0,0,0,.35), 0 0 0 14px rgba(255, 94, 138, 0); }
}

/* ---------- Fenetre ---------- */
.chat-panel {
  background: rgba(22, 18, 46, .94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 94, 138, .22);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset, 0 0 40px rgba(255, 94, 138, .08);
  transform-origin: bottom right;
  animation: mcp-ouvre .28s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes mcp-ouvre {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* En-tete */
.chat-head {
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(180deg, rgba(255, 94, 138, .10), rgba(255, 94, 138, 0));
  border-bottom: 1px solid var(--trait, rgba(255,255,255,.09));
}
.mcp-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mcp-avatar {
  position: relative; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 25%, #2a2152, var(--nuit, #0d0b1f)) padding-box,
    var(--degrade, linear-gradient(100deg, #ff5e8a, #ffb454)) border-box;
  border: 2px solid transparent;
}
.mcp-avatar svg { width: 30px; height: 30px; animation: mcp-bat 2.6s ease-in-out infinite; }
@keyframes mcp-bat {
  0%, 60%, 100% { transform: scale(1); }
  10% { transform: scale(1.08); }
  20% { transform: scale(1); }
  30% { transform: scale(1.05); }
}
.mcp-avatar::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #3ddc84; border: 2px solid var(--nuit-2, #16122e);
}
.mcp-avatar .mcp-eq-logo rect { transform-box: fill-box; transform-origin: center; }
.chat-panel.mcp-occupe .mcp-avatar svg { animation: none; }
.chat-panel.mcp-occupe .mcp-eq-logo rect { animation: mcp-barre .9s ease-in-out infinite; }
.chat-panel.mcp-occupe .mcp-eq-logo rect:nth-child(2) { animation-delay: -.2s; }
.chat-panel.mcp-occupe .mcp-eq-logo rect:nth-child(3) { animation-delay: -.45s; }
.chat-panel.mcp-occupe .mcp-eq-logo rect:nth-child(4) { animation-delay: -.1s; }
.chat-panel.mcp-occupe .mcp-eq-logo rect:nth-child(5) { animation-delay: -.6s; }

.mcp-textes { display: flex; flex-direction: column; min-width: 0; }
.mcp-textes strong {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.15rem; line-height: 1.1; letter-spacing: -.01em;
}
.mcp-textes small { display: flex; align-items: center; gap: 6px; color: var(--lavande, #a99fc4); font-size: .8rem; margin-top: 2px; }
.mcp-statut { color: #3ddc84; display: inline-flex; align-items: center; gap: 4px; }
.mcp-statut::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chat-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--verre, rgba(255,255,255,.045)); border: 1px solid var(--trait, rgba(255,255,255,.09));
  color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer;
  transition: background .2s, transform .2s;
}
.chat-close:hover { background: rgba(255,255,255,.1); transform: rotate(90deg); }

/* Zone de discussion avec portee en filigrane */
.chat-log {
  padding: 16px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='140' viewBox='0 0 320 140'%3E%3Cg stroke='%23ffffff' stroke-opacity='.045' stroke-width='1'%3E%3Cpath d='M0 40h320M0 50h320M0 60h320M0 70h320M0 80h320'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.05'%3E%3Cellipse cx='70' cy='75' rx='6' ry='4.5' transform='rotate(-20 70 75)'/%3E%3Cpath d='M75.5 73V38h1.6v35z'/%3E%3Cellipse cx='190' cy='55' rx='6' ry='4.5' transform='rotate(-20 190 55)'/%3E%3Cellipse cx='225' cy='65' rx='6' ry='4.5' transform='rotate(-20 225 65)'/%3E%3Cpath d='M195.5 53V22h1.6v31zM230.5 63V32h1.6v31zM195.5 22l36.6 10v4l-36.6-10z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

/* Bulles */
.chat-msg {
  border-radius: 18px;
  animation: mcp-bulle .25s ease-out;
}
@keyframes mcp-bulle {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.chat-bot {
  background: rgba(169, 159, 196, .13);
  border: 1px solid rgba(255,255,255,.07);
  border-bottom-left-radius: 6px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.chat-user {
  background: var(--degrade, linear-gradient(100deg, #ff5e8a 0%, #ff8a5e 55%, #ffb454 100%));
  color: #1a0d14;
  font-weight: 500;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px rgba(255, 94, 138, .22);
}

/* Indicateur "le bot ecrit" : egaliseur */
.chat-wait { opacity: 1; font-style: normal; padding: 12px 16px; }
.mcp-eq { display: inline-flex; align-items: flex-end; gap: 4px; height: 20px; vertical-align: middle; }
.mcp-eq i {
  display: block; width: 4px; height: 100%; border-radius: 2px;
  background: var(--degrade, linear-gradient(100deg, #ff5e8a, #ffb454));
  transform-origin: bottom;
  animation: mcp-barre .9s ease-in-out infinite;
}
.mcp-eq i:nth-child(2) { animation-delay: -.3s; }
.mcp-eq i:nth-child(3) { animation-delay: -.6s; }
.mcp-eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes mcp-barre {
  0%, 100% { transform: scaleY(.3); }
  50% { transform: scaleY(1); }
}
.mcp-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Suggestions */
.chat-chips { gap: 8px; padding: 2px 14px 10px; }
.chat-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--verre, rgba(255,255,255,.045));
  border: 1px solid rgba(255,255,255,.12);
  padding: 8px 13px 8px 10px;
  text-align: left;
  transition: border-color .2s, background .2s, transform .2s;
}
.chat-chip:hover {
  border-color: var(--rose, #ff5e8a);
  background: rgba(255, 94, 138, .1);
  transform: translateY(-1px);
}
.chat-chip svg { width: 16px; height: 16px; flex: none; color: var(--soleil, #ffb454); }

/* Saisie */
.chat-form { border-top: 1px solid var(--trait, rgba(255,255,255,.09)); }
.chat-form input {
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  transition: border-color .2s, box-shadow .2s;
}
.chat-form input:focus {
  outline: none;
  border-color: var(--rose, #ff5e8a);
  box-shadow: 0 0 0 3px rgba(255, 94, 138, .18);
}
.chat-form button { border-radius: 999px; transition: transform .2s, filter .2s; }
.chat-form button:hover { transform: translateY(-1px); filter: brightness(1.08); }

/* Ordinateur : pastille vinyle + texte */
@media (min-width: 701px) {
  .chat-open { padding: 8px 18px 8px 8px; }
}
/* Mobile : on garde la pastille ronde de 48px de chat.css, le vinyle la remplit */
@media (max-width: 700px) {
  .mcp-vinyle { width: 42px; height: 42px; }
  .chat-panel { border-radius: 18px; }
  .chat-open:hover { transform: none; }
}

/* Respect des preferences d'accessibilite */
@media (prefers-reduced-motion: reduce) {
  .chat-open, .mcp-vinyle, .chat-panel, .chat-msg, .mcp-avatar svg,
  .mcp-eq i, .chat-panel.mcp-occupe .mcp-eq-logo rect { animation: none !important; }
  .mcp-eq i { transform: scaleY(.7); }
}
