:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --background-color: #f8f9fa;
  --text-color: #212529;
  --border-radius: 5px;
  --input-height: 60px;
  --message-max-width: 90%;
}

/* General Styles */
body {
  font-family: Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
}

/* Chat Container */
.chat-container {
  display: grid;
  grid-template-rows: auto 1fr auto; /* Header, chat history, input area */

}

/* Chat History */
.chat-history-wrapper {
  
  padding: 1rem;
  max-height: 70vh; /* Limit height for scrolling */
  background-color: #fff; /* White background for messages */
}

/* Message Styles */
.message {
  margin: 5px 0; /* Space between messages */
}

.message-content-wrapper {
  max-width: var(--message-max-width); /* Limit width for readability */
  overflow-wrap: break-word; /* Break long words */
  padding: 10px;
  border-radius: var(--border-radius);
  transition: background-color 0.3s ease;
}

.message.received .message-content-wrapper {
  background-color: #e6f2ff; /* Light blue for received messages */
}

.message.sent .message-content-wrapper {
  background-color: var(--primary-color); /* Primary color for sent messages */
  color: white; /* White text for sent messages */
}

/* Chat Input Area */
.chat-input-container {
  position: sticky; /* Keeps it at the bottom */
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10; /* Ensure it stays above other elements */
  background-color: #fff; /* White background */
  padding: 1rem;
  border-top: 1px solid #ddd; /* Top border */
}

.chat-input {
  display: flex; /* Flexbox for input and button */
  align-items: center; /* Center align items vertically */
  width: 100%; /* Full width */
}

.chat-input textarea {
  width: 90%; /* Take up 90% of the container width */
  min-height: 60px; /* Increased minimum height */
  max-height: 100px; /* Maximum height */
  padding: 10px; /* Padding for textarea */
  border: 1px solid #ced4da; /* Border */
  border-radius: var(--border-radius); /* Rounded corners */
  resize: none; /* Disable resizing */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  font-size: 16px; /* Font size for better visibility */
  transition: border-color 0.3s ease; /* Smooth transition for border color */
}

.chat-input textarea:focus {
  border-color: var(--primary-color); /* Change border color on focus */
  outline: none; /* Remove default outline */
}




/* Accessibility */
textarea:focus,
button:focus {
  outline: 2px solid var(--primary-color); /* Highlight focused elements */
}

/* Smooth Transitions */
.message-content-wrapper {
  transition: all 0.3s ease; /* Smooth transitions for message bubbles */
}

/* Scrollbar Styles */
.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.messages::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsive Design */
@media (max-width: 915px) {
  .chat-container {
      grid-template-rows: auto 1fr auto; /* Adjust layout for mobile */
  }

  .chat-history-wrapper {
      max-height: 50vh; /* Limit height on small screens */
  }

  .chat-input-container {
      padding: 0.5rem; /* Reduce padding on mobile */
  }
}

.chat-input-container {
  z-index: 1000; /* Ensure it appears above other elements */
}

.chat-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}



.button-container {
  display: flex;
  gap: 10px; /* Adjust the gap as needed */
}



/* Additional styling to ensure the textarea and button fit well */
.chat-input form {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
}

.chat-input textarea {
  flex: 1;
  margin-right: 10px; /* Space between textarea and submit button */
}



/* Chat Header */
.chat-header {
  padding: 1rem 0; /* Reduced padding to decrease height */
}

.chat-header .card-title {
  font-size: 1.25rem; /* Adjust font size for the title */
}

.chat-header .light {
  font-size: 0.9rem; /* Adjust font size for the clock or any other text */
}

/* Responsive Design for Smaller Screens */
@media (max-width: 915px) {
  .chat-header {
      padding: 0.5rem 0; /* Further reduce padding on smaller screens */
  }

  .chat-header .card-title {
      font-size: 1.1rem; /* Adjust font size for smaller screens */
  }

  .chat-header .light {
      font-size: 0.8rem; /* Adjust font size for smaller screens */
  }
}



.button-container {
  display: flex;
  gap: 10px; /* Adjust the gap as needed */
}

/* Collapsible header styles */
.chat-header {
  display: block;
  align-items: start;
  max-height: none;
  background-color: #f8f9fa;
}

.chat-header.collapsed {
  display: none;
}

.card-header .btn-tool {
  color: gray;
}

.card-header .btn-tool:hover {
  color: black;
}

