#machinedb-chat-toggle {
  position: fixed;
  bottom: 30px;
  left: 30px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid #285bb8;
  width: 50px;
  height: 50px;
  z-index: 9999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#machinedb-chat-toggle img {
  width: 40px;
  height: 40px;
  margin: 0px !important;
}

#machinedb-chat-widget {
  position: fixed;
  bottom: 173px;
  left: 20px;
  width: 350px;
  max-height: 500px;
  background: white;
  border-radius: 10px 10px 0 0;
  z-index: 19998;
  border-top: 1px solid #032936;
  border-left: 1px solid #032936;
  border-right: 1px solid #032936;
}

#botui-app {
  height: 100%;
  overflow-y: auto;
}

.botui-messages-container{
    padding-left: 0px;
    padding-right: 0px;
    background: #efecea;
    padding: 10px 10px 0 10px;
    min-height: 390px;
}

.botui-message-content.human {
    color: #fff;
    background-color: #285bb8;
}

.botui-message {
    margin: 5px 5px 10px 5px;
}

.botui-message-content.html a{
  color: #285bb8;
  text-decoration: underline;
}

.botui-message-content.html a:hover{
  color: #285bb8;
  text-decoration: none;
}

.botui-message-content.html a {
  margin-bottom: 0px;
  word-wrap: break-word;
}

.botui-message-content.html span > p {
  margin-bottom: 10px;
  word-wrap: break-word;
}

.botui-message-content.html span > p:last-of-type{
  margin-bottom: 0px;
}

.botui-message-content.html ol{
  margin: 0px;
  padding: 0px 0 0 16px;
}

.botui-message-content.html ul{
  margin: 0px 0 10px 0;
  padding: 0px 0 0 30px;
  list-style: none;
}

.botui-message-content.html ol ul{
  padding: 0px 0 0 20px;
}


.botui-message-content.html ol li p, 
.botui-message-content.html ul li p{
  margin-bottom: 5px;
}

.botui-message-content.html ol li, 
.botui-message-content.html ul li{
  margin-bottom: 5px;
}

.botui-message-content.html ol li::marker{
  content: unset;
}

.botui-message-content{
    padding: 7px 13px;
    border-radius: 15px;
    margin: 0px;
    width: auto;
    max-width: 90%;
    display: inline-block;
    color: #032936;
    background-color: #fff;
    overflow: hidden;
}

.botui-message:last-of-type{
  margin-bottom: 0px;
}

.botui-actions-container {
    padding: 0px;
    background-color: #efecea;
    position: fixed;
    bottom: 91px;
    left: 21px;
    width: 350px;
    height: 82px;
    border-radius: 0 0 10px 10px;
    border-bottom: 1px solid #032936;
    border-left: 1px solid #032936;
    border-right: 1px solid #032936;
    margin-left: -1px;
    padding-top: 15px;
}

.botui-actions-container div{
  background-color: #fff;
  border-radius: 10px;
  margin: 10px;
  bottom: 7px;
  position: relative;
}

.botui-actions-text-input{
    border-bottom: none;
    width: 100%;
    padding: 17px 65px 17px 17px;
    position: relative;
}

.machinedb-chat-header {
  background-color: #032936;
  color: white;
  font-weight: bold;
  padding: 10px 15px;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
}

#machinedb-chat-close {
  cursor: pointer;
  font-weight: bold;
  font-size: 20px;
  line-height: 20px;
}

.botui-actions-text-submit {
  font-family: "Font Awesome 5 Free"; /* Required for icon */
  font-weight: 900; /* Solid weight (fas) */
  font-size: 18px;
  color: #f9f9f9 ;
  background-color: #285bb8;
  border: none;
  padding: 0;
  bottom: 6px !important;
  right: 6px !important;
  width: 50px;
  height: 40px;
  border-radius: 10px;
}

.botui-actions-text-submit span {
  visibility: hidden; /* hides Go but keeps element */
}

.botui-actions-text-submit::before {
  content: "\f1d8"; /* Unicode for paper-plane */
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  left: 49%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.botui-actions-text-submit{
    display: inline-block;
    position: absolute;
    bottom: 11px;
    right: 10px;
}

.botui-actions-text{
  position: relative;
}

.botui-container{
  width: 100%;
    height: 395px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: #efecea;
    padding-bottom: 0px;
}

.machinedb-chat-header a{
  margin-left: 11px;
  margin-right: 5px;
  color: #fff !important;
  font-size: 21px;
}

.machinedb-chat-header a:hover{
  color: #fff !important;
}

.machinedb-chat-header .fas.fa-envelope{
  position: relative;
  top: 1px;
  font-size: 20px;
}

.machinedb-chat-header .fas.fa-envelope:hover{
  cursor: pointer;
}


.page-template-page-Chat #machinedb-chat-toggle, .page-template-page-Chat #machinedb-chat-close{
  display: none;
}

