/* Make the chatbot container cover the full screen */
.chat-container {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: #f4f6f7;
  transition: none;
  padding-left: 0;
  padding-right: 0;
}

.chat-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 10px 20px;
  text-align: center;
  font-size: 1.5em;
  background-color: #87CEEB; /* Changed to sky blue */
  color: #333; /* Darker text for light blue background */
  z-index: 1000; /* Ensures it's above other elements */
  display: flex; /* Use flexbox for alignment */
  justify-content: space-between; /* Space between logos and selector */
  align-items: center; /* Vertically center items */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Stronger shadow for visual separation */
  border-bottom: 1px solid #000; /* Black line at the bottom */
  height: 60px; /* Fixed height to match other bars */
  box-sizing: border-box;
}

.header-logo-left,
.header-logo-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 150px;
}

.header-logo {
  max-height: 45px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Hide alt text if image fails to load */
.header-logo[alt]:after {
  display: none;
}

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

.language-selector {
  padding: 8px 16px;
  font-size: 14px;
  border: 2px solid #333;
  border-radius: 6px;
  background-color: white;
  color: #333;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  outline: none;
  min-width: 150px;
}

.language-selector:hover {
  background-color: #f0f0f0;
  border-color: #0056b3;
}

.language-selector:focus {
  border-color: #0056b3;
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .header-logo {
    max-height: 35px;
  }
  
  .header-logo-left,
  .header-logo-right {
    min-width: 100px;
  }
  
  .language-selector {
    font-size: 12px;
    padding: 6px 10px;
    min-width: 100px;
  }
  
  .chat-header {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .header-logo {
    max-height: 30px;
  }
  
  .header-logo-left,
  .header-logo-right {
    min-width: 80px;
  }
  
  .language-selector {
    font-size: 11px;
    padding: 5px 8px;
    min-width: 90px;
  }
}

.chat-box {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #ffffff;
  border-bottom: 1px solid #ddd;
  padding-bottom: 230px; /* Increased padding to accommodate taller input area */
  margin-right: 0; /* No margin to ensure it meets the edge of panels */
  margin-left: 0; /* No margin to ensure it meets the edge of panels */
  transition: margin-right 0.3s ease-in-out, margin-left 0.3s ease-in-out;
  width: auto; /* Auto width instead of fixed calculation */
  margin: 0; /* Remove margin */
  margin-top: 60px; /* Add space for fixed header only */
}

.message {
  margin-bottom: 15px;
  padding: 12px 18px;
  border-radius: 18px;
  line-height: 1.5;
  max-width: 100%; /* Expand to full width */
  word-wrap: break-word;
}

.user-message {
  background-color: #dcf8c6; /* Light green background */
  color: #333333; /* Dark text color */
  align-self: flex-end;
  border-bottom-right-radius: 5px; /* Slightly less round on one corner */
}

.bot-message {
  background-color: #f1f0f0; /* Light grey background */
  color: #333333; /* Dark text color */
  align-self: flex-start;
  border-bottom-left-radius: 5px; /* Slightly less round on one corner */
  /* Ensure bold/italic styles are visible */
  strong {
    color: #111; /* Darker color for bold text */
  }
  em {
    color: #555; /* Slightly different color for italic */
  }
}

.input-area {
  position: fixed;
  bottom: 0;
  left: 0; /* Full width - no sidebars */
  width: 100%; /* Full width */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Center vertically */
  background: white;
  padding: 10px 20px;
  border-top: 1px solid #e5e5e5;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

/* Sidebar-related rules removed - sidebars are now hidden */

.input-area .button-container {
  display: flex;
  justify-content: center; /* Center buttons */
  gap: 10px;
  margin-top: 10px; /* Space below textarea */
  width: 100%; /* Allow centering */
  /* Removed absolute positioning */
}

.input-area button {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 8px;
  cursor: pointer;
  font-size: 16px;
  color: #10a37f;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

.input-area button:hover {
  background: transparent;
  color: #0d8c6d;
  transform: translateY(-1px);
}

.input-area button img {
  width: 24px;
  height: 24px;
}

/* ADDED: Desktop styles for Upload and Send buttons */
#uploadButton,
#sendButton {
    padding: 8px 16px;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 120px; /* Reduced from 140px */
    height: 40px; /* Reduced from 45px */
    display: inline-block;
    text-align: center;
    transition: background-color 0.3s;
}

#uploadButton:hover,
#sendButton:hover {
    background-color: #333;
}

/* Mobile view adjustments */
@media (max-width: 768px) {
    #uploadButton, #sendButton {
        width: 80px; /* Reduced by 1/3 from 120px */
        height: 30px; /* Reduced by 1/3 from 45px */
        font-size: 10px; /* Reduced by 1/3 from 14px */
        padding: 4px 8px; /* Reduced by 1/3 from 6px 12px */
    }
}

/* Sidebar styling - HIDDEN */
#sidebar {
  display: none !important;
}

