@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
@import "./css/table.scss";
@import "./css/lists.scss";
@import "./css/theme.scss";

:host {
  position: fixed;
  background-color: white;
  height: 100vw;
  bottom: 0;
  right: 0;
  z-index: 10000;
  font-family: Poppins;

  /* TODO:NIKOLA:1 this is where z-index will be added so our chat will overlay the website  */
}

.betterbot__ai__chat__main {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }


  .reset-button-styles {
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
  }

  .betterbot_expand {
    cursor: pointer;
  }

  .betterbot_chat_layout {
    display: flex;
    flex-direction: column;
    height: 100%;

  }

  .message {
    margin: 12px 34px;
    max-width: 90%;
    border-radius: 8px;
    animation: fadeIn 0.3s ease-in-out;
    font-size: 16px;
  }

  .embeded .message {
    font-size: 16px;
  }

  .message:last-child {
    padding-bottom: 24px;
  }

  .human {
    align-self: flex-end;
    margin-left: 2rem;
    padding: 14px 16px;
  }

  .assistant {
    align-self: flex-start;
  }

  .assistant > div {
    position: relative;
    animation: textReveal 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  .full-height {
    min-height: calc(100% - 125px);
  }

  .full-height > :last-child {
    padding-bottom: 30px;
  }

  .typing-indicator {
    margin-left: 2rem;
  }

  .full-chat .typing-indicator {
    margin-left: 0;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }



  #input-form {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
  }

  .typing-indicator {
    display: inline-block;
    margin-left: 2rem;
    min-height: calc(100% - 105px);
  }

  .typing-indicator span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: #2a2b32;
    border-radius: 50%;
    margin: 0 2px;
    animation: blink 0.7s infinite;
    /* background-color: blue; */
    /* min-height: calc(100% - 120px); */
  }

  .typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
  }

  .appear {
    opacity: 0;
    animation: appear 0.3s forwards;
  }

  @keyframes appear {
    to {
      opacity: 1;
    }
  }



  .human {
    max-width: 300px;
    overflow-wrap: break-word;
    color: rgba(1, 18, 55, 0.9);
    font-feature-settings: "liga" off, "clig" off;
    font-family: Poppins;
    line-height: 19px;
    border-radius: 12px 0px 12px 12px;
    background: var(--background-secondary);
    text-align: left;
    p {
      padding: 0;
      margin: 0;
    }
  }

  .mimic-website {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    overflow: hidden;
    z-index: -1;

    .header {
      height: 120px;
      background: linear-gradient(180deg, #fff 73.46%, #e6edfc 139.45%);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 20px;
      font-size: 20px;
      font-weight: 600;
      color: var(--color-midnight-opacity-90, rgba(1, 18, 55, 0.9));

      .logo-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;

        img {
          width: 200px;
        }
      }
    }

    .full-page {
      width: 100%;
      height: calc(100vh - 120px);
      overflow: hidden;
      position: relative;
    }
  }

  :root {
    --background-primary: #343541;
    --background-secondary: #2a2b32;
    --text-primary: #ececf1;
    --text-secondary: #a9b5d0;
    --border-color: #4a4b53;
    --highlight-color: #10a37f;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: var(--text-primary);
    margin-top: 6px;
    margin-bottom: 4px;
    text-align: start;
  }

  p {
    margin: 0.5em 0;
    text-align: start;
  }

  a {
    color: var(--highlight-color);
    text-decoration: none;
    cursor: pointer;
  }

  a:hover {
    text-decoration: underline;
  }

  code {
    background-color: var(--background-secondary);
    color: var(--text-primary);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: "Courier New", Courier, monospace;
  }

  pre {
    background-color: var(--background-secondary);
    color: var(--text-primary);
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    font-family: "Courier New", Courier, monospace;
  }

  blockquote {
    border-left: 4px solid var(--highlight-color);
    margin: 1em 0;
    padding: 0.5em 1em;
    background-color: var(--background-secondary);
    color: var(--text-secondary);
  }

  .chat-wrapper img {
    height: 150px;
    cursor: pointer;
  }

  .chat-wrapper table img {
    height: 80px;
    cursor: pointer;
  }

  .image-wrapper {
    height: 150px;
    text-align: start;
  }

  .table-image-wrapper {
    height: 80px;
  }

  .chat-wrapper table .image-wrapper {
    height: 80px;
    min-width: 30px;
  }


  .message-title-content { 
    margin: 0 32px;
    min-height: 100px;
    height: 90px;
  }


  @media (max-width: 768px) {
    .message {
      margin: 12px 22px;
    }
  }

  @media (max-width: 480px) {
    .message {
      font-size: 14px;
    }

    .section-content {
      width: calc(100% - 40px);
      margin-left: 20px;
      margin-right: 20px;
      overflow-x: auto;
    }

    .last .message-container {
      margin-top: 0;
    }

    .message-container {
      margin-bottom: 35px;
    }

    .message-content {
      overflow-x: auto;
    }
    .last {
      margin-top: 100x/* 230px; */
    }

    .message-title-content { 
      max-height: 78px;
      min-height: unset;
      height: fit-content;
    }

    .message-title-content.expanded {
      max-height: fit-content;

      /* min-height:fit-content; */
    }

    .message-title-answer { 
      margin: 0 16px;
    }

    .message-content { 
      padding: 5px 16px;
      font-size: 14px;
    }

    .message-title-content p { 
      overflow: hidden;
      text-overflow: unset ;
      white-space: unset ;
    }
    
  }

  .message-title-content .tooltip p { 
    overflow: hidden;
    text-overflow: unset !important;
    white-space: unset !important;
  }

  #input-form input {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  .message-input {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}


