* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  /* Custom selection */
  ::selection {background-color: #5B6D92; color: white;}
}
mjx-container {
  display: inline-block !important;
}


/* Re-labeled for CodeMirror usage (formerly .ace-container) */
.codemirror-container {
  width: 100%;
  height: 100%;
  min-height: 10px;
  border: 1px solid #ccc;
  position: relative;
}

.CodeMirror {
  height: auto !important;
  border: none !important;
}

.CodeMirror, 
.CodeMirror-scroll {
    background: #fff !important;
}

.CodeMirror-gutters{
  background-color: #ffffff !important;
  color: white !important;
  
}

.dark-mode .CodeMirror-gutters{
  background-color: black !important;
  border-color: var(--dark-border) !important;
}



.dark-mode .CodeMirror, 
.dark-mode .CodeMirror-scroll {
    background: #000000 !important; /* Dark background */
    color: #ffffff !important; /* Light text for contrast */
}

.dark-mode .CodeMirror-cursor {
    border-left: 1px solid white !important; /* White cursor */
}

.dark-mode .codemirror-container {
  border: 1px solid var(--dark-border) !important;
}

/* Define CSS Variables */
:root {
  --primary-color: #333;
  --secondary-color: #faf7f2;
  --background-color: #fff; 
  --text-color: #333;
  --border-color: #ccc;
  --box-shadow-color: rgba(0, 0, 0, 0.1);
  --button-bg-light: #fff;
  --button-text-light: #333;
  --button-bg-dark: #333;
  --button-text-dark: #fff;
  --placeholder-color: #aaa;
  --scrollbar-thumb: rgba(197, 197, 197, 0.5);
  --scrollbar-thumb-hover: rgba(197, 197, 197, 0.8);
  --dark-background: black;
  --dark-text: white;
  --dark-border: rgba(255, 255, 255, 0.1);
  --dark-shadow: none;
  --dark-focus-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  --dark-focus-border: rgba(255, 255, 255, 0.8);
}

.code-wrapper {
    padding-bottom: 20px;
}

/* Dark Mode Toggle */
.dark-mode {
  --background-color: var(--dark-background);
  --text-color: var(--dark-text);
  --box-shadow-color: transparent;
  /* Override scrollbar colors for dark mode */
  --scrollbar-thumb: rgba(100, 100, 100, 0.5);
  --scrollbar-thumb-hover: rgba(100, 100, 100, 0.8);
}
.dark-mode .button-base {
  --button-bg: var(--button-bg-dark);
  --button-text: var(--button-text-dark);
}
.dark-mode .button-light:hover {
  background-color: var(--button-bg-dark);
}
.dark-mode .button-dark:hover {
  background-color: #555;
}
.dark-mode .tools-menu {
  border: 1px solid black;
  background-color: black;
}
.dark-mode .tools-menu a {
  color: var(--dark-text);
}
.dark-mode .tools-menu a:hover {
  background-color: #555;
}
.dark-mode textarea {
  background-color: var(--dark-background);
  border-color: var(--dark-border);
  color: var(--dark-text);
  box-shadow: var(--dark-shadow);
}
.dark-mode textarea:focus {
  box-shadow: var(--dark-focus-shadow);
  border-color: var(--dark-focus-border);
}

