@font-face {
  font-family: 'Bauhaus';
  src: url('./assets/fonts/BAUHAUSH.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
}

body,
html {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  height: 100%;
  overflow: hidden;
  background-color: #ffffff;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- GLOBALE SCROLLBAR STYLES --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  margin: 4px 0;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c1c1c1, #a8a8a8);
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a8a8a8, #909090);
}

::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #909090, #787878);
}

/* Dark Mode - Globale Scrollbars */
body.dark-mode ::-webkit-scrollbar {
  width: 8px;
}

body.dark-mode ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin: 4px 0;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4a4a4a, #363636);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #555555, #424242);
}

body.dark-mode ::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #606060, #4e4e4e);
}

/* Mobile Scrollbar-Adjustement */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
  }
  
  ::-webkit-scrollbar:horizontal {
    display: none;
  }
  
  body.dark-mode ::-webkit-scrollbar {
    width: 4px;
  }
}

/* --- Main Sidebar Styles --- */
.sidebar {
  width: 260px;
  min-width: 260px;
  background-color: #f7f7f8;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
  overflow: hidden;
}

.sidebar.closed {
  width: 0;
  min-width: 0;
  padding: 0;
  border-right: none;
  opacity: 0;
}

.sidebar-header {
  margin-top: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.new-chat-btn {
  display: flex;
  align-items:center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  padding-left: 6px;
  margin-left: 10px;
  cursor: pointer;
  font-size: 15px;
  color: inherit;
  transition: background-color 0.3s ease;
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
}
.new-chat-btn:hover{
  background-color: #E8E8E8;
}
body.dark-mode .new-chat-btn:hover {
  background-color: #2A2A2A;
}

/* Chat Header for Incognito Controls */
.chat-header {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.incognito-chat-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: #666;
  transition: background-color 0.3s ease;
  border-radius: 20px;
  min-width: 40px;
  height: 40px;
}

.incognito-chat-btn:hover {
  background: #f0f0f0;
}

body.dark-mode .incognito-chat-btn {
  background: #212121;
  color: #ccc;
}

body.dark-mode .incognito-chat-btn:hover {
  background: #333;
}

.incognito-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: #666;
  border-radius: 20px;
  min-width: 40px;
  height: 40px;
  transition: background-color 0.3s ease;
}

.incognito-indicator:hover {
  background: #f0f0f0;
}

body.dark-mode .incognito-indicator {
  background: #212121;
  color: #ccc;
}

body.dark-mode .incognito-indicator:hover {
  background: #333;
}

/* Incognito Mode Prompt Bar Styling - Only in Light Mode */
body:not(.dark-mode) .prompt-bar.incognito-mode {
  background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  border: 1px solid #404040;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body:not(.dark-mode) .prompt-bar.incognito-mode textarea {
  background: transparent !important;
  color: #ffffff !important;
  border: none !important;
}

body:not(.dark-mode) .prompt-bar.incognito-mode textarea::placeholder {
  color: #888 !important;
}

body:not(.dark-mode) .prompt-bar.incognito-mode button {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body:not(.dark-mode) .prompt-bar.incognito-mode button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 165, 0, 0.4);
}

body:not(.dark-mode) .prompt-bar.incognito-mode .search-mode-container button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body:not(.dark-mode) .prompt-bar.incognito-mode .search-mode-container button:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* Mobile Responsive for Chat Header */
@media (max-width: 768px) {
  /* Hide desktop incognito buttons on mobile */
  .chat-header {
    display: none !important;
  }
}

@media (min-width: 769px) {
  /* Hide mobile incognito buttons on desktop */
  .mobile-incognito-chat-btn,
  .mobile-incognito-indicator {
    display: none !important;
  }
}

/* Logo im Icon Strip */
.logo-icon-btn {
  background: none;
  border: none;
  cursor: ew-resize;
  padding: 0.5rem;
  border-radius: 10px;
  color: inherit;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;  
  height: 35px; 
}

