/* app/css/chat.css : compléments du panneau de discussion (base : .chat, .cmsg, .typing, .chat-fab de maquette.css),
   discussion en grand (#/discussion/<agent>) et discussion compacte (panneaux du tableau de bord). */
.chat .chat-av,.discussion .chat-av{display:flex;flex:none}
/* mascottes des agents (R3) : en-tête, rangée des agents, bouton flottant */
.chat-av .mascotte{width:34px;height:34px;border-radius:50%}
.chat-agents button .mascotte{width:28px;height:28px;border-radius:50%;flex:none}
.chat-fab .mascotte{width:34px;height:34px;border-radius:50%;background:#fff;flex:none}
.chat.indispo .chat-head .live,.discussion.indispo .chat-head .live{background:var(--muted2);box-shadow:0 0 0 2px rgba(138,150,168,.2)}
.chat-head .chat-grand i{transform:rotate(-45deg)}

/* discussion hors du panneau : en grand (vue #/discussion/<agent>) ou compacte (tableau de bord) */
.discussion{display:flex;flex-direction:column;min-height:0;background:#fff;border:1px solid var(--line);border-radius:16px;overflow:hidden;box-shadow:var(--shadow)}
.discussion .chat-agents{padding-top:12px}
.discussion-grande{height:calc(100dvh - 230px);min-height:460px}
.discussion-compacte{height:440px}
.discussion-compacte .chat-head{padding:12px 14px 10px;border-bottom:1px solid var(--line)}
.discussion-compacte .chat-head .btn{flex:none}

/* fil */
.cmsg .b strong{font-weight:650;color:var(--navy)}
.cmsg.out .b strong{color:#fff}
.cmsg .acts .btn i{width:15px;height:15px}
.cmsg.erreur .b{background:#FDF3F3;border-color:#F3C4C4;color:#7A1E1E}
.cmsg.provisoire{opacity:.75}
/* adresse longue sans espace (source du Radar, page LinkedIn) : coupée dans la bulle, jamais hors de l'écran */
.cmsg{min-width:0}
.cmsg .b{overflow-wrap:anywhere}
.cmsg .b .chat-lien{color:var(--blue);font-weight:600;text-decoration:underline;text-underline-offset:2px}
.cmsg.out .b .chat-lien{color:#fff}
.chat-indispo .btn{margin-top:10px}
.chat-auteur{font-weight:600;color:var(--muted);margin-right:6px}
.chat-attente{display:grid;place-items:center;flex:1;min-height:120px}
.chat-accueil,.chat-indispo{align-self:center;max-width:320px;text-align:center;color:var(--muted);font-size:13px;line-height:1.5;margin:auto 0}
.chat-indispo i{display:inline-block;width:22px;height:22px;color:var(--muted2);margin-bottom:6px}

/* Oui / Non : question fermée de l'agent (R5) et proposition d'action (R26) */
.chat-oui-non{display:flex;gap:8px;flex-wrap:wrap}
.chat-oui-non .btn{min-width:64px;justify-content:center}
.chat-prop{background:#fff;border:1px solid color-mix(in srgb,var(--c,var(--blue)) 35%,var(--line));border-radius:12px;padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.chat-prop-quoi{font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.chat-prop-texte{font-size:13.3px;line-height:1.45;color:var(--navy);font-weight:600;overflow-wrap:anywhere}
.chat-prop-etat{font-size:12px;color:var(--muted)}
.chat-prop-etat.acceptee{color:#167A3E}
.chat-prop-etat.echouee{color:#B42318}
.chat-exemples{display:flex;flex-direction:column;gap:6px}
.chat-exemples-titre{font-size:12px;color:var(--muted)}
.chat-exemple{background:var(--bg);border-radius:10px;padding:8px 10px;font-size:12.5px;line-height:1.45}
.chat-exemple b{display:block;font-size:11.5px;color:var(--muted);margin-bottom:2px}
.chat-exemple p{white-space:pre-line;overflow-wrap:anywhere}

/* pièces jointes (R25) */
.chat-pieces-msg{display:flex;gap:6px;flex-wrap:wrap}
.cmsg.out .chat-pieces-msg{justify-content:flex-end}
.chat-piece-img img{display:block;max-width:220px;max-height:180px;border-radius:12px;border:1px solid var(--line);object-fit:cover;background:#fff}
.chat-piece-lien{display:inline-flex;align-items:center;gap:6px;max-width:260px;padding:7px 10px;border:1px solid var(--line);border-radius:12px;background:#fff;font-size:12.5px;color:var(--navy)}
.chat-piece-lien i{width:15px;height:15px;flex:none}
.chat-piece-lien span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
.chat-piece-lien small{color:var(--muted);white-space:nowrap}
.chat-pieces{display:flex;gap:6px;flex-wrap:wrap;padding:10px 18px 0}
.chat-piece{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:4px 4px 4px 8px;border:1px solid var(--line);border-radius:10px;background:#fff;font-size:12px}
.chat-piece img{width:28px;height:28px;border-radius:6px;object-fit:cover}
.chat-piece > i{width:15px;height:15px;color:var(--muted)}
.chat-piece-nom{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:160px;font-weight:600;color:var(--navy)}
.chat-piece small{color:var(--muted)}
.chat-piece button{width:24px;height:24px;border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--muted)}
.chat-piece button:hover{background:var(--bg);color:#B42318}
.chat-piece button i{width:14px;height:14px}
.chat.depot .chat-body,.discussion.depot .chat-body{outline:2px dashed var(--blue);outline-offset:-8px;background:color-mix(in srgb,var(--blue) 5%,var(--bg))}

/* raccourcis réglés par Blueia (R9) : même allure que les anciennes suggestions de la maquette */
.chat-raccourcis{display:flex;gap:6px;flex-wrap:wrap;padding:12px 18px 0;border-top:1px solid var(--line)}
.chat-raccourcis button{font-size:12.5px;font-weight:500;line-height:1.35;padding:6px 11px;border-radius:999px;border:1px solid var(--line);background:#fff;color:var(--navy);text-align:left}
.chat-raccourcis button:hover{border-color:var(--c);background:color-mix(in srgb,var(--c) 7%,#fff)}

/* saisie */
.chat-form input:disabled{background:var(--bg);cursor:not-allowed}
.chat-form button[disabled]{opacity:.5;cursor:not-allowed}
.chat-form button[disabled]:hover{background:var(--navy)}
.chat-form .chat-joindre{background:#fff;color:var(--muted);border:1px solid var(--line)}
.chat-form .chat-joindre:hover{background:var(--bg);color:var(--navy)}
.chat-form .chat-joindre[disabled]:hover{background:#fff}

/* pied du panneau */
.chat-note{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-bottom:max(14px,env(safe-area-inset-bottom))}
.chat-effacer{font-size:11.5px;font-weight:600;color:var(--muted);text-decoration:underline;text-underline-offset:2px;white-space:nowrap}
.chat-effacer:hover{color:#B42318}
.chat-effacer[hidden]{display:none}

/* téléphone : bouton flottant et en-tête hors des zones système ; raccourcis sur une ligne qui défile,
   pour laisser la hauteur au fil quand le clavier est ouvert (pas de masquage au focus : le toucher d'une pastille serait perdu) */
@media (max-width:600px){
  .chat-fab{bottom:max(16px,env(safe-area-inset-bottom))}
  .chat-head{padding-top:max(16px,env(safe-area-inset-top))}
  .chat-raccourcis{flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;padding-bottom:2px}
  .chat-raccourcis::-webkit-scrollbar{display:none}
  .chat-raccourcis button{white-space:nowrap;flex:none}
  .chat-form{gap:6px}
  .discussion-grande{height:calc(100dvh - 190px);min-height:400px;border-radius:12px}
  .chat-piece-img img{max-width:180px}
}
@media (prefers-reduced-motion:reduce){
  .chat,.cmsg.new,.typing span{transition:none;animation:none}
}

/* Champs de saisie à 16 px au téléphone et sur tout écran tactile : en dessous, Safari sur iPhone zoome à chaque saisie
   et reste zoomé. Placé dans la dernière feuille chargée, avec !important, pour passer devant les tailles des pages
   (.ca-form .champ textarea, .lin-simu-groupe .saisie…). Le code à 6 chiffres garde ses 20 px. */
@media (max-width:600px),(hover:none) and (pointer:coarse){
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not(.code-saisie),textarea,select{font-size:16px!important}
}

/* Téléphone couché ou fenêtre basse : raccourcis sur une ligne, en-tête et choix d'agent resserrés, le fil garde sa place */
@media (max-height:520px){
  .chat-raccourcis{flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;padding-top:8px;padding-bottom:2px}
  .chat-raccourcis::-webkit-scrollbar{display:none}
  .chat-raccourcis button{white-space:nowrap;flex:none}
  .chat-head{padding-top:8px;padding-bottom:6px}
  .chat-agents{padding-bottom:6px}
  .chat-agents button{flex-direction:row;justify-content:center;gap:6px;padding:4px 6px}
  .chat-head,.chat-agents,.chat-raccourcis,.chat-pieces,.chat-form,.chat-note{flex:none}
  .chat-note{padding-top:4px}
}
/* Téléphone : le bouton « Discuter » devient une pastille ronde (libellé lu par les lecteurs d'écran) qui s'efface
   pendant le défilement vers le bas, pour ne pas couvrir « Refuser » ou « Écarter » au bas d'une carte */
@media (max-width:600px){
  .chat-fab{width:46px;padding:0;justify-content:center;gap:0}
  .chat-fab > span:not(.av){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .chat-fab.cache{transform:translateY(calc(100% + 24px));opacity:0;pointer-events:none}
}
@media (prefers-reduced-motion:reduce){
  .chat-fab{transition:none}
}