.page-template-page-Chat #machinedb-chat-widget {
    position: static;
    width: 100%;
    margin: 40px 0 119px 0;
}

.page-template-page-Chat .botui-actions-container {
    position: static;
    width: 100%;
    border-radius: 0;
}

.page-template-page-Chat .botui-container{
  padding-bottom: 0px;
  position: static;
}

.page-template-page-Chat .botui-messages-container {
    min-height: 392px;
}

.botui-message-content.html ul li a{
  margin-bottom: 10px;
  display: inline-block;
  overflow-wrap: anywhere;
}

.botui-message-content.html ul li{
  position: relative;
  overflow-wrap: anywhere;
}

.botui-message-content.html ul li:before {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    left: -22px;
    top: 0px;
    content: "\f00c";
    color: #285bb8;
    font-size: 16px;
}

.page-template-page-Chat #machinedb-chat-widget {
    max-height: 450px;
}

.page-template-page-Chat .botui-actions-container {
    position: absolute;
    left: 16px;
    bottom: 37px;
    border-radius: 0 0 10px 10px;
    width: calc(100% - 30px);
}

.botui-message-content.loading{
  text-align: left;
}

.loading .dot {
    margin-left: 0 !important;
    margin-right: .3rem !important;
}

.dot:nth-last-child(4) {
    animation: loading .6s .1s linear infinite;
}

.dot:nth-last-child(3) {
    animation: loading .6s .2s linear infinite;
}

.dot:nth-last-child(2) {
    animation: loading .6s .3s linear infinite;
}

.dot:nth-last-child(1) {
    animation: loading .6s .4s linear infinite;
}

.dummy-message{
  margin-left: 7px;
  line-height: 21px;
}

/* === NEW: email overlay panel === */
#machinedb-email-panel{
  position:absolute;
  top:54px;           /* under the chat header */
  right:0px;
  background:#fff;
  border-radius:0 0 10px 10px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  padding:10px 10px 0 10px;
  z-index:9999;
  width:350px;
}

#machinedb-email-form{
  display:flex;
  gap:8px;
  align-items:stretch;
  flex-wrap:wrap;
}

#machinedb-email-input{
  flex:1 1 100%;
  padding:10px 12px;
  border:1px solid #ddd;
  border-radius:8px;
  font-size:14px;
}

#machinedb-email-send{
  flex:1 1 auto;
  padding:10px 12px;
  border:0;
  border-radius:8px;
  font-size:14px;
  background:#285bb8;
  color:#fff;
  cursor:pointer;
}

#machinedb-email-send:disabled{ opacity:.6; cursor:not-allowed; }

#machinedb-email-note{
  flex:1 1 100%;
  font-size:12px;
  margin-top: 2px;
  margin-bottom: 10px;
}
#machinedb-email-note.ok{ color:#157347; }
#machinedb-email-note.err{ color:#b02a37; }

.page-template-page-Chat #machinedb-email-panel {
    top: 85px;
    right: 16px;
    width: calc(100% - 32px);
}

.tooltip-custom {
  position: relative;
  cursor: pointer;
  display: inline-flex;       /* normalize box size */
  align-items: center;
  justify-content: center;
  line-height: 20px;             /* removes extra vertical space */
  padding: 0;                 /* removes default inline padding if any */
}

.tooltip-custom::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%; /* above element */
  left: 50%;
  transform: translateX(-50%);
  background: #efecea;
  color: rgb(3, 41, 54);
  padding: 4px 8px;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.tooltip-custom:hover::after,
.tooltip-custom:hover::before {
  opacity: 1;
}

.machinedb-chat-header i {
  font-size: 18px; /* adjust as needed */
  line-height: 20px;
  width: 20px;
  height: 20px;
}

.machinedb-chat-header i.fas.fa-times{
  font-size: 23px;
  position: relative;
  top: 2px;
  color: #fff;
}

.fas.fa-expand{
  padding-top: 1px;
}


 .page-template-page-Chat .tooltip-custom{
  position: relative;
  opacity: 1;
  font-family: 'Open Sans', Arial, sans-serif; 
  font-weight: bold;
 }

 .icons-header{
  float: right;
 }


.botui-container::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

.botui-container::-webkit-scrollbar {
  width: 8px; /* scrollbar thickness */
}

.botui-container::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.3);
  border-radius: 4px;
}

.botui-container::-webkit-scrollbar-track {
  background-color: transparent;
}

/* Scroll lock helper for mobile chat */
html.machinedb-lock,
body.machinedb-lock {
  overflow: hidden;
  height: 100%;
}

.machinedb-chat-header i.fas.fa-undo{
  margin-right: 6px;
}

.page-template-page-Chat .machinedb-chat-header i{
  float: left;
}

