#novaai-chat { font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
#novaai-chat svg{ width:18px; height:18px; fill: currentColor; }

#novaai-chat{
  position: fixed;
  bottom: 12px;
  z-index: 2147483000;
}
#novaai-chat.is-right{ right: 12px; }
#novaai-chat.is-left{ left: 12px; }

#novaai-chat .novaai-fab{
  width:52px;height:52px;border-radius:16px;border:0;cursor:pointer;
  background:var(--novaai-primary);color:var(--novaai-bubble-color);
  box-shadow:0 14px 35px rgba(0,0,0,.22);
  display:flex;align-items:center;justify-content:center;
  position:relative;
}
#novaai-chat .novaai-fab__icon{ 
  font-size:20px;
  font-weight:800;
  line-height:1;
}
#novaai-chat .novaai-fab__dot{
  position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:999px;
  background:#2ee59d;box-shadow:0 0 0 3px rgba(46,229,157,.18);
}

#novaai-chat .novaai-panel{
  position:absolute;
  bottom:64px;
  width:460px;
  max-width:calc(100vw - 24px);
  max-height:80vh;
  background:rgba(255,255,255,.98);
  backdrop-filter:blur(14px);
  border:1px solid rgba(15,23,42,.10);
  border-radius:16px;
  box-shadow:0 20px 50px rgba(0,0,0,.22);
  overflow:hidden;
  opacity:0;pointer-events:none;
  transform:translateY(10px) scale(.98);
  transition:all .18s ease;
  display:flex;
  flex-direction:column;
}
#novaai-chat.is-open .novaai-panel{
  opacity:1;pointer-events:auto;
  transform:translateY(0) scale(1);
}
#novaai-chat.is-right .novaai-panel{ right:0; }
#novaai-chat.is-left .novaai-panel{ left:0; }

.novaai-panel__top{
  padding:10px 12px 8px;
  display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid rgba(15,23,42,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.75));
  flex-shrink:0;
  z-index:10;
}
.novaai-agent{ display:flex;align-items:center;gap:8px; }
.novaai-agent__avatar{
  width:36px;height:36px;border-radius:12px;
  background:var(--novaai-primary);color:var(--novaai-bubble-color);
  display:flex;align-items:center;justify-content:center;
  font-weight:800;
  font-size:14px;
  flex-shrink:0;
}
.novaai-agent__info{
  min-width:0;
  flex:1;
}
.novaai-agent__name{ 
  font-weight:800;font-size:13px;line-height:1.1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.novaai-agent__sub{ font-size:11px;opacity:.72;margin-top:2px; }
.novaai-x{
  width:32px;height:32px;border-radius:10px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.8);
  cursor:pointer;
  font-size:18px;line-height:26px;
  flex-shrink:0;
}

.novaai-panel__body{
  flex:1;
  overflow-y:auto;
  overflow-x:hidden;
  padding:12px;
  min-height:0;
  display:flex;
  flex-direction:column;
}
.novaai-messages{ 
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:1;
  min-height:min-content;
}

.novaai-msg{ display:flex; }
.novaai-msg.is-user{ justify-content:flex-end; }
.novaai-msg.is-ai{ justify-content:flex-start; }

.novaai-bubble{
  max-width:82%;
  padding:10px 12px;border-radius:14px;
  font-size:14px;line-height:1.4;white-space:pre-wrap;
  word-wrap:break-word;
  overflow-wrap:break-word;
  border:1px solid rgba(15,23,42,.08);
  box-shadow:0 6px 18px rgba(0,0,0,.06);
}
.novaai-msg.is-user .novaai-bubble{
  background:var(--novaai-primary);color:#fff;border-color:rgba(255,255,255,.18);
}
.novaai-msg.is-ai .novaai-bubble{
  background:rgba(255,255,255,.86);color:#0f172a;
}

