/* --------------------------------Import Fonts------------------------------------------*/
/*@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap');*/

/* --------------------------------Reset and Base Styles------------------------------------------*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; /* Font stack with fallbacks */
}

body {
  background-color: #ffffff;
  color: #333;
  line-height: 1.5;
  font-size: 10px;
}

/* --------------------------------Typography------------------------------------------*/
h1 {
  font-size: 2rem;
  margin-bottom: 10px;
  text-align: left;
  color: #01579B; /* Default light mode */
}

body.dark-mode h1 {
  color: #4caf50; /* Light green for dark mode, visible against dark background */
}

h2 {
  font-size: 1rem;
  margin-bottom: 10px;
  margin-top: 10px;
  color: #001F3F; /* Default light mode */
  font-weight: 500;
}

#documents h2 {
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2c3e50;
  background: linear-gradient(to right, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 2px solid #eee;
}

body.dark-mode #documents h2 {
  border-bottom: 2px solid #4a4a4a;
}

.edu-note {
  font-size: 0.55rem;
  font-weight: 400;
  color: #888;
  font-style: italic;
  margin-left: 0.3rem;
}


body.dark-mode h2 {
  color: #ffffff;
}

h3 {
    font-size: 0.65rem;
    font-weight: normal;
    color: #ff0202;
    font-weight: 500;
    }

body.dark-mode h3 {
  color: #ffffff;
  font-weight: normal;
}


#chat-h2 {
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-icon {
  color: #1284ff; /* keep it blue or default emoji styling */
  
}

.chat-text-h2 {
  background: linear-gradient(to right, #00c6ff, #0072ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent; /* fallback */
  letter-spacing: 0.5px;
}

body.dark-mode #chat-h2 {
  color: #ffffff;
}


body.dark-mode #sidebar h3 {
  font-size: 1rem;
  margin-bottom: 20px;
  color: #9d9d9d;
}

/* --------------------------------Links------------------------------------------*/
a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #1f78d1;
  text-decoration: underline;
}

/* --------------------------------Layout Container------------------------------------------*/
#container {
  display: flex;
  min-height: 100vh;
  position: relative;
  margin: 0;
  padding: 0;
  flex-direction: row;
}

/* --------------------------------Top Bar Section------------------------------------------*/
:root {
  --topbar-height: 35px;
}

/* Top Bar */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--topbar-height);
  background-color: #ffffff00; 
  color: #000000;
  text-align: left;
  padding: 0 10px;
  font-size: 14px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  border-bottom: 1px solid #ccc;
}

body.dark-mode #top-bar {
  border-bottom: 1px solid #535353;
}

#top-bar-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0; /* important to allow tabs to scroll */
  overflow: hidden; /* prevents tabs from escaping */
}

#top-bar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

#top-bar-left img {
  margin-right: 8px; /* Space between icon and text */
}


/* Scrollable tab bar inside top bar */
#topbar-tabs {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  gap: 10px;
  flex: 1;
  -webkit-overflow-scrolling: touch; /* smooth scroll on mobile */
  scroll-behavior: smooth;
}

#topbar-tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.tab-link {
  flex-shrink: 0;
  color: #000000;
  padding: 0px 3px;
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s;
}

body.dark-mode .tab-link {
  color: #ffffff;
}

.tab-link:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.tab-link.active {
  background-color: #fff;
  color: #000;
  font-weight: bold;
}

body.dark-mode .tab-link.active {
  background-color: #ffffff;
  color: #000000 !important;
  font-weight: bold;
}

#top-bar span {
  font-weight: bold;
}

#top-bar-left2 {
  flex-grow: 1;
  overflow: hidden;
}

#topbar-filename {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: bold;
}

#top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#sidebarToggle {
  font-size: 28px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #000000;
}

body.dark-mode #sidebarToggle {
  color: #ffffff;
}

/* --------------------------------Dark Mode-------------------------------------*/
#dark-mode-toggle {
  cursor: pointer;
  font-size: 20px;
  color: #000000;
  margin-left: 10px;
}

#dark-mode-toggle:hover {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

body.dark-mode #dark-mode-toggle {
  color: #ddd;
}

body.dark-mode {
  background: linear-gradient(109deg, #141414 0%, #141414 20%, #141414 100%);
  color: #ffffff;
}

body.dark-mode #top-bar {
  background-color: #000000; /* Dark blue for top bar in dark mode */
}

body.dark-mode #top-bar,
body.dark-mode #sidebar,
body.dark-mode #main-content {
  color: #fff;
}

body.dark-mode #documentSidebar {
  color: #ffffff;
  background: #000000;
}

body.dark-mode #chat-messages,
body.dark-mode input,
body.dark-mode textarea {
  background-color: #313131;
  color: #fff;
  border: 1px solid #444;
}

body.dark-mode a {
  color: #80bfff;
}

