/* General Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  
  body {
    font-family: 'Roboto', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    padding: 0;
    position: relative;
  }
  
  
  /* Sidebar */
  .sidebar {
    width: 20%;
    height: 100vh;
    background-color: #f8f9fa;
    border-right: 1px solid #333;
    padding: 20px;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
  }
  
  
  .sidebar button {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
/* padding-right: 0;
    padding-left: 0; */
  }

  #new-chat {
    margin-bottom: 10px;
  }

  #clear-history{
    margin-bottom: 10px;
  }
  
  
  .chat-list {
    margin-top: 15px;
    flex-grow: 1;
    overflow-y: auto;
    width:100%;
    /* padding-right: 10px;
    margin-right: -10px; */
  }
  
  /* Chat List Scrollbar Styling */
.chat-list::-webkit-scrollbar {
    width: 10px;
    /* margin-right: 10px; */

  }
  
  .chat-list::-webkit-scrollbar-thumb {
    background: #e0e0e0; 
    border-radius: 5px;
    background-clip: content-box;
    visibility: hidden;
  }
  
  .chat-list::-webkit-scrollbar-track {
    background: transparent; /* Make the track transparent */
  }
  
  .chat-list:hover::-webkit-scrollbar-thumb {
      background: #e0e0e0; 
      border-radius: 5px;
      visibility: visible;
  }
  
  .chat-list:hover::-webkit-scrollbar-track {
      background: rgba(200,200,200, 0.1)
  }
  
  body.dark-mode .chat-list::-webkit-scrollbar-thumb {
    background: #3d3d3d;
    border-radius: 5px;
    visibility: hidden;
    background-clip: content-box;
}

  body.dark-mode .chat-list:hover::-webkit-scrollbar-thumb {
      background: #3d3d3d;
      border-radius: 5px;
      visibility: visible;
  }
  
  body.dark-mode .chat-list::-webkit-scrollbar-track {
    background: transparent;
}

  body.dark-mode .chat-list:hover::-webkit-scrollbar-track {
      background: transparent;
  }
  
  
  .chat-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-height: 2rem;
    width: 100%;
  }
  
  
  .chat-list div:hover {
    background-color: #e3f2fd;
  }
  
  
  .delete-chat {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    max-width: 20px;
    margin-right: 10px;
    margin-top: 10px;
  }
  
  
  .delete-chat:hover {
    color: #c82333;
  }
  
  
  /* Main Content */
  .container {
/* position: relative; */
    display: flex;
    margin-left: 20%;
    flex-direction: column;
    align-items: right; /* Center horizontally */
    justify-content: center; /* Distribute space between header, chat history, and input */
    height: 100vh; /*Make the container take full viewport height*/
    padding: 1% 0% 1% 15%;
    width: calc(100% - 20%);
    margin-left: auto;
    margin-right: auto; 
    gap: 10px;
  }
  
  /* Header */
  h2 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
  }
  
  
  /* Chat History */
  #chat-history {
    height: 87vh; /* Adjust as needed */
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 0px; /* Adjusted to prevent overlap with the input area */
    background-color: rgb(227, 227, 227);
    border-radius: 5px;
    width: 100%;
    margin-bottom: 0px;
  }
  
  
  #chat-history .message {
    margin-bottom: 10px;
    padding: 10px 20px;
    border-radius: 5px;
    background-color: white;
  }
  
  
  #chat-history .user {
    text-align: right;
    background-color: #e3f2fd;
  }
  
  
  #chat-history .bot {
    text-align: left;
    background-color: #f5f5f5;
  }
  
  #chat-history .bot code {
    background-color: #eee; /* White background for light mode */
    color: #222; /* Dark text for light mode */
    padding: 2px 4px;
    border-radius: 5px;
    border: #222 solid 1px; /* Grey border for light mode */
    font-family: "Courier New", Courier, monospace;
    font-weight: bold;
}

