:root {
  --primary-color: #4A9098; 
  --secondary-color: #333333; 
  --text-primary: #ffffff; 
  --text-secondary: #333333; 
  --background-light: #f7f7f7; 
  --background-dark: #FFFFFF; 
  --customer-message-bg: #e6e6e6; 
  --timestamp-color: #b0b0b0; 
  --hover-bg-color: #4A9098; 
  --hover-text-color: #ffffff;
  --assistant-bubble-bg: #00adb5;
  --assistant-text-color: #ffffff;
  --user-bubble-bg: #dddddd;
  --user-text-color: #00adb5;
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--background-dark);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  width: 100%;
  background: var(--background-light);
  padding: 20px 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

#logo {
  width: 250px;
  margin-right: 20px;
  margin-bottom: 10px;
}

#logo2 {
  width: 400px;
  margin-left: 20px;
}

nav {
  background: var(--primary-color);
  width: 100%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-links {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  margin: 0 15px;
  padding: 10px 20px;
  font-weight: 500;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.nav-link:hover, .nav-link.active {
  background-color: var(--secondary-color);
  color: var(--text-primary);
}

#logout-container {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding: 10px 20px;
  box-sizing: border-box;
  background: transparent;
  box-shadow: none;
}

#logout-button {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-primary);
}

#logout-button:hover {
  background-color: var(--hover-bg-color);
  border-color: var(--hover-bg-color);
  color: var(--hover-text-color);
}

h2 {
  margin: 0;
  padding: 5px 0;
  color: var(--secondary-color); 
  font-size: 1.2rem; 
}

#content {
  flex: 1;
  width: 90%;
  max-width: 1200px; /* Increased max width for larger tables */
  padding: 20px;
  margin-top: 10px;
  background: var(--background-light);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

#embed-container {
  width: 100%;
  height: 80vh; /* Adjust height as needed */
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none; /* Hide the regular nav links on mobile */
  }

  #logo {
    width: 150px; /* Adjust as necessary */
  }

  #logo2 {
    display: none;
  }

  .navbar-nav {
    width: 100%;
    justify-content: center;
  }

  .dropdown-toggle::after {
    margin-left: 5px;
  }

  .dropdown-menu a {
    width: 100%;
  }

}


/* Chat Styles for nexie_chat.html */
.nexie-chat #testBotContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90%;
  margin-bottom: 30px;
  max-width: 600px;
  margin: auto;
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  background: var(--background-light);
}

.nexie-chat #testBotChatbox {
  width: 100%;
  height: 300px;
  overflow-y: scroll;
  padding: 10px;
  background: var(--background-dark);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nexie-chat .message {
  padding: 8px;
  border-radius: 12px;
  margin: 5px;
  max-width: 60%;
  word-break: break-word;
}

.nexie-chat .user-message {
  align-self: flex-end;
  background: var(--user-bubble-bg);
  color: var(--user-text-color);
}

.nexie-chat .assistant-message {
  align-self: flex-start;
  background: var(--assistant-bubble-bg);
  color: var(--assistant-text-color);
}

.nexie-chat .message p, .nexie-chat .message ul, .nexie-chat .message li {
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.nexie-chat input, .nexie-chat button {
  padding: 10px;
  font-size: 16px;
  margin-top: 10px;
  border: none;
  width: 100%;
  border-radius: 8px;
}

.nexie-chat #testBotUserInput {
  background: var(--background-dark);
  color: var(--user-text-color);
}

.nexie-chat #testBotSendButton {
  background: var(--primary-color);
  color: var(--text-primary);
  cursor: pointer;
}

@media (max-width: 600px) {
  .nexie-chat #subtitle {
    font-size: 28px;
  }
  .nexie-chat #testBotContainer, .nexie-chat #testBotChatbox {
    width: 95%;
  }
  .nexie-chat input, .nexie-chat button {
    font-size: 14px;
  }
  .nexie-chat .message {
    padding: 6px;
  }
  .nexie-chat #logo {
    margin-top: 3px;
    margin-left: 3px;
  }
}

