/* fond page du chat – plus chaud, plus dense */
body #lbsdlv-v3ia-chat-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  background: radial-gradient(circle at top, #fde3c9 0%, #e3d2c3 45%, #d2cbc4 100%);
  padding: 25px 0;
  box-sizing: border-box;
}

/* conteneur du chat */
#lbsdlv-v3ia-chat.lbsdlv-chat-app {
  width: 100%;
  max-width: 420px;
  background: #fffaf6;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 90vh;
  max-height: 640px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0 auto;
  box-shadow: 0 18px 45px rgba(176,138,105,.2);
}

/* barre du haut – plus marquée */
#lbsdlv-v3ia-chat .chat-top {
  display: grid;
  grid-template-columns: auto 1fr auto;   /* avatar | titre | boutons */
  grid-auto-rows: auto;
  row-gap: 6px;
  align-items: center;
  background: linear-gradient(135deg, #fff, #ffcf9d);
  padding: 11px 14px;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.5);
}

#lbsdlv-v3ia-chat .chat-top-left { 
  display: contents; 
}
#lbsdlv-v3ia-chat .chat-top-left > div {
  display: contents;  /* Safari iOS : permet à .chat-title et .chat-sub d'être des items de grille */
}

#lbsdlv-v3ia-chat .chat-avatar { grid-column: 1; grid-row: 1; }
#lbsdlv-v3ia-chat .chat-title  { grid-column: 2; grid-row: 1; align-self: center; }
#lbsdlv-v3ia-chat .chat-top-right { grid-column: 3; grid-row: 1; justify-self: end; }

/* Le sous-texte passe sous toute la largeur, ligne 2 */
#lbsdlv-v3ia-chat .chat-sub {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 2px;
  font-size: 10px;
  color: rgba(56,40,29,.7);
}

#lbsdlv-v3ia-chat .chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  background: #ddd;
  box-shadow: 0 5px 16px rgba(0,0,0,.14);
}
#lbsdlv-v3ia-chat .chat-title {
  font-weight: 600;
  font-size: 14px;
  color: #322016;
  line-height: 1.2;
  white-space: normal;          /* autorise le retour à la ligne si nécessaire */
  overflow: visible;
  text-overflow: clip;
}


#lbsdlv-v3ia-chat .open-modal-btn {
  background: #fff;
  border: 1px solid rgba(230,134,61,.5);
  border-radius: 999px;
  padding: 5px 13px 6px;
  font-size: 12px;
  cursor: pointer;
  color: #235886;
  box-shadow: 0 3px 12px rgba(231,145,69,.35);
  transition: .16s;
}
/* même style pour le bouton de l’écran d’accueil */
#v3ia-screen1 .open-modal-btn {
  background: #fff;
  border: 1px solid rgba(230,134,61,.5);
  border-radius: 999px;
  padding: 5px 13px 6px;
  font-size: 12px;
  cursor: pointer;
  color: #235886;
  box-shadow: 0 3px 12px rgba(231,145,69,.35);
  transition: .16s;
}

#v3ia-screen1 .open-modal-btn:hover {
  transform: translateY(-1px);
}

#lbsdlv-v3ia-chat .open-modal-btn:hover {
  transform: translateY(-1px);
}

/* zone messages – un peu plus orangée */
#lbsdlv-v3ia-chat .chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px calc(80px + env(safe-area-inset-bottom, 0px)) 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, #fff2ea 0%, #f7ede6 100%);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#lbsdlv-v3ia-chat .chat-body::-webkit-scrollbar { display: none; }


/* lignes de messages */
#lbsdlv-v3ia-chat .msg-row {
  display: flex;
  gap: 6px;
  animation: msgIn .12s ease-out;
}
#lbsdlv-v3ia-chat .msg-row.left {
  justify-content: flex-start;
}
#lbsdlv-v3ia-chat .msg-row.right {
  justify-content: flex-end;
}

/* avatar à gauche pour le bot */
#lbsdlv-v3ia-chat .msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
  background: #f5c9a8;
  flex: 0 0 30px;
  margin-top: 2px;
  box-shadow: 0 2px 8px rgba(208,143,98,.4);
}

/* bulles de messages – plus contrastées */
#lbsdlv-v3ia-chat .msg-bubble {
  max-width: 78%;
  border-radius: 16px;
  padding: 6px 10px 14px 10px;
  font-size: 13px;
  line-height: 1.3;
  position: relative;
  white-space: pre-line;
  min-height: 30px;
}
#lbsdlv-v3ia-chat .msg-bubble.bot {
  background: #ffffff;
  border: 1px solid rgba(208,154,110,.12);
  box-shadow: 0 6px 14px rgba(181,142,109,.15);
  border-top-left-radius: 5px;
}
#lbsdlv-v3ia-chat .msg-bubble.user {
  background: radial-gradient(circle at top, #2f73ff 0%, #1550c5 100%);
  color: #fff;
  border-top-right-radius: 5px;
  box-shadow: 0 5px 18px rgba(25,67,153,.55);
}