/* Typography */
@font-face {
  font-family: 'FKCai';
  src: url('../fonts/fkcai.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}
body {
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}
.logo {
  font-family: 'FKCai', sans-serif;
  position: fixed;
  top: 5px;
  width: 100%;
  text-align: center;
  font-size: 1.5em;
  color: #5f5959;
  font-weight: 100;
  letter-spacing: 5px;
  word-spacing: 2px;
  line-height: 1.8;
  z-index: 990;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dark-mode .logo {
  color: white;
}

/* Layout */
html, body {
  height: 100%;
  overflow: hidden; /* Keep body from scrolling; let .chatarea handle it */
}
body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-grow: 1;
  padding: 10px;
  padding-top: 15px; /* Adjust based on header height */
  padding-bottom: 160px; /* Adjust based on textarea height */
  background-color: #fff;
}

.dark-mode .content {background-color: black;}

.textarea-container {
  position: fixed;
  bottom: 40px; /* space for the bottom-bar */
  left: 0;
  right: 0;
  width: auto;
  background-color: transparent;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #fff;
}

.dark-mode .textarea-container {background-color: black;}

textarea {
  width: 100%;
  max-width: 700px;
  max-height: 300px;
  padding: 10px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  resize: none;
  overflow: auto;
  box-shadow: var(--box-shadow-color);
  outline: none;
  transition: height 0.6s ease, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
textarea::placeholder {
  opacity: 1;
  transition: opacity 0.3s ease;
}
textarea:focus::placeholder {
  opacity: 0;
}
/* Scrollbar Styles for WebKit on Textarea */
textarea::-webkit-scrollbar{
  width: 8px;
  height: 8px;
}
textarea::-webkit-scrollbar-track{
  background: transparent;
  backdrop-filter: blur(4px);
}
textarea::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
textarea::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
/* Focus State for Textarea */
textarea:focus {
  box-shadow: 0 0 8px var(--scrollbar-thumb-hover);
  border-color: var(--scrollbar-thumb-hover);
}

/* Bottom Bar */
.bottom-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 700px;
  background-color: transparent;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.buttons {
  display: flex;
  gap: 10px;
  position: relative;
}
/* Button Styles */
.button-base {
  padding: 5px 10px;
  font-size: 0.8em;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: var(--box-shadow-color);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.button-light {
  background-color: var(--button-bg-light);
  color: var(--button-text-light);
}
.button-light:hover {
  background-color: #e2e8f0;
}
.button-dark {
  background-color: var(--button-bg-dark);
  color: var(--button-text-dark);
}
.button-dark:hover {
  background-color: #555;
}
.disclaimer {
  font-size: 0.8em;
  color: var(--placeholder-color);
  transition: color 0.7s ease;
}

/* Tools Menu */
.tools-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: -60px;
  background-color: white;
  border: 1px solid white;
  border-radius: 5px;
  box-shadow: var(--box-shadow-color);
  z-index: 1000;
  padding: 5px 0;
}
.tools-menu a {
  display: block;
  padding: 5px 10px;
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.8em;
}
.tools-menu a:hover {
  background-color: #e2e8f0;
}
.dark-mode .tools-menu a {
  color: var(--dark-text);
}
.dark-mode .tools-menu a:hover {
  background-color: #555;
}

/* Shockwave Effects */
.sendit {
  font-size: 14px;
  position: relative;
  background-color: var(--background-color);
  color: var(--placeholder-color);
  border: none !important;
  font-family: inherit;
  padding: 9px 50px;
  margin: -50px;
  z-index: 1;
}
@keyframes shockwave {
  0% { box-shadow: 0 0 0 0 rgba(70, 101, 132, 0.4); }
  25% { box-shadow: 0 0 10px 5px rgba(70, 101, 132, 0.3); }
  50% { box-shadow: 0 0 25px 15px rgba(70, 101, 132, 0.2); }
  75% { box-shadow: 0 0 15px 10px rgba(70, 101, 132, 0.1); }
  100% { box-shadow: 0 0 0 0 rgba(70, 101, 132, 0); }
}
.shockwave-effect {
  animation: shockwave 0.5s ease-out;
}
@keyframes shockwavedark {
  0% { box-shadow: 0 0 0 rgba(70, 101, 132, 0.5); }
  50% { box-shadow: 0 0 150px 5px rgba(70, 101, 132, 0.5); }
  100% { box-shadow: 0 0 0 rgba(70, 101, 132, 0.5); }
}
.shockwave-effectdark {
  animation: shockwavedark 0.5s ease-out;
}
.glowing-border {
  border: 2px solid rgba(70, 101, 132, 0.8);
  box-shadow: 0 0 10px rgba(70, 101, 132, 0.8), 0 0 20px rgba(70, 101, 132, 0.6), 0 0 30px rgba(70, 101, 132, 0.4);
  transition: box-shadow 0.3s ease-in-out;
}

.dark-mode #inkSyncHeaderBar {background-color: black;}

/* Sidebar Styles */
.sidebar {
  opacity: 0;
  transform: translateX(-100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100%;
  background-color: #fff;
  z-index: 1000;
  padding-top: 20px;
}
.dark-mode .sidebar {
  background-color: black;
}
.sidebar.visible {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
}
.sidebar h3 {
  text-align: center;
  color: black;
  font-weight: normal;
  padding-bottom: 15px;
}
.dark-mode .sidebar h3 {
  color: var(--dark-text);
}
.searchchats {
  text-align: center;
}
.searchchats input {
  border: 1px solid var(--border-color);
  width: 80%;
  padding: 5px;
}
.searchchats input:focus{
  box-shadow: 0 0 8px var(--scrollbar-thumb-hover);
  border-color: var(--scrollbar-thumb-hover);
  outline: none;
}
.dark-mode .searchchats input {
  background-color: var(--dark-background);
  border-color: var(--dark-border);
  color: var(--dark-text);
  box-shadow: var(--dark-shadow);
}
.dark-mode .searchchats input:focus {
  box-shadow: var(--dark-focus-shadow);
  border-color: var(--dark-focus-border);
}
.sidebar-divider {
  border: none;
  border-top: 2px solid #333;
  margin: 20px auto;
  width: 80%;
  opacity: 0.7;
}

.bottomsidebar{
    position: absolute; 
    left:25px; bottom: 10px; 
    width: 200px;
}

.bottomsidebar button {
    width: 100%;
    height: 30px;
    border: 1px solid var(--border-color);
    background-color: white;
}

.dark-mode .bottomsidebar button {
  background-color: #333232;
  border: 1px solid #333232;
}

.dark-mode .bottomsidebar button:hover {
  background-color: black;
  border: 1px solid var(--dark-border);
}

.top {
  position: fixed;
  top: 0;
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--background-color);
  z-index: 1000;
}

/* .chatarea is now the FULL WIDTH scrolling container */
.chatarea {
  width: 100%;
  height: calc(100vh - 210px);
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 30px;
  background-color: #fff;
}

.dark-mode .chatarea {background-color: black;}

/* .actualchat is just centered content, no own scroll */
.actualchat {
  position: relative;
  width: 90%;
  max-width: 1000px !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 25px !important;
  background-color: #fff;
  overflow-x: hidden;


  /*border: 1px solid red;*/
  /* no overflow here */
}

.dark-mode .actualchat {background-color: black;}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Chat Bubble Styles */
.chat-bubble {
  max-width: 75%;
  padding: 10px 15px;
  border-radius: 15px;
  font-size: 14px;
  word-wrap: break-word;
  animation: fadeInUp 0.4s ease;
}

.user-bubble p:last-child {
  margin-bottom: 0;
}


.chat-bubble.assistant-bubble {max-width: 100%;}

/* User Bubble with preserved whitespace and line breaks */
.user-bubble {
  align-self: flex-end;
  background-color: #5B6D92;
  color: white;
  border-radius: 15px 15px 0 15px;
  padding-bottom: 10px;
  max-width: 75%;
  word-wrap: break-word;
  animation: fadeInUp 0.4s ease;
  white-space: pre-wrap; /* Preserve whitespace and wrap lines */
  font-size: 13px;
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  ::selection {
  background-color: #fff !important;
  color: black !important;
}

}

.user-bubble::selection {
  background-color: #fff !important;
  color: black !important;
}
.user-bubble::-moz-selection {
  background-color: #fff !important;
  color: black !important;
}



.dark-mode .user-bubble {
  background-color: black;
  color: #e2e8f0;
  border: 1px solid var(--dark-border);
}
/* Markdown Styles for Chat Area */
.actualchat {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}
.actualchat h1,
.actualchat h2,
.actualchat h3,
.actualchat h4,
.actualchat h5,
.actualchat h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 100;
  line-height: 1.2;
  color: var(--text-color);
}
.actualchat h1 {
  font-size: 2em;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.3em;
}
.actualchat h2 {
  font-size: 1.75em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.2em;
}
.actualchat h3 { font-size: 1.5em;  width: auto; }
.actualchat h4 { font-size: 1.25em; }
.actualchat h5 { font-size: 1em; }
.actualchat h6 { font-size: 0.875em; color: #666; }
.actualchat p { margin-top: 0; margin-bottom: 1em; }
.actualchat a { color: #007bff; text-decoration: none; }
.actualchat a:hover { text-decoration: underline; }
.actualchat ul,
.actualchat ol { margin-top: 0; margin-bottom: 1em; padding-left: 2em; }
.actualchat li { margin-bottom: 0.5em; }
.actualchat ul { list-style-type: disc; }
.actualchat ol { list-style-type: decimal; }
.actualchat blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--border-color);
  color: #666;
  background-color: var(--background-color);
}
.actualchat blockquote p { margin: 0; }
.actualchat code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.875em;
  background-color: var(--background-color);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: #d63384;
}
.actualchat pre {
  background-color: #e7e7e7;
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  margin-top: 0;
  margin-bottom: 1em;
  color: black;
}

.actualchat pre code { background-color: transparent; padding: 0; color: inherit; }
.actualchat table { width: 100%; border-collapse: collapse; margin-bottom: 1em; }
.actualchat th,
.actualchat td {
  padding: 0.5em;
  border: 1px solid var(--border-color);
  text-align: left;
}
.actualchat th { background-color: var(--background-color); font-weight: 600; }
.actualchat hr {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 2em 0;
}
.actualchat img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em 0;
  border-radius: 4px;
}
.actualchat strong { font-weight: 600; color: var(--text-color); }