/* Custom scrollbar styles for the message display area */
#messageDisplay::-webkit-scrollbar,
#threadList::-webkit-scrollbar,
#contactsContainer::-webkit-scrollbar {
  width: 10px;
}

#messageDisplay::-webkit-scrollbar-thumb,
#threadList::-webkit-scrollbar-thumb,
#contactsContainer::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 10px;
  border: 3px solid #fff;
}

#messageDisplay::-webkit-scrollbar-track,
#threadList::-webkit-scrollbar-track,
#contactsContainer::-webkit-scrollbar-track {
  background-color: #f1f1f1;
  border-radius: 10px;
}

#messageDisplay,
#threadList,
#contactsContainer {
  scrollbar-width: thin;
  scrollbar-color: #888 #f1f1f1;
}

.section-header h2 {
  color: var(--primary-color); 
  font-size: 1.5em;
  padding: 10px 0;
  margin: 0 0 10px 0;
  text-align: left;
  width: 100%;
  background-color: var(--background-light);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message {
  padding: 15px;
  border-radius: 10px;
  margin: 10px 0;
  color: var(--text-primary);
  max-width: 80%;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.timestamp {
  font-size: 0.75rem;
  color: var(--timestamp-color);
  margin-top: 2px;
}

.from-client {
  background: var(--primary-color);
  color: var(--text-primary);
  margin-left: auto; 
  align-items: flex-end;
}

.from-customer {
  background: var(--customer-message-bg);
  color: var(--secondary-color);
  margin-right: auto; 
  align-items: flex-start;
}

.list-group-item {
  cursor: pointer;
  color: var(--secondary-color);
  background-color: transparent;
  border: none;
  border-bottom: 1px solid var(--background-light);
  transition: background-color 0.3s ease;
}

.list-group-item:hover {
  background-color: var(--hover-bg-color);
  color: var(--hover-text-color);
  transform: scale(1.05); 
}

.active-thread {
  background-color: var(--primary-color); 
  color: var(--text-primary); 
}

/* Contacts Table Styling */
#contactsContainer {
  margin-top: 20px;
  overflow-y: auto;
  height: 500px;
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1rem;
  background-color: transparent;
}

.table th,
.table td {
  vertical-align: middle;
  text-align: center;
  font-size: 0.85rem; /* Reduced font size */
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid #dee2e6;
  background-color: var(--primary-color);
  color: var(--text-primary);
}

.table tbody tr:nth-of-type(odd) {
  background-color: var(--background-light);
}

.table tbody tr:nth-of-type(even) {
  background-color: var (--background-dark);
}

.table tbody tr:hover {
  background-color: var(--hover-bg-color);
  color: var(--hover-text-color);
}

/* Custom scrollbar styles for the contacts table */
#contactsTable::-webkit-scrollbar {
  width: 10px;
}

#contactsTable::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 10px;
  border: 3px solid #fff;
}

#contactsTable::-webkit-scrollbar-track {
  background-color: #f1f1f1;
  border-radius: 10px;
}

#contactsTable {
  scrollbar-width: thin;
  scrollbar-color: #888 #f1f1f1;
}

/* Styling for the search bar */
.search-bar {
  border-radius: 20px;
  border: none;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-bar:focus {
  outline: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

#dateSearchIcon {
  display: inline-block;
  margin-left: 10px;
  vertical-align: middle;
}

/* Set flex-direction to column to stack elements vertically */
#chatContainer {
  display: flex;
  flex-direction: column; /* Add this line */
  width: 100%;
  padding: 20px;
  background: var(--background-light);
  border-radius: 20px;
}

#threadList {
  margin-top: 5px;
  flex-grow: 1;
  height: 500px;
  overflow-y: auto;
  padding: 10px;
  background: var(--background-dark);
  border-radius: 20px;
}