/* all animations */
@keyframes blink {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}



/* full width chat css */

.section-content {
  /* background-color: white; */
  /* min-height: */
  opacity: 0;
  width: 800px;
  color: black;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInUp 0.7s ease-out forwards;

}

 .last {
  /* height: calc(100vh); */
  /* padding-top: 100px; */
  /* margin-top: 50px; */
  /* overflow-y: auto; */
  /* padding-bottom: 50px; */
  min-height: calc(100vh - 235px);
} 

.last .message-container{
  margin-top: 100px; /*235px; */
  min-height: calc(100vh - 395px);
  overflow-y: visible;
  border-radius: 12px;
  
  /* background: linear-gradient(1deg, rgba(255, 255, 255, 0.00) 49.84%, #FFF 68.07%); */
 
}

.message-container {
  overflow: visible;
}

.last::-webkit-scrollbar ,.last .message-container::-webkit-scrollbar {
  display: none;
}

.message-title {
  /* height: 50px; */
  background-color: transparent;
  width: 100%;
  font-size: 20px;
  /* padding: 10px; */

}

.message-title-content {
  border-bottom: 1px solid #C4C2C9;
  color: rgba(1, 18, 55, 0.90);
  font-family: Poppins;
  font-size: 20px;
  font-weight: 600;
  line-height: 160%; 
  padding: 25px 0px 13px;
  margin: 0 35px;
  text-align: left;
  /* text-transform: capitalize; */
  position: relative;

}

.message-title-content p::first-letter {
  text-transform: uppercase;
} 

.message-title-content-mobile {
  max-height: 90px;
  overflow: hidden;
  padding-right: 36px;
  padding: 10px 20px 10px 0px;
}

.hide-expand {
  display: none !important;
}

.expand-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.message-title-content p { 
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-title-answer { 
  color: rgba(1, 18, 55, 0.50);
  font-family: Poppins;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  line-height: 140%; /* 19.6px */
  padding: 14px 0px;
  margin: 0 35px;
  text-align: left;
}

.message-content {
  min-height: 300px;
  background-color: transparent;
  width: 100%;
  padding: 5px 35px;
  padding-bottom: 250px;
  overflow-x: auto;
    font-size: 16px;

}

.last .message-title { 
  background: white;
}

.last .message-content { 
  background: linear-gradient(to bottom, #FFF 0%, rgba(255, 255, 255, 0) 100%);
  background-size: 100% 300px, auto;
  background-repeat: no-repeat, repeat;
  background-position: left top, 0 0;
  padding-bottom: 250px !important;
}

.full-chat.fade-background::before {
  opacity: 0 !important;
}

.full-chat #input-container {
  border-radius: 10px 10px 10px 10px !important;
  overflow: hidden;
}


.tooltip-container {
  position: relative;
  /* cursor: pointer; */
}

.tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  transition: opacity 0.3s, visibility 0.3s;
  height: 63px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  border-radius: 4px;
  background: #FFF;
  box-shadow: 4.599px 3.066px 18.397px -0.767px rgba(162, 162, 162, 0.25);
  color: #68738A;
  font-family: Poppins;
  font-size: 12px !important;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
  width: 280px;
  display: flex;
  pointer-events: none;
  
}

.tooltip-right {
  left: 100% !important;
}
/*   
.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
} */

.tooltip-container:hover .tooltip {
  visibility: visible;
opacity: 1;
position: absolute; /* Change to fixed positioning */
z-index: 9999;
/* Remove the transform and use different positioning */
bottom: auto;
top: -70px;
left: 40px;
right: auto;
pointer-events: none; /* Prevent tooltip from being hoverable */
}

.tooltip-container:hover .tooltip:hover {
  visibility: hidden;
  opacity: 0;
}

.tooltip-container:hover .tooltip-bottom {
  left: unset !important;
  right: unset !important;

}

.tooltip-bottom {
  top: -30px !important; 
  /* left: 0 !important; */
  right: 0 !important;
  bottom: unset !important;
  width: 800px !important;
  transform: translateX(0) !important;
  height: fit-content !important;
  min-height: 30px !important;
  border-radius: 4px;
  background: #3B374E;
  color: rgba(255, 255, 255, 0.90);
  font-family: Poppins;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 160%; /* 19.2px */
}

/* Safari-specific styles */
/* @supports (-webkit-appearance: none) and (not (appearance: none)) {
  .tooltip-bottom {
    top: 10px !important;
  }
}

/* Alternative Safari detection method as fallback */
@media not all and (min-resolution: 0.001dpcm) {
  @supports (-webkit-appearance: none) {
    .tooltip-bottom {
      top: 10px !important;
    }
  }
} */

.tooltip-bottom p {
      overflow: unset !important;
    text-overflow: unset !important;
    white-space: unset !important;
}


@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}