#chat-history .bot pre code {
    background-color: #eee; /* White background for light mode */
    color: #222; /* Dark text for light mode */
    padding: 10px;
    border-radius: 5px;
    display: block; /* Make it a block element */
    overflow-x: auto; /* Add horizontal scrolling if needed */
    white-space: pre; /* Keep whitespace and line breaks */
    border: #222 solid 1px; /* Grey border for light mode */
    font-weight: bold;
}
  
  /* Typing Indicator */
  #typing-indicator {
    display: none;
    color: #666;
    font-style: italic;
    margin-top: 10px;
  }
  
  
  .typing-animation {
    display: inline-block;
  }
  
  
  .typing-animation span {
    animation: blink 1.4s infinite;
    opacity: 0;
  }
  
  
  .typing-animation span:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  
  .typing-animation span:nth-child(3) {
    animation-delay: 0.4s;
 }
  
  
  @keyframes blink {
    0%,
    100% {
      opacity: 0;
    }
    50% {
      opacity: 1;
    }
  }
  
  
  /* Input Container */
  .input-container {
    display: flex;
    gap: 10px;
    padding: 10px; /* Add padding for visual spacing */
    background-color: rgb(227, 227, 227); /* Add a background color to the input area */
    border-radius: 5px;
    width: 100%;
    position: relative;
    bottom: 0;
    left: auto;
    
  }
  
  
  .input-container input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    word-wrap: break-word;
  }
  
  
  .input-container button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    background-color: #28a745;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  
  
  .input-container textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    resize: none; 
    overflow-wrap: break-word; /* Ensures long words wrap */
  }
  
  
  .input-container button:hover {
    background-color: #218838;
  }
  
  
  /* #response {
    margin-top: 30px;
    padding: 20px;
    background-color: #f1f1f1;
    border-radius: 5px;
    min-height: 100px;
    font-size: 1em;
    color: #333;
  }
  
  
  #response-content {
    margin-top: 10px;
  }
  
  
  #copy-response {
    display: none;
    margin-top: 10px;
  } */
  
  
  /* Dark Mode Toggle */
  .dark-mode-toggle {
    position: sticky;
    max-width: 100%;
    /* bottom: 0; */
    z-index: 10;
    padding: 10px;
    align-self: flex-end;
    margin-top: 20px;
    margin-bottom: 0px;
  }
  
  
  /* Dark Mode Styles */
  body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
  }
  
  
  body.dark-mode .sidebar {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-right: #e0e0e0 solid 1px;
  }
  
  
  body.dark-mode .chat-list div {
    background-color: #2d2d2d;
    color: #e0e0e0;
  }
  
  
  body.dark-mode .chat-list div:hover {
    background-color: #3d3d3d;
  }
  
  body.dark-mode .input-container {
    background-color: #292929;
  }

  body.dark-mode .input-container input {
    background-color: #2d2d2d;
    color: #2f2f2f;
    border-color: #444;
  }
  
  
  body.dark-mode .input-container button {
    background-color: #28a745;
  }
  
  
  body.dark-mode .input-container button:hover {
    background-color: #218838;
  }
  
  
  body.dark-mode #chat-history {
    background-color: #2d2d2d;
    color: #e0e0e0;
  }
  
  
  body.dark-mode #chat-history .message {
    background-color: #3d3d3d;
    color: #e0e0e0;
  }
  
  
  body.dark-mode #chat-history .user {
    background-color: #072757;
  }
  
  
  body.dark-mode #chat-history .bot {
    background-color: #222222;
    color: #e0e0e0;
  }
  
  /* Target code blocks in dark mode */
body.dark-mode #chat-history .bot code {
    background-color: #222; /* Darker color */
    color: #f8f8f2; /* Light color for text */
    padding: 2px 4px;
    border-radius: 5px;
    border: #f8f8f2 solid 1px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

/* Target pre code blocks in dark mode */
body.dark-mode #chat-history .bot pre code {
    background-color: #222;
    color: #f8f8f2;
    padding: 10px;
    border-radius: 5px;
    display: block; /* Make it a block element */
    overflow-x: auto; /* Add horizontal scrolling if needed */
    white-space: pre; /* Keep whitespace and line breaks */
    font-weight: bold;
}

  body.dark-mode #response {
    background-color: #2d2d2d;
    color: #e0e0e0;
  }
  
  
  body.dark-mode #response-content {
    color: #e0e0e0;
  }

  body.dark-mode h2 {
    color: #e0e0e0;
  }
  
  
  /* Loading Spinner */
  .loading {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 5px;
  }
  
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  
  /* Active Chat Item */
  .chat-list div.active {
    background-color: #e3f2fd; /* Active color */
  }
  
  
  /* Benjamin Name Styling */
  #chatbot-name-display {
    color: #be3cff; /* Name color */
    font-weight: bold;
  }
  
  
  /* For screens smaller than 768px */
  @media (max-width: 768px) {
    .sidebar {
        width: 100%; /* Make the sidebar take full width on small screens */
    }
  
  
    .container {
        margin-left: 0; /* Remove the margin on small screens */
        width: 100%; /* Make the container take full width on small screens */
    }
  }
  
  .message.bot ul,
  .message.bot ol {
    padding-left: 20px;
    list-style-position: outside;
  }

  .message.bot li {
    margin-left: 10px;
  }