/***********************************************
 *  SMALL POP-UP CHAT WINDOW (#chatbot-window)
 ***********************************************/
 #chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    /* Fixed height so it always stays the same size even when empty */
    height: 500px;
    background: #e5ddd5; /* WhatsApp-like background */
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  }
  
  #chatbot-window header {
    padding: 10px;
    background: linear-gradient(135deg, #075E54, #128C7E);
    color: #fff;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  #chat-close {
    cursor: pointer;
    font-size: 20px;
    margin-left: 10px;
  }
  
  #chatbot-window #chatbox {
    flex-grow: 1;
    background: url('https://www.transparenttextures.com/patterns/cubes.png');
    padding: 10px;
    overflow-y: auto;
  }
  
  /* Input group at bottom of the chat window */
  #chatbot-window .input-group {
    padding: 10px;
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
  }
  #chatbot-window #user-message {
    flex: 1;
    margin-right: 5px;
  }
  
  /* Loading Spinner Overlay */
  #chat-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
  }
  
  .spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #25d366;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* Chat toggle button (for minimized chat window) */
  #chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #075E54;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1050;
    font-size: 24px;
  }
  
  /* Bubble Layout for messages in chat window */
  #chatbot-window .message-wrapper {
    display: flex;
    margin-bottom: 10px;
  }
  #chatbot-window .message-wrapper.sent {
    justify-content: flex-end;
  }
  #chatbot-window .message-wrapper.received {
    justify-content: flex-start;
  }
  
  #chatbot-window .message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background-color: #fff;
    position: relative;
  }
  
  #chatbot-window .message-wrapper.sent .message {
    background-color: #dcf8c6;
    border-bottom-right-radius: 0;
  }
  #chatbot-window .message-wrapper.received .message {
    border-bottom-left-radius: 0;
  }
  
  #chatbot-window .sender-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
  }
  #chatbot-window .message-text {
    color: #333;
    white-space: pre-wrap;
  }
  #chatbot-window .message-timestamp {
    font-size: 10px;
    color: #999;
    text-align: right;
    margin-top: 5px;
  }
  
  /***********************************************
   *  CONVERSATION PANEL (.conversation-panel)
   ***********************************************/
  .conversation-panel .chat-container {
    height: 90vh;
    overflow: hidden;
    background-color: #f0f2f5;
  }
  
  .conversation-panel .chat-list {
    background-color: #ffffff;
    border-right: 1px solid #ddd;
  }
  
  .conversation-panel .chat-list-header {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
  }
  
  .conversation-panel .chat-list .list-group-item {
    border: none;
    border-bottom: 1px solid #f1f1f1;
    background-color: #fff;
    transition: background-color 0.2s;
  }
  .conversation-panel .chat-list .list-group-item:hover {
    background-color: #f9f9f9;
  }
  .conversation-panel .chat-list .list-group-item.active {
    background-color: #d1f2eb !important;
    color: #0c5460;
    border-color: #d1f2eb;
  }
  
  .conversation-panel .chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #e5ddd5;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
  }
  
  .conversation-panel .chat-header {
    background: linear-gradient(135deg, #075E54, #128C7E);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 10px 15px;
    color: #fff;
  }
  
  .conversation-panel .chat-box {
    background: url('https://www.transparenttextures.com/patterns/cubes.png');
    overflow-y: auto;
    padding: 15px;
  }
  
  .conversation-panel .chat-box::-webkit-scrollbar {
    width: 8px;
  }
  .conversation-panel .chat-box::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 4px;
  }
  .conversation-panel .chat-box::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .conversation-panel .message-wrapper {
    display: flex;
    margin-bottom: 10px;
  }
  .conversation-panel .message-wrapper.sent {
    justify-content: flex-end;
  }
  .conversation-panel .message-wrapper.received {
    justify-content: flex-start;
  }
  
  .conversation-panel .message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background-color: #fff;
  }
  
  .conversation-panel .message-wrapper.sent .message {
    background-color: #dcf8c6;
    border-bottom-right-radius: 0;
  }
  .conversation-panel .message-wrapper.received .message {
    border-bottom-left-radius: 0;
  }
  
  .conversation-panel .sender-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
  }
  .conversation-panel .message-text {
    color: #333;
    white-space: pre-wrap;
  }
  .conversation-panel .message-timestamp {
    font-size: 10px;
    color: #999;
    text-align: right;
    margin-top: 5px;
  }
  
  .conversation-panel .date-separator {
    text-align: center;
    font-size: 12px;
    color: #666;
    background-color: rgba(255,255,255,0.8);
    padding: 5px 10px;
    border-radius: 15px;
    display: inline-block;
    margin: 10px 0;
  }
  
  .conversation-panel .input-container {
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 10px 15px;
  }
  .conversation-panel .input-container textarea {
    flex-grow: 1;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    margin-right: 10px;
    background-color: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    font-size: 14px;
  }
  .conversation-panel .input-container textarea:focus {
    outline: none;
  }
  .conversation-panel .input-container input[type="file"] {
    display: none;
  }
  
  .conversation-panel .custom-file-upload {
    background-color: #128C7E;
    color: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 5px;
    transition: background-color 0.2s;
  }
  .conversation-panel .custom-file-upload:hover {
    background-color: #0e705d;
  }
  
  .conversation-panel .send-btn {
    background-color: #25d366;
    color: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
  }
  .conversation-panel .send-btn:hover {
    background-color: #1ebe57;
  }
  
  .conversation-panel .file-preview {
    margin-left: 10px;
  }
  .conversation-panel .file-preview img {
    max-width: 40px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  