/* ============================================================
   BOT COPILOT STUDIO – bot.css
   Scuole Dussmann
   Collega in appalto.php con:
   <link rel="stylesheet" href="css/bot.css">
   ============================================================ */


/* ── FAB (pulsante flottante) ─────────────────────────────── */

#botFab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  transition: none;
  position: fixed;
  /* position:relative necessario per i figli absolute */
  overflow: visible;
}

#botFab:hover {
  background: transparent;
  transform: none;
}

#botFab svg {
  display: none;
}

#botFabCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 90px;
  height: 90px;
  pointer-events: none;
}

#botFabInner {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #c8102e;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(200,16,46,.4);
  transition: opacity .35s ease, transform .35s ease, box-shadow .35s ease;
  pointer-events: none;
}

#botFabInner svg {
  display: flex;
  width: 22px;
  height: 22px;
  color: #fff;
  stroke: #fff;
  pointer-events: none;
}

#botFabMascotte {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.3);
  transition: opacity .4s cubic-bezier(.34,1.56,.64,1), transform .4s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}

#botFabMascotte img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 10%;
}

#botFab.fab-opened #botFabInner {
  opacity: 0;
  transform: scale(0.2);
  box-shadow: none;
}

#botFab.fab-opened #botFabMascotte {
  opacity: 1;
  transform: scale(1);
}


/* ── FAB – stato loading ── */

#botFab.loading {
  display: flex;
}

@keyframes botSpin {
  to { transform: rotate(360deg); }
}


/* ── FAB – disabilitato ── */

#botFab.fab-disabled {
  display: flex;
  cursor: not-allowed;
}

#botFab.fab-disabled #botFabInner {
  background: #9ca3af !important;
  transform: none !important;
}

#botFab.fab-disabled:hover #botFabInner {
  background: #9ca3af !important;
}


/* ── FAB – tooltip ── */

#botFab[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #1f2937;
  color: #fff;
  font-size: .76rem;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 1;
}

#botFab[data-tooltip]:hover::before {
  opacity: 1;
}


/* ── PANNELLO ── */

#botPanel {
  position: fixed;
  bottom: 138px;
  right: 28px;
  z-index: 9997;
  width: 400px;
  height: 520px;
  max-height: calc(100vh - 118px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

#botPanel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}


/* ── HEADER pannello ── */

#botPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #c8102e;
  color: #fff;
  flex-shrink: 0;
}

#botPanelHeader .bot-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .01em;
}

#botPanelHeader .bot-title svg {
  width: 20px;
  height: 20px;
  opacity: .9;
}

#botPanelHeader .comune-badge {
  font-size: .72rem;
  font-weight: 600;
  background: rgba(255,255,255,.22);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 2px;
}


/* ── BOTTONE CHIUDI ── */

#botCloseBtn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background .15s;
}

#botCloseBtn:hover {
  background: rgba(255,255,255,.15);
}

#botCloseBtn svg {
  width: 19px;
  height: 19px;
}


/* ── AREA WEBCHAT ── */

#botWebchat {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}


/* ── FEEDBACK BUTTONS ── */

.bot-feedback {
  display: flex;
  gap: 4px;
  margin: 0 0 10px 7px;
}

.bot-feedback button {
  background: none;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
  transition: all .15s;
}

.bot-feedback button svg {
  width: 15px;
  height: 15px;
}


/* ── COLORI E PADDING BOLLE ─────────────────────────────────
   Per cambiarlo modifica solo i valori di padding qui sotto
   ─────────────────────────────────────────────────────────── */

/* Reset padding SDK su tutti i bubble content */
#botWebchat .webchat__bubble__content {
  padding: 0 !important;
}

/* -- BOLLA AGENTE: grigio chiaro, testo grigio scuro -- */
#botWebchat .webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
  background: #f0f0f0 !important;
  border-radius: 12px !important;
}

#botWebchat .webchat__bubble:not(.webchat__bubble--from-user) .webchat__text-content {
  padding: 10px 14px !important;
  color: #333333 !important;
}

#botWebchat .webchat__bubble:not(.webchat__bubble--from-user) .webchat__text-content * {
  color: #333333 !important;
}