body.dark-mode #chat-form {
  /*background-color: #1a1a1a;
  border-top: 1px solid #333;*/s
}

body.dark-mode #chat-input-container {
  /*background-color: #1a1a1a;*/
}

body.dark-mode #chat-input {
  background-color: #313131;
  color: #fff;
  border: 1px solid #444;
}

body.dark-mode #send-button {
  background-color: #494949; /* Bootstrap primary blue */
  color: white;
  border: none;
}

body.dark-mode #send-button:focus {
    outline: none;
    border: 1px solid #ffffff;
    box-shadow: 0 0 1px #ffffff;
}

body.dark-mode #send-button:hover {
  background-color: #303030;
}

body.dark-mode th {
  background-color: #313131;
  color: #a3a3a3;
  border-bottom: 1px solid #333;
}

body.dark-mode td {
  background-color: #252525;
  color: #eee;
}

body.dark-mode table.document-table tr.document-row:hover td {
  background-color: #4b6b8a !important; /* or any hover color you like */
  color: #ffffff !important;
}

body.dark-mode table.document-table tr.document-row.selected td {
    background-color: #375a7f !important;
    color: #ffffff !important;
}

/* Dark mode sidebar */
body.dark-mode #sidebar {
  min-height: 100vh;
  background-color: #000000; /* Dark background for the sidebar */
  border-right: 1px solid #252525;
  padding: 10px;
  box-sizing: border-box;
  transition: transform 0.3s ease;
  transform: translateX(0);
  color: #907e7e; /* White text color for dark mode */
  position: fixed;
  top: 35px;
  left: 0;
  z-index: 999;
}

body.dark-mode .user-message {
  background-color: #6cf28ea6;
  color: #ffffff;
}

body.dark-mode .bot-message {
  background-image: linear-gradient(to right, #a06fe5, #f985aa);
  color: #ffffff;
}

/* User bubble tail (right side) */
body.dark-mode .user-message::after {
  border-color: transparent transparent transparent #6cf28ea6;
}

/* Bot bubble tail (left side) */
body.dark-mode .bot-message::after {
  border-color: transparent #a06fe5 transparent transparent;
}

body.dark-mode #fullscreen-btn {
  color: #858585;
}

body.dark-mode #fullscreen-btn:hover {
  color: #ffffff;
}

body.dark-mode .delete-button {
    background-color: #313131;
    color: #ffffff;
}

body.dark-mode .delete-button:hover {
    background-color: #717171;
    color: #ffffff;
}

body.dark-mode .view-button {
    background-color: #404040;
    color: #ffffff;
}

body.dark-mode .view-button:hover {
    background-color: #313131;
    color: #ffffff;
}

body.dark-mode #chat-input:focus {
    outline: none;
    border: 1px solid #ffffff;
    box-shadow: 0 0 2px #ffffff;
}

body.dark-mode #chat-container {
  background-color: #141414
}

body.dark-mode #documents {
  background-color: #141414;
}

body.dark-mode .document-table {
  background-color: #515151;
}

body.dark-mode .sidebar-content ul li a {
    text-decoration: none;
    color: #ffffff;
    font-size: 12px;
    transition: color 0.3s ease;
}

/* Mobile/Small viewport adjustments */
@media (max-width: 768px) {
  /* Ensure the sidebar is hidden on small screens in dark mode */
  body.dark-mode #sidebar {
    width: 100vw; /* Smaller sidebar for mobile */
    position: fixed;
    /*top: 50px; /* Sidebar below the top bar */*/
    left: 0;
    min-height: 100vh;
    transition: transform 0.3s ease;
    transform: translateX(-100%); /* Sidebar is hidden by default */
    z-index: 1000;
  }

  /* Optionally, ensure sidebar toggle appears on mobile */
  body.dark-mode #sidebarToggle {
    display: block; /* Show toggle button on mobile */
  }

  
  /* Sidebar hidden state */
  body.dark-mode #sidebar.hidden {
    transform: translateX(-100%); /* Move sidebar offscreen */
  }

 
  body.dark-mode #sidebar:not(.hidden) {
    transform: translateX(0); /* Show sidebar when toggled */
  }


}

/* --------------------------------Sidebar Section (Left Navigation)------------------------------------------*/

/* Sidebar as a flex container spanning from below the top bar to the bottom */
#sidebar {
  position: fixed;
  top: var(--topbar-height); /* starts below top bar */
  bottom: 0;                 /* always reaches the bottom */
  left: 0;
  width: 35vw;
  padding: 10px;
  min-height: 100vh;
  background-color: #ffffff;
  border-right: 1px solid #ccc;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  z-index: 999;
}


/* Hides sidebar immediately on page load before JS kicks in */
.js-hidden {
  display: none !important;
}

/* Used by JS to hide sidebar when needed */
.hidden {
  display: none !important;
}