.logo-icon-btn .logo-text-strip {
  font-family: 'Bauhaus', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 750;
  font-size: 28px;
  color: #00AEEF;
  text-transform: uppercase;
  transition: all 0.3s ease;
  user-select: none;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon-btn .hamburger-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.logo-icon-btn:hover .logo-text-strip {
  opacity: 0;
}

.logo-icon-btn:hover .hamburger-overlay {
  opacity: 1;
}

.logo-icon-btn:hover {
  background-color: #e8e8e8;
}

/* Dark Mode */
body.dark-mode .logo-icon-btn .logo-text-strip {
  color: #36C4FF;
}

body.dark-mode .logo-icon-btn:hover {
  background-color: #333;
}

.sidebar-logo {
  display: flex;
  position: absolute;
  width: 30px;
  height: 25px;
  padding: 14px;
  align-items: center;
  justify-content: center;
  top: 0;
  left: 0;
  cursor: pointer;
}

.sidebar-logo .logo-letter {
  font-family: 'Bauhaus', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 750;
  font-size: 32px;
  color: #00AEEF;
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dark Mode */
body.dark-mode .sidebar-logo .logo-letter {
  color: #36C4FF;
}
.sidebar-toggle-close {
  position: relative;
  bottom: 3rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: ew-resize;
  padding: 0.3rem;
  padding-bottom: 2.3px;
  padding-right: 5px;
  border-radius: 10px;
  color: inherit;
  transition: background-color 0.3s ease;
}

.sidebar-toggle-close:hover {
  background-color: #e8e8e8;
}
body.dark-mode .sidebar-toggle-close:hover {
  background-color: #333;
}
.search-history button{
  position: relative;
  right: 8px;
  top: 10px;
  display: flex;
  align-items:center;
  border: none;          
  background: none;       
  box-shadow: none;       
  outline: none; 
  cursor: pointer;
  font-size: 15px;
  color: inherit;
  gap: 0.5rem;
  padding: 0.5rem;
  padding-right: 100px;
  border-radius: 10px;
  transition: background-color 0.3s ease;
}
.search-history button:hover{
  background-color: #E8E8E8;
}
body.dark-mode .search-history button:hover {
  background-color: #2A2A2A;
}
body.dark-mode .search-history button{
  color: white;
}
.search-history,
.chat-history {
  padding: 0 1rem;
  white-space: nowrap;
}

.chat-history {
  padding: 0 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.chat-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}
.body.dark-mode.chat-history-header h3{
  color: white;
}

.chat-history h3 {
  margin: 0;
}

.chat-history-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0.5rem 0;
  flex-shrink: 0;
}

.history-list-container {
  flex-grow: 1;
  overflow-y: auto;
  margin-right: -8px;
  padding-right: 8px;
}

/* Overlay */
.search-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  z-index: 1000;
}

/* Popup */
.search-modal {
  width: 92%;
  max-width: 500px;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1rem 1rem 1rem;
  box-shadow: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.search-modal h4 {
  margin: 0 0 0.5rem 0;
}

.search-modal-input {
  width: 95%;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.search-modal-results {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  max-height: 200px;
  overflow-y: auto;
}

.search-modal-results li {
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.search-modal-results li:hover {
  background: #f0f0f0;
}

.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.search-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #555;
  line-height: 1;
}

.search-close:hover {
  color: #000;
}

body.dark-mode .search-close {
  color: #bbb;
}
body.dark-mode .search-close:hover {
  color: #fff;
}

/* Dark mode */
body.dark-mode .search-modal {
  background: #1f1f1f;
  color: #e0e0e0;
}
body.dark-mode .search-modal-input {
  background: #2a2a2a;
  border-color: #444;
  color: #e0e0e0;
}
body.dark-mode .search-modal-results li:hover {
  background: #333;
}

.sidebar-footer {
  padding: 0.75rem 1rem 0.25rem 1rem;
  border-top: 1px solid #eaeaea;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Clear History button */
.clear-history-btn {
  margin: 0;
  margin-top: 3.5px;
  margin-right: 20px;
  padding: 0.4rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #f87171;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.05s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clear-history-btn:hover {
  background-color: rgba(220, 38, 38, 0.1);
}
.clear-history-btn:active {
  transform: scale(0.95);
}
body.dark-mode .clear-history-btn {
  background: transparent;
  color: #f87171;
}
body.dark-mode .clear-history-btn:hover {
  background-color: rgba(248, 113, 113, 0.15);
}

body.dark-mode .chat-history-divider {
  border-top-color: #333;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-list li {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-radius: 5px;
  cursor: pointer;
}

.history-list li:hover {
  background-color: #f0f0f0;
}

.history-title {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-options-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0.25rem;
  display: none;
}

.history-list li:hover .history-options-btn {
  display: block;
}

.history-options-menu {
  display: none;
  position: absolute;
  right: 5px;
  top: 30px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 120;
  width: 120px;
}

.history-options-menu.visible {
  display: block;
  border-radius:20px;
}

.history-options-menu.show-above {
  top: auto;
  bottom: 30px;
}

.history-options-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
  border-radius: 20px;
  color: #f87171;
  transition: background-color 0.2s;
}
.history-options-menu button:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* --- Main Content Area Styles --- */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  min-width: 0;
}

/* --- Vertical Icon Strip --- */
.icon-strip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50px;
  border-right: 1px solid #e0e0e0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding-top: 1rem;
  gap: 1rem;
  z-index: 100;
  transition: background-color 0.3s;
}

