/* Widget chatbot Spyk Photo — bulle + panneau + styles de conversation. */
:root {
  --spw-accent: #e2001a;
  --spw-dark: #16181d;
  --spw-bot: #f1f3f5;
}

/* Lanceur (bulle bas-droite) */
.spyk-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 99998;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--spw-accent); color: #fff; font-size: 26px; line-height: 60px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.spyk-launcher:hover { transform: scale(1.06); }

/* Panneau */
.spyk-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 99999;
  width: 380px; max-width: calc(100vw - 24px); height: 580px; max-height: calc(100vh - 44px);
  background: #fff; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,.3); font-family: system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
.spyk-panel-head {
  flex: 0 0 auto;
  background: var(--spw-dark); color: #fff; padding: 13px 16px; font-weight: 600; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between;
}
.spyk-panel-close {
  background: none; border: none; color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer; padding: 4px 10px; margin: -4px -6px -4px 0; border-radius: 8px;
}
.spyk-panel-close:hover, .spyk-panel-close:active { background: rgba(255,255,255,.15); }
.spyk-panel-body { flex: 1; min-height: 0; display: flex; }
#spyk-chat-root { flex: 1; min-height: 0; }

/* Conversation (mêmes classes que client.js) */
.spyk-chat { display: flex; flex-direction: column; height: 100%; width: 100%; background: #fff; color: #16181d; }
.spyk-chat-conv { display: none; } /* pas de panneau historique dans le widget */
.spyk-chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.spyk-chat-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.spyk-bubble { max-width: 80%; padding: 10px 13px; border-radius: 14px; line-height: 1.45; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.spyk-bubble a { color: inherit; text-decoration: underline; }
.spyk-user { align-self: flex-end; background: var(--spw-accent); color: #fff; border-bottom-right-radius: 4px; }
.spyk-assistant { align-self: flex-start; background: var(--spw-bot); color: #16181d; border-bottom-left-radius: 4px; }
.spyk-typing { display: inline-flex; align-items: center; gap: 5px; padding: 14px; }
.spyk-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; display: inline-block; animation: spyw-bounce 1.3s infinite ease-in-out both; }
.spyk-dot:nth-child(1) { animation-delay: -.32s; }
.spyk-dot:nth-child(2) { animation-delay: -.16s; }
@keyframes spyw-bounce { 0%,80%,100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* Chips QCM */
.spyk-chips { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 7px; max-width: 92%; }
.spyk-chip { padding: 8px 12px; background: #fff; border: 1px solid var(--spw-accent); color: var(--spw-accent); border-radius: 18px; font-size: 13px; cursor: pointer; text-align: left; }
.spyk-chip:hover { background: var(--spw-accent); color: #fff; }
.spyk-chip-back { border-color: #c4c9cf; color: #6b7178; }
.spyk-chip-back:hover { background: #6b7178; color: #fff; }

/* Bouton contact */
.spyk-contact-cta { align-self: flex-start; }
.spyk-contact-btn { display: inline-block; padding: 9px 14px; background: var(--spw-accent); color: #fff; border-radius: 10px; text-decoration: none; font-size: 13px; }
.spyk-contact-btn:hover { filter: brightness(.92); }

/* Formulaire de saisie */
.spyk-chat-form { display: flex; gap: 8px; padding: 11px; border-top: 1px solid #e6e8eb; }
.spyk-chat-input { flex: 1; padding: 11px 13px; border: 1px solid #d0d4d9; border-radius: 10px; font-size: 14px; outline: none; }
.spyk-chat-input:focus { border-color: var(--spw-accent); }
.spyk-chat-send { padding: 0 16px; background: var(--spw-dark); color: #fff; border: none; border-radius: 10px; cursor: pointer; font-size: 14px; }
.spyk-chat-send:hover { background: #000; }

@media (max-width: 480px) {
  /* Plein écran mais en hauteur de viewport DYNAMIQUE (100dvh) pour que
     l'en-tête (et le bouton fermer) restent visibles malgré la barre d'adresse. */
  .spyk-panel {
    right: 0; left: 0; top: 0; bottom: 0;
    width: 100vw; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0;
  }
  /* Barre de préhension (indique le geste « glisser pour fermer ») */
  .spyk-panel-head { position: relative; padding: 20px 16px 12px; font-size: 16px; }
  .spyk-panel-head::before {
    content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.45);
  }
  .spyk-panel-close { font-size: 30px; padding: 6px 12px; }
  .spyk-launcher { right: 16px; bottom: 16px; }
}