#chatHistory {
  flex-grow: 1;
  overflow-y: auto;
  margin-top: 10px;
}

/* Style for when sidebar is explicitly opened (mostly for mobile) */
#sidebar.open {
  transform: translateX(0);
}

/* Toggle Button Styles for both toggles - HIDDEN */
#sidebar-toggle, #overview-toggle {
  display: none !important;
}

/* Specific positioning for sidebar toggle (left side) */
#sidebar-toggle {
  position: fixed;
  top: 40%; /* Position below the overview toggle (which is at 30%) */
  left: 0; /* Position at left edge */
  border-radius: 0 5px 5px 0; /* Round only right corners */
  writing-mode: vertical-rl; /* Vertical text */
  text-orientation: mixed; /* Make text readable */
  transform: rotate(0deg); /* No rotation needed for left side */
  padding: 12px 8px; /* Match overview toggle padding */
  height: auto; /* Let height adjust to content */
  line-height: 1.2; /* Match overview toggle */
  background-color: #555; /* Match overview toggle */
  color: white;
  cursor: pointer;
  font-size: 18px;
  z-index: 1001;
}

/* Specific positioning for overview toggle (right side) */
#overview-toggle {
  position: fixed;
  top: 30%; /* Match sidebar toggle position */
  right: 0; /* Position at right edge */
  border-radius: 5px 0 0 5px; /* Round only left corners */
  writing-mode: vertical-rl; /* Vertical text */
  text-orientation: mixed; /* Make text readable */
  transform: rotate(180deg); /* Flip text to read top to bottom */
  padding: 12px 8px; /* Adjust padding for vertical text */
  height: auto; /* Let height adjust to content */
  line-height: 1.2; /* Set line height */
  background-color: #555; /* Match sidebar toggle */
  color: white;
  cursor: pointer;
  font-size: 18px;
  z-index: 1001;
}

/* Sidebar-related container rules removed */

/* --- Desktop Styles (Screen width >= 1024px) --- */
@media (min-width: 1024px) {
  .chat-container {
    padding-left: 0;
    padding-right: 0;
  }

  .input-area {
    left: 0 !important;
    width: 100% !important;
    right: auto !important;
  }

  .chat-box {
    width: 100%;
    margin: 0;
    margin-top: 0;
  }

  #questionInput {
    width: 100%;
  }
}

/* Media query for mobile views */
@media (max-width: 1023px) {
  .chat-container {
    transition: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .chat-box {
    transition: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    margin-top: 60px !important; /* Ensure space for fixed header only */
    padding-top: 20px;
    position: relative;
    z-index: 1;
  }
  
  .chat-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 1005 !important;
  }
  

  .input-area {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 1003 !important;
  }
}

/* Ensure chat history items are styled correctly */
#chatHistory ul {
    list-style: none;
    padding: 0;
  margin: 0;
}

#chatHistory li {
  padding: 12px 10px;
  border-bottom: 1px solid #444;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chatHistory li:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Lighter hover effect */
}

#chatHistory li.selected {
    background-color: rgba(173, 216, 230, 0.15); /* Subtle light blue background */
    border-left: 3px solid #add8e6; /* Light blue left border */
    padding-left: 7px; /* Adjust padding to compensate for border */
    color: #ffffff; /* Ensure selected text is bright */
}

#chatHistory li a {
  color: #00bfff;
  text-decoration: none;
  display: block;
  width: 100%;
}

#chatHistory li a:hover {
  color: #fff;
}

/* Smaller timer text inside the Stop button */
.timer-text {
  font-size: 24px; /* Increased from 16px for better visibility */
  margin-left: 5px;
  vertical-align: middle;
  opacity: 1;
  font-weight: bold; /* Make text bolder for better visibility */
}

#chatHistory li {
  border-bottom: 1px solid #555;
  padding-bottom: 8px;
}

#chatHistory button:hover {
  opacity: 0.8;
}

#chatHistory button {
  transition: opacity 0.2s;
}

.chat-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #000; /* Black line at the bottom */
  color: #e0e0e0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Stronger shadow for visual separation */
  height: 60px; /* Fixed height to match other bars */
}