/* Context Menu Styles */
.context-menu {
  background-color: var(--background-color);
  border: 1px solid white;
  border-radius: 5px;
  padding: 5px 0;
  z-index: 1000;
  position: absolute;
  min-width: 120px;
}
.context-menu-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9em;
  color: var(--text-color);
  transition: background-color 0.2s ease;
  text-align: center;
}
.dark-mode .context-menu {
  border: 1px solid black;
}
.context-menu-item:hover { background-color: #e2e8f0; }
.dark-mode .context-menu-item:hover { background-color: #555; }

/* Responsive Design */
@media (max-width: 768px) {
  .actualchat {
    font-size: 14px;
    padding: 10px;
  }
  .actualchat h1 { font-size: 1.75em; }
  .actualchat h2 { font-size: 1.5em; }
  .actualchat h3 { font-size: 1.25em; }
}
/* Chat List Styles */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}
.chat-list::-webkit-scrollbar { width: 8px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
.chat-list::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

.chat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: #fff;
  color: black;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  width: 90%;
  margin: 0 auto;
}
.chat-item:hover {color: black; background-color: #5b6d92c4; }
.chat-item span { color: var(--light-text); font-size: 0.9em; }
.dark-mode .chat-item span { color: var(--dark-text); }
.dark-mode .chat-item { background-color: black; }
.dark-mode .chat-item:hover { background-color: #555; }

.inksync-children .chat-item {margin-top: 3px;}

.chat-item:hover .chat-actions {
  background-color: transparent; /* Background color changes to black on hover */
}

.dark-mode .chat-actions {
  background-color: transparent;
}

.chat-actions {
  color: black;
  font-size: 1.2em;
  cursor: pointer;
  padding-left: 3px; padding-right: 3px;
  padding-top: 3px; padding-bottom: 10px;
  border: none;
  background-color: transparent;
}

.chat-actions:hover {
  color: silver;
  background-color: transparent;
}



/* Modal for Rendering HTML */
.code-modal {
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  width: 90%;
  max-width: 1800px;
  height: 99%;
  z-index: 2000;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  box-shadow: var(--box-shadow-color);
  padding: 25px;
  resize: both; /* or 'horizontal' or 'vertical' depending on preference */
  overflow: auto; /* Ensures content is scrollable when resized */
  border-radius: 8px;
}

.dark-mode .code-modal {
  background-color: var(--dark-background);
  border: 1px solid var(--dark-border);
  color: var(--dark-text);
  box-shadow: var(--dark-shadow);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-close {
  position: absolute;
  top: -2px;
  right: 5px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #555;
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

.modal-close:hover {color: #d8d4d4;}

.dark-mode .modal-close {
  background-color: black;
}

.render-html-btn, .copy-btn, .save-btn, .inksync-btn {
  border: 1px solid var(--border-color);
  background-color: white;
}

.render-html-btn:hover, .copy-btn:hover, .save-btn:hover, .inksync-btn:hover {
  border: 1px solid var(--border-color);
  background-color: #e2e8f0;
}

.dark-mode .render-html-btn,
.dark-mode .copy-btn,
.dark-mode .save-btn, .dark-mode .inksync-btn {
  border: 1px solid #333232;
  background-color: #333232;
  color: white;
}

.dark-mode .render-html-btn:hover,
.dark-mode .copy-btn:hover,
.dark-mode .save-btn:hover, .dark-mode .inksync-btn:hover {
  border: 1px solid var(--dark-border);
  background-color: black;
}

.bottom-bar button {
  border: 1px solid var(--border-color);
  background-color: white;
}

.bottom-bar .disclaimer button { border: 1px solid white; }

.dark-mode .bottom-bar button {
  background-color: #333232;
  border: 1px solid #333232;
}

.dark-mode button { background-color: #333232; color: white; }
.dark-mode .bottom-bar button:hover { background-color: black; }
.dark-mode .disclaimer button { border: 1px solid black; }

/* ========================================================================= */
/*                        Global Scrollbar Styles                           */
/* ========================================================================= */

/* Applies to all scrollable elements */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
  backdrop-filter: blur(4px);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Scroll-to-Bottom Button */
.scroll-to-bottom-button {
  position: fixed;
  bottom: 140px; /* So it appears above the textarea */
  right: 30px;
  background-color: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  padding: 6px;
  cursor: pointer;
  box-shadow: var(--box-shadow-color);
  transition: opacity 0.3s ease, visibility 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 1001;
}
.scroll-to-bottom-button.visible {
  opacity: 1;
  visibility: visible;
}

/* Backdrop to cover the screen */
#settings-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  display: none;
}

/* Pop-up styling */
#settings-popup {
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  background-color: white;
  width: 90%;
  max-width: 400px;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--box-shadow-color);
  position: relative;
  z-index: 10000 !important;
  display: none;
}

.dark-mode #settings-popup {
  background-color: black;
  border: 1px solid var(--dark-border);
  box-shadow: var(--dark-shadow);
}

#settings-close-btn {
  position: absolute;
  top: 1px;
  right: 7px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

/* Input group styling */
#settings-api-key-section, #settings-username-section {
  margin-bottom: 15px;
}

#settings-api-key-section label, #settings-username-section label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

#settings-api-key-section input, #settings-username-section input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
}

.dark-mode #settings-api-key-section input, 
.dark-mode #settings-username-section input {
  border: 1px solid var(--border-color);
  background-color: var(--dark-background);
  border-color: var(--dark-border);
  color: var(--dark-text);
  box-shadow: var(--dark-shadow);
  padding: 8px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.dark-mode #settings-api-key-section input:focus, 
.dark-mode #settings-username-section input:focus {
    box-shadow: var(--dark-focus-shadow);
    border-color: var(--dark-focus-border);
}