/* Optional: main content expansion */
#main-content.expanded {
  width: 100%;
}

/* Sidebar hidden state */
#sidebar.hidden {
  transform: translateX(-100%);
}

/* Navigation area: scrollable if needed */
.sidebar-content {
  flex-grow: 1;            /* takes up remaining space */
  overflow-y: auto;        /* scroll if content is too long */
  padding: 20px 15px;
}

/* Sidebar headings and navigation list */
.sidebar-content h3 {
  font-size: 1rem;
  margin-bottom: 20px;
  color: #000;
}

.sidebar-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-content ul li {
  margin-bottom: 10px;
}

.sidebar-content ul li a {
  text-decoration: none;
  color: #000;
  font-size: 12px;
  transition: color 0.3s ease;
}

/* Fixed bottom section for Settings and Login */
.sidebar-bottom {
  /* Because the sidebar is a flex container, using margin-top: auto pushes this element to the bottom */
  margin-top: auto;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 35px;
}

.sidebar-bottom a {
  text-decoration: none;
  color: #6291ff;
  font-size: 12px;
  display: flex;
  align-items: center;
}

/* Icon styles (adjust if using your own icon code) */
.icon, .sidebar-bottom i {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
}


/* --------------------------------Main Content Section------------------------------------------*/
#main-content {
  flex-grow: 1;
  padding: 1px;
  box-sizing: border-box;
  margin-top: 36px; /* Ensure space below the top bar */
  /*margin-left: 351px; /* Sidebar width */
  transition: margin-left 0.3s ease; /* Smooth transition for expanding */
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;  
}

#content-wrapper {
  display: flex;
  height: calc(100vh - 40px); /* adjust if have a top bar */
  overflow: hidden;
}

#left-panel {
  width: 35vw;
  /*min-width: 450px;*/
  background-color: #ffffff00;
  border-right: 1px solid #ebebeb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: horizontal;
  padding: 2px;
}

#right-panel {
  flex: 1;
  overflow-y: auto;
  padding: 2px;
  background-color: #ffffff00;
}

body.dark-mode #left-panel {
  background-color: #272727;
  border-right: 1px solid #535353;
}

body.dark-mode #right-panel {
  background-color: #272727;
}


/* --------------------------------Responsive Design Section------------------------------------------*/
/* Responsive layout for small screens */
@media (max-width: 768px) {
  #content-wrapper {
    flex-direction: column;
  }

  #left-panel, #right-panel {
    width: 100%;
    max-width: 100%;
  }

  #left-panel {
    order: 1;
  }

  #right-panel {
    order: 2;
  }

  #container {
    flex-direction: column;
  }
  
  #chat {
  width: 100% !important;
  }

  #chat-messages {
  height: auto;       /* allow JS to set it */
  max-height: none;   /* remove rigid max if present */
  overflow-y: auto;
  }

  /* Sidebar behavior on small screens */
  #sidebar {
    width: 100vw; /* Smaller sidebar for mobile */
    position: fixed;
    /*top: 50px; /* Sidebar below the top bar */*/
    left: 0;
    min-height: 100vh;
    transition: transform 0.3s ease;
    transform: translateX(-100%); /* Sidebar is hidden by default */
    z-index: 1000;
  }

  #sidebar:not(.hidden) {
    transform: translateX(0); /* Show sidebar when toggled */
  }
  
  /* Make burger button larger on mobile */
  #sidebarToggle {
    font-size: 27px;
  }

  #main-content {
    display: flex;
    flex-direction: column;
  }

  /* Fix the top bar height in small screen mode */
  #top-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
  }
  
  /* Fixed bottom section for Settings and Login */
  .sidebar-bottom {
    /* Because the sidebar is a flex container, using margin-top: auto pushes this element to the bottom */
    margin-top: auto;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 80px;
  }
  
  #chat-container {
    background-color: #fefefe !important;
    height: 600px;
    max-height: 100vh;
    overflow-y: auto;
    transition: height 0.3s ease;
  }

  #left-panel {
    background-color: #fefefe !important;
    width: 100%;
    margin-top: 0;
    transition: margin-top 0.3s ease;
  }
  
  body.dark-mode #chat-container {
    background-color: #141414 !important;
  }
  
  body.dark-mode  #left-panel {
    background-color: #141414 !important;
  }

}

/* --------------------------------Large Screen Sidebar Toggle------------------------------------------*/
@media (min-width: 769px) {
  #sidebarToggle {
    display: block; /* Ensure the burger button is visible */
  }

  /* Sidebar behavior on large screens */
  #sidebar.hidden {
    transform: translateX(-200px); /* Move sidebar offscreen */
  }
  
  /* Sidebar behavior on large screens */
  body.dark-mode #sidebar.hidden {
    transform: translateX(-200px); /* Move sidebar offscreen */
  }

  /* Expand main content when sidebar is hidden */
  #main-content.expanded {
    margin-left: 0; /* Remove the left margin */
  }

  /* Ensure sidebar is displayed when toggled on large screen */
  #sidebar:not(.hidden) {
    transform: translateX(0); /* Show sidebar */
  }
}