/* -- BOLLA UTENTE: rosso, testo bianco -- */
#botWebchat .webchat__bubble--from-user .webchat__bubble__content {
  background: #c8102e !important;
  border-radius: 12px !important;
  padding: 0 !important;
}

#botWebchat .webchat__bubble--from-user .webchat__text-content {
  padding: 10px 14px !important;
  color: #ffffff !important;
}

#botWebchat .webchat__bubble--from-user .webchat__bubble__content * {
  color: #ffffff !important;
}


/* ── MOBILE ── */

@media (max-width: 520px) {
  #botPanel {
    width: calc(100vw - 16px);
    right: 8px;
        bottom: 81px;
        height: calc(83dvh - 80px);
    max-height: calc(100dvh - 80px);
  }
  #botFab {
    right: 10px;
    bottom: 80px;
    width: 80px;
    height: 80px;
  }
  #botFabCanvas {
    width: 80px;
    height: 80px;
  }
  #botFabInner {
    top: 15px;
    left: 15px;
    width: 50px;
    height: 50px;
  }
  #botFabMascotte {
    display: none !important;
  }

  body:has(#botPanel.open) #botFab {
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
  }
}


/* ── RESET FONT-WEIGHT nelle bolle ── */

#botWebchat .webchat__bubble__content p,
#botWebchat .webchat__bubble__content span,
#botWebchat .webchat__bubble__content li {
  font-weight: 400 !important;
}

/* Link in bold */
#botWebchat .webchat__bubble__content a {
  font-weight: 700 !important;
}


/* ══════════════════════════════════════════════════════════
   ADAPTIVE CARD – Form invio mail
   ══════════════════════════════════════════════════════════ */

/* Contenitore generale card */
#botWebchat .webchat__adaptive-card-renderer {
  background: transparent !important;
  padding: 4px 2px !important;
}

/* Card principale */
#botWebchat .webchat__adaptive-card-renderer .ac-adaptiveCard {
  border-radius: 12px !important;
  overflow: hidden !important;
}

/* ── Header della card (ColumnSet con stile warning/accent) ── */
#botWebchat .webchat__adaptive-card-renderer .ac-columnSet:first-child {
  background: #c8102e !important;
  padding: 14px 16px !important;
  margin-bottom: 0 !important;
}

#botWebchat .webchat__adaptive-card-renderer .ac-columnSet:first-child .ac-textBlock {
  color: #ffffff !important;
      margin: 0px !important;
    margin-left: 5px !important;
}

#botWebchat .webchat__adaptive-card-renderer .ac-columnSet:first-child .ac-textBlock p {
  color: #ffffff !important;
      margin: 0px !important;
    margin-left: 5px !important;
}

/* ── Label dei campi ── */
#botWebchat .webchat__adaptive-card-renderer .ac-input-label {
  font-size: .78rem !important;
  font-weight: 800 !important;
  color: #6b7280 !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
  margin-bottom: 4px !important;
}

/* ── Input testuali ── */
#botWebchat .webchat__adaptive-card-renderer input[type="text"],
#botWebchat .webchat__adaptive-card-renderer input[type="email"],
#botWebchat .webchat__adaptive-card-renderer input[type="tel"],
#botWebchat .webchat__adaptive-card-renderer textarea,
#botWebchat .webchat__adaptive-card-renderer select {
  border: 1.5px solid #e5e7eb !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  font-size: .88rem !important;
  font-family: 'Raleway', sans-serif !important;
  color: #111827 !important;
  background: #fafafa !important;
  transition: border-color .15s, box-shadow .15s !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#botWebchat .webchat__adaptive-card-renderer input[type="text"]:focus,
#botWebchat .webchat__adaptive-card-renderer input[type="email"]:focus,
#botWebchat .webchat__adaptive-card-renderer input[type="tel"]:focus,
#botWebchat .webchat__adaptive-card-renderer textarea:focus,
#botWebchat .webchat__adaptive-card-renderer select:focus {
  border-color: #c8102e !important;
  box-shadow: 0 0 0 3px rgba(200,16,46,.12) !important;
  background: #fff !important;
  outline: none !important;
}

/* ── Textarea messaggio più alta ── */
#botWebchat .webchat__adaptive-card-renderer textarea {
  min-height: 90px !important;
  resize: vertical !important;
}