#settings-api-key-section > input:focus, #settings-username-section > input:focus {
  box-shadow: 0 0 8px var(--scrollbar-thumb-hover) !important;
  outline: none;
}

.dark-mode #settings-api-key-section button, 
.dark-mode #settings-username-section button {
  border: 1px solid var(--dark-border);
  background-color: #333232;
  color: white;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.8em;
  cursor: pointer;
}

.dark-mode #settings-api-key-section button:hover, 
.dark-mode #settings-username-section button:hover {
  background-color: black;
  border: 1px solid var(--dark-border);
}

#settings-popup button {border: 1px solid var(--border-color);}
.dark-mode #settings-popup button {border: 1px solid black;}
#settings-popup h3 {font-weight: 100;}

#settings-popup #settings-close-btn {border: none;}
#settings-popup #settings-close-btn:hover {color: #ccc;}

#settings-username-section .divide {color: transparent;}
#settings-api-key-section .divide {color: transparent;}

/* Multi-Select */
.multi-select-green {
  padding-left: 3px; padding-right: 3px;
  padding-top: 3px; padding-bottom: 10px;
  background-color: #e2e8f085!important;
}

.dark-mode .multi-select-green {
    background-color: #666262!important;
}

.selected-red {
  background-color: rgba(255, 0, 0, 0.329) !important;
  color: white;
}

