/* ===== Arti-IT Chat Widget ===== */
:root{
  --ac-bg:#ffffff;
  --ac-ink:#0f172a;
  --ac-muted:#64748b;
  --ac-bd:#e5e7eb;
  --ac-shadow: 0 18px 55px rgba(2,6,23,.18);
  --ac-radius:16px;
}

.arti-chat-root{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:999999;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial;
  color:var(--ac-ink);
}

/* launcher bubble */
.arti-chat-launcher{
  width:56px;height:56px;border-radius:18px;
  border:0;cursor:pointer;
  background: linear-gradient(90deg,#7c3aed,#06b6d4);
  box-shadow: 0 14px 34px rgba(6,182,212,.25);
  display:flex;align-items:center;justify-content:center;
}
.arti-chat-launcher:active{ transform: translateY(1px); }

.arti-chat-launcher svg{ width:22px;height:22px; fill:#fff; }

/* panel */
.arti-chat-panel{
  position:absolute;
  right:0;
  bottom:72px;
  width:360px;
  max-width: calc(100vw - 24px);
  height:540px;
  max-height: calc(100vh - 120px);
  background:var(--ac-bg);
  border:1px solid var(--ac-bd);
  border-radius: var(--ac-radius);
  box-shadow: var(--ac-shadow);
  overflow:hidden;

  /* ✅ default chiuso */
  display:none;
  flex-direction:column;
}

/* ✅ quando aperto */
.arti-chat-panel.is-open{ display:flex; }

.arti-chat-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 12px;
  border-bottom:1px solid var(--ac-bd);
  background:linear-gradient(180deg,#f8fafc,#fff);
}
.arti-chat-title{ font-weight:800; font-size:14px; line-height:1.1; }
.arti-chat-sub{ font-size:12px; color:var(--ac-muted); margin-top:2px; }

.arti-chat-close{
  border:1px solid var(--ac-bd);
  background:#fff;
  width:34px;height:34px;border-radius:12px;
  cursor:pointer;
}
.arti-chat-close:hover{ background:#f1f5f9; }

.arti-chat-cta{
  display:flex; gap:8px; flex-wrap:wrap;
  padding:10px 12px;
  border-bottom:1px solid var(--ac-bd);
  background:#fff;
}
.arti-chat-cta a{
  text-decoration:none;
  color:var(--ac-ink);
  font-size:12px;
  font-weight:700;
  border:1px solid var(--ac-bd);
  padding:7px 10px;
  border-radius:999px;
  background:#fff;
}
.arti-chat-cta a:hover{ background:#f1f5f9; }

.arti-chat-quick{
  padding:10px 12px;
  display:flex; gap:8px; flex-wrap:wrap;
}
.arti-chat-quick button{
  border:1px solid var(--ac-bd);
  background:#fff;
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  cursor:pointer;
}
.arti-chat-quick button:hover{ background:#f1f5f9; }

.arti-chat-body{
  flex:1;
  padding:12px;
  overflow:auto;
  background: linear-gradient(180deg,#ffffff,#f8fafc);
}

.arti-msg{
  max-width: 92%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--ac-bd);
  line-height:1.35;
  font-size:13px;
  word-wrap:break-word;
  margin: 0 0 10px 0;
}
.arti-msg.user{
  margin-left:auto;
  background:rgba(124,58,237,.08);
}
.arti-msg.bot{
  margin-right:auto;
  background:#fff;
}

.arti-chat-footer{
  border-top:1px solid var(--ac-bd);
  padding:10px;
  background:#fff;
}
.arti-chat-row{
  display:flex; gap:8px; align-items:flex-end;
}
.arti-chat-input{
  flex:1;
  min-height:42px;
  max-height:120px;
  resize:vertical;
  border:1px solid var(--ac-bd);
  border-radius:12px;
  padding:10px 10px;
  font-size:13px;
  outline:none;
  box-sizing:border-box;
}
.arti-chat-send{
  width:78px;
  border:0;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  color:#fff;
  font-weight:800;
  background: linear-gradient(90deg,#7c3aed,#06b6d4);
}
.arti-chat-send:disabled{ opacity:.6; cursor:not-allowed; }

/* mobile */
@media (max-width: 520px){
  .arti-chat-panel{
    width: calc(100vw - 24px);
    height: 70vh;
  }
}