.sidebar.closed + .main-content .icon-strip {
  display: flex;
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  padding-bottom: 1px;
  border-radius: 10px;
  color: inherit;
}
.icon-btn:hover {
  background-color: #e8e8e8;
}

.chat-area {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem calc((100% - 800px) / 2);
  display: flex;
  flex-direction: column;
  transition: padding-left 0.3s, padding-right 0.3s;
}
.prompt-area {
  padding: 1rem 2rem;
  background-color: transparent;
  transition: padding-left 0.3s;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.greeting {
  text-align: center;
  margin: auto;
}

.main-title {
  font-family: 'Bauhaus', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 750;
  font-size: 2.5rem;
  color: #00AEEF;
  margin: 0 0 1rem 0;
  letter-spacing: 0.02em;
}

.subtitle {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 1.1rem;
  color: #00AEEF;
  margin: 0;
}

/* Dark Mode */
body.dark-mode .main-title {
  color: #36C4FF;
}

body.dark-mode .subtitle {
  color: #36C4FF;
}

.message {
  margin-top: 45px;
  max-width: 100%;
  border-radius: 20px;
  line-height: 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
  box-sizing: border-box;
}

.user-message {
  padding-left: 16px;
  padding-right: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
  align-self: flex-end;
  background-color: #dcf8c6;
  color: black;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 65%;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

.bot-message {
  padding-left: 20px;
  padding-right: 20px;
  align-self: flex-start;
  background-color: transparent;
  border: none;
  color: black;
  line-height: 1.6;
  max-width: 100%;
  box-sizing: border-box;
}

/* Enhanced bot message styling for structured content */
.bot-message p {
  margin: 0.8em 0;
  line-height: 1.6;
}

.bot-message h1, .bot-message h2, .bot-message h3, .bot-message h4, .bot-message h5, .bot-message h6 {
  margin: 1.2em 0 0.6em 0;
  color: #333;
  font-weight: 600;
}

.bot-message ul, .bot-message ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}

.bot-message li {
  margin: 0.4em 0;
  line-height: 1.5;
}

.bot-message blockquote {
  margin: 1em 0;
  padding: 0.8em 1.2em;
  background-color: #f5f5f5;
  border-left: 4px solid #e0e0e0;
  border-radius: 4px;
  font-style: italic;
}

.bot-message code {
  background-color: #f4f4f4;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.bot-message pre {
  background-color: #f4f4f4;
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1em 0;
}

.bot-message pre code {
  background-color: transparent;
  padding: 0;
}

.bot-message strong, .bot-message b {
  font-weight: 600;
  color: #222;
}

.bot-message em, .bot-message i {
  font-style: italic;
}

.bot-message hr {
  margin: 1.5em 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

/* Sources section styling */
.bot-message .sources-section {
  margin-top: 1.5em;
  padding-top: 1em;
  border-top: 1px solid #e0e0e0;
}

.bot-message .sources-section p {
  margin: 0 0 0.8em 0;
  font-weight: 600;
  color: #333;
}

.bot-message .sources-section ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.bot-message .sources-section li {
  margin: 0.6em 0;
  display: flex;
  align-items: flex-start;
  gap: 0.8em;
}

.bot-message .sources-section .citation-number {
  background-color: #f0f0f0;
  color: #666;
  font-size: 0.8em;
  font-weight: bold;
  padding: 0.3em 0.6em;
  border-radius: 4px;
  min-width: 1.5em;
  text-align: center;
  flex-shrink: 0;
}

.bot-message .sources-section a {
  color: #00AEEF;
  text-decoration: none;
  line-height: 1.4;
  word-break: break-word;
}

.bot-message .sources-section a:hover {
  text-decoration: underline;
  color: #0088cc;
}

.prompt-area {
  padding: 1rem 2rem;
  background-color: transparent;
  transition: padding-left 0.3s;
}

.prompt-bar {
  display: flex;
  align-items: flex-end;
  max-width: min(800px, 90vw);
  margin: 0 auto;
  border: 1px solid #ccc;
  border-radius: 25px;
  padding-left: 10px;
  padding-top: 7px;
  padding-bottom: 3px;
  background-color: #fff;
  gap: 0.5rem;
  align-items: center;
  position: relative;
  bottom: 15px;
}
.search-mode-container {
    position: relative;
    display: flex;
    align-items: center;
}

#searchModeButton {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 4px;
}
#searchModeButton:hover {
    background-color: #f0f0f0;
}