.dark-mode .selected-red{
    background-color: rgba(255, 0, 0, 0.329) !important;
  color: white;
}

/* Style for the multi-select controls */
#multi-select-controls {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 10px;
  display: flex;
  gap: 10px;
  z-index: 1000;
  border: 1px solid var(--border-color);
}

.dark-mode #multi-select-controls{
    background-color: black;
    border: 1px solid var(--dark-border);
}

#multi-select-controls button {
  padding: 5px 10px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  z-index: 10001;
  border: 1px solid var(--border-color);
  font-size: 12px;
  background-color: white;
  color: black;
}

.dark-mode #multi-select-controls button {
    background-color: #333232;
    border: 1px solid #333232;
    color: white;
}

#multi-select-controls button:hover {
background-color: #e2e8f0;
}

.dark-mode #multi-select-controls button:hover {
background-color: black;
}

#confirm-delete {
  background-color: white; 
}

#cancel-delete {
  background-color: white; /* Red */
}

/* Define the glowing animation */
@keyframes glow {
  0% {
    box-shadow: 0 0 5px rgba(70, 101, 132, 0.5), 0 0 10px rgba(70, 101, 132, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(70, 101, 132, 0.8), 0 0 30px rgba(70, 101, 132, 0.8);
  }
  100% {
    box-shadow: 0 0 5px rgba(70, 101, 132, 0.5), 0 0 10px rgba(70, 101, 132, 0.5);
  }
}

.glow-effect {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px;
  font-size: 16px;
  outline: none; /* Remove default focus outline */
  animation: glow 2s infinite; /* Apply the glow animation */
}

.CodeMirror-scroll {
    background-color: #e7e7e7;
}

/* 🔥 Starry Background Animation */
#image-progress-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 150px;
    background-color: var(--background-color);
    border-radius: 15px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
}