.chat-history-header h2 {
  margin: 0;
}

.history-buttons {
  display: flex;
  gap: 10px;
}

.history-buttons button {
  background: none;
  border: none;
  color: #cccccc;
  cursor: pointer;
  font-size: 16px;
  padding: 5px;
}

.history-buttons button:hover {
  color: #ffffff;
  opacity: 1;
}

#deleteHistoryButton {
  font-size: 1.2em;
  padding: 5px;
  cursor: pointer;
}

/* Permission button styles */
.permission-button {
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    margin: 10px 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.permission-button:hover {
    background-color: #356ac3;
}

/* User info container removed */

.button-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 10px;
}

.button-container button {
  background-color: #555;
  border: none;
  color: white;
  padding: 10px 15px;
  border-radius: 4px; /* Changed from 50% to 4px for rectangular shape */
  cursor: pointer;
  font-size: 16px;
  width: 90px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Added shadow effect */
}

.button-container button:hover {
  background-color: #777;
  transform: translateY(-2px); /* Slight lift effect on hover */
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); /* Enhanced shadow on hover */
}

/* Specific style for the record button */
#recordButton {
  background-color: #C00000; /* Lipstick Red */
  font-size: 32px;
  padding: 15px;
  width: 110px;
  height: 110px;
  border-radius: 50%; /* Restored circular shape */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

#recordButton:hover {
  background-color: #A00000;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.25);
}

/* Style for Pause and Stop buttons specifically */
#pauseButton, #stopButton {
  font-size: 16px;
  width: 180px;
  height: 90px;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  padding: 8px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  white-space: normal;
  text-align: center;
  position: relative;
}

/* Specific style for Pause button */
#pauseButton {
  background-color: #FFA500; /* Orange color */
}

/* Specific style for Stop button */
#stopButton {
  background-color: #FF6B6B; /* Light red color */
}

/* Add flashing animation for paused state */
@keyframes flash-pause {
  0% { background-color: #FFA500; } /* Orange */
  50% { background-color: #FF8C00; } /* Darker orange */
  100% { background-color: #FFA500; } /* Orange */
}

.paused {
  animation: flash-pause 1s infinite;
}

/* Update timer display styles */
.timer-display {
  font-size: 64px; /* Increased from 48px */
  font-weight: bold;
  color: white;
  background-color: #333;
  padding: 15px 30px; /* Increased padding */
  border-radius: 4px;
  margin-left: 10px;
  min-width: 200px; /* Increased from 160px */
  text-align: center;
  display: inline-block;
}

/* Style the input area if needed */
.input-area {
    display: flex;
    align-items: center;
    padding: 10px;
    border-top: 1px solid #444;
}

.chat-input-container {
    display: flex;
    align-items: center;
    padding: 0;
    background-color: #ffffff;
    width: calc(100% - 25%); /* Subtract sidebar width */
    margin-left: 25%; /* Start after sidebar */
    position: relative;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
}

#questionInput {
    flex: 1;
    padding: 10px 15px; /* Adjusted padding */
    border: 1px solid #ccc; /* Added subtle border */
    border-radius: 6px; /* Rounded corners */
    resize: none;
    font-size: 16px;
    line-height: 1.5;
    min-height: 80px; /* Increased min-height for ~3 lines */
    margin: 0; /* Keep margin 0 */
    background-color: #ffffff;
    box-shadow: none;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    width: 100%; /* Default full width */
    box-sizing: border-box; /* Include padding/border in width */
}

#questionInput:focus {
    outline: none;
    box-shadow: none;
}

/* Hide file input visually but keep it functional */
#fileInput {
    display: none;
}

/* Styling for search input */
#historySearchInput {
  width: calc(100% - 10px);
  padding: 8px 10px;
  margin-top: 15px;
  margin-bottom: 15px;
  box-sizing: border-box;
  background-color: #555; /* Dark Gray */
  color: #e0e0e0;
  border: 1px solid #444; /* Slightly darker gray border */
  border-radius: 5px;
  font-size: 14px;
}

#historySearchInput::placeholder {
  color: #888;
}

/* Header title and tagline styles removed - now using logos and language selector */

/* Action bar removed */

/* Remove the gradient line */
.chat-input-container::before {
    display: none;
}

/* Add a subtle animation to the button */
.input-area button:active {
    transform: translateY(1px);
}

/* Add a subtle hover effect to the textarea */
#questionInput:hover {
    box-shadow: none;
}