/* Case card styles */
.case-card {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.case-card:hover {
  transform: scale(1.05);
}

.case-card .card-img-top {
  width: 100%;
  height: 100px;
  object-fit: cover;
}

.case-card .card-title,
.selected-cat .sel_cat-title {
  font-size: 0.75rem !important;
  margin-bottom: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-card .card-body,
.selected-cat .sel_cat-body {
  padding: 0.5rem !important;
}

.case-card img,
.selected-cat img {
  max-width: 75px;
  max-height: 75px;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

.selected-cat {
  cursor: pointer;
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 10%);
}


.chat-header {
  padding: 0.5rem 0; /* Reduced padding to decrease height */
}

.chat-header .card-title {
  font-size: 1.15rem; /* Adjust font size for the title */
}

.chat-header .light {
  font-size: 0.8rem; /* Adjust font size for the clock or any other text */
}

/* Message List */
.messages {
  
  max-height: 90vh; /* Adjusted height for better visibility */
  padding: 0; /* Remove padding to prevent overflow */
}

/* Chat Input Area */
.chat-input-container {
  position: sticky; /* Keeps it at the bottom */
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10; /* Ensure it stays above other elements */
  background-color: #fff; /* White background */
  padding: 0.5rem; /* Reduced padding */
  border-top: 1px solid #ddd; /* Top border */
}

.chat-input {
  display: flex; /* Flexbox for input and button */
  align-items: center; /* Center align items vertically */
  width: 100%; /* Full width */
}

.chat-input textarea {
  width: 90%; /* Take up 90% of the container width */
  min-height: 50px; /* Adjusted minimum height */
  padding: 10px; /* Padding for textarea */
  border: 1px solid #ced4da; /* Border */
  border-radius: var(--border-radius); /* Rounded corners */
  resize: none; /* Disable resizing */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  font-size: 16px; /* Font size for better visibility */
}







/* Responsive Design */
@media (max-width: 915px) {
  .chat-header {
      padding: 0.5rem 0; /* Further reduce padding on smaller screens */
  }

  .chat-header .card-title {
      font-size: 1rem; /* Adjust font size for smaller screens */
  }

  .chat-header .light {
      font-size: 0.7rem; /* Adjust font size for smaller screens */
  }

  .chat-input-container {
      padding: 0.5rem; /* Reduce padding on mobile */
  }
}


/* Responsive Design for Mobile */
@media (max-width: 915px) {
  .chat-container {
      grid-template-rows: auto 1fr auto; /* Adjust layout for mobile */
  }

  .chat-history-wrapper {
      max-height: 50vh; /* Limit height on small screens */
  }

  .chat-input-container {
      padding: 0.5rem; /* Reduce padding on mobile */
  }

  .chat-header {
      padding: 0.5rem 0; /* Further reduce padding on smaller screens */
  }

  .chat-header .card-title {
      font-size: 1.1rem; /* Adjust font size for smaller screens */
  }

  .chat-header .light {
      font-size: 0.8rem; /* Adjust font size for smaller screens */
  }

  .chat-input textarea {
      min-height: 50px; /* Adjusted minimum height for mobile */
  }

 


}

.chat-input-container {
  position: sticky; /* Keeps it at the bottom */
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10; /* Ensure it stays above other elements */
  background-color: #fff; /* White background */
  padding: 0.5rem; /* Adjust padding */
  width: 100%; /* Full width */
}

.chat-input {
  display: flex; /* Flexbox for input and button */
  align-items: center; /* Center align items vertically */
  width: 100%; /* Full width */
}

.chat-input textarea {
  flex-grow: 1; /* Take up available space */
  min-height: 60px; /* Minimum height */
  padding: 10px; /* Padding for textarea */
  border: 1px solid #ced4da; /* Border */
  border-radius: var(--border-radius); /* Rounded corners */
  resize: none; /* Disable resizing */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  font-size: 16px; /* Font size for better visibility */
  margin-right: 10px; /* Space between textarea and button */
}


.chat-input-container {
  position: sticky; /* Keeps it at the bottom */
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10; /* Ensure it stays above other elements */
  background-color: #fff; /* White background */
  padding: 0.5rem; /* Adjust padding */
  border-top: 1px solid #ddd; /* Top border */
}

.chat-input {
  display: flex; /* Flexbox for input and button */
  align-items: center; /* Center align items vertically */
  width: 100%; /* Full width */
}

.chat-input textarea {
  width: 90%; /* Take up 90% of the container width */
  min-height: 60px; /* Increased minimum height */
  padding: 10px; /* Padding for textarea */
  border: 1px solid #ced4da; /* Border */
  border-radius: var(--border-radius); /* Rounded corners */
  resize: none; /* Disable resizing */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  font-size: 16px; /* Font size for better visibility */
}




/* Message styles */
.message {
  max-width: 85%; /* Increased from 80% */
  margin-bottom: 0.5rem; /* Reduced space between messages */
}

.message-content-wrapper {
  padding: 0.5rem; /* Reduced padding */
}

/* Responsive styles */
@media (max-width: 915px) {
  .message {
    max-width: 95% !important; /* Further increased for mobile */
    font-size: 0.8rem !important; /* Slightly smaller font size */
  }
  
  .message-content-wrapper {
    padding: 0.4rem; /* Further reduced padding */
  }
  
  /* Adjust the chat history to take up more vertical space */
  .chat-history-wrapper {
    max-height: 85vh;
  }
  
  /* Reduce the size of the input area */
  .chat-input-container {
    padding: 0.3rem;
  }
  
  .chat-input textarea {
    min-height: 40px; /* Reduced height */
    font-size: 0.9rem !important; /* Smaller font size */
  }
  
 
}

/* Adjusting the container-fluid to take up majority of viewport height */
.container-fluid {
  display: flex;
  flex-direction: column;
  /*min-height: calc(100vh - 50px);  Adjust 50px based on your footer height */
  padding-bottom: 10px; /* Small padding at the bottom */
}

/* Adjusting the chat-app to fill available space */
.chat-app {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Reducing the size of sel_cat-body */
.sel_cat-body {
  padding: 0.5rem !important;
}

.sel_cat-body img {
  max-width: 50px;
  max-height: 50px;
}

.sel_cat-title {
  font-size: 0.7rem;
}

/* Moving "Mock Oral Board Case" title */
.mock-oral-board-title {
  font-size: 1.2rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 15px;
}

/* Adjusting the main content area */
.chatcard {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.chat-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.chat-history-wrapper {
  flex-grow: 1;
  overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 915px) {
  .container-fluid {
    padding-left: 5px;
    padding-right: 5px;
  }

  .mock-oral-board-title {
    font-size: 1rem;
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
  }

  .sel_cat-body img {
    max-width: 40px;
    max-height: 40px;
  }

  .sel_cat-title {
    font-size: 0.6rem;
  }
}

.container-fluid {
  padding: 0;
}

.card {
  height: 100%;
  margin-bottom: 0;
}

.chat-app {
  height: 100%;
}

.chat-container {
  height: 100%;
}

.card-header {
  padding: 0.5rem 1rem;
}

.card-title {
  font-size: 1.25rem;
}

.chat-header {
  padding: 0.5rem;
}

.sel_cat-body {
  padding: 0 !important;
}

.sel_cat-body img {
  max-width: 30px;
  max-height: 30px;
}

.sel_cat-title {
  font-size: 0.9rem;
}

#clock {
  font-size: 0.9rem;
  padding: 5px;
  margin: 0;
}

.chat-history-wrapper {
  height: calc(100% - 130px); /* Adjust based on your header and input heights */
  overflow-y: auto;
}

.chat-input-container {
  background-color: #fff;
  border-top: 1px solid #ddd;
}

.chat-input {
  padding: 0.5rem;
}



@media (max-width: 915px) {
  .card-title {
    font-size: 1rem;
  }

  .sel_cat-body img {
    max-width: 25px;
    max-height: 25px;
  }

  .sel_cat-title {
    font-size: 0.8rem;
  }

  #clock {
    font-size: 0.8rem;
  }

  .chat-input textarea {
    font-size: 0.9rem;
  }


}

/* General message styles */
.message {
  display: flex;
  margin-bottom: 15px;
}

/* Styles for sent messages */
.message.sent {
  justify-content: flex-end;
}

.message.sent .message-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 85%; /* Adjust as needed */
}

.message.sent .message-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.message.sent .message-time {
  order: 1;
  margin-right: 10px;
}

.message.sent .message-sender {
  order: 2;
  margin-right: 10px;
}

.message.sent .avatar {
  order: 3;
  width: 70px; /* Adjust as needed */
  height: 70px; /* Adjust as needed */
}

.message.received .avatar {
  width: 70px; /* Adjust as needed */
  height: 70px; /* Adjust as needed */
}

.message.sent  {
  width: 100%;
  margin-top: 5px; /* Space between header and content */
}

.message.sent p {
  text-align: right;
  margin-bottom: 0;
}

/* Ensure the content doesn't overflow the bubble */
.message-content-wrapper {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Responsive design for smaller screens */
@media (max-width: 576px) {
  .message.sent .message-content-wrapper {
    max-width: 90%; /* Allow slightly wider messages on small screens */
  }
}

/* Toggle Switch Styles */
.ai-model-toggle {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

#aiModelLabel {
  margin-left: 8px;
}

.ai-model-toggle .ai-label {
  transition: all 0.3s ease;
  font-weight: normal;
  font-size: 14px;
}

.ai-model-toggle .ai-label.active {
  font-weight: bold;
  font-size: 16px;
  text-shadow: 0 0 1px rgba(0,0,0,0.3);
}

.ai-model-toggle .ai-label.inactive {
  opacity: 0.5;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #10A37F;
  transition: .4s;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: #4285F4;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}