.search-mode-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 150;
    width: 180px;
    padding: 0.5rem;
}
.search-mode-menu.visible {
    display: block;
}

#internetSearchOption {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0.75rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: inherit;
    border-radius: 5px;
}
#internetSearchOption:hover {
    background-color: #f0f0f0;
}
#redmineAnalysisOption {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0.75rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: inherit;
    border-radius: 5px;
}
#redmineAnalysisOption:hover {
    background-color: #f0f0f0;
}
body.dark-mode #redmineAnalysisOption:hover {
    background-color: #555;
}

#searchModeButton #redmineIcon {
    width: 20px;
    height: 20px;
}

/* --- Dark Mode for Search Toggle --- */
body.dark-mode #searchModeButton {
    color: white;
}
body.dark-mode #searchModeButton:hover {
    background-color: #333;
}
body.dark-mode .search-mode-menu {
    background-color: #3a3a3a;
    border-color: #555;
}
body.dark-mode #internetSearchOption:hover {
    background-color: #555;
}
#userInput {
  flex-grow: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  color: inherit;
  font-family: inherit;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.5;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  max-height: 144px;
}

#sendButton,
#micButton {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #3BB9FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Theme Switch Styles --- */
.theme-switch-wrapper {
  position: static;
}

body.dark-mode .sidebar-footer {
  border-top-color: #333;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  bottom: 10px;
  left: 0px;
}
.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: relative;
  cursor: pointer;
  width: 55px;
  height: 29px;
  top: 0;
  left: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  align-items: center;
  justify-content: start;
}
.slider:before {
  position: absolute;
  content: "";
  height: 23px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
}
input:checked + .slider {
  background-color: #00aeef;
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.slider.round {
  border-radius: 34px;
  display: flex;
  position: absolute;
  top: 3px;
}
.slider.round:before {
  border-radius: 50%;
}
.slider.round img {
  z-index: 1;
  max-width: 40px;
  max-height: 19px;
}
.slider img {
  max-width: 40px;
  max-height: 19px;
  padding: 1.5px;
  transition: all 0.3s ease-in-out;
}
.light-img {
  position: relative;
  left: 2px;
  opacity: 1;
  z-index: 2;
}
.dark-img {
  opacity: 0;
  z-index: 1;
}
input:checked + .slider .light-img {
  opacity: 0;
}

input:checked + .slider .dark-img {
  opacity: 1;
  padding-left: 9px;
}

/* --- DARK MODE STYLES --- */
body.dark-mode {
  background-color: #212121;
  color: #e0e0e0;
}
body.dark-mode .sidebar {
  background-color: #171717;
  border-right-color: #2f2f2f;
}
body.dark-mode .new-chat-btn,
body.dark-mode .search-bar {
  border-color: #555;
  color: white;
}
body.dark-mode .search-bar,
body.dark-mode .prompt-bar {
  background-color: #2a2a2a;
  border-color: #444;
  color: white;
}
body.dark-mode .history-list li:hover,
body.dark-mode .icon-btn:hover {
  background-color: #333;
}
body.dark-mode .icon-strip {
  background-color: #121212;
  border-right-color: #333;
}
body.dark-mode .bot-message {
  background-color: transparent;
  color: white;
}

/* Dark mode for enhanced bot message styling */
body.dark-mode .bot-message h1,
body.dark-mode .bot-message h2,
body.dark-mode .bot-message h3,
body.dark-mode .bot-message h4,
body.dark-mode .bot-message h5,
body.dark-mode .bot-message h6 {
  color: #e0e0e0;
}

body.dark-mode .bot-message blockquote {
  background-color: #2a2a2a;
  border-left-color: #444;
}

body.dark-mode .bot-message code {
  background-color: #2a2a2a;
  color: #e0e0e0;
}

body.dark-mode .bot-message pre {
  background-color: #2a2a2a;
}

body.dark-mode .bot-message strong,
body.dark-mode .bot-message b {
  color: #f0f0f0;
}

body.dark-mode .bot-message hr {
  border-top-color: #444;
}

body.dark-mode .bot-message .sources-section {
  border-top-color: #444;
}

body.dark-mode .bot-message .sources-section p {
  color: #e0e0e0;
}

body.dark-mode .bot-message .sources-section .citation-number {
  background-color: #3a3a3a;
  color: #bbb;
}

body.dark-mode .bot-message .sources-section a {
  color: #36C4FF;
}

body.dark-mode .bot-message .sources-section a:hover {
  color: #5dd4ff;
}
body.dark-mode #sendButton,
body.dark-mode #micButton {
  color: white;
}
body.dark-mode .history-options-menu {
  background-color: #3a3a3a;
  border-color: #555;
}
body.dark-mode .history-options-menu button {
  color: #fc8995;
}
body.dark-mode .history-options-menu button:hover {
  background-color: rgba(248, 113, 113, 0.15);
}

