/* ===================================================================
   Assistant du site PROFIA — widget bulle flottante
   Module isolé. Classes préfixées .pa- pour éviter toute collision CSS.
   =================================================================== */

#profia-assistant-root,
#profia-assistant-root * {
  box-sizing: border-box;
}

#profia-assistant-root {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Bulle repliée (lanceur) ── */
.pa-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #667eea;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.pa-bubble:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 28px rgba(102, 126, 234, 0.55);
}
.pa-bubble:focus-visible {
  outline: 3px solid #ff9a56;
  outline-offset: 3px;
}
.pa-bubble svg {
  width: 30px;
  height: 30px;
  fill: #ffffff;
}
.pa-bubble .pa-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  background: #ff9a56;
  border: 2px solid #ffffff;
  border-radius: 50%;
}
.pa-hidden {
  display: none !important;
}

/* ── Panneau déplié ── */
.pa-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 40px);
  background: #F7F8FA;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(26, 32, 60, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9001;
}

/* ── En-tête ── */
.pa-header {
  background: #667eea;
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.pa-header-title {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.pa-header-title strong {
  font-size: 15px;
  font-weight: 700;
}
.pa-header-title span {
  font-size: 12px;
  opacity: 0.85;
}
.pa-close {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.pa-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* ── Zone de conversation ── */
.pa-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pa-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.pa-msg-bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e4e6ef;
  color: #2b2f3a;
  border-bottom-left-radius: 4px;
}
.pa-msg-user {
  align-self: flex-end;
  background: #e8ebfd;
  color: #2b2f3a;
  border-bottom-right-radius: 4px;
}

/* ── Note de clôture de conversation ── */
.pa-closed-note {
  align-self: center;
  text-align: center;
  font-size: 12px;
  color: #9a9eac;
  background: #eef0f4;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 4px;
}

/* ── Indicateur de chargement (3 points) ── */
.pa-typing {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e4e6ef;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
}
.pa-typing span {
  width: 7px;
  height: 7px;
  background: #b9bdca;
  border-radius: 50%;
  animation: pa-blink 1.2s infinite ease-in-out both;
}
.pa-typing span:nth-child(2) { animation-delay: 0.2s; }
.pa-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pa-blink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Zone de saisie ── */
.pa-footer {
  flex-shrink: 0;
  border-top: 1px solid #e4e6ef;
  background: #ffffff;
  padding: 10px 12px;
}
.pa-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.pa-input {
  flex: 1;
  resize: none;
  border: 1px solid #d4d7e2;
  border-radius: 10px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 96px;
  color: #2b2f3a;
}
.pa-input:focus {
  outline: none;
  border-color: #667eea;
}
.pa-send {
  flex-shrink: 0;
  background: #ff9a56;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pa-send:hover:not(:disabled) {
  background: #f4863c;
}
.pa-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pa-counter {
  margin-top: 5px;
  text-align: right;
  font-size: 11px;
  color: #9a9eac;
}
.pa-counter.pa-counter-max {
  color: #e8722a;
}

/* ── Mobile : panneau plein écran ── */
@media (max-width: 480px) {
  .pa-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .pa-bubble {
    bottom: 16px;
    right: 16px;
  }
}