/* heure dans la bulle */
#lbsdlv-v3ia-chat .msg-time {
  font-size: 10px;
  color: rgba(0,0,0,.28);
  position: absolute;
  bottom: 2px;
  right: 8px;
}
#lbsdlv-v3ia-chat .msg-bubble.user .msg-time {
  color: rgba(255,255,255,.6);
}

/* champ de saisie – un peu plus flottant */
#lbsdlv-v3ia-chat .chat-input {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px;
  background: #f2f2f2;
  border-top: 1px solid rgba(223,179,142,.4);
  backdrop-filter: saturate(1.1) blur(2px);
}


#lbsdlv-v3ia-chat .chat-input textarea {
  flex: 1;
  resize: none;
  min-height: 34px;
  max-height: 120px;
  border-radius: 14px;
  border: 1px solid rgba(214,163,125,.3);
  padding: 6px 8px;
  font-size: 13px;
  outline: none;
  background: #fffefd;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
#lbsdlv-v3ia-chat .send-btn {
  background: linear-gradient(160deg, #3579ff 0%, #1d55be 100%);
  border: none;
  color: #fff;
  border-radius: 999px;
  width: 36px;
  height: 34px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(29,73,136,.5);
}

/* modale accompagnateurs */
#accomp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}
#accomp-modal .accomp-modal-inner {
  background: #fffdf9;
  width: 320px;
  max-height: 80vh;
  border-radius: 17px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}
#accomp-modal .accomp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f2d0af;
}
#accomp-modal .accomp-modal-body {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#accomp-modal .accomp-item {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #ffe8d0;
  border-radius: 10px;
  padding: 7px 8px;
  cursor: pointer;
  transition: .14s;
  border: 1px solid rgba(0,0,0,.02);
}
#accomp-modal .accomp-item:hover {
  background: #ffd9b3;
}
#accomp-modal .accomp-item img {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(0,0,0,.05);
}
#accomp-modal .accomp-item-name {
  font-weight: 600;
  font-size: 13px;
}
#accomp-modal .accomp-item-text {
  font-size: 12px;
  color: #5f4a39;
}
#accomp-modal .am-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* bulle "en train d'écrire" */
#lbsdlv-v3ia-chat .typing-bubble {
  display: flex;
  gap: 3px;
  align-items: center;
  width: 50px;
  padding-bottom: 10px;
}
#lbsdlv-v3ia-chat .typing-dot {
  width: 5px;
  height: 5px;
  background: #b87f51;
  border-radius: 999px;
  display: inline-block;
  animation: typingBlink 1s infinite ease-in-out;
}
#lbsdlv-v3ia-chat .typing-dot:nth-child(2) { animation-delay: .15s; }
#lbsdlv-v3ia-chat .typing-dot:nth-child(3) { animation-delay: .3s; }

/* animations */
@keyframes msgIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes typingBlink {
  0%, 80%, 100% { opacity: .2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* mobile plein écran */
@media (max-width: 600px) {
  body #lbsdlv-v3ia-chat-wrapper {
    padding: 0;
    min-height: 100svh;
  }
  #lbsdlv-v3ia-chat.lbsdlv-chat-app {
    max-width: 100%;
    height: 100svh;
    border-radius: 0;
  }
  /* gouttières latérales pour l'écran d'accueil en mobile */
  #v3ia-screen1 .v3ia-card {
    width: auto;
    margin: 0 12px;   /* 12px de chaque côté */
  }

}

/* masque header/menu/captcha du thème */
.navbar,
#header,
.site-header,
.menu-toggle,
button[aria-controls="site-navigation"] {
  display: none !important;
}
.grecaptcha-badge {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}
/* === ÉCRAN D’ACCUEIL V3IA (MAJ) === */
#v3ia-screen1 {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
  background: inherit;
  transition: opacity 0.22s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.22s;
  z-index: 20;
}
#v3ia-screen1.is-hidden { opacity: 0; pointer-events: none; }
#v3ia-screen1.is-hiding { opacity: 0; transform: translateY(4px); pointer-events: none; }
#v3ia-screen1.is-active  { opacity: 1; transform: translateY(0); }

/* carte écran 1 = mêmes dimensions/arrondis/ombre que le chat */
.v3ia-card {
  position: relative;
  width: calc(100% - 24px);
  max-width: 420px;
  height: 90vh;
  max-height: 640px;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffe8d3 0%, #ffd9b3 100%);
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: 0 18px 45px rgba(176,138,105,.2);
  display: flex;
  flex-direction: column;
  padding: 0; /* haut collé comme le chat */
}

.v3ia-card-body {
  flex: 1;
  overflow: auto;                 /* autorise le défilement interne si nécessaire */
  padding: 8px 16px 80px;         /* réserve l’espace du pied pour ne rien masquer */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;          /* masque la barre (Firefox) */
}
.v3ia-card-body::-webkit-scrollbar { display: none; } /* masque la barre (WebKit) */