/* Confirmation Modal */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1010;
}

.confirm-modal {
  width: 75%;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1rem 0.875rem 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.confirm-modal h4 {
  margin: 0 0 0.25rem 0;
}
.confirm-modal .confirm-message {
  margin: 0.25rem 0 0.875rem 0;
}
.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.btn {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: #fff;
  cursor: pointer;
}
.btn-secondary {
  color: #374151;
}
.btn-danger {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}
.btn:hover {
  filter: brightness(0.98);
}
.btn:active {
  transform: scale(0.99);
}

/* Dark mode for modal */
body.dark-mode .confirm-modal {
  background: #1f1f1f;
  color: #e0e0e0;
}
body.dark-mode .btn {
  background: #2a2a2a;
  border-color: #444;
  color: white;
}
body.dark-mode .btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

/* --- Thinking Message & Table Styles --- */
.thinking-message {
  opacity: 0.7;
  font-style: italic;
}

/* The main container for a bot message that contains a table */
.bot-message.table-wrapper {
  align-self: flex-start;
  max-width: 95%;
  padding: 0;
  background-color: transparent;
  border: none;
  position: relative;
  flex-shrink: 0;
}

/* The scrollable 'window' for the table */
.table-container {
  max-width: 100%;
  max-height: 65vh;
  overflow: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* The actual table element */
.results-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  background-color: #fff;
  width: auto;
  table-layout: auto;
  white-space: nowrap;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  padding: 10px 14px;
  text-align: left;
}

.results-table th:first-child,
.results-table td:first-child {
  border-left: none;
}
.results-table th:last-child,
.results-table td:last-child {
  border-right: none;
}

.results-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* --- Dark Mode for Table --- */
body.dark-mode .table-container {
  border-color: #444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
body.dark-mode .results-table {
  background-color: #2a2a2a;
}
body.dark-mode .results-table th,
body.dark-mode .results-table td {
  border-color: #444;
}
body.dark-mode .results-table th {
  background-color: #3a3a3a;
}
body.dark-mode .results-table tbody tr:nth-child(even) {
  background-color: #2c2c2c;
}

/* --- Download Button Styles --- */
.download-table-btn {
  position: absolute;
  top: -12px;
  right: 10px;
  background-color: #ffffff;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.download-table-btn:hover {
  background-color: #f0f0f0;
  transform: scale(1.1);
}

body.dark-mode .download-table-btn {
  background-color: #3a3a3a;
  border-color: #555;
  color: #e0e0e0;
}

body.dark-mode .download-table-btn:hover {
  background-color: #555;
}

/* --- Citation and Mic Styles --- */
.citation-link {
  display: inline-block;
  background-color: #e0e0e0;
  color: #333;
  font-size: 0.75rem;
  font-weight: bold;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0 2px;
  transition: background-color 0.2s;
  cursor: pointer;
}

.citation-link:hover {
  background-color: #ccc;
}

body.dark-mode .citation-link {
  background-color: #444;
  color: #e0e0e0;
}

body.dark-mode .citation-link:hover {
  background-color: #555;
}

#micButton.listening {
  color: #ef4444;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0% {
    transform: scale(1);
    text-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    transform: scale(1.08);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
}
body.dark-mode #micButton.listening {
  color: #ef4444;
}