/* -------------------------------------- Ai Agent Section ----------------------------------------------- */
#chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
  width: 100%;
  max-width: 100%; /* Expand fully */
}

#chat-container {
  display: flex;
  flex-direction: column;
  height: 300px; /* Default height */
  transition: height 0.3s ease;
  border: 1px solid #51515151;
  padding: 5px;
  border-radius: 5px;
  background-color: #ffffff00;
}

#chat-messages {
  background-color: #ffffff;
  padding: 0px 5px 5px 5px;
  border: 1px solid #ccc;
  border-radius: 10px;
  overflow-y: auto;
  transition: height 0.3s ease; /* ?? smooth height transition */
  position: relative;
  flex-grow: 1;
  width: 100%;
  height: 150px; /* initial screen size */
  min-height: 150px; /* Set a minimum height for chat-messages */
  max-height: 1200px; /* Max height limit (optional) */
  /*resize: vertical; /* Allow vertical resizing only */
}

/*#chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}*/

#chat-messages:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}


#chat-form {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 10px;
  margin-top: 5px;
  margin-bottom: 2px;
  /*padding: 5px;
  /*border: 0.5px solid #6d6d6d6b;
  border-radius: 5px;
  background-color: #fff;
  /*resize: vertical; /* Allow vertical resizing only */
  max-width: 100%;
  width: 100%;
  min-width: 300px;
  /*overflow: hidden; /* Hide content overflow */
  cursor: ns-resize; /* Change cursor to show vertical resizing handle */
}

#chat-input-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%; /* Ensure full width of container */
  gap: 5px; /* Add space between input and button */
  flex-grow: 1;
  /*resize: none; /* Allow vertical resizing only */
  overflow: hidden; /* Hide overflow to keep button and input together */
}

#chat-input {
  width: 100%; /* Make input take full width of the container */
  height: 100%; /* Ensure input grows/shrinks with the container */
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  padding: 10px 50px 10px 10px;
  font-size: 0.65rem;
  background-color: #ffffff;
  color: #333;
  resize: none;
  /*resize: vertical; /* Allow vertical resizing only */
  /*cursor: ns-resize; /* Change cursor to show vertical resizing handle */
}

#chat-input:focus {
    outline: none;
    border: 1px solid #8d8d8d;
    box-shadow: 0 0 2px #858585;
}

#send-button {
  align-self: center; /* Keep it at the top of the flex container */
  /"margin-top: 5px;*/
  padding: 8px 8px;
  background-color: #6c9eff;
  color: white;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.65rem;
  text-align: center;
  transition: background-color 0.3s ease, box-shadow 0.2s ease;
  height: 37px;
  width: auto; /* Let the button width adjust */
  min-width: 60px; /* Ensure the button has a minimum width */
  flex-shrink: 0; /* Prevent the button from shrinking when resizing */
}

#send-button:hover {
  background-color: #32CD32;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

#send-button:focus {
    outline: none;
    border: 1px solid #194caf;
    box-shadow: 0 0 1px #194caf;
}

/* Container for each individual message (timestamp above bubble) */
.message-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  max-width: 100%;
}

/* Timestamp styling outside the bubble */
.message-timestamp-outside {
  font-size: 0.6rem;
  color: #2149a7;
  margin-bottom: 0px;
}

/* Align timestamp to the right for user messages */
.user-container .message-timestamp-outside {
  text-align: right;
  padding-right: 11px;
}

/* Align timestamp to the left for bot messages */
.bot-container .message-timestamp-outside {
  text-align: left;
  padding-left: 15px;
}

/* Common chat bubble base */
.chat-message {
  /*max-width: 80%;*/
  padding: 7px 14px;
  border-radius: 10px;
  position: relative;
  font-size: 0.6rem;
  line-height: 1.4;
  word-wrap: break-word;
}

/* User messages (right-aligned) */
.user-message {
  background-color: #659cff;
  color: #ffffff;
  margin-left: auto;  /* Pushes bubble to the right */
  border-bottom-right-radius: 0px;
  margin-right: 10px;
  border: ridge 1px #e1e1e1;
}

/* Bot messages (left-aligned) */
.bot-message {
  background-color: #f7f7f7;
  color: #000000;
  margin-right: auto; /* Ensures it stays left */
  border-bottom-left-radius: 0px;
  margin-left: 10px;
  border: ridge 1px #e1e1e1;
  /*max-width: 80%;*/
}

