/* ============================================================
   SURF CHAT — Conversation fantôme intégrée à la page.
   Pas de panneau encadré : Barel parle directement depuis le fond.
   ============================================================ */

.surf-chat-section {
  position: relative;
  overflow: hidden;
  padding-top: clamp(80px, 10vw, 140px);
  padding-bottom: clamp(140px, 14vw, 200px); /* place pour composer sticky */
  background:
    radial-gradient(ellipse 70% 90% at 15% 30%, rgba(91,110,248,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 70%, rgba(139,92,246,0.08) 0%, transparent 60%),
    var(--bg-1);
}
.surf-chat-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240,238,248,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,238,248,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 80%);
  pointer-events: none;
}

/* vagues ambient en bas de section */
.surf-chat-section__waves {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 120px;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}
.surf-chat-section__waves svg { width: 100%; height: 100%; display: block; }

/* wrap principal : flux vertical centré */
.surf-chat-wrap {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 32px);
}

/* topbar : avatar + statut, centré, sans encadré */
.surf-chat__topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: clamp(48px, 8vw, 80px);
  position: relative;
}
.surf-chat__avatar {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.surf-chat__avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow:
    0 8px 28px rgba(91,110,248,0.45),
    0 0 0 1px rgba(255,255,255,0.06) inset;
}
.surf-chat__avatar-status {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 14px; height: 14px;
  background: #34d399;
  border: 2px solid var(--bg-1);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52,211,153,0.6);
  animation: surfPulse 2s ease-out infinite;
}
@keyframes surfPulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.surf-chat__who {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.surf-chat__who strong {
  font-size: 17px;
  color: var(--text-1);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.surf-chat__who span {
  font-size: 13px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.surf-chat__online {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #34d399;
  display: inline-block;
}
.surf-chat__reset {
  /* Hidden from users by default — reveal with ?debug=1 in URL or Ctrl+Shift+D */
  display: none;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s;
  align-items: center; justify-content: center;
}
.surf-chat__reset.is-debug-visible {
  display: flex;
}
.surf-chat__reset:hover {
  background: var(--bg-2);
  color: var(--text-1);
  border-color: var(--text-3);
  transform: translateY(-50%) rotate(-45deg);
}

/* messages flux : pas de fond, juste des bulles flottantes */
.surf-chat__messages {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 32px);
  width: 100%;
  min-height: 200px;
}

/* bulle */
.surf-msg {
  display: flex;
  gap: 12px;
  max-width: 78%;
  /* état initial pour scroll-reveal (JS ajoute .is-in pour révéler) */
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.9, 0.3, 1),
    transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.surf-msg.is-in {
  opacity: 1;
  transform: translateY(0);
}
.surf-msg--bot { align-self: flex-start; }
.surf-msg--user { align-self: flex-end; flex-direction: row-reverse; }

/* avatar à côté de la bulle (uniquement bot, plus discret) */
.surf-msg__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  margin-top: 2px;
}
.surf-msg--bot .surf-msg__avatar {
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  color: white;
  font-size: 16px;
  box-shadow: 0 4px 14px -2px rgba(91,110,248,0.4);
}
.surf-msg--user .surf-msg__avatar {
  background: linear-gradient(135deg, #34d399, #059669);
  color: white;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 14px -2px rgba(52,211,153,0.35);
}

.surf-msg__bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  letter-spacing: -0.005em;
}
.surf-msg--bot .surf-msg__bubble {
  background: var(--surface);
  color: var(--text-1);
  border-top-left-radius: 6px;
  border: 1px solid var(--border);
  box-shadow:
    0 8px 24px -8px rgba(0,0,0,0.25),
    0 0 0 1px rgba(255,255,255,0.02) inset;
}
.surf-msg--user .surf-msg__bubble {
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  color: white;
  border-top-right-radius: 6px;
  box-shadow: 0 8px 24px -6px rgba(91,110,248,0.45);
}

/* mots-clés stylés */
.surf-msg__bubble strong {
  color: inherit;
  font-weight: 700;
}

/* Paragraphes & retours ligne dans les bulles longues (pitch, pricing) */
.surf-msg__bubble p {
  margin: 0 0 10px;
  line-height: 1.5;
}
.surf-msg__bubble p:last-child { margin-bottom: 0; }
.surf-msg__bubble em {
  color: var(--text-3);
  font-style: italic;
  font-size: 0.92em;
}
.surf-msg--bot .surf-msg__bubble strong {
  background: linear-gradient(90deg, #5b6ef8, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

/* carte stats / pitch — version narrative & lisible */
.surf-msg__pitch {
  margin-top: 10px;
  border-radius: 14px;
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, rgba(91,110,248,0.10), rgba(139,92,246,0.06));
  border: 1px solid rgba(91,110,248,0.22);
}
.surf-msg__pitch-headline {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 14px;
  line-height: 1.4;
}
.surf-msg__pitch-headline strong { color: var(--text-1); }

/* Tunnel narratif : prospects → réponses → RDV */
.surf-msg__pitch-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 14px;
}
.surf-msg__pitch-step {
  text-align: center;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.surf-msg__pitch-step--hero {
  background: linear-gradient(135deg, rgba(91,110,248,0.18), rgba(139,92,246,0.12));
  border-color: rgba(91,110,248,0.45);
}
.surf-msg__pitch-step-num {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  letter-spacing: -0.02em;
}
.surf-msg__pitch-step--hero .surf-msg__pitch-step-num { font-size: 26px; }
.surf-msg__pitch-step-lbl {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
  line-height: 1.25;
}
.surf-msg__pitch-step-lbl span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-3);
}
.surf-msg__pitch-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: rgba(91,110,248,0.55);
  font-weight: 700;
}