#messageDisplayContainer {
  overflow-y: auto;
  flex-grow: 1;
  height: calc(100vh - 200px);
  padding: 10px;
  background: var(--background-dark);
  border-radius: 20px;
}

#messageDisplay {
  flex: 2;
  overflow-y: auto;
  height: 100%;
}

.conversion-stats-header {
  text-align: center;
  margin-bottom: 20px;
}

#login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 65vh;
  padding-top: 10px;
}

#login-logo {
  width: 200px;
  margin-bottom: 20px;
}

.login-input {
  width: 100%; /* Ensure it takes up the full width within the form */
  max-width: 320px; /* Center align with the logo and button */
  margin: 10px 0;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid var(--primary-color);
  text-align: center; /* Center-align the text in the input box */
}

#login-button {
  width: 100%; /* Ensure it takes up the full width within the form */
  max-width: 320px; /* Center align with the logo and input boxes */
  margin-top: 20px;
  padding: 10px;
  border: none;
  border-radius: 5px;
  background-color: var(--primary-color);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
}

#login-button:hover {
  background-color: var(--hover-bg-color);
}

.form-label {
  width: 100%;
  text-align: center; /* Center-align the labels */
}

/* Center-align the placeholders */
.login-input::placeholder {
  text-align: center;
}

.form-check {
  max-width: 320px; /* Center align with the logo and input boxes */
  width: 100%; /* Ensure it takes up the full width within the form */
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.form-check-label {
  margin-left: 10px; /* Add space between the checkbox and the label */
}

.admin-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background: var(--background-light);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
}

.admin-container h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.admin-input {
  width: 100%;
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid var(--primary-color);
}

.admin-button {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 5px;
  background-color: var(--primary-color);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.admin-button:hover {
  background-color: var(--hover-bg-color);
}

.admin-form-check {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.admin-form-check-label {
  margin-left: 10px;
}

/* Add spacing between sections */
.admin-divider {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--primary-color);
}

.loading-image {
  width: 75px; /* Adjust the width as needed */
  height: 50px; /* Adjust the height as needed */
}

/* Mobile optimization */
@media (max-width: 768px) {
  #logo {
    width: 150px;
  }

  #logo2 {
    width: 250px;
  }

  .nav-links {
    display: none;
  }

  .dropdown {
    display: block;
    position: relative;
  }

  .dropdown-toggle {
    display: inline-block;
    padding: 10px;
    color: var(--text-primary);
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
  }

  .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-color);
    border-radius: 5px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1;
  }

  .dropdown-menu a {
    display: block;
    padding: 10px;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--hover-bg-color);
  }

  .dropdown-menu a:hover {
    background: var(--hover-bg-color);
  }

  .dropdown:hover .dropdown-menu {
    display: block;
  }

  .nexie-chat #testBotContainer {
    width: 100%;
  }

  .nexie-chat #testBotChatbox {
    height: 400px;
  }

  .message {
    max-width: 80%;
  }

  .nexie-chat input, .nexie-chat button {
    font-size: 14px;
  }

  .nexie-chat .message {
    padding: 8px;
  }
}

.message {
  max-width: 60%;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.from-nexie {
  align-self: flex-start;
  background: var(--assistant-bubble-bg);
  color: var(--assistant-text-color);
}

.from-user {
  align-self: flex-end;
  background: var(--user-bubble-bg);
  color: var(--user-text-color);
}

/* Style for the 'searchControls' div */
#searchControls {
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

#searchControls button {
  padding: 5px 10px;
  margin: 0 5px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background-color: var(--primary-color);
  color: var(--text-primary);
}

#matchCount {
  margin: 0 10px;
  font-weight: bold;
  color: var(--secondary-color);
}

/* Style for the 'clearSearchContainer' */
#clearSearchContainer {
  text-align: center;
  margin-bottom: 10px;
}

/* Highlighted matches */
mark {
  background-color: yellow;
  padding: 0;
}

/* Current match styling */
.current-match {
  background-color: orange !important;
}