/* --- Download Progress Bar Styles --- */
.progress-bar-wrapper {
  padding: 1rem;
  border-radius: 8px;
  background-color: transparent;
  border: none;
}

.progress-bar-wrapper p {
  margin: 0 0 8px 0;
  font-weight: 500;
  font-size: 0.9rem;
}

.progress-bar-container {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  height: 12px;
}

.progress-bar-inner {
  height: 100%;
  width: 100%;
  border-radius: 10px;
  transition: background-color 0.5s ease;
}

.progress-bar-inner.in-progress {
  background-color: #00aeef;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 40px 40px;
  animation: progress-bar-stripes 1s linear infinite;
}

.progress-bar-inner.success {
  background-color: #22c55e;
}

.progress-bar-inner.failed {
  background-color: #ef4444;
}

body.dark-mode .progress-bar-container {
  background-color: #555;
}

@keyframes progress-bar-stripes {
  from {
    background-position: 40px 0;
  }
  to {
    background-position: 0 0;
  }
}

/* --- Voice visualizer shown while listening --- */
.voice-visualizer {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  margin-right: 4px;
}
.voice-visualizer.active {
  display: flex;
}
.voice-visualizer .voice-bar {
  width: 2px;
  background: #00aeef;
  height: 2px;
  transition: height 90ms ease, opacity 120ms ease;
  border-radius: 1px;
}

body.dark-mode .voice-visualizer .voice-bar {
  background: #36c4ff;
}

.search-modal-results li.highlighted {
  background-color: #e3f2fd;
}

body.dark-mode .search-modal-results li.highlighted {
  background-color: #102a43;
}

@media (max-width: 768px) {
  .search-modal-overlay {
    padding: 1rem;
  }
  
  .search-modal {
    width: calc(100% - 2rem);
    max-width: 400px;
  }
}

@media (max-width: 480px) {
  .search-modal-overlay {
    padding: 0.75rem;
  }
  
  .search-modal {
    width: calc(100% - 1.5rem);
  }
}

