@keyframes smooth-appear {
    to{
      bottom: 40px;
      opacity:1;
    }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes typing-bounce {
      0%, 80%, 100% { 
        transform: translateY(0);
        opacity: 0.7;
      }
      40% { 
        transform: translateY(-5px);
        opacity: 1;
      }
}

.chat-window {
    position: fixed;
    bottom: -20px;
    right: 40px;
    width: 500px;
    opacity: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    border-radius: 5px;
    max-height: 550px;
    background: #fff;
    color: #000;
    box-sizing: border-box;
    box-shadow: 0 5px 27px rgba(0,0,0,.28);
}
.chat-window.open {
    /*bottom: 40px;*/
    display: block;
    z-index: 1012;
    /*transform: translateX(-10%);*/
    animation: smooth-appear .5s ease forwards;
}
.chat-window-close-button{background:rgba(0,0,0,0);position:absolute;right:18px;top:24px;font-size:18px;height:24px;width:24px;border:0;margin:0;padding:0;z-index:10;outline:0}
.chat-window-close-button:focus-visible{outline:0;border-radius:4px;box-shadow:0 0 0 2px #fff,0 0 0 6px #009de6}
.chat-window-close-button:hover {
    cursor: pointer;
}
.chat-window-content {
    position: relative;
    padding: 40px 24px 0;
    min-height: 540px;
    transition: all 0.5s ease;
}
.chat-window-init {
    padding-top: 30px;
}
.chat-window-title {
    font-size: 24px;
    line-height: 28px;
    font-weight: 400;
    letter-spacing: .3px;
    text-align: center;
    margin-bottom: 24px;
}
.chat-window-contact-list {
    border-top:1px solid #CFD2D7;
    margin:0 0 60px 0;
    padding:0;
    width:100%
}
.chat-window-contact-link{
    color: #003881;
    border-bottom:1px solid #CFD2D7;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    padding:16px 0;
    text-decoration:none;
    text-align:left;
    box-sizing:border-box;
    font-size:16px;
    font-weight:400;
    letter-spacing:.5px;
    line-height:20px
}
.chat-window-contact-element,
.chat-window-service-element {
    list-style:none
}
.chat-window-contact-link-title{
    display: inline-block;
    flex: 1;
}
.chat-window-contact-link-arrow{
    font-size:24px;
    line-height:24px;
    height:24px;
    margin-top:-4px;
    align-self:start
}
.chat-window-contact-link-arrow::before{
    font-size:16px;
    line-height:16px;
    font-weight:900;
    vertical-align:middle;
    display:inline-block;
    font-family: "Allianz-Icons", sans-serif;
    content: '\e90c';
}
.chat-window-service-list {
    margin:0;
    padding:0;
    width:100%
}
.chat-window-service-link{
    color: #003881;
    padding:16px 0;
    text-decoration:none;
    text-align:left;
    box-sizing:border-box;
    font-size:16px;
    font-weight:400;
    letter-spacing:.5px;
    line-height:20px
}

  #chat-output {
    border: 1px solid #ccc;
    padding: 1em;
    height: 450px;
    overflow-y: auto;
    background: #f9f9f9;
    position: relative;
  }
  .message { margin: 0.5em 0; }
  .user    { text-align: right; }
  .bot     { text-align: left; }
  .sender  { font-weight: bold; margin-right: 0.3em; }
  .content { }
  /* Markdown styling */
    .content h1 { font-size: 1.4em; margin: 0.5em 0; }
    .content h2 { font-size: 1.2em; margin: 0.5em 0; }
    .content pre  { background: #eee; padding: 0.5em; border-radius: 3px; overflow-x: auto; }
    .content ul, .content ol { margin-left: 1.2em; }

    /* 3-dot typing indicator */
    .typing-indicator {
      display: flex;
      align-items: center;
      gap: 3px;
      padding: 2px 0;
      margin-top: 1.5rem;
    }
    .typing-indicator .dot {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background-color: #888;
      animation: typing-bounce 1.4s infinite ease-in-out;
    }
    .typing-indicator .dot:nth-child(1) {
      animation-delay: -0.32s;
    }
    .typing-indicator .dot:nth-child(2) {
      animation-delay: -0.16s;
    }

  /* Spinner */
  #spinner {
    display: none;
    width: 36px;
    height: 36px;
    border: 4px solid rgba(0,0,0,0.1);
    border-left-color: #09f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    bottom: 10px;
    left: calc(50% - 18px);
  }
    /* Thread management styles */
    .thread-info {
        display: none;
      background: #e8f4fd;
      border: 1px solid #b3d9ff;
      border-radius: 5px;
      padding: 0.5em;
      margin-bottom: 1em;
      font-size: 0.9em;
    }
    .thread-actions {
      display: flex;
      gap: 0.5em;
      align-items: center;
      flex-wrap: wrap;
    }
    .thread-id {
      font-family: monospace;
      background: #fff;
      padding: 0.2em 0.4em;
      border-radius: 3px;
      border: 1px solid #ccc;
      font-size: 0.8em;
    }
    #new-thread-btn {
      background: #28a745;
      color: white;
      border: none;
      padding: 0.3em 0.8em;
      border-radius: 4px;
      cursor: pointer;
      font-size: 0.85em;
    }
    #new-thread-btn:hover {
      background: #218838;
    }

  #chat-input { width: 100%; box-sizing: border-box; padding: 0.5em; margin-top: 1em; }
  #send-btn   { margin-top: 0.5em; cursor: pointer; background-color: #003881; color: #fff; border-radius: 5px; }

  .thumbs {
        display: none;
        cursor: pointer;
    }
    #thumb-up {
        margin-right: 10px;
    }

    @media (max-width: 576px) {
      .chat-window {
        width: 370px;
      }
    }