.novaai-typing .dot{
  display:inline-block;width:6px;height:6px;margin:0 2px;border-radius:999px;
  background:rgba(15,23,42,.35);
  animation:novaaiDot 1.1s infinite ease-in-out;
}
.novaai-typing .dot:nth-child(2){ animation-delay:.12s; }
.novaai-typing .dot:nth-child(3){ animation-delay:.24s; }
@keyframes novaaiDot{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-3px);opacity:1}}

.novaai-panel__quick{
  padding: 0 12px 8px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  flex-shrink:0;
}
.novaai-quick{
  flex:1;
  min-width:calc(50% - 4px);
  border-radius: 10px;
  padding: 10px 8px;
  font-weight: 800;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.85);
  cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:6px;
  font-size: 12px;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.novaai-quick:hover{
  border-color: rgba(43,89,255,.25);
  background: rgba(43,89,255,.08);
}

.novaai-panel__consent{ 
  padding: 0 12px 8px;
  flex-shrink:0;
}
.novaai-panel__consent.is-hidden{ display:none; }
.novaai-consent{
  background:rgba(255,255,255,.72);
  border:1px solid rgba(15,23,42,.08);
  border-radius:14px;
  padding:12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}
.novaai-consent__title{ font-weight:900;font-size:12px;margin-bottom:10px;color:rgba(15,23,42,.85); }
.novaai-consent__row{ margin-bottom: 10px; }
.novaai-email{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(15,23,42,.12);
  outline:none;
  background: rgba(255,255,255,.95);
  font-size:14px;
}
.novaai-check{ font-size:12px;display:flex;gap:8px;align-items:flex-start;opacity:.9; }
.novaai-check a{ color:var(--novaai-primary); text-decoration:none; }
.novaai-consent__actions{ margin-top: 10px; display:flex; }
.novaai-consent__hint{ font-size: 11px; opacity: .65; margin-top: 8px; }

.novaai-panel__bottom{
  padding:12px;
  border-top:1px solid rgba(15,23,42,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.62), rgba(255,255,255,.88));
  flex-shrink:0;
}

.novaai-inputwrap{ display:flex;gap:6px;align-items:center; }
.novaai-input{
  flex:1;
  padding:12px;
  border-radius:12px;
  border:1px solid rgba(15,23,42,.12);
  outline:none;
  background:rgba(255,255,255,.9);
  font-size:14px;
  min-width:0;
}
.novaai-send{
  width:44px;height:44px;
  border-radius:12px;
  border:0;
  background:var(--novaai-primary);
  color:var(--novaai-bubble-color);
  cursor:pointer;
  box-shadow:0 12px 26px rgba(43,89,255,.22);
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.novaai-send:disabled{ opacity:.6; cursor:not-allowed; }

.novaai-actions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:10px;
  gap:8px;
}
.novaai-wa{
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.86);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  font-weight: 800;
  font-size: 11px;
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  flex:1;
  justify-content:center;
}
.novaai-wa.is-hidden{ display:none; }

.novaai-cartbtn{
  width:40px;height:40px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.86);
  display:flex;align-items:center;justify-content:center;
  color: rgba(15,23,42,.85);
  text-decoration:none;
  flex-shrink:0;
}
.novaai-cartbtn:hover{
  border-color: rgba(43,89,255,.25);
  background: rgba(43,89,255,.08);
}

/* bottoni */
.novaai-btn{
  border-radius:10px;
  padding:8px 10px;
  font-size:12px;
  cursor:pointer;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.90);
  display:inline-flex; align-items:center; gap:6px;
  font-weight: 800;
  white-space:nowrap;
}
.novaai-btn--primary{
  background: rgba(43,89,255,.12);
  border-color: rgba(43,89,255,.20);
  color: rgba(15,23,42,.9);
}
.novaai-btn--primary:hover{
  background: rgba(43,89,255,.18);
  border-color: rgba(43,89,255,.28);
}

/* ======= PRODOTTI COMPATTI ======= */
.novaai-products{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin:6px 0 2px;
}

.novaai-pcard{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px;
  border-radius:12px;
  border:1px solid rgba(15,23,42,.08);
  background:rgba(255,255,255,.90);
  box-shadow:0 8px 20px rgba(0,0,0,.06);
}

