/* ═══════════════════════════════════════════════════════════════════
   v2-chat.css — Chatfolio : le portfolio parcouru comme une conversation.
   Même langage que le reste du site (Jost, accent --p1, filets --n3).
   ═══════════════════════════════════════════════════════════════════ */

.chat-wrap{
  display:flex;flex-direction:column;
  height:calc(100vh - 0px);max-height:100vh;
  padding:0;
}

/* ── En-tête ── */
.chat-head{
  display:flex;align-items:center;gap:1rem;
  padding:1.25rem var(--gutter);
  border-bottom:1px solid rgba(var(--n3),.28);flex-shrink:0;
}
.chat-head-av{
  width:46px;height:46px;border-radius:50%;flex-shrink:0;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
  background:rgb(var(--p1));color:#fff;font-size:15px;font-weight:600;
}
.chat-head-av img{width:100%;height:100%;object-fit:cover;}
.chat-head-t{font-size:17px;font-weight:600;line-height:1.25;}
.chat-head-s{font-size:13px;color:rgb(var(--n3));display:flex;align-items:center;gap:.4rem;margin-top:.1rem;}
.chat-head-s::before{content:"";width:7px;height:7px;border-radius:50%;background:#22c55e;}
.chat-reset{
  margin-left:auto;display:inline-flex;align-items:center;gap:.4rem;
  font-size:13px;font-weight:500;color:rgb(var(--n4));cursor:pointer;
  background:transparent;border:1px solid rgba(var(--n3),.4);
  padding:8px 14px;border-radius:100px;transition:all .3s var(--ease);
}
.chat-reset:hover{color:rgb(var(--p1));border-color:rgb(var(--p1));}
.chat-reset svg{width:15px;height:15px;}

/* ── Fil de discussion ── */
.chat-log{
  flex:1;overflow-y:auto;padding:1.75rem var(--gutter);
  display:flex;flex-direction:column;gap:1rem;scroll-behavior:smooth;
}
.chat-row{display:flex;gap:.75rem;max-width:760px;}
.chat-row.me{align-self:flex-end;flex-direction:row-reverse;}
.chat-av{
  width:34px;height:34px;border-radius:50%;flex-shrink:0;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
  background:rgba(var(--p1),.14);color:rgb(var(--p1));font-size:12px;font-weight:600;
}
.chat-av img{width:100%;height:100%;object-fit:cover;}
.chat-row.me .chat-av{background:rgba(var(--n3),.2);color:rgb(var(--n4));}

.chat-bubble{
  background:rgb(var(--n2));border:1px solid rgba(var(--n3),.28);
  border-radius:16px 16px 16px 4px;padding:1rem 1.25rem;
  font-size:16px;line-height:165%;color:rgb(var(--n5));min-width:0;
}
.chat-row.me .chat-bubble{
  background:rgb(var(--p1));color:#fff;border-color:transparent;
  border-radius:16px 16px 4px 16px;
}
.chat-bubble p{margin-bottom:.7rem;}
.chat-bubble p:last-child{margin-bottom:0;}
.chat-bubble strong{font-weight:600;}
.chat-bubble a{color:rgb(var(--p1));text-decoration:underline;}
.chat-row.me .chat-bubble a{color:#fff;}
.chat-bubble ul{margin:.5rem 0 .2rem;display:flex;flex-direction:column;gap:.45rem;}
.chat-bubble li{display:flex;gap:.6rem;align-items:flex-start;font-size:15px;}
.chat-bubble li::before{content:"";width:6px;height:6px;border-radius:50%;background:rgb(var(--p1));margin-top:.55rem;flex-shrink:0;}

/* Indicateur de frappe */
.chat-typing{display:flex;gap:5px;padding:.35rem .2rem;}
.chat-typing span{
  width:8px;height:8px;border-radius:50%;background:rgba(var(--n3),.7);
  animation:chatBounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2){animation-delay:.15s;}
.chat-typing span:nth-child(3){animation-delay:.3s;}
@keyframes chatBounce{0%,60%,100%{transform:translateY(0);opacity:.5;}30%{transform:translateY(-5px);opacity:1;}}

/* ── Fiches riches dans une bulle ── */
.chat-stats{display:flex;flex-wrap:wrap;gap:.6rem;margin-top:.8rem;}
.chat-stat{
  background:rgba(var(--p1),.10);border:1px solid rgba(var(--p1),.24);
  border-radius:10px;padding:.6rem .9rem;
}
.chat-stat b{display:block;font-size:20px;font-weight:600;color:rgb(var(--p1));line-height:1.1;}
.chat-stat span{font-size:12px;color:rgb(var(--n3));}

.chat-skill{margin-top:.75rem;}
.chat-skill-h{display:flex;justify-content:space-between;font-size:14px;margin-bottom:.3rem;}
.chat-skill-h b{font-weight:500;}
.chat-skill-h i{font-style:normal;color:rgb(var(--p1));font-weight:600;}
.chat-skill-t{height:5px;border-radius:3px;background:rgba(var(--n3),.22);overflow:hidden;}
.chat-skill-f{height:100%;border-radius:3px;background:rgb(var(--p1));width:0;transition:width .9s var(--ease);}

.chat-proj{
  margin-top:.9rem;border:1px solid rgba(var(--n3),.28);border-radius:12px;overflow:hidden;
  background:rgb(var(--n1));
}
.chat-proj-img{aspect-ratio:16/9;background:rgba(var(--n3),.14);overflow:hidden;}
.chat-proj-img img{width:100%;height:100%;object-fit:cover;}
.chat-proj-ph{
  width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  font-size:34px;font-weight:600;color:rgba(var(--n4),.45);
}
.chat-proj-body{padding:1rem 1.15rem;}
.chat-proj-cat{font-size:12px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:rgb(var(--p1));}
.chat-proj-t{font-size:18px;font-weight:600;margin:.25rem 0 .4rem;line-height:1.3;}
.chat-proj-d{font-size:14px;color:rgb(var(--n3));line-height:1.6;}
.chat-proj-tags{display:flex;gap:.4rem;flex-wrap:wrap;margin-top:.7rem;}
.chat-proj-tags li{font-size:12px;color:rgb(var(--n4));border:1px solid rgba(var(--n3),.35);padding:2px 10px;border-radius:100px;}
.chat-proj-tags li::before{display:none;}

/* ── Boutons de rebond ── */
.chat-opts{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.9rem;}
.chat-opt{
  display:inline-flex;align-items:center;gap:.4rem;
  font-family:var(--ff);font-size:14px;font-weight:500;
  padding:8px 16px;border-radius:100px;cursor:pointer;
  background:transparent;color:rgb(var(--p1));
  border:1px solid rgba(var(--p1),.45);transition:all .3s var(--ease);
}
.chat-opt:hover{background:rgb(var(--p1));color:#fff;border-color:rgb(var(--p1));}
.chat-opt svg{width:15px;height:15px;}
.chat-opt.solid{background:rgb(var(--p1));color:#fff;border-color:rgb(var(--p1));}
.chat-opt.solid:hover{filter:brightness(1.1);}

/* ── Barre de saisie ── */
.chat-foot{
  flex-shrink:0;border-top:1px solid rgba(var(--n3),.28);
  padding:1rem var(--gutter) 1.25rem;background:rgb(var(--n1));
}
.chat-hints{display:flex;gap:.45rem;flex-wrap:wrap;margin-bottom:.8rem;align-items:center;}
.chat-hints-l{font-size:13px;color:rgb(var(--n3));margin-right:.2rem;}
.chat-hint{
  font-family:var(--ff);font-size:13px;font-weight:500;cursor:pointer;
  padding:5px 13px;border-radius:100px;color:rgb(var(--n4));
  background:rgba(var(--n3),.12);border:1px solid transparent;transition:all .3s var(--ease);
}
.chat-hint:hover{color:rgb(var(--p1));border-color:rgba(var(--p1),.45);background:rgba(var(--p1),.08);}
.chat-form{display:flex;gap:.6rem;align-items:center;}
.chat-input{
  flex:1;min-width:0;background:rgb(var(--n2));
  border:1px solid rgba(var(--n3),.4);border-radius:100px;
  padding:13px 20px;color:rgb(var(--n5));font-family:var(--ff);font-size:16px;
  outline:none;transition:all .3s var(--ease);
}
.chat-input:focus{border-color:rgb(var(--p1));box-shadow:0 0 0 3px rgba(var(--p1),.16);}
.chat-send{
  width:48px;height:48px;border-radius:50%;flex-shrink:0;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  background:rgb(var(--p1));color:#fff;border:none;transition:all .3s var(--ease);
}
.chat-send:hover:not(:disabled){filter:brightness(1.1);transform:scale(1.05);}
.chat-send:disabled{opacity:.4;cursor:not-allowed;}
.chat-send svg{width:19px;height:19px;}

@media(max-width:991px){
  .chat-wrap{height:calc(100vh - 64px);}
  .chat-head{padding-left:calc(var(--gutter) + 52px);}
}
@media(max-width:600px){
  .chat-row{max-width:100%;}
  .chat-bubble{font-size:15px;padding:.85rem 1.05rem;}
  .chat-hints-l{display:none;}
}
@media (prefers-reduced-motion:reduce){
  .chat-log{scroll-behavior:auto;}
  .chat-typing span{animation:none;}
}

/* ══════════════════════════════════════════════════════════════════
   BULLE FLOTTANTE — ouvre le chatfolio en fenêtre, sur toutes les pages
   ══════════════════════════════════════════════════════════════════ */
.chat-fab{
  position:fixed;right:1.5rem;bottom:1.5rem;z-index:120;
  width:58px;height:58px;border-radius:50%;border:none;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  background:rgb(var(--p1));color:#fff;
  box-shadow:0 8px 28px rgba(0,0,0,.22);
  transition:transform .3s var(--ease),filter .3s var(--ease);
}
.chat-fab:hover{filter:brightness(1.1);transform:translateY(-3px) scale(1.04);}
.chat-fab svg{width:25px;height:25px;}
.chat-fab-ico{display:flex;align-items:center;justify-content:center;}
.chat-fab .chat-fab-close{display:none;}
.chat-fab.open .chat-fab-open{display:none;}
.chat-fab.open .chat-fab-close{display:flex;}

/* Pastille d'appel tant que la conversation n'a pas été ouverte */
.chat-fab-dot{
  position:absolute;top:3px;right:3px;width:13px;height:13px;border-radius:50%;
  background:#ef4444;border:2px solid rgb(var(--n1));display:none;
}
.chat-fab.has-dot .chat-fab-dot{display:block;}
.chat-fab.has-dot::after{
  content:"";position:absolute;inset:0;border-radius:50%;
  border:2px solid rgb(var(--p1));animation:chatPulse 2.4s infinite ease-out;
}
@keyframes chatPulse{
  0%{transform:scale(1);opacity:.7;}
  100%{transform:scale(1.5);opacity:0;}
}

/* ── Fenêtre ── */
.chat-pop{
  position:fixed;right:1.5rem;bottom:5.5rem;z-index:119;
  width:min(400px, calc(100vw - 3rem));
  height:min(600px, calc(100vh - 8rem));
  display:flex;flex-direction:column;overflow:hidden;
  background:rgb(var(--n1));border:1px solid rgba(var(--n3),.3);
  border-radius:18px;box-shadow:0 18px 60px rgba(0,0,0,.26);
  transform-origin:bottom right;
  animation:chatPopIn .28s var(--ease);
}
@keyframes chatPopIn{
  from{opacity:0;transform:translateY(14px) scale(.96);}
  to{opacity:1;transform:none;}
}
.chat-pop[hidden]{display:none;}
.chat-pop .chat-head{padding:1rem 1.1rem;gap:.7rem;}
.chat-pop .chat-head-av{width:38px;height:38px;font-size:13px;}
.chat-pop .chat-head-t{font-size:15px;}
.chat-pop .chat-head-s{font-size:12px;}
.chat-pop .chat-reset{padding:7px;border-radius:50%;margin-left:auto;}
.chat-pop .chat-log{padding:1.1rem;gap:.8rem;}
.chat-pop .chat-row{max-width:100%;}
.chat-pop .chat-bubble{font-size:15px;padding:.8rem 1rem;line-height:155%;}
.chat-pop .chat-foot{padding:.8rem 1.1rem 1rem;}
.chat-pop .chat-hints{margin-bottom:.6rem;}
.chat-pop .chat-hint{font-size:12px;padding:4px 11px;}
.chat-pop .chat-input{padding:11px 16px;font-size:15px;}
.chat-pop .chat-send{width:42px;height:42px;}
.chat-pop .chat-send svg{width:17px;height:17px;}
.chat-pop .chat-stat b{font-size:17px;}
.chat-pop .chat-opt{font-size:13px;padding:6px 13px;}

.chat-pop-close{
  width:32px;height:32px;border-radius:50%;flex-shrink:0;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  background:transparent;border:1px solid rgba(var(--n3),.35);
  color:rgb(var(--n4));transition:all .3s var(--ease);
}
.chat-pop-close:hover{color:rgb(var(--p1));border-color:rgb(var(--p1));}
.chat-pop-close svg{width:15px;height:15px;}
.chat-pop-full{text-align:center;margin-top:.6rem;font-size:12px;color:rgb(var(--n3));}
.chat-pop-full a{color:rgb(var(--p1));text-decoration:underline;}

/* Le bouton admin remonte pour ne pas chevaucher la bulle */
.v2-admin-float{bottom:calc(1.5rem + 70px);}

@media(max-width:600px){
  .chat-fab{right:1rem;bottom:1rem;width:52px;height:52px;}
  .chat-pop{
    right:.75rem;left:.75rem;bottom:4.75rem;width:auto;
    height:min(560px, calc(100vh - 7rem));
  }
}
@media (prefers-reduced-motion:reduce){
  .chat-pop{animation:none;}
  .chat-fab.has-dot::after{animation:none;opacity:0;}
}