/* User bubble tail (right side) */
.user-message::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -10px;  /* Adjust as needed */
  border-width: 10px 0 0 10px;
  border-style: solid;
  border-color: transparent transparent transparent #a3a3a3;
}

/* Bot bubble tail (left side) */
.bot-message::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: -10px;  /* Adjust as needed */
  border-width: 10px 10px 0 0;
  border-style: solid;
  border-color: transparent #a3a3a3 transparent transparent;
}

#typing-indicator {
  font-size: 0.65rem;
  margin: 8px 0;
  padding: 6px 15px;
  background-color: #f4f4f4;
  border-radius: 8px;
  color: #f03333;
  text-align: left;
}

.chatarea-styled-table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 10px;
  font-size: 0.75rem;
}

.chatarea-styled-table th,
.chatarea-styled-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
}

.chatarea-styled-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

/*-------------------------------------Pin document to chat-----------------------------------------*/

.sticky-left {
  display: flex;
  margin-right: auto;
  margin-bottom: 5px;
  align-items: stretch;
}

/* Keep the resize-handle fixed to top-left inside chat-container */
.resize-handle {
  position: sticky;
  top: 10px;
  left: 10px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  justify-content: space-between; /* Left and right items spaced out */
}

.resize-handle i.fas.fa-arrows-alt-diagonal {
  pointer-events: auto; /* allow interactions if needed */
  cursor: nwse-resize;
}

.clip-document {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0px 0px 0px 2px;
  margin: 0px 2px 0px 0px;
  font-size: 0.7rem;
  color: #333;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  max-width: 35vh;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-document i {
  color: #666;
  flex-shrink: 0;
  font-size: 1.2rem;
}

#clip-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-grow: 1;
  font-size: 0.6rem;
}

/* -------------------------------------Image generation----------------------------------------------*/

#create-image-btn-container {
  position: sticky;
  bottom: 0;
  text-align: center;
  z-index: 2;
}

#create-image-btn {
  padding: 0px 0px;
  font-size: 1rem;
  margin: 0px 2px 0px 2px;
  background-color: #ffffff;
  color: #333;
  border: 1px solid #0000002b;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

#create-image-btn.selected {
  background-color: #038d8d00;
  color: white;
  border-color: #999999;
}


/* -------------------------------------Chart generation----------------------------------------------*/

#create-chart-btn-container {
  position: sticky;
  bottom: 0;
  text-align: center;
  z-index: 2;
}

#create-chart-btn {
  padding: 0px 0px;
  font-size: 1rem;
  margin: 0px 2px 0px 2px;
  background-color: #ffffff;
  color: #333;
  border: 1px solid #0000002b;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

#create-chart-btn.selected {
  background-color: #038d8d00;
  color: white;
  border-color: #999999;
}


/* -------------------------------------Graph generation----------------------------------------------*/

#create-graph-btn-container {
  position: sticky;
  bottom: 0;
  text-align: center;
  z-index: 2;
}

#create-graph-btn {
  padding: 0px 0px;
  font-size: 1rem;
  margin: 0px 2px 0px 2px;
  background-color: #ffffff;
  color: #333;
  border: 1px solid #0000002b;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

#create-graph-btn.selected {
  background-color: #038d8d00;
  color: white;
  border-color: #999999;
}


/* ----------------------------------Fullscreen icon Toggle------------------------------------------*/

/* Sticky container for the button */
.sticky-btn-container {
  position: sticky;
  top: 0px;
  display: flex;
  justify-content: flex-end; /* Align content to the right */
  z-index: 10; /* Keep it on top */
  background-color: #ffffff;
  border-bottom-style: inset;
  margin: 0px 0px 15px 0px;
  padding: 5px 0px 0px 0px;
}

body.dark-mode .sticky-btn-container {
  background-color: #313131;
  border-bottom-color: #474747;
}

body.dark-mode #fullscreen-btn {
  background: #4b4b4b12
}

/* Style for the fullscreen button */
#fullscreen-btn {
  background: #ffffff12; /* Optional for contrast */
  border: none;
  cursor: pointer;
  /*padding: 5px;*/
  border-radius: 5px;
  font-size: 15px;
  /*box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);*/
}

#fullscreen-btn:hover {
  color: #000;
}


/* --------------------------------Document Listing Section------------------------------------------*/
#documents {
  margin-top: 0px;
  display: flex;
  flex-direction: column;
  transition: height 0.3s ease;
  border: 1px solid #aaaaaabf;
  padding: 5px;
  border-radius: 5px;
  background-color: #ffffff00;
}

body.dark-mode #documents {
  border: 1px solid #535353;
}

#document-list {
  /* Populated by JavaScript */
}

.document-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0px;
  background-color: #ffffff;
}

.document-table th,
.document-table td {
  border-bottom: 1px solid #7f7e7e30;
  padding: 6px;
  text-align: left;
  font-size: 0.6rem;
}