.v3ia-card-footer {
  padding: 10px 16px 14px;  /* -2/+ -4px */
  border-top: 1px solid rgba(223,179,142,.35);
  background: #fffaf6;
}

.v3ia-logo {
  width: 210px;              /* -12px */
  height: 72px;
  margin: 8px auto 1px;     /* moins d'espace sous le logo */
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.12));
}


.v3ia-greeting {
  font-size: 0.95em;        /* -0.1em */
  margin-bottom: 8px;       /* moins d'espace */
  color: #4b3a2f;
}

.v3ia-input {
  width: 100%;
  padding: 8px;             /* -2px */
  margin: 4px 0 8px;        /* marges réduites */
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.92em;        /* -0.03em */
}

.v3ia-btn {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 1em;
  border: none;
  border-radius: 12px;
  background-color: #c1723e;   /* ambre/taupe */
  color: #fff;
  cursor: pointer;
  transition: filter .15s ease;
  box-shadow: 0 2px 0 rgba(0,0,0,.06);
}
.v3ia-btn:hover { filter: brightness(0.95); }
.v3ia-btn:active { filter: brightness(0.9); }


/* Fond plus foncé du bloc input utilisateur dans le chat */
.chat-input-zone {
  background-color: #f2f2f2 !important;
  border-radius: 12px;
}
/* bouton thème (petit, discret, top-right) */
.theme-btn {
  margin-left: 6px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(176,138,105,.35);
  border-radius: 8px;
  background: #fff7ef;
  color: #5a4539;
  cursor: pointer;
  transition: background-color .15s;
}
.theme-btn:hover { background: #ffe9d6; }

/* Couche reprise / nouveau chat sur l'écran d'accueil */
.v3ia-resume-layer {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.35);
  z-index: 40;
}

.v3ia-resume-box {
  width: 100%;
  max-width: 320px;
  background: #fffdf9;
  border-radius: 18px;
  padding: 16px 18px 14px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}

.v3ia-resume-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #3b2a1d;
}

.v3ia-resume-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v3ia-resume-btn {
  padding: 9px 12px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.v3ia-resume-btn.primary {
  background: linear-gradient(135deg, #c1723e 0%, #a65a2a 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(161,93,46,.4);
}

.v3ia-resume-btn.secondary {
  background: #fff7ef;
  color: #5a4539;
  border: 1px solid rgba(176,138,105,.4);
}

/* === V3IA coach row (accueil) === */
.v3ia-card-footer {
  padding: 12px 20px 18px;
  border-top: 1px solid rgba(223,179,142,.35);
  background: #fffaf6;
}

.v3ia-row {
  display: flex;
  align-items: center;
  gap: 8px;                 /* -2px */
  margin: 4px 0 8px;        /* marges réduites */
}

.v3ia-picked {
  display: flex;
  align-items: flex-start;
  gap: 8px;                 /* -2px */
  margin: 6px 0 2px;        /* marges réduites */
  padding: 8px;             /* -2px */
  background: #fff7ef;
  border: 1px solid rgba(176,138,105,.25);
  border-radius: 10px;
}

.v3ia-picked.is-empty { display: none; }
.v3ia-picked img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 36px;
}
.v3ia-picked-name {
  font-weight: 600;
  color: #4b3a2f;
  margin-bottom: 2px;
}
.v3ia-picked-line {
  font-size: .92em;
  color: #6b574a;
  opacity: .9;
}


/* Élévation modale au-dessus de l'écran d'accueil */
#accomp-modal { z-index: 30; }
#v3ia-screen1 { z-index: 20; } /* l'écran 1 reste sous la modale */

/* Alignement strict du bouton “Choisir mon accompagnateur” (écran d’accueil) */
#v3ia-screen1 .open-modal-btn {
  background: #fff !important;
  border: 1px solid rgba(230,134,61,.5) !important;
  border-radius: 999px !important;
  padding: 5px 13px 6px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  color: #235886 !important;
  box-shadow: 0 3px 12px rgba(231,145,69,.35) !important;
  transition: .16s !important;
}

#v3ia-screen1 .open-modal-btn:hover {
  transform: translateY(-1px) !important;
}
/* Nom + micro-bouton engrenage inline */
#lbsdlv-v3ia-chat .chat-name-group {
  grid-column: 2;           /* se place sur la colonne du nom */
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;             /* évite les débordements */
}
#lbsdlv-v3ia-chat .chat-inline-btn {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.65);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  font-size: 12px;          /* taille de l'emoji ⚙️ */
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s, transform .12s;
}
#lbsdlv-v3ia-chat .chat-inline-btn:hover { background: #fff; transform: translateY(-1px); }
#lbsdlv-v3ia-chat .chat-inline-btn:active { transform: translateY(0); }