/* Mobile Sidebar Overlay Solution */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* Mobile Sidebar Behavior */
@media (max-width: 768px) {
  body, html {
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  .container {
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  .main-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  
  .chat-area {
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 90%;
    padding: 1rem;
  }
  
  .message,
  .bot-message,
  .user-message {
    max-width: calc(100% - 20px);
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .prompt-area {
    overflow-x: hidden;
    max-width: 90%;
    padding: 1rem;
  }
  
  .prompt-bar {
    max-width: calc(100% - 20px);
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: none;
  }

  .sidebar:not(.closed) {
    transform: translateX(0);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  }

  .sidebar.closed {
    transform: translateX(-100%);
    opacity: 1;
    width: 260px;
    min-width: 260px;
    padding: inherit;
    border-right: 1px solid #e0e0e0;
  }
  
  .sidebar:not(.closed) + .main-content .sidebar-overlay {
    display: block;
  }
  
  .main-content {
    width: 100%;
    position: relative;
  }
  
  .icon-strip {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 998;
  }
  
  .sidebar.closed + .main-content .chat-area,
  .sidebar.closed + .main-content .prompt-area,
  .sidebar:not(.closed) + .main-content .chat-area,
  .sidebar:not(.closed) + .main-content .prompt-area {
    padding-left: 84px;
  }
}

body.dark-mode .sidebar-overlay {
  background: rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  body.sidebar-open .main-content > *:not(.sidebar-overlay):not(.icon-strip) {
    pointer-events: none !important;
  }

  body.sidebar-open .chat-area,
  body.sidebar-open .prompt-area,
  body.sidebar-open .prompt-bar,
  body.sidebar-open #userInput,
  body.sidebar-open #sendButton,
  body.sidebar-open #micButton,
  body.sidebar-open .search-mode-container {
    pointer-events: none !important;
    user-select: none !important;
  }

  body.sidebar-open .sidebar,
  body.sidebar-open .sidebar * {
    pointer-events: auto !important;
  }

  body.sidebar-open #userInput {
    background-color: rgba(0, 0, 0, 0.004) !important;
    cursor: not-allowed !important;
  }

  body.dark-mode.sidebar-open #userInput {
    background-color: rgba(0, 0, 0, 0.006) !important;
  }

  /* Add dimmed overlay effect for mobile top nav */
  body.sidebar-open .mobile-top-nav {
    background-color: rgba(0, 0, 0, 0.004) !important;
    pointer-events: none !important;
  }

  body.dark-mode.sidebar-open .mobile-top-nav {
    background-color: rgba(0, 0, 0, 0.006) !important;
  }

  body.sidebar-open .mobile-top-nav .mobile-nav-btn {
    opacity: 0.8 !important;
  }

  body.dark-mode.sidebar-open .mobile-top-nav .mobile-nav-btn {
    opacity: 0.7 !important;
  }
}

/* Mobile-specific fixes for Chat History Options */
@media (max-width: 768px) {
  .history-list li .history-options-btn {
    display: block !important;
    opacity: 0.7;
    position: relative;
    min-width: 24px;
    min-height: 24px;
    padding: 4px;
  }
  
  .history-list li .history-options-btn:active {
    opacity: 1;
    background-color: #212121;
    border-radius: 4px;
  }
  
  body.dark-mode .history-list li .history-options-btn:active {
    background-color: rgba(255, 255, 255, 0.1);
  }
  @media (hover: none) {
    .history-list li:hover .history-options-btn {
      display: block !important;
    }
    
    .history-list li .history-options-btn {
      display: block !important;
    }
  }
  
  .history-options-menu {
    min-width: 140px;
    padding: 4px 0;
  }
  
  .history-options-menu button {
    padding: 12px 16px;
    font-size: 16px;
    min-height: 44px;
  }
}
/* Mobile Top Navigation - just for Mobile */
.mobile-top-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: #fff;
  z-index: 1001;
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
}

.mobile-top-nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-top-nav-center {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mobile-top-nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
}

.mobile-nav-btn:hover {
  background-color: #f0f0f0;
}

.mobile-nav-btn:active {
  background-color: #e0e0e0;
}

.mobile-sidebar-toggle {
  cursor: ew-resize !important;
  transform: scale(0.95);
}

.mobile-logo {
  height: 35px;
  width: auto;
}

/* Dark Mode for Mobile Nav */
body.dark-mode .mobile-top-nav {
  background-color: #121212;
  border-bottom-color: #333;
  color: white;
}

body.dark-mode .mobile-nav-btn:hover {
  background-color: #333;
}

body.dark-mode .mobile-nav-btn:active {
  background-color: #444;
}