/* Optional: Add border at the top for the header row */
.document-table th {
  border-top: 1px solid #7f7e7e30;
}


.document-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

.document-table tr:hover {
  background-color: #eaeaea;
  cursor: pointer;
}

.document-row.selected {
  background-color: #cce5ff;
}

/*
.document-table tr:nth-child(even) {
    background-color: #f9f9f9;
}*/

.document-table td:nth-child(1),
.document-table th:nth-child(1) {
    width: 35%;
}

.document-table td:nth-child(2),
.document-table th:nth-child(2) {
    width: 5%;
    text-align: right;
}

.document-table td:nth-child(3),
.document-table th:nth-child(3) {
    width: 10%;
}

.document-table td:nth-child(4),
.document-table th:nth-child(4) {
    width: 5%;
    text-transform: uppercase;
}

.document-table td:nth-child(5),
.document-table th:nth-child(5) {
    width: 8%;
    text-align: center;
}


/* Style for the Action column */
.action-cell {
    max-width: 15%; /* Let the column take up a percentage of the total table width */
    text-align: center;
    white-space: nowrap; /* Prevent text from wrapping */
}

/* Optional: Smaller buttons */
.view-button, .delete-button {
    padding: 2px 5px; /* Reduce padding */
    font-size: 0.65rem; /* Smaller font size */
}

/* Style for the View button */
.view-button {
    padding: 2px 10px;
    border: 0.5px solid #d1d5db00; /* Soft gray border */
    border-radius: 5px; /* Fully rounded */
    background-color: #e1e1e1; /* Light gray background */
    color: #111111; /* Soft black text */
    font-weight: 300;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.view-button:hover {
    background-color: #f3f4f6; /* Slightly darker on hover */
    transform: translateY(-1px);
}

/* Style for the Delete button */
.delete-button {
    padding: 2px 6px;
    border: 0.5px solid #61050500; /* Very soft muted red/gray border */
    border-radius: 5px;
    background-color: #d1d1d1; /* Softer, warmer tone */
    color: #060606;
    font-weight: 300;
    cursor: pointer;
    margin-left: 5px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.delete-button:hover {
    background-color: #f0dcdc; /* Slight hover contrast */
    transform: translateY(-1px);
}

th .sort-icon {
  margin-left: 5px;
  font-size: 0.75em;
  vertical-align: middle;
}


/*-----------------------------------search bar section---------------------------------------------*/


.search-bar {
  width: 100%;
  padding: 10px;
  padding-right: 36px; /* Add space for the clear button */
  margin: 10px 0;
  font-size: 0.65rem;
  border: 1px solid #ccc;
  border-radius: 10px;
  background-color: #f9f9f9;
  color: #333;
  box-sizing: border-box; /* Ensure padding doesn't affect width */
}

.search-bar-wrapper {
  position: relative;
  width: 100%;
}

.clear-button {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background-color: #444;
  color: white;
  border: solid 1px #5f5f5f;
  border-radius: 20%;
  width: 24px;
  height: 24px;
  font-size: 24px;
  line-height: 0;
  text-align: center;
  padding: 0px 0px 3px 0px;
  cursor: pointer;
  opacity: 0.6;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  display: none; /* Hidden until there's text */
}

.clear-button.active {
  display: inline-block;
  background-color: red;
  opacity: 1;
}

/* Optional: Add focus style for search input */
.search-bar:focus {
  border-color: #6c9eff; /* Highlight with blue */
  outline: none;
}


/* --------------------------------------------------sideView documents---------------------------------------*/

/*#documentSidebar {
  display: none;
  position: fixed;
  top: 50px;
  right: 0;
  width: 400px;
  height: 100vh;
  background: #f0f0f0;
  border-left: 1px solid #ccc;
  overflow: auto;
  z-index: 1000;
  transition: width 0.2s ease;
}*/

/* =======================
   Document Sidebar Styles
========================== */
#documentSidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  background-color: #fff;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  z-index: 1000;
}


/* =======================
   Header and Control Buttons
========================== */
.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 5px;
  background-color: #295c8f;
  border-bottom: 1px solid #ccc;
  gap: 10px;
  flex-wrap: wrap; /* Optional: wrap if window is narrow */
}

body.dark-mode .doc-header {
  background-color: #000000;
  border-bottom: 1px solid #353434;
}

.zoom-controls {
  display: inline-flex;
  border: 1px solid #ccc;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.zoom-button {
  background-color: #f8f8f8;
  color: #333;
  border: none;
  padding: 4px 4px;
  font-size: 16px; /* Larger icon size */
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
}

.zoom-button:first-child {
  border-right: 1px solid #ccc;
}

.zoom-button:hover {
  background-color: #e0e0e0;
}

.zoom-button:active {
  background-color: #d0d0d0;
}

