/* Chat dei clienti (chat-cliente.js): un pezzo a sé, pensato per andare anche sul sito del negozio.
   Tutte le classi cominciano con «jc-» e i colori stanno nelle variabili qui sotto, così non si scontra col sito. */
.jc-radice {
  --jc-colore: #0a74c4;
  --jc-colore-scuro: #085d9e;
  --jc-testa: #0f172a;
  --jc-sfondo: #ffffff;
  --jc-bolla: #f1f4f8;
  --jc-testo: #18212b;
  --jc-tenue: #64748b;
  --jc-bordo: #e2e8f0;
  --jc-ombra: 0 24px 60px -12px rgba(15, 23, 42, .35);
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--jc-testo);
}
.jc-radice *, .jc-radice *::before, .jc-radice *::after { box-sizing: border-box; }
.jc-bottone {
  display: flex; align-items: center; gap: .55rem; margin-left: auto; padding: .8rem 1.15rem .8rem .95rem; border: 0;
  border-radius: 999px; background: var(--jc-colore); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 12px 30px -8px rgba(10, 116, 196, .6); transition: transform .15s, background .15s;
}
.jc-bottone:hover { background: var(--jc-colore-scuro); transform: translateY(-1px); }
.jc-bottone svg { width: 22px; height: 22px; }
.jc-aperta .jc-bottone { display: none; }

.jc-finestra {
  display: none; flex-direction: column; width: min(390px, calc(100vw - 24px)); height: min(620px, calc(100vh - 40px));
  height: min(620px, calc(100dvh - 40px)); background: var(--jc-sfondo); border-radius: 18px; overflow: hidden;
  box-shadow: var(--jc-ombra); border: 1px solid rgba(15, 23, 42, .08);
}
.jc-aperta .jc-finestra { display: flex; animation: jc-entra .22s ease-out; }
@keyframes jc-entra { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .jc-aperta .jc-finestra { animation: none; } }

.jc-testa { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; background: var(--jc-testa); color: #fff; }
.jc-avatar {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--jc-colore), #38bdf8); color: #fff; font-weight: 700;
}
.jc-testa-nome { font-weight: 650; line-height: 1.2; }
.jc-testa-stato { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: #cbd5e1; }
.jc-testa-stato::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34d399; }
.jc-testa-azioni { margin-left: auto; display: flex; gap: .25rem; }
.jc-icona {
  display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent;
  color: #e2e8f0; cursor: pointer;
}
.jc-icona:hover { background: rgba(255, 255, 255, .1); }
.jc-icona svg { width: 18px; height: 18px; }