.novaai-pcard__img{
  width:48px;height:48px;
  border-radius:10px;
  overflow:hidden;
  flex:0 0 auto;
  background:#fff;
  border:1px solid rgba(15,23,42,.06);
}
.novaai-pcard__img img{ width:100%;height:100%;object-fit:cover;display:block; }

.novaai-pcard__main{
  min-width:0;
  flex:1 1 auto;
  overflow:hidden;
}
.novaai-pcard__title{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;

  font-weight:800;
  font-size:12px;
  line-height:1.2;
  color:#0f172a;
  text-decoration:none;
}
.novaai-pcard__meta{
  margin-top:4px;
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}
.novaai-price{ 
  font-size:11px;
  font-weight:900;
  line-height:1.2;
}
.novaai-tags{
  font-size:10px;
  color:#64748b;
  margin-top:2px;
  line-height:1.2;
}

.novaai-pill{
  font-size:9px;
  padding:2px 6px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.10);
  opacity:.9;
  line-height:1.2;
}
.novaai-pill--out{ opacity:.6; }

.novaai-pcard__actions{
  display:flex;
  gap:6px;
  flex:0 0 auto;
}
.novaai-iconbtn{
  width:32px;height:32px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.92);
  color:rgba(15,23,42,.86);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  padding:0;
  flex-shrink:0;
}
.novaai-iconbtn:hover{
  border-color: rgba(43,89,255,.25);
  background: rgba(43,89,255,.08);
}
.novaai-iconbtn:disabled{ opacity:.5; cursor:not-allowed; }

/* variations box */
.novaai-variantbox{
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.90);
  border-radius: 14px;
  padding: 10px;
  margin: 8px 0 2px;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
.novaai-variantbox__title{ 
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 6px;
  line-height:1.2;
}
.novaai-variantbox__select{
  width:100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.95);
  outline: none;
  margin-bottom: 8px;
  font-size:13px;
}
.novaai-variantbox__add{ 
  width: 100%; 
  justify-content: center;
  padding: 10px;
  font-size:12px;
}

/* appointment form */
.novaai-appointment-form{
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.90);
  border-radius: 14px;
  padding: 10px;
  margin: 8px 0 2px;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
.novaai-appointment-form__title{ 
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 6px;
  line-height:1.2;
}
.novaai-form-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.novaai-form-field{
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.novaai-form-field label{
  font-size: 10px;
  font-weight: 700;
  color: rgba(15,23,42,.75);
  line-height:1.2;
}
.novaai-form-field input,
.novaai-form-field select,
.novaai-form-field textarea{
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.95);
  outline: none;
  font-size: 12px;
  min-width:0;
}
.novaai-form-field.full-width{
  grid-column: 1 / -1;
}
.novaai-appointment-form__actions{
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* availability slots */
.novaai-slots{
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0;
}
.novaai-slot{
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.85);
  font-size: 10px;
  cursor: pointer;
  white-space:nowrap;
}
.novaai-slot:hover{
  border-color: rgba(43,89,255,.25);
  background: rgba(43,89,255,.08);
}
.novaai-slot--booked{
  opacity: .5;
  cursor: not-allowed;
  background: rgba(15,23,42,.05);
}
.novaai-slot--selected{
  border-color: var(--novaai-primary);
  background: rgba(43,89,255,.12);
}

/* WhatsApp operator message */
.novaai-whatsapp-message{
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.90);
  border-radius: 14px;
  padding: 10px;
  margin: 8px 0 2px;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
.novaai-whatsapp-message__title{
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 6px;
  color: #25D366;
  line-height:1.2;
}
.novaai-whatsapp-message__button{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  background: #25D366;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 11px;
  margin-top: 6px;
  white-space:nowrap;
}