.action-group {
  display: inline-flex;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.action-group button {
  color: #333;
  padding: 0px 2px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
}

.action-group button:first-child {
  border-right: 1px solid #ccc;
}

.action-group button:hover {
  background-color: #e0e0e0;
}

.action-group button:active {
  background-color: #d0d0d0;
}

.navigation-controls {
  display: inline-flex;
  background-color: #f8f8f8;
  border-radius: 2px; /* Full pill shape */
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #ccc;
}

.nav-button {
  background-color: transparent;
  color: #333;
  border: none;
  padding: 4px 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 26px;
  font-weight: 600;
  border-radius: 0; /* overridden by outer pill container */
}

.nav-button:first-child {
  border-right: 1px solid #ccc;
}

.nav-button:hover {
  background-color: #e0e0e0;
}

.nav-button:active {
  background-color: #d0d0d0;
}

#downloadButton {
    padding: 0px 8px;
}

button#resetButton {
}

#fullscreenButton {
  background: #f5f5f5;
  border: 1px solid #6f6f6f;
  color: #060606;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 2px;
  padding: 5px;
  height: 30px;
  width: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#fullscreenButton.fullscreen {
  background-color: red;
}

#fullscreenIcon {
  pointer-events: none;
}

#closeButton {
  background: red;
  border: 1px solid #613d3d;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px;
  height: 30px;
  width: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* =======================
   Content Area
========================== */
#doc-content {
  width: 100%;
  height: calc(100% - 50px);
  overflow-y: auto;
  padding: 12px 0px 0px 12px;
}

/* =======================
   Sidebar Resizer
========================== */
#documentSidebarResizer {
  position: absolute;
  left: -5px;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  background: rgba(0, 0, 0, 0.02);
}


/* =======================
   PDF Viewer (inside iframe)
========================== */
#pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

/* =======================
   Preformatted Text Viewer (Markdown / TXT)
========================== */
#doc-content pre {
  white-space: pre;
  overflow-x: auto;
  font-size: 12px;
}


/* --------------------------------expand circle popup float------------------------------------------*/

/* ========================== */
/* Floating Chat Popup Styles */
/* ========================== */

/* Floating button container */
#floating-chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

#floating-chat-button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #007bff;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}


#floating-chat-button .chat-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #0056b3;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}


/* When hidden */
#floating-chat-container.hidden {
  display: none;
}

/* Main Floating Small Bubble */
#floating-chat-icon {
  font-size: 18px;
  background-color: #ffffffb5;
  padding: 8px;
  border-radius: 50%;
  border: ridge #cdcdcdb5;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-weight: bold;
  text-align: center;
  display: flex;
  flex-direction: column;
  line-height: 1;
  width: 70px;
  height: 70px;
  justify-content: center;
  align-items: center;
  animation: wiggle 2s ease-in-out infinite;
}

/* Wiggle Animation for Icon */
.chat-icon {
  font-size: 15px;
  display: inline-block;
  animation: wiggle 2s ease-in-out infinite;
  transition: color 0.3s ease;
  color: red;
}

#floating-chat-icon:hover .chat-icon {
  color: orange;
}

/* Text under Icon */
.chat-text {
  font-size: 12px;
  color: black;
  margin-top: 3px;
}

/* Expandable Menu Container */
#menu-container {
  position: absolute;
  bottom: 0px;
  right: 0px;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 1001;
  animation: fadeIn 0.3s ease forwards;
}

#menu-container.active {
  display: flex;
}

.menu-button {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    transform: scale(1.1);
    font-size: 20px;
    z-index: 101;
    color: #000;
}

.menu-button:hover {
  transform: scale(1.4);
}

span.menu-icon {
    font-size: 30px;
    position: absolute;
    justify-self: anchor-center;
}

span.menu-label {
    font-size: 0.7rem;
    text-wrap-mode: nowrap;
    left: -8px;
    top: 60px;
    position: absolute;
    color: white;
    text-shadow:
      -1px -1px 0 black,
       1px -1px 0 black,
      -1px  1px 0 black,
       1px  1px 0 black;
}


/* Optional: You can add a hover effect for the entire container */
#menu-container:hover {
  /*background-color: rgba(108, 158, 255, 0.2);*/ /* Change the background color on hover */
}