.jc-messaggi { flex: 1; overflow-y: auto; padding: 1rem .9rem .5rem; display: flex; flex-direction: column; gap: .55rem;
               background: linear-gradient(180deg, #f8fafc, #ffffff 30%); }
.jc-msg { max-width: 86%; padding: .6rem .8rem; border-radius: 16px; word-wrap: break-word; }
.jc-bot { align-self: flex-start; background: var(--jc-bolla); border-bottom-left-radius: 5px; }
.jc-tu { align-self: flex-end; background: var(--jc-colore); color: #fff; border-bottom-right-radius: 5px; }
.jc-msg p { margin: 0 0 .45rem; } .jc-msg p:last-child { margin-bottom: 0; }
.jc-msg ul, .jc-msg ol { margin: .2rem 0 .45rem; padding-left: 1.15rem; } .jc-msg li { margin: .15rem 0; }
.jc-msg a { color: var(--jc-colore-scuro); }
.jc-errore { align-self: center; max-width: 92%; padding: .45rem .75rem; border-radius: 10px; background: #fff1f2; color: #be123c;
             font-size: .85rem; text-align: center; }
.jc-scrive { display: inline-flex; gap: 4px; padding: .2rem 0; }
.jc-scrive i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: jc-salta 1s infinite; }
.jc-scrive i:nth-child(2) { animation-delay: .15s; } .jc-scrive i:nth-child(3) { animation-delay: .3s; }
@keyframes jc-salta { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.jc-rapide { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .9rem .6rem; }
.jc-rapide button {
  padding: .4rem .75rem; border: 1px solid var(--jc-bordo); border-radius: 999px; background: #fff; color: var(--jc-colore-scuro);
  font: inherit; font-size: .85rem; cursor: pointer;
}
.jc-rapide button:hover { border-color: var(--jc-colore); background: #f0f7fd; }

.jc-scrivi { display: flex; align-items: flex-end; gap: .5rem; padding: .65rem .75rem; border-top: 1px solid var(--jc-bordo); }
.jc-scrivi textarea {
  flex: 1; min-height: 42px; max-height: 120px; margin: 0; padding: .6rem .75rem; resize: none; border: 1px solid var(--jc-bordo);
  border-radius: 12px; font: inherit; color: inherit; background: #fff; outline: none;
}
.jc-scrivi textarea:focus { border-color: var(--jc-colore); box-shadow: 0 0 0 3px rgba(10, 116, 196, .15); }
.jc-invia {
  display: grid; place-items: center; flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--jc-colore); color: #fff; cursor: pointer;
}
.jc-invia:disabled { opacity: .5; cursor: wait; }
.jc-invia svg { width: 19px; height: 19px; }
.jc-piede { padding: 0 .9rem .6rem; font-size: .72rem; color: var(--jc-tenue); text-align: center; }

@media (max-width: 480px) {
  .jc-radice { right: 12px; bottom: 12px; }
  .jc-aperta.jc-radice { inset: 0; }
  .jc-aperta .jc-finestra { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
}
/* Chi risponde: una persona del negozio (presa del controllo), messaggi del gestionale, il messaggio che sta partendo */
.jc-bottone { position: relative; }
.jc-nuovi { position: absolute; top: -6px; right: -4px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
            border-radius: 999px; background: #e11d48; color: #fff; font-size: .75rem; font-weight: 700; box-shadow: 0 0 0 2px #fff; }
.jc-nuovi[hidden] { display: none; }
.jc-testa-stato.jc-con-persona::before { background: #fbbf24; }
.jc-persona { background: #e8f6ee; }
.jc-sistema { background: #f4f4f5; color: var(--jc-tenue); font-size: .9rem; }
.jc-chi { display: block; margin-bottom: .2rem; color: #047857; font-size: .74rem; font-weight: 700; }
.jc-in-partenza { opacity: .6; }
.jc-largo { width: 86%; }

/* Modulo della lista d'attesa: nome e numero vanno al negozio, non in chat */
.jc-modulo { display: grid; gap: .45rem; margin: 0; }
.jc-modulo-titolo { color: var(--jc-tenue); font-size: .78rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.jc-modulo-cosa { margin-bottom: .15rem; font-weight: 650; }
.jc-modulo input:not([type="checkbox"]) {
  width: 100%; height: 40px; margin: 0; padding: 0 .7rem; border: 1px solid var(--jc-bordo); border-radius: 10px; background: #fff;
  color: inherit; font: inherit; outline: none;
}
.jc-modulo input:not([type="checkbox"]):focus { border-color: var(--jc-colore); box-shadow: 0 0 0 3px rgba(10, 116, 196, .15); }
.jc-modulo-spunta { display: flex; align-items: flex-start; gap: .5rem; margin: .1rem 0; color: var(--jc-tenue); font-size: .8rem; line-height: 1.35; }
.jc-modulo-spunta input { flex: none; width: 16px; height: 16px; margin: .1rem 0 0; accent-color: var(--jc-colore); }
.jc-modulo-errore { color: #be123c; font-size: .82rem; }
.jc-modulo-errore[hidden] { display: none; }
.jc-modulo-invia { height: 40px; border: 0; border-radius: 10px; background: var(--jc-colore); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.jc-modulo-invia:hover { background: var(--jc-colore-scuro); }
.jc-modulo-invia:disabled { opacity: .6; cursor: wait; }
.jc-modulo-fatto { display: flex; align-items: center; gap: .5rem; color: #047857; font-weight: 600; }
.jc-modulo-fatto svg { flex: none; width: 18px; height: 18px; }
.jc-modulo-spunta a { color: inherit; text-decoration: underline; }
.jc-contatto { margin-top: .25rem; }