/* ── Dropdown ── */
#botWebchat .webchat__adaptive-card-renderer select {
  appearance: auto !important;
  cursor: pointer !important;
}

/* ── Spaziatura tra campi compatta ── */
#botWebchat .webchat__adaptive-card-renderer .ac-input-container {
  margin-bottom: 2px !important;
}

/* ── Azzera margini verticali interni alla card ── */
#botWebchat .webchat__adaptive-card-renderer .ac-adaptiveCard .ac-textBlock,
#botWebchat .webchat__adaptive-card-renderer .ac-adaptiveCard .ac-input-container,
#botWebchat .webchat__adaptive-card-renderer .ac-adaptiveCard .ac-actionSet {
  margin-top: 2px !important;
  margin-bottom: 2px !important;
}

/* ── Messaggio di errore ── */
#botWebchat .webchat__adaptive-card-renderer .ac-input-validation-error {
  color: #dc2626 !important;
  font-size: .75rem !important;
  margin-top: 3px !important;
}

/* ── Bottone invio (Action.Submit style positive) ── */
#botWebchat .webchat__adaptive-card-renderer .ac-pushButton[aria-label="Invia richiesta"],
#botWebchat .webchat__adaptive-card-renderer .ac-pushButton.style-positive,
#botWebchat .webchat__adaptive-card-renderer .ac-actionSet .ac-pushButton {
  background: #c8102e !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 10px 24px !important;
  font-size: .88rem !important;
  font-weight: 700 !important;
  font-family: 'Raleway', sans-serif !important;
  cursor: pointer !important;
  width: 100% !important;
  transition: background .15s, transform .1s !important;
  margin: 4px 0 0 0 !important;
  letter-spacing: .02em !important;
}

#botWebchat .webchat__adaptive-card-renderer .ac-actionSet .ac-pushButton:hover {
  background: #a00d25 !important;
  transform: translateY(-1px) !important;
  color: #fff !important;
}

/* ── Padding interno corpo card ── */
#botWebchat .webchat__adaptive-card-renderer .ac-adaptiveCard > :not(.ac-columnSet:first-child) {
    padding: 0px 0px !important;
    margin-top: 10px !important;
}


/* ── CSAT stelle ── */

/* ── CSAT stelle colorate ── */
#botWebchat .webchat__adaptive-card-renderer .ac-pushButton {
  background: none !important;
  border: 2px solid #c8102e !important;
  border-radius: 7px !important;
  color: #c8102e !important;
  width: 44px !important;
  height: 44px !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  margin: 4px !important;
  cursor: pointer !important;
  transition: background .15s, color .15s !important;
}

#botWebchat .webchat__adaptive-card-renderer .ac-pushButton:hover {
  background: #c8102e !important;
  color: #fff !important;
}

/* Stelle SVG colorate */
#botWebchat .webchat__adaptive-card-renderer .ac-pushButton svg path {
  fill: #c8102e !important;
  stroke: #c8102e !important;
}

/* ── Card Style ── */

.ac-horizontal-separator {
    display: none !important;
}



#botWebchat p, #botWebchat ol, #botWebchat li {
    font-size: 14px;
}

#botWebchat h3 {
    margin-bottom: 10px;
    font-size: 16px;
    text-decoration-line: underline;
}

#botWebchat table {
    font-size: 14px;
}

#botWebchat thead {
    text-align: left;
}

#botWebchat tbody {
    font-weight: 400
  }

.webchat__suggested-actions__button {
  border: 2px solid #c8102e !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  height: auto !important;
  color: #151515 !important;
  background: #ffffff !important;
  cursor: pointer !important;
}

.webchat__suggested-actions__button:hover {
  background: #c8102e !important;
  color: #ffffff !important;
}

/* ── Bullet point liste visibili ── */
#botWebchat .webchat__bubble__content ul,
#botWebchat .webchat__bubble__content ol {
  padding-left: 20px !important;
  list-style-position: outside !important;
}

#botWebchat .webchat__bubble__content ul li {
  list-style-type: disc !important;
}

#botWebchat .webchat__bubble__content ol li {
  list-style-type: decimal !important;
}

/** Citazione **/ 

#botWebchat details {
  display: none !important;
}

#botWebchat button.webchat__render-markdown__pure-identifier {
  display: none !important;
}