/* Quarter donut background */
.quarter-donut {
  position: absolute;
  bottom: -25px;
  right: -25px;
  width: 35vh;
  height: 35vh;
  background: radial-gradient(circle at bottom right, rgb(0 0 0 / 44%) 30%, #00000005 70%);
  border-top-left-radius: 100%;
  display: none;
  z-index: -1;
}

.quarter-donut.active {
  display: block;
}


/* ========================== */
/* Animations                 */
/* ========================== */

/* Wiggle Animation */
@keyframes wiggle {
  0% { transform: translateX(0); }
  50% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* Fade in effect for menu */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}



/* --------------------------------upload button------------------------------------------*/

/* Wrapper for Upload Button Section */
.h3-button-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.h3-button-wrapper h3 {
  margin: 0;
  font-weight: normal;
}

/* Upload Button */
.open-chat-btn {
  padding: 6px 6px;
  font-size: 10px;
  cursor: pointer;
  background-color: #6c9eff;
  color: white;
  border: none;
  border-radius: 6px;
}

body.dark-mode .open-chat-btn {
  padding: 6px 6px;
  font-size: 10px;
  cursor: pointer;
  background-color: #474747;
  color: white;
  border: none;
  border-radius: 6px;
}

.open-chat-btn:hover {
  background-color: #005a99;
}

/* Upload Icon inside the button */
.upload-icon {
  font-size: 12px;
  margin-right: 0px;
  line-height: 1;
  display: inline-block;
}


/* -------------------------------------------------popup infobot--------------------------*/
#infobot-popup {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 10px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  font-family: sans-serif;
}

.infobot-header {
  background: #2d89ef;
  color: white;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

#close-infobot {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

#infobot-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f5f5f5;
  font-size: 14px;
  line-height: 1.4;
}

.infobot-input {
  display: flex;
  border-top: 1px solid #ccc;
  padding: 10px;
  background: #fff;
}

#infobot-message-input {
  flex: 1;
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#send-infobot-btn {
  margin-left: 8px;
  padding: 8px 12px;
  background: #2d89ef;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Message Wrapper */
.infobot-message-wrapper {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

/* Chat Bubble Styles */
.infobot-user,
.infobot-bot {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  display: inline-block;
}

/* User Message */
.infobot-user {
  background-color: #e0e0e0;
  color: #333;
  align-self: flex-end;
  border-bottom-right-radius: 0;
}

/* Bot Message */
.infobot-bot {
  background-color: #007bff;
  color: white;
  align-self: flex-start;
  border-bottom-left-radius: 0;
}

/* Divider */
.infobot-divider {
  border: none;
  border-top: 1px solid #ccc;
  margin: 10px 0;
}


  align-self: flex-start;
  border-bottom-left-radius: 0;
}

/* Divider */
.infobot-divider {
  border: none;
  border-top: 1px solid #ccc;
  margin: 10px 0;
}




/* -------------------------------------------------Group document json table--------------------------*/

/* Wrapper scroll */
#grouped-documents-wrapper {
  overflow-x: auto;
  position: relative;
}

/* Table general styles */
.group-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 800px;
}

.group-table th,
.group-table td {
  padding: 3px 12px;
  border-top: 1px solid #e1e1e1;
  white-space: nowrap;
  background: #fff;
}

body.dark-mode .group-table th,
body.dark-mode .group-table td {
  border-top: 1px solid #434343;
}

/* Freeze the rightmost column */
.group-table th:last-child,
.group-table td:last-child {
  position: sticky;
  right: 0;
  background: #edf5ff;
  border-left: 1px solid #ccc;
  z-index: 2;
}

/* Freeze the rightmost column */
body.dark-mode .group-table th:last-child,
body.dark-mode .group-table td:last-child {
  background: #272727;
  border-left: 1px solid #3b3b3b;
}

/* Optional: highlight the fixed column */
.group-table th:last-child {
  background: #f5f5f5;
  z-index: 3;
}

body.dark-mode .group-table th:last-child {
  background: #2b2b2b;
  z-index: 3;
}

/* Highlighted row style */
.group-row.selected {
  background-color: #e0f0ff; /* Light blue background to indicate selection */
  font-weight: bold;
}

.group-row:hover {
  background-color: #f2f2f2; /* Light gray on hover */
  cursor: pointer;
}

.group-row.selected td {
  background-color: #e0f0ff !important; /* Light blue */
}

.group-row:hover td {
  background-color: #f2f2f2;
  cursor: pointer;
}

body.dark-mode .group-row.selected td {
  background-color: #7d7d7d !important; 
}

body.dark-mode .group-row:hover td {
  background-color: #7d7d7d;
}

.group-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 12px;
  margin-bottom: 4px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.88rem;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
  font-size: 0.65rem;
}

.file-actions {
  display: flex;
  gap: 8px;
}

.file-actions button {
  padding: 4px 10px;
  font-size: 0.85rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.65rem;
}

.file-actions .view-button {
  background-color: #1976d2;
  color: white;
}

.file-actions .view-button:hover {
  background-color: #1565c0;
}

.file-actions .delete-button {
  background-color: #d32f2f;
  color: white;
}

.file-actions .delete-button:hover {
  background-color: #c62828;
}

.group-table thead th {
  position: sticky;
  top: 0;
  background: #f5f5f5;
  z-index: 1;
}

body.dark-mode .group-table thead th {
  background: #2b2b2b;
}