.page-template-page-Chat .icons-header{
  width: 55px;
}

.page-template-page-Chat .machinedb-chat-header i.fas.fa-undo {
    margin-right: 10px;
}

/* Let long content wrap nicely (links, long words) */
#machinedb-chat-widget .botui-message-content {
  overflow: visible;                 /* no clipping */
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* HTML replies (like tables) get horizontal scrolling if needed */
#machinedb-chat-widget .botui-message-content.html {
  overflow-x: auto;                  /* shows horizontal scroll only when needed */
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; /* smooth on iOS */
}

/* BotUI wraps HTML in a <span>—make it behave like a block container */
#machinedb-chat-widget .botui-message-content.html > span {
  display: block;
}

/* Make tables size to their natural width, so the bubble can scroll */
#machinedb-chat-widget .botui-message-content.html table {
  border-collapse: collapse;
  width: max-content;                /* shrink-to-fit columns (modern browsers) */
  max-width: none;                   /* don't clamp at bubble width */
  margin-bottom: 10px;
}

/* Optional: basic cell spacing so it stays readable inside the bubble */
#machinedb-chat-widget .botui-message-content.html th,
#machinedb-chat-widget .botui-message-content.html td {
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
}

/* Optional: keep the header visible and distinguishable */
#machinedb-chat-widget .botui-message-content.html thead th {
  font-weight: 600;
  border-bottom: 1px solid #e5e5e5;
}
#machinedb-chat-widget .botui-message-content.html tbody td {
  border-bottom: 1px solid #f2f2f2;
}

/* Show a clear affordance when a bot HTML message can scroll sideways */
#machinedb-chat-widget .botui-message-content.html.is-scrollable {
  cursor: grab;
}
#machinedb-chat-widget .botui-message-content.html.is-dragging {
  cursor: grabbing;
  user-select: none; /* avoid accidental text selection while dragging */
}

/* Floating hint next to the chat toggle (visible only when chat is closed) */
#machinedb-chat-hint{
  display:none;                 /* toggled by JS */
  position:fixed;
  z-index:99999;
  background:#285bb8;
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
  font-size:14px;
  line-height:1;
  white-space:nowrap;
  box-shadow:0 6px 14px rgba(0,0,0,.18);
}

/* your desired placement */
#machinedb-chat-hint.manual-pos{
  left:28px !important;
  top:auto !important;
  bottom: 90px;
}

.botui-message-content.html span > p, 
.botui-message-content.html p{
  font-size: 14px;
  line-height: 20px;
}

.botui-message-content.text{
  line-height: 20px;
}


@media (max-width: 500px){
  #machinedb-chat-widget{
    top: 0px;
    width: 100%;
    left: 0px;
    border-radius: 0;
    z-index: 100000;
    height: calc(100% - 50px);
    max-height: 100%;
  }

  .botui-actions-container{
    left: 1px;
    width: 100%;
    bottom: 0;
    border-radius: 0;
    border-bottom: none;
  }

  .page-template-page-Chat .botui-actions-container{
    border-bottom: 1px solid #032936;
  }

  .botui-container{
    height: calc(100% - 76px);
  }

  .page-template-page-Chat .botui-container {
    height: 395px; 
  }

  .page-template-page-Chat #machinedb-chat-widget{
    border-radius: 10px 10px 0 0;
    overflow: hidden;
  }

  #machinedb-email-panel {
    width: 100%;
  }

  .machinedb-chat-header{
    border-radius: 0;
    display: inline-block;
    width: 100%;
  }

  .machinedb-chat-header span, .machinedb-chat-header a{
    float: left;
  }

  .machinedb-chat-header a {
    margin-right: 12px;
    margin-left: 18px;
  }

  a.tooltip-custom{
    display: none;
  }

  .machinedb-chat-header i.fas.fa-times {
      margin-left: 20px;
  }

  .machinedb-chat-header i.fas.fa-undo {
      margin-right: 15px;
  }

  .tooltip-custom::after {
    display: none;
  }

  #machinedb-chat-hint{
    font-size:13px;
    padding:7px 10px;
  }
  
}

/* Prevent iOS input-focus zoom by using >=16px font-size */
@media (max-width: 500px){
  .botui-actions-container input,
  .botui-actions-container textarea,
  .botui-actions-text-input {
    font-size: 16px !important;   /* key line */
    line-height: 1.35;
  }

  /* Helpful on iPhones with home indicator */
  .botui-actions-container {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* iOS-only reinforcement (optional, harmless elsewhere) */
@supports (-webkit-touch-callout: none) {
  .botui-actions-container input,
  .botui-actions-container textarea,
  .botui-actions-text-input {
    font-size: 16px !important;
  }
}

/* Avoid unexpected text auto-resizing */
html { -webkit-text-size-adjust: 100%; }

