/* ============================================================
   ALLODENTIX CHATBOT — Styles
   ============================================================
   Préfixe `pc-` partout pour éviter les conflits avec ton CSS.
   Couleur principale : #2563eb (bleu médical)
   Personnalisable via les variables CSS ci-dessous.
   ============================================================ */

.pc-chatbot {
  /* === Variables personnalisables === */
  --pc-primary:        #2563eb;
  --pc-primary-dark:   #1d4ed8;
  --pc-primary-light:  #dbeafe;
  --pc-bg:             #ffffff;
  --pc-bg-alt:         #f8fafc;
  --pc-border:         #e5e7eb;
  --pc-text:           #1f2937;
  --pc-text-muted:     #6b7280;
  --pc-user-bg:        #2563eb;
  --pc-user-text:      #ffffff;
  --pc-assistant-bg:   #f1f5f9;
  --pc-assistant-text: #1f2937;
  --pc-shadow:         0 10px 40px rgba(37, 99, 235, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
  --pc-radius:         16px;
  --pc-radius-msg:     14px;

  /* === Position + base === */
  position: fixed;
  bottom: 10px;
  right: 24px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--pc-text);
}

.pc-chatbot *,
.pc-chatbot *::before,
.pc-chatbot *::after {
  box-sizing: border-box;
}

/* ===================== BULLE FLOTTANTE — PILL DESKTOP / RONDE MOBILE ===================== */
.pc-bubble {
  height: 36px;
  padding: 0 18px;
  border-radius: 26px;
  width: auto;
  background: #1d4ed8;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 5px 16px rgba(29, 78, 216, 0.35);
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.25s ease;
  outline: none;
  white-space: nowrap;
}

.pc-bubble-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: #fff;
}

.pc-bubble-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.pc-bubble:hover {
  background: #1e40af;
  transform: scale(1.04);
}

.pc-bubble:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.4);
  outline-offset: 3px;
}

.pc-bubble-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
}


/* ===================== MOBILE — RONDE ===================== */
@media (max-width: 480px) {
  .pc-bubble {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    padding: 0;
    gap: 0;
  }

  .pc-bubble-label,
  .pc-bubble-dot {
    display: none;
  }
}

/* ===================== PANNEAU ===================== */
.pc-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 48px);
  background: var(--pc-bg);
  border-radius: var(--pc-radius);
  box-shadow: var(--pc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.pc-panel.pc-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ===================== HEADER ===================== */
.pc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--pc-primary) 0%, var(--pc-primary-dark) 100%);
  color: #fff;
  flex-shrink: 0;
}

.pc-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pc-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pc-header-text {
  min-width: 0;
}

.pc-header-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-header-subtitle {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.pc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
  flex-shrink: 0;
}

.pc-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.pc-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ===================== BODY (zone des messages) ===================== */
.pc-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background: var(--pc-bg-alt);
  scroll-behavior: smooth;
}

/* Scrollbar discrète */
.pc-body::-webkit-scrollbar { width: 6px; }
.pc-body::-webkit-scrollbar-track { background: transparent; }
.pc-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
.pc-body::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

/* ===================== MESSAGES ===================== */
.pc-msg {
  display: flex;
  margin-bottom: 10px;
  animation: pc-msg-in 0.25s ease-out;
}

.pc-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--pc-radius-msg);
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 14px;
  line-height: 1.5;
}

.pc-msg-user {
  justify-content: flex-end;
}

.pc-msg-user .pc-msg-bubble {
  background: var(--pc-user-bg);
  color: var(--pc-user-text);
  border-bottom-right-radius: 4px;
}

.pc-msg-assistant {
  justify-content: flex-start;
}

.pc-msg-assistant .pc-msg-bubble {
  background: var(--pc-assistant-bg);
  color: var(--pc-assistant-text);
  border-bottom-left-radius: 4px;
}

.pc-msg-bubble strong { font-weight: 600; }
.pc-msg-bubble em     { font-style: italic; }

.pc-msg-bubble code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.pc-msg-user .pc-msg-bubble code {
  background: rgba(255, 255, 255, 0.2);
}

.pc-msg-bubble ul {
  margin: 6px 0;
  padding-left: 20px;
}

