<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chatbot UI with Text Input and Submit Button</title>
<style>
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f9f9f9;
    font-family: Arial, sans-serif;
  }

  /* Outer container block (static) */
  .outer-container {
    width: 320px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  /* Chat input area */
  .chat-input {
    width: 100%;
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 8px;
    padding: 10px;
    box-shadow: inset 0px 4px 8px rgba(0, 0, 0, 0.1);
  }

  .chat-input input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1em;
    color: #333;
  }

  /* Submit button (expandable block) */
  .submit-button {
    width: 100%;
    height: 50px;
    background-color: #4CAF50;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
  }

  .submit-button.expanded {
    height: 80px;
    box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.3);
  }

  /* Hide text when expanded */
  .submit-button.expanded .button-text {
    display: none;
  }

  /* Loading bar container */
  .loading-bar-container {
    width: 80%;
    height: 8px;
    background-color: #ddd;
    border-radius: 10px;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none; /* Hidden by default */
  }

  /* Loading bar */
  .loading-bar {
    width: 0;
    height: 100%;
    background-color: #ffffff;
    transition: width 2s ease; /* Animation duration */
  }

  /* Show loading bar when expanded */
  .submit-button.expanded .loading-bar-container {
    display: block;
  }

</style>
</head>
<body>

<div class="outer-container">
  <!-- Chat input area above the submit button -->
  <div class="chat-input">
    <input type="text" placeholder="Type your message here..." />
  </div>
  
  <!-- Submit button (expandable block) -->
  <div class="submit-button" id="expandableBox">
    <span class="button-text">Submit</span>
    <div class="loading-bar-container">
      <div class="loading-bar"></div>
    </div>
  </div>
</div>

<script>
  // Get the box and loading bar elements
  const box = document.getElementById("expandableBox");
  const loadingBar = document.querySelector(".loading-bar");

  // Toggle the "expanded" class and animate the loading bar on click
  box.addEventListener("click", function() {
    box.classList.toggle("expanded");

    if (box.classList.contains("expanded")) {
      // Reset the loading bar width to 0 before starting
      loadingBar.style.width = "0";

      // Animate the loading bar to full width over 2 seconds
      setTimeout(() => {
        loadingBar.style.width = "100%";
      }, 100); // Small delay to reset before animation
    } else {
      // Hide the loading bar when contracting
      loadingBar.style.width = "0";
    }
  });
</script>

</body>
</html>

Make it beautiful