/* Add flashing animation for critical care items */
@keyframes flash-red {
  0% { background-color: rgba(255, 0, 0, 0.0); }
  50% { background-color: rgba(255, 0, 0, 0.15); }
  100% { background-color: rgba(255, 0, 0, 0.0); }
}

.flash-item {
  animation: flash-red 2s infinite;
  border-left: 3px solid red;
  padding-left: 10px;
}

.critical-care-label {
  color: #ffdddd; /* Lighter red text for label */
  font-size: 0.8em;
  font-weight: bold;
  margin-top: 5px;
  padding: 3px 6px;
  border-radius: 3px;
  background-color: rgba(255, 0, 0, 0.2); /* Slightly stronger background */
  display: inline-block;
}

/* History item styling */
.history-item-content {
    flex-grow: 1;
    margin-right: 10px;
}

.history-item-title {
    font-weight: bold;
    color: #ffffff; /* Brighter white for title */
    font-size: 0.95em; /* Slightly adjust size if needed */
}

.history-item-date {
    font-size: 0.8em; /* Slightly smaller date */
    color: #bdbdbd; /* Lighter gray for date */
    font-style: italic;
}

/* New style for individual delete button */
.history-item-delete-button {
    background: none;
    border: none;
    color: #a94442; /* Red color for delete action */
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
    line-height: 1; /* Prevent extra vertical space */
    transition: color 0.2s ease;
}

.history-item-delete-button:hover {
    color: #ff0000; /* Brighter red on hover */
}

/* Ensure history items are properly spaced and readable */
#chatHistory ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#chatHistory li:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Lighter hover effect */
}

#chatHistory li.selected {
    background-color: rgba(173, 216, 230, 0.15); /* Subtle light blue background */
    border-left: 3px solid #add8e6; /* Light blue left border */
    padding-left: 7px; /* Adjust padding to compensate for border */
    color: #ffffff; /* Ensure selected text is bright */
}

/* Ensure flashing items with selection still look good */
#chatHistory li.selected.flash-item {
    border-left: 3px solid red;
    background-color: rgba(255, 0, 0, 0.1); /* Slightly more visible red flash bg */
    color: #ffffff; /* Ensure text remains bright */
}

/* Rapid Overview panel styling - HIDDEN */
#rapid-overview {
  display: none !important;
}

/* Add this new class for when overview is open */
#rapid-overview.open {
  transform: translateX(0); /* Slide in from right */
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 10px; /* Add top padding to match sidebar header */
  border-bottom: 1px solid #000; /* Black line at the bottom */
  margin-bottom: 15px; /* Add space below header */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Stronger shadow for visual separation */
  height: 60px; /* Fixed height to match other bars */
}

.overview-header h2 {
  margin: 0;
  color: #333; /* Change color to black */
  font-size: 1em; /* Standardized header font size */
  font-weight: bold;
  text-align: left; /* Left align like chat history header */
  width: 100%; /* Ensure it takes full width */
  padding-left: 10px; /* Add padding to move title from edge */
}

#overviewContent {
  flex-grow: 1;
  overflow-y: auto;
  margin-top: 10px;
  padding-bottom: 20px; /* Space at the bottom */
  font-size: 0.9em;
}

/* Styling for overview sections */
.overview-section {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.overview-section:last-child {
  border-bottom: none;
}

.overview-section h3 {
  margin: 0 0 8px 0;
  font-size: 1em;
  color: #10a37f;
}

/* Red styling for Critical Time header */
.critical-time-header {
  color: #d9534f !important; /* Red color */
  font-weight: bold;
}

.overview-section p {
  margin: 0;
  line-height: 1.4;
  color: #333;
}

.no-data {
  color: #999;
  font-style: italic;
  text-align: center;
  margin-top: 30px;
}

/* Overview-related input area rules removed */

#overview-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background-color: #007bff;
  color: white;
  padding: 10px 5px;
  border-radius: 5px 0 0 5px;
  cursor: pointer;
  z-index: 1201; /* Increased to be above the overview panel */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform-origin: right;
  font-size: 14px;
  transition: 0.3s ease;
}

#overview-toggle:hover {
  background-color: #0056b3;
}

/* Add flashing animation for paused state */
@keyframes flash-pause {
  0% { background-color: #FFA500; } /* Orange */
  50% { background-color: #FF8C00; } /* Darker orange */
  100% { background-color: #FFA500; } /* Orange */
}

.paused {
  animation: flash-pause 1s infinite;
}