.pc-msg-bubble li {
  margin: 2px 0;
}

.pc-msg-bubble a {
  color: inherit;
  text-decoration: underline;
}

@keyframes pc-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== INDICATEUR "TYPING" ===================== */
.pc-typing-bubble {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  padding: 14px 16px !important;
}

.pc-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pc-text-muted);
  animation: pc-typing 1.2s ease-in-out infinite;
}

.pc-typing-dot:nth-child(1) { animation-delay: 0s; }
.pc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.pc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pc-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ===================== SUGGESTIONS ===================== */
.pc-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 12px;
  background: var(--pc-bg-alt);
  flex-shrink: 0;
}

.pc-suggestion {
  background: var(--pc-bg);
  border: 1px solid var(--pc-border);
  color: var(--pc-primary);
  padding: 7px 12px;
  border-radius: 18px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.3;
}

.pc-suggestion:hover {
  background: var(--pc-primary-light);
  border-color: var(--pc-primary);
}

.pc-suggestion:active {
  transform: scale(0.97);
}

/* ===================== FORMULAIRE ===================== */
.pc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  background: var(--pc-bg);
  border-top: 1px solid var(--pc-border);
  flex-shrink: 0;
}

.pc-input {
  flex: 1;
  border: 1px solid var(--pc-border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  background: var(--pc-bg-alt);
  color: var(--pc-text);
  transition: border-color 0.15s ease, background 0.15s ease;
  max-height: 120px;
  line-height: 1.4;
}

.pc-input:focus {
  border-color: var(--pc-primary);
  background: var(--pc-bg);
}

.pc-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pc-input::placeholder {
  color: var(--pc-text-muted);
}

.pc-send {
  background: var(--pc-primary);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.pc-send:hover:not(:disabled) {
  background: var(--pc-primary-dark);
  transform: scale(1.05);
}

.pc-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pc-send svg {
  transform: translateX(-1px);
}

/* ===================== RESPONSIVE MOBILE ===================== */
@media (max-width: 480px) {
  .pc-chatbot {
    bottom: 16px;
    right: 16px;
  }

  .pc-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 32px);
    max-height: calc(100vh - 32px);
    bottom: 0;
    right: 0;
    border-radius: 14px;
  }

  .pc-bubble {
    width: 54px;
    height: 54px;
  }
}

/* ===================== ACCESSIBILITÉ — REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  .pc-bubble,
  .pc-msg,
  .pc-typing-dot,
  .pc-panel {
    animation: none !important;
    transition: none !important;
  }
}

/* ===================== DARK MODE (auto si le navigateur préfère) ===================== */
@media (prefers-color-scheme: dark) {
  .pc-chatbot {
    --pc-bg:             #1f2937;
    --pc-bg-alt:         #111827;
    --pc-border:         #374151;
    --pc-text:           #f9fafb;
    --pc-text-muted:     #9ca3af;
    --pc-assistant-bg:   #374151;
    --pc-assistant-text: #f9fafb;
  }

  .pc-msg-bubble code {
    background: rgba(255, 255, 255, 0.1);
  }

  .pc-suggestion {
    background: var(--pc-bg-alt);
    color: #93c5fd;
  }

  .pc-suggestion:hover {
    background: rgba(37, 99, 235, 0.2);
  }
}




/* ===================== ALLODENTIX — BOUTONS D'ACTION ===================== */
.pc-msg-assistant.pc-has-actions {
  flex-direction: column;
  align-items: flex-start;
}

.pc-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 6px;
  max-width: 80%;
}

.pc-action {
  display: block;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.pc-action:hover { transform: translateY(-1px); filter: brightness(1.06); }
.pc-action:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.4); outline-offset: 2px; }

.pc-action-primary { background: var(--pc-primary); color: #fff; }
.pc-action-wa      { background: #25d366; color: #0b3d1e; }
.pc-action-call    { background: var(--pc-bg); color: var(--pc-primary-dark); border: 1.5px solid var(--pc-primary); }

.pc-action-note {
  font-size: 13px;
  font-weight: 600;
  color: var(--pc-text);
  padding: 2px 2px 0;
}

.pc-notice {
  padding: 0 14px 8px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--pc-text-muted);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .pc-action-call { color: #93c5fd; }
}