/* Assistente AI di Luca Marzotto — usa i colori del sito (variabili :root di index.html). */
.lma-launcher{
  position:fixed;
  right:16px;
  bottom:98px;
  z-index:112;
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:52px;
  padding:0 20px 0 16px;
  border-radius:999px;
  border:1px solid rgba(73,240,141,.38);
  background:rgba(8,8,8,.94);
  color:var(--text,#f5f5f0);
  font:600 15px/1 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  box-shadow:0 14px 40px rgba(0,0,0,.4),0 0 0 6px rgba(73,240,141,.06);
  backdrop-filter:blur(10px);
  cursor:pointer;
  transition:transform .2s ease,opacity .2s ease,border-color .2s ease;
}
.lma-launcher:hover{transform:translateY(-2px);border-color:rgba(73,240,141,.6);}
.lma-launcher[hidden]{display:none;}
.lma-dot{
  width:10px;height:10px;border-radius:50%;
  background:var(--green,#49f08d);
  box-shadow:0 0 0 0 rgba(73,240,141,.6);
  animation:lma-pulse 2.2s infinite;
}
@keyframes lma-pulse{
  0%{box-shadow:0 0 0 0 rgba(73,240,141,.55);}
  70%{box-shadow:0 0 0 10px rgba(73,240,141,0);}
  100%{box-shadow:0 0 0 0 rgba(73,240,141,0);}
}
.lma-short{display:none;}

.lma-panel{
  position:fixed;
  right:16px;
  bottom:98px;
  z-index:2147483600;
  width:min(410px,calc(100vw - 32px));
  height:min(620px,calc(100vh - 130px));
  display:flex;
  flex-direction:column;
  border-radius:28px;
  border:1px solid var(--border-strong,rgba(255,255,255,.14));
  background:#070707;
  color:var(--text,#f5f5f0);
  box-shadow:0 30px 90px rgba(0,0,0,.6);
  font:400 15px/1.55 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  overflow:hidden;
  opacity:0;
  transform:translateY(12px) scale(.98);
  pointer-events:none;
  transition:opacity .2s ease,transform .2s ease;
}
.lma-panel.open{opacity:1;transform:none;pointer-events:auto;}

.lma-head{
  display:flex;align-items:center;gap:12px;
  padding:16px 16px 14px 18px;
  border-bottom:1px solid var(--border,rgba(255,255,255,.08));
  background:linear-gradient(180deg,rgba(73,240,141,.07),rgba(73,240,141,0));
}
.lma-avatar{
  position:relative;flex:none;
  width:40px;height:40px;border-radius:50%;
  display:grid;place-items:center;
  background:#101010;border:1px solid rgba(73,240,141,.35);
  font:700 14px/1 Georgia,'Times New Roman',serif;letter-spacing:.5px;color:#fff;
}
.lma-avatar img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block;}
.lma-avatar::after{
  content:"";position:absolute;right:0;bottom:1px;
  width:10px;height:10px;border-radius:50%;
  background:var(--green,#49f08d);border:2px solid #070707;
}
.lma-title{flex:1;min-width:0;}
.lma-title strong{display:block;font-size:15px;line-height:1.3;}
.lma-title small{display:block;color:var(--muted,#a5a5a5);font-size:12.5px;}
.lma-close{
  flex:none;width:36px;height:36px;border-radius:50%;
  border:1px solid var(--border,rgba(255,255,255,.08));
  background:#0d0d0d;color:#fff;font-size:20px;line-height:1;cursor:pointer;
}
.lma-close:hover{border-color:var(--border-strong,rgba(255,255,255,.14));}

.lma-note{
  margin:0;padding:8px 18px;
  font-size:12px;color:var(--muted-2,#7e7e7e);
  border-bottom:1px solid var(--border,rgba(255,255,255,.08));
}
.lma-note a{color:var(--muted,#a5a5a5);}

.lma-log{
  flex:1;overflow-y:auto;
  padding:18px 16px 8px;
  display:flex;flex-direction:column;gap:10px;
  scroll-behavior:smooth;
}
.lma-msg{
  max-width:86%;
  padding:11px 15px;
  border-radius:20px;
  white-space:pre-wrap;
  word-wrap:break-word;
  animation:lma-in .25s ease;
}
@keyframes lma-in{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:none;}}
.lma-msg.bot{
  align-self:flex-start;
  background:#111;border:1px solid var(--border,rgba(255,255,255,.08));
  border-bottom-left-radius:6px;
}
.lma-msg.user{
  align-self:flex-end;
  background:rgba(73,240,141,.14);border:1px solid rgba(73,240,141,.28);
  color:#effff5;border-bottom-right-radius:6px;
}

.lma-thinking{
  align-self:flex-start;
  display:flex;align-items:center;gap:10px;
  padding:11px 15px;border-radius:20px;border-bottom-left-radius:6px;
  background:#0d0d0d;border:1px dashed rgba(73,240,141,.25);
  color:var(--muted,#a5a5a5);font-size:13.5px;
}
.lma-dots{display:inline-flex;gap:4px;}
.lma-dots i{
  width:6px;height:6px;border-radius:50%;
  background:var(--green,#49f08d);opacity:.3;
  animation:lma-blink 1.2s infinite;
}
.lma-dots i:nth-child(2){animation-delay:.2s;}
.lma-dots i:nth-child(3){animation-delay:.4s;}
@keyframes lma-blink{0%,100%{opacity:.25;transform:translateY(0);}40%{opacity:1;transform:translateY(-2px);}}

.lma-contact{
  align-self:stretch;
  padding:14px;border-radius:20px;
  background:#0c0c0c;border:1px solid rgba(73,240,141,.28);
  display:grid;gap:8px;
}
.lma-contact strong{font-size:14px;}
.lma-contact input[type=text],
.lma-contact input[type=email],
.lma-contact input[type=tel],
.lma-contact select{
  width:100%;min-height:42px;padding:0 14px;
  border-radius:14px;border:1px solid var(--border,rgba(255,255,255,.08));
  background:#070707;color:#fff;font:inherit;font-size:14px;outline:none;
}
.lma-contact input:focus{border-color:rgba(73,240,141,.4);}
.lma-consent{display:flex;gap:8px;align-items:flex-start;font-size:12.5px;color:var(--muted,#a5a5a5);}
.lma-consent input{margin-top:3px;accent-color:#49f08d;}
.lma-consent a{color:#d8d8d8;}
.lma-error{color:#ff9b8f;font-size:12.5px;min-height:0;}
.lma-btn{
  min-height:44px;border:0;border-radius:999px;cursor:pointer;
  background:var(--green,#49f08d);color:#03140a;
  font-family:inherit;font-size:14px;font-weight:700;
}
.lma-btn:disabled{opacity:.6;cursor:wait;}

.lma-form{
  display:flex;align-items:flex-end;gap:8px;
  padding:10px 12px 12px;
  border-top:1px solid var(--border,rgba(255,255,255,.08));
}
.lma-input{
  flex:1;min-height:46px;max-height:120px;
  padding:12px 14px;border-radius:18px;resize:none;
  border:1px solid var(--border,rgba(255,255,255,.08));
  background:#0b0b0b;color:#fff;font:inherit;outline:none;
}
.lma-input:focus{border-color:rgba(73,240,141,.4);}
.lma-send{
  flex:none;width:46px;height:46px;border-radius:50%;border:0;cursor:pointer;
  background:var(--green,#49f08d);color:#03140a;font-size:20px;font-weight:700;
}
.lma-send:disabled{opacity:.45;cursor:default;}
.lma-foot{
  display:flex;justify-content:space-between;gap:10px;
  padding:0 16px 12px;font-size:12px;color:var(--muted-2,#7e7e7e);
}
.lma-foot button{
  background:none;border:0;padding:0;cursor:pointer;
  color:var(--green,#49f08d);font:inherit;text-decoration:underline;
}
.lma-foot button[hidden]{display:none;}

/* Pulsante "Assistente AI" nella barra mobile del sito: pulsa per attirare l'attenzione */
.lma-pulse{position:relative;gap:8px;animation:lma-glow 2.4s ease-in-out infinite;}
.lma-pulse-dot{
  display:inline-block;width:9px;height:9px;border-radius:50%;
  background:#03140a;box-shadow:0 0 0 0 rgba(3,20,10,.5);
  animation:lma-pulse-dark 2.4s infinite;margin-right:8px;vertical-align:middle;
}
@keyframes lma-glow{
  0%,100%{box-shadow:0 0 0 0 rgba(73,240,141,.55);}
  50%{box-shadow:0 0 0 8px rgba(73,240,141,0),0 0 24px rgba(73,240,141,.45);}
}
@keyframes lma-pulse-dark{
  0%{box-shadow:0 0 0 0 rgba(3,20,10,.55);}
  70%{box-shadow:0 0 0 7px rgba(3,20,10,0);}
  100%{box-shadow:0 0 0 0 rgba(3,20,10,0);}
}

@media (max-width:760px){
  .lma-launcher{
    right:12px;
    bottom:calc(16px + env(safe-area-inset-bottom));
    min-height:46px;padding:0 16px 0 14px;font-size:14px;
  }
  .lma-long{display:none;}
  .lma-short{display:inline;}
  /* In home su mobile la chat si apre dal pulsante "Assistente AI" della barra in basso */
  html.lma-has-sticky .lma-launcher{display:none !important;}
  .lma-panel{
    inset:0;right:0;bottom:0;
    width:100%;height:100%;
    border-radius:0;border:0;
    padding-bottom:env(safe-area-inset-bottom);
    z-index:2147483647;
  }
  /* Con la chat aperta la barra azioni del sito non deve coprire il campo di scrittura. */
  html.lma-open body #mobileStickyCta,
  html.lma-open body #lmWpMobileDock{
    display:none !important;
    visibility:hidden !important;
  }
}

@media (prefers-reduced-motion:reduce){
  .lma-dot,.lma-dots i,.lma-msg,.lma-pulse,.lma-pulse-dot{animation:none;}
  .lma-panel,.lma-launcher{transition:none;}
}