/* Section "Comment Barel le fait" */
.surf-msg__pitch-how {
  padding-top: 10px;
  border-top: 1px dashed rgba(91,110,248,0.22);
}
.surf-msg__pitch-how-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 6px;
}
.surf-msg__pitch-pills {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.surf-msg__pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px;
  padding: 5px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  line-height: 1.2;
}
.surf-msg__pill b {
  color: #5b6ef8;
  font-weight: 700;
}
.surf-msg__pitch-foot {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  font-style: italic;
  line-height: 1.4;
  text-align: center;
}
.surf-msg__pitch-foot strong { color: var(--text-2); font-style: normal; }

/* carte pricing — réponse rapide "c'est combien ?" */
.surf-msg__pricing {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.surf-msg__price {
  position: relative;
  padding: 10px 10px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
}
.surf-msg__price--featured {
  background: linear-gradient(135deg, rgba(91,110,248,0.10), rgba(139,92,246,0.06));
  border-color: rgba(91,110,248,0.45);
}
.surf-msg__price-badge {
  position: absolute;
  top: -7px; right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  color: white;
}
.surf-msg__price-name {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 2px;
}
.surf-msg__price-amount {
  display: flex; align-items: baseline; gap: 3px;
  margin-bottom: 3px;
}
.surf-msg__price-amount strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
}
.surf-msg__price-amount span {
  font-size: 11px;
  color: var(--text-3);
}
.surf-msg__price-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.3;
}

/* CTA inline */
.surf-msg__cta {
  margin-top: 14px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.surf-msg__cta button,
.surf-msg__cta a {
  appearance: none;
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  color: white;
  border: 0;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 18px -3px rgba(91,110,248,0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}
.surf-msg__cta button:hover,
.surf-msg__cta a:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -4px rgba(91,110,248,0.55);
}

/* typing indicator */
.surf-typing {
  display: flex; align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.surf-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: surfTypingBounce 1.2s ease-in-out infinite;
}
.surf-typing span:nth-child(2) { animation-delay: 0.15s; }
.surf-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes surfTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   Composer & quick replies — sticky/floating en bas de section
   ============================================================ */
.surf-chat__dock {
  position: sticky;
  bottom: 24px;
  margin-top: clamp(40px, 6vw, 64px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  pointer-events: none; /* enfants réactivent */
}
.surf-chat__dock > * { pointer-events: auto; }

/* quick replies */
.surf-chat__quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 720px;
}
.surf-chat__quickreplies:empty { display: none; }
.surf-quick {
  appearance: none;
  background: rgba(28, 26, 38, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.surf-quick:hover {
  background: rgba(91,110,248,0.18);
  border-color: rgba(91,110,248,0.5);
  transform: translateY(-1px);
}
.surf-quick--primary {
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 18px -3px rgba(91,110,248,0.45);
}
.surf-quick--primary:hover {
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  color: white;}

/* Bouton déjà cliqué — grisé mais visible (l'user voit ce qu'il a déjà demandé) */
.surf-quick--disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.25);
  text-decoration-thickness: 1px;
}

/* Bouton CTA final — vert pour signaler "fin du tunnel + action" */
.surf-quick--cta {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: rgba(16,185,129,0.6);
  color: white;
  font-weight: 600;
  box-shadow: 0 6px 18px -3px rgba(16,185,129,0.45);
}
.surf-quick--cta:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -4px rgba(16,185,129,0.6);
}

/* composer flottant glassmorphique */
.surf-chat__composer {
  display: flex;
  gap: 10px;
  padding: 10px 10px 10px 18px;
  background: rgba(28, 26, 38, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow:
    0 12px 40px -8px rgba(0,0,0,0.45),
    0 0 0 1px rgba(255,255,255,0.03) inset;
  width: min(640px, 100%);
  align-items: center;
}
.surf-chat__input {
  flex: 1;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  color: var(--text-1);
  font-size: 14.5px;
  font-family: inherit;
  min-width: 0;
}
.surf-chat__input:focus { outline: none; }
.surf-chat__input::placeholder { color: var(--text-3); }

/* Composer caché — pas affiché tant qu'on est pas sur "Autre…" en métier */
.surf-chat__composer.is-hidden {
  display: none;
}
.surf-chat__send {
  appearance: none;
  background: linear-gradient(135deg, #5b6ef8, #8b5cf6);
  border: 0;
  color: white;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px -2px rgba(91,110,248,0.45);
  transition: transform 0.15s;
}
.surf-chat__send:hover { transform: scale(1.05); }
.surf-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.surf-chat__footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 4px;
  font-size: 11px;
  color: var(--text-3);
}

/* compact mobile */
@media (max-width: 640px) {
  .surf-msg { max-width: 92%; }
  .surf-msg__pitch-flow {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .surf-msg__pitch-arrow {
    transform: rotate(90deg);
    font-size: 14px;
    padding: 2px 0;
  }
  .surf-msg__pitch-step { padding: 8px 6px; }
  .surf-msg__pitch-step-num { font-size: 20px; }
  .surf-msg__pitch-step--hero .surf-msg__pitch-step-num { font-size: 24px; }
  .surf-msg__pricing { grid-template-columns: 1fr 1fr; gap: 5px; }
  .surf-msg__price-amount strong { font-size: 18px; }
  .surf-chat__topbar { margin-bottom: 36px; }
  .surf-chat__reset {
    position: static;
    transform: none;
  }
  .surf-chat__reset:hover {
    transform: rotate(-45deg);
  }
  .surf-chat__dock { bottom: 16px; }
}