/* Quick actions per aggiunta al carrello */
.novaai-quick-actions{
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.novaai-quick-action{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(43,89,255,.08);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.novaai-quick-action:hover{
  background: rgba(43,89,255,.12);
}

/* ===== MEDIA QUERIES PER MOBILE ===== */
@media (max-width: 480px){
  #novaai-chat{
    bottom: 10px;
  }
  #novaai-chat.is-right{ right: 10px; }
  #novaai-chat.is-left{ left: 10px; }
  
  #novaai-chat .novaai-fab{
    width:48px;height:48px;border-radius:14px;
  }
  #novaai-chat .novaai-fab__icon{ 
    font-size:18px;
  }
  #novaai-chat .novaai-fab__dot{
    top:6px;right:6px;width:7px;height:7px;
  }
  
  #novaai-chat .novaai-panel{
    bottom:58px;
    width:calc(100vw - 20px);
    height:85vh;
    max-height:85vh;
    border-radius:14px;
  }
  
  .novaai-panel__body{
    flex:1;
    padding:10px;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
  }
  
  .novaai-bubble{
    max-width:85%;
    padding:8px 10px;
    font-size:13px;
    line-height:1.35;
  }
  
  .novaai-panel__quick{
    padding: 0 10px 6px;
    gap:6px;
  }
  .novaai-quick{
    min-width:calc(50% - 3px);
    padding: 8px 6px;
    font-size: 11px;
    gap:4px;
  }
  
  .novaai-panel__consent{ 
    padding: 0 10px 6px;
  }
  
  .novaai-inputwrap{ gap:4px; }
  .novaai-input{
    padding:10px;
    font-size:13px;
  }
  .novaai-send{
    width:40px;height:40px;
  }
  
  .novaai-actions{
    gap:6px;
    margin-top:8px;
  }
  .novaai-wa{
    padding:6px 8px;
    font-size:10px;
    gap:4px;
  }
  .novaai-cartbtn{
    width:36px;height:36px;
  }
  
  /* Prodotti mobile */
  .novaai-pcard{
    gap:6px;
    padding:6px;
  }
  .novaai-pcard__img{
    width:42px;height:42px;
  }
  .novaai-pcard__title{
    font-size:11px;
  }
  .novaai-price{ 
    font-size:10px;
  }
  .novaai-pcard__actions{
    gap:4px;
  }
  .novaai-iconbtn{
    width:28px;height:28px;
  }
  
  /* Form mobile */
  .novaai-form-row{
    grid-template-columns: 1fr;
    gap: 4px;
  }
  
  .novaai-variantbox,
  .novaai-appointment-form,
  .novaai-whatsapp-message{
    padding:8px;
  }
}

@media (max-width: 360px){
  #novaai-chat .novaai-panel{
    width:calc(100vw - 16px);
    height:90vh;
  }
  
  .novaai-quick{
    min-width:100%;
    font-size:10px;
  }
  
  .novaai-agent__avatar{
    width:32px;height:32px;
    font-size:12px;
  }
  .novaai-agent__name{ font-size:12px; }
  .novaai-agent__sub{ font-size:10px; }
  
  .novaai-bubble{
    font-size:12px;
  }
  
  .novaai-wa span{
    display:none;
  }
  .novaai-wa{
    padding:6px;
    justify-content:center;
  }
}

/* Prevenire zoom su input su iOS */
@media screen and (max-width: 480px) {
  input, select, textarea {
    font-size: 16px !important;
  }
  
  .novaai-input {
    font-size: 16px !important;
  }
}

/* Migliorare tocco su mobile */
@media (hover: none) and (pointer: coarse) {
  .novaai-quick,
  .novaai-btn,
  .novaai-iconbtn,
  .novaai-wa,
  .novaai-send,
  .novaai-quick-action {
    min-height: 44px;
  }
  
  .novaai-fab {
    min-height: 44px;
    min-width: 44px;
  }
  
  .novaai-input {
    min-height: 44px;
  }
}

/* Supporto per safe-area per iPhone X e superiori */
@supports (padding: max(0px)) {
  #novaai-chat {
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  
  .novaai-panel__body {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  
  .novaai-panel__bottom {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}