.darkmode #image-progress-container{
background-color: black;
}

#starry-background {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/stardust.png'); /* ✨ Starry pattern */
    animation: starry-move 2s infinite alternate ease-in-out;
    opacity: 0.8;
}

@keyframes starry-move {
    0% { background-position: 0px 0px; }
    100% { background-position: 50px 50px; }
}

/* 🔥 Progress Bar */
#progress-bar {
    width: 0%;
    height: 6px;
    background: linear-gradient(90deg, #FFD700, #FF69B4, #4B0082); /* 🌈 Gradient */
    border-radius: 6px;
    transition: width 0.5s ease-in-out;
}

#progress-text {
    font-family: "Arial", sans-serif;
    font-size: 14px;
    color: black;
    margin-top: 10px;
}

.darkmode #progress-text {
  color: white;
}

.custom-btn {
  border: 1px solid var(--border-color);
  background-color: white;
  color: black;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, border 0.2s;
}

.custom-btn:hover {
  background-color: #e2e8f0;
}

.dark-mode .custom-btn {
  border: 1px solid #333232;
  background-color: #333232;
  color: white;
}

.dark-mode .custom-btn:hover {
  border: 1px solid var(--dark-border);
  background-color: black;
}

.newchatbutton {border: 1px solid #fff; background-color: #fff; padding-left: 10px; font-size: 20px;}
.newchatbutton:hover {color: silver;}

.dark-mode .newchatbutton {border: 1px solid black ; color: white; background-color: black;}
.dark-mode .newchatbutton:hover {color: silver;}


.dark-mode .inksyncoptions {color: white; background-color: black !important;}

#clearsearch {color: silver ;background-color: white; border: none; position: relative; top: 0px; right: 20px; opacity: 0; transition: opacity 0.3s, border 0.3s; /* Smooth transition for better UX */}
#clearsearch:hover {color: rgb(143, 141, 141);}

.dark-mode #clearsearch {background-color: black;}

.labeler:hover {background-color: #e2e8f0;}
.dark-mode .labeler:hover {background-color: #333232;}
.CodeMirror {
  background: #007bff !important;
  background-color:#007bff !important;
}

/* Context menu container */
.context-menu {
  position: absolute;
  background: #fff;
  border: 1px solid white;
  padding: 5px;
  z-index: 2000;
  display: none;
  min-width: 150px;
  border-radius: 5px;
}

/* Context menu options */
.context-menu-option {
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
}

/* Hover effect */
.context-menu-option:hover {
  background: #e2e8f0;
}

.dark-mode .context-menu {
  background-color: black;
}

.dark-mode .context-menu-option:hover {
  background: #555;
}

/* Default (light mode) */
.inksync-editor-container {
  border: 1px solid #ccc; /* Light mode border */
  border-radius: 8px;
  padding: 5px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Dark mode */
.dark-mode .inksync-editor-container {
  border: 1px solid #555; /* Dark mode border */
}



.ql-toolbar.ql-snow {
    border: 1px solid #ccc !important;
}

.dark-mode .ql-toolbar.ql-snow {
    border: 1px solid #555 !important;
}

/* Make the Quill container auto-height, no scrolling */
#inkSyncQuillContainer .ql-container {
  height: auto !important;
  min-height: 0 !important;
}

/* Make the Quill editing area also auto-height */
#inkSyncQuillContainer .ql-editor {
  height: auto !important;
  min-height: 0 !important;
  overflow-y: visible !important; /* no internal scrollbar */
}

.dark-mode .ql-container.ql-snow {
    border: 1px solid #555 !important;
}

.button-base.button-light#stop-button,
.button-base.button-dark#stop-button {
      /* You can tweak this styling as needed */
      background-color: rgb(138, 133, 133);
      color: white;
      display: none;
    }


    .custom-image {
      max-width: 300px;
  max-height: 300px;
  height: auto;
  width: auto;
}

@media (max-width: 999px) {
    .inksyncviewportcheck {
        display: none !important;
    }
}