: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, #logo2 {
  margin-bottom: 0px;
}

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

#logo2 {
  width: 135px;
  margin-left: 20px;
  margin-bottom: 3px;
}

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 (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 10px;
  }
}

/* Chat Styles for test_bot.html */
.test-bot #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);
}

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

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

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

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

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

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

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

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

@media (max-width: 600px) {
  .test-bot #subtitle {
    font-size: 28px;
  }
  .test-bot #testBotContainer, .test-bot #testBotChatbox {
    width: 95%;
  }
  .test-bot input, .test-bot button {
    font-size: 14px;
  }
  .test-bot .message {
    padding: 6px;
  }
  .test-bot #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;
}

/* Reversed colors for live chat */
.from-customer {
  background: var(--assistant-bubble-bg); /* Assistant colors */
  color: var(--assistant-text-color);
  margin-right: auto;
  align-items: flex-start;
}

.from-client {
  background: var(--user-bubble-bg); /* User colors */
  color: var(--user-text-color);
  margin-left: auto;
  align-items: flex-end;
}

.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;
}

/* Ensure the panes are defined for the conversations tab */
#chatContainer {
  display: flex;
  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: 300px;
  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 */
}

/* Colors for SMS */
.sms-from-client {
  background: var(--primary-color);
  color: var(--text-primary);
}

.sms-from-customer {
  background: var(--customer-message-bg);
  color: var(--secondary-color);
}

/* Colors for Live Chat (Reversed) */
.live-chat-from-client {
  background: var(--customer-message-bg);
  color: var(--secondary-color);
}

.live-chat-from-customer {
  background: var(--primary-color);
  color: var(--text-primary);
}

.upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background-color: var(--background-light);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.upload-section h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  align-items: center;
}

.upload-input {
  display: block;
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid var(--primary-color);
  width: 100%;
  max-width: 100%;
  font-size: 16px;
}

.upload-button {
  background-color: var(--primary-color);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  display: none; /* Hidden initially until the file is selected */
  margin-top: 20px;
}

.upload-button.show {
  display: inline-block; /* Displayed when file is selected */
}

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

.upload-section .message {
  margin-top: 20px;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 16px;
}

.message-success {
  background-color: #d4edda;
  color: #155724;
}

.message-error {
  background-color: #f8d7da;
  color: #721c24;
}

/* Styling for the file label */
.custom-file-upload {
  display: inline-block;
  padding: 10px;
  cursor: pointer;
  border: 1px solid var(--primary-color);
  background-color: var(--primary-color);
  color: var(--text-primary);
  border-radius: 5px;
}

.custom-file-upload:hover {
  background-color: var(--hover-bg-color);
  color: var(--hover-text-color);
}

.modal {
  z-index: 1050; /* Set a high z-index to ensure the modal appears above other elements */
  display: none; /* Hidden by default */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 500px;
}

.modal-backdrop {
  z-index: 1040; /* Lower z-index for the backdrop so the modal appears behind the modal content */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); /* Backdrop opacity */
}

/* Modal content style */
.modal-content {
  background-color: var(--background-light);
  padding: 20px;
  border: 1px solid var(--primary-color);
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

/* Ensure modal header and body layout properly */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h5 {
  color: var(--primary-color);
  margin: 0;
  font-size: 1.5em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5em;
  color: var(--secondary-color);
  cursor: pointer;
}

.modal-body {
  margin-top: 15px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-footer .btn {
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: var(--text-primary);
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.modal-footer .btn:hover {
  background-color: var(--hover-bg-color);
}

/* Alert box styles */
.alert {
  padding: 15px;
  margin: 15px 0;
  border-radius: 5px;
  border: 1px solid transparent;
}

.alert-success {
  background-color: var(--primary-color);
  color: var(--text-primary);
  border-color: var(--hover-bg-color);
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.alert-dismissible .btn-close {
  color: inherit;
  padding: 0;
  background-color: transparent;
  border: none;
  font-size: 1.2em;
}

.alert-dismissible .btn-close:hover {
  color: #333;
}

/* Additional Spacing and Styling for Consistency */
.upload-section form {
  margin-bottom: 30px;
}

#mapping-section {
  margin-top: 40px;
  padding: 20px;
  background-color: var(--background-light);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
}

#mapping-section h3 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--primary-color);
}

#mapping-fields label {
  display: block;
  text-align: center;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--secondary-color);
}

#mapping-fields select {
  width: 100%;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid var(--primary-color);
  margin-bottom: 20px;
}

#mapping-fields select:focus {
  border-color: var(--hover-bg-color);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

/* Mapping Submit Button Styling */
.mapping-submit-button {
  background-color: var(--primary-color);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  display: inline-block;
  margin-top: 20px;
  width: 100%; /* Full width button */
}

.mapping-submit-button:hover {
  background-color: var(--hover-bg-color);
  color: var(--hover-text-color);
}

#mapping-fields .form-control {
  margin: 0 auto; /* Center the dropdowns themselves */
  max-width: 300px; /* Set a max-width for the dropdowns if desired */
}

/* Custom Button Styling */
.btn {
  background-color: #4A9098;
  border-color: #4A9098;
  color: #ffffff;
  border-radius: 20px;
  padding: 8px 16px;  /* Smaller padding */
  font-size: 14px;    /* Smaller font size */
  cursor: pointer;
}

.btn:hover {
  background-color: #333333;  /* Darker shade on hover */
  border-color: #333333;
  color: #ffffff;
}

.btn-secondary {
  background-color: #4A9098;
  border-color: #4A9098;
  color: #ffffff;
  padding: 8px 16px;  /* Smaller padding for secondary buttons as well */
  font-size: 14px;    /* Smaller font size for secondary buttons */
}

.btn-secondary:hover {
  background-color: #333333; /* Darker hover for secondary button */
  border-color: #333333;
}