@media (max-width: 768px) {
  .mobile-top-nav {
    display: flex !important;
  }
  
  .main-content {
    padding-top: 60px;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    display: flex;
    flex-direction: column;
  }
  
  .chat-area {
    flex: 1;
    min-height: 0; 
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    overflow-y: auto;
  }
  
  .prompt-area {
    flex-shrink: 0; 
    padding: 1rem;
    position: relative; 
  }
  
  /* other existing Mobile-Rules staying unchanged */
  .icon-strip {
    display: none !important;
  }
  
  /* Mobile content stays normal - no padding adjustments needed */
  .sidebar.closed + .main-content .chat-area,
  .sidebar.closed + .main-content .prompt-area,
  .sidebar:not(.closed) + .main-content .chat-area,
  .sidebar:not(.closed) + .main-content .prompt-area {
    padding-left: 1rem;
  }

  /* Hide desktop toggle buttons on mobile */
  .sidebar .sidebar-toggle-close,
  .sidebar-header-actions .sidebar-toggle-close {
    display: none !important;
  }

  /* Mobile Close Button - only visible on mobile */
  .mobile-close-btn {
    display: block !important;
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 10px;
    color: inherit;
    transition: background-color 0.3s ease;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-close-btn:hover {
    background-color: #e8e8e8;
  }

  body.dark-mode .mobile-close-btn:hover {
    background-color: #333;
  }
}

/* Hide mobile close button on desktop */
@media (min-width: 769px) {
  .mobile-close-btn {
    display: none !important;
  }
}

/* Responsive prompt-bar scaling for all devices */
@media (min-width: 1200px) {
  .prompt-bar {
    max-width: min(800px, 85vw);
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .prompt-bar {
    max-width: min(750px, 88vw);
  }
}

/* iPad and tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .prompt-area {
    padding: 1rem 3rem;
    width: 100%;
    box-sizing: border-box;
  }

  .prompt-bar {
    max-width: min(700px, 90vw);
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }

  .chat-area {
    padding: 1rem 3rem;
    width: 100%;
    box-sizing: border-box;
  }

  .message {
    max-width: 100%;
  }

  .user-message {
    max-width: 75%;
  }

  .bot-message {
    max-width: 100%;
  }

  /* Override desktop rules - consistent padding regardless of sidebar state */
  .sidebar:not(.closed) + .main-content .chat-area {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .sidebar:not(.closed) + .main-content .prompt-area {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .sidebar.closed + .main-content .chat-area {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .sidebar.closed + .main-content .prompt-area {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* iPad Air specific adjustments */
@media (min-width: 820px) and (max-width: 1024px) {
  .prompt-area {
    padding: 1rem 4rem;
  }

  .prompt-bar {
    max-width: min(650px, 85vw);
    margin: 0 auto;
  }

  .chat-area {
    padding: 1rem 4rem;
  }

  /* Ensure prompt-bar doesn't overlap with sidebar area */
  .sidebar:not(.closed) + .main-content .prompt-area {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
  }

  .sidebar.closed + .main-content .prompt-area {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
  }

  .sidebar:not(.closed) + .main-content .chat-area {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
  }

  .sidebar.closed + .main-content .chat-area {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
  }
}

/* Additional iPad portrait specific rules */
@media (min-width: 769px) and (max-width: 820px) and (orientation: portrait) {
  .prompt-area {
    padding: 1rem 2.5rem;
  }

  .prompt-bar {
    max-width: min(600px, 88vw);
  }

  .chat-area {
    padding: 1rem 2.5rem;
  }

  .user-message {
    max-width: 70%;
  }

  /* Override desktop rules for iPad Portrait */
  .sidebar:not(.closed) + .main-content .chat-area {
    padding-left: 2.5rem !important;
    padding-right: 2.5rem !important;
  }

  .sidebar:not(.closed) + .main-content .prompt-area {
    padding-left: 2.5rem !important;
    padding-right: 2.5rem !important;
  }

  .sidebar.closed + .main-content .chat-area {
    padding-left: 2.5rem !important;
    padding-right: 2.5rem !important;
  }

  .sidebar.closed + .main-content .prompt-area {
    padding-left: 2.5rem !important;
    padding-right: 2.5rem !important;
  }
}

/* Send Button Styles - Updated Design with Up Arrow */
#sendButton {
  background: #3BB9FF;
  border: none;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s ease;
}

#sendButton:hover {
  background: #2da8e8;
  transform: scale(1.05);
}

#sendButton:active {
  transform: scale(0.95);
}

/* Dark Mode for Send Button */
body.dark-mode #sendButton {
  background: #3BB9FF;
  color: white;
}

body.dark-mode #sendButton:hover {
  background: #2da8e8;
}
  .message {
    max-width: calc(100% - 20px); 
  }
  
  .user-message,
  .bot-message {
    margin-left: 0;
    margin-right: 0;
  }
