 :root {
    --primary: #007bff;
    --light: #ffffff;
    --bg: #f0f2f5;
    --bot-msg: #e6e6e6;
    --user-msg: #007bff;
  }

  * {
    box-sizing: border-box;
  }

  /* body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg);
  } */
  #chat-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: background 0.3s;
  }

  #chat-btn:hover {
    background: #0056b3;
  }

  #chat-window {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    height: 500px;
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
  }

  #chat-header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  /* Instead of space-between, let's use space-around and flex-grow */
  justify-content: flex-start;
  gap: 10px; /* space between flex items */
  overflow: visible; /* ensure children don't get clipped */
}

#chat-header > span:first-child {
  flex-shrink: 0; /* don't shrink the title */
  white-space: nowrap; /* keep title on single line */
}

#area-select {
  font-size: 14px !important;
  border-radius: 5px !important;
  padding: 4px 8px !important;
  flex-shrink: 0 !important;
  max-width: 140px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#chat-close {
  cursor: pointer;
  font-size: 22px;
  margin-left: auto; /* push close button all the way right */
  flex-shrink: 0;
  line-height: 1;
  padding-left: 10px;
}



  #chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: #f7f7f7;
  }

  .message {
    max-width: 80%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    line-height: 1.4;
    font-size: 14px;
    white-space: pre-wrap;
  }

  .user-msg {
    background: var(--user-msg);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0;
  }

  .bot-msg {
    background: var(--bot-msg);
    color: black;
    align-self: flex-start;
    border-bottom-left-radius: 0;
  }

  #chat-input-container {
    display: flex;
    border-top: 1px solid #ccc;
    padding: 10px;
    background: #fff;
  }

  #chat-input {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
  }

  #chat-send {
    margin-left: 10px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
  }

  #chat-send:disabled {
    background: #a5c3f3;
    cursor: not-allowed;
  }

  @media (max-width: 480px) {
    #chat-window {
      width: 95%;
      right: 2.5%;
      bottom: 80px;
    }

    #chat-btn {
      bottom: 15px;
      right: 15px;
      padding: 10px 16px;
    }
     #chat-header {
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    #chat-header > span:first-child {
        flex-basis: 100%; /* full width */
        margin-bottom: 6px;
    }

    #area-select {
        flex-basis: auto;
        min-width: 120px;
        margin-left: 0;
        margin-right: 10px;
    }

    #chat-close {
        margin-left: auto; /* push close button right */
    }
  }