:root[data-theme="dark"] {
  --canvasBG: #292A2D;
  --bg: #292A2D !important;
  --sidebar: #292A2D;
  --input: #404045;
  --input-button: #262626;
  --input-button-hover: #3B3B3F;
  --user-message: #313131;
  --code-bg: #323336;
  --topbar-bg: rgba(33, 33, 33, 0.9);
  --topbar-border: rgba(255, 255, 255, 0.05);
  --text-color: #eeeeee;
  --outline: #7F8189;
  --accent-color: #6DB3FF;
  --accent-color-light: #D1E7FF;
  --scroll-bar: #404045;
  --scroll-track: #4D505A;
  --latex: #6DB3FF;
  --deleteButton: #303030;
  --dots: #9CC6E7;
  --tableHead: #2B2E35;
    --code-keyword: #D4BFFF;   /* brighter lilac */
  --code-string:  #B5F4A5;   /* pale green mint */
  --code-number:  #FFC387;   /* soft orange */
  --code-function: #89DDFF;  /* light sky blue */
  --code-variable: #FF8F9B;  /* warm pink */
  --code-comment: #7F848E;   /* neutral gray */
  --code-operator: #78DCE8;  /* cyan frost */
  --toolBtnActive: #4285f4;
  --postitbody: #35363B;
  --node-color: #47484F;
  --postithead: #252527;
  --gridCol: #444444;
  --linkCol:#646464;
  --sidebar-rgb: 29, 29, 29;
  --drawerBG: #404045;
  --drawerHD: #292A2D;
  --user-font-size: 16px;
  --inputBorder: #4E5056;
  --right-pane: #39393D;
}

:root[data-theme="light"] {
  --canvasBG: #FFFFFF;
  --bg: #F8F7F6; /*#FAF9F5*/;
  --sidebar: #F8F7F6; /*#F5F4E7;*/
  --sidebar-width: 210px;
  --input: #FFFFFF;
  --input-button: #F5F4ED;
  --input-button-hover: #ECEADC;
  --user-message: #FAF9F5; 
  --code-bg: #F8F7F2;
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --topbar-border: rgba(0, 0, 0, 0.05);
  --text-color: #434343;
  --outline: #D9D9D2;
  --accent-color: #F9BB95;
  --accent-color-light: #6D160D;
   --scroll-bar: #8B8B8B;
  --scroll-track: #DAD6BC;
  --latex: #F36D1E;
  --deleteButton: #F5F4ED;
  --dots: #F9BB95;
  --tableHead: #F5DBDB;
  --code-keyword: #9A6DD7;   /* mid violet â€“ regal but soft */
  --code-string:  #4C9A6A;   /* sage green â€“ grounded and clear */
  --code-number:  #C96A30;   /* terracotta peach â€“ warm and assertive */
  --code-function: #3D7EDB;  /* ocean blue â€“ clean and readable */
  --code-variable: #C34157;  /* crimson rose â€“ strong yet refined */
  --code-comment: #8E8E87;   /* cool gray â€“ soft enough to recede */
  --code-operator: #2AA198;  /* teal ink â€“ calm but sharp */
  --toolBtnActive: #E7A7A7;
  --postitbody: #FAF9F5;
  --node-color: #D6CEAE;
  --postithead: #F5F4E7;
  --gridCol: #E5E2C1;
  --linkCol:#857E33;
  --sidebar-rgb: 245, 244, 231;
  --drawerBG: #ffffff;
  --drawerHD: #F8F7F6; /*#EEEBDE;*/
  --user-font-size: 16px;
 --inputBorder: #F9E6CF;
  --right-pane: #FFFDFD;
}

html body {
  display: flex;
  font-family: 'Sora', sans-serif !important;
  background-color: var(--bg);
  height: 100vh !important;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
  padding-top: 0px;
  color: var(--text-color);
  margin: 0px;
  line-height: 1.8;
  min-width: 720px !important;
  font-size: var(--user-font-size);
  transition: background-color var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#main-content {
  margin-left: 60px;
  height: 100vh !important;
  transition: margin-left var(--transition-base);
}

/* ============================================
   TOGGLE CONTAINER & LABELS
   ============================================ */

.toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.toggle-label {
  color: var(--text-color);
  font-size: var(--user-font-size);
  margin-left: 20px;
  font-weight: 500;
  letter-spacing: -0.2px;
  transition: color var(--transition-base);
}

/* ============================================
   LOGO & WELCOME PANEL
   ============================================ */

.logo-container {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

#welcome-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + 30px), -50%);
  text-align: center;
  padding: 2rem;
  background-color: transparent;
  border-radius: var(--border-radius-xl);
  z-index: 10;
}

.tagline-text {
  font-size: 1.05rem;
  color: var(--text-color);
  margin-top: 0.5rem;
  opacity: 0.75;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.3px;
  transition: opacity var(--transition-base);
}

.welcome-logo {
  width: 160px;
  height: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
  transition: transform var(--transition-base);
}

.welcome-logo:hover {
  transform: scale(1.02);
}

.logo {
  width: 300px;
  animation: pulseOnce 1.8s ease-in-out 0.3s 1 forwards;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
}

@keyframes pulseOnce {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.88;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.welcome-message {
  font-size: 1.5rem;
  color: var(--text-color);
  font-weight: 500;
  letter-spacing: -0.5px;
  transition: color var(--transition-base);
}

/* ============================================
   MODERN TOGGLE SWITCH
   ============================================ */

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(127, 129, 137, 0.3);
  transition: all var(--transition-base);
  border-radius: 26px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: all var(--transition-base);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background: var(--gradient-accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.3);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.switch:hover .slider {
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.2);
}

/* ============================================
   NOTESTREAM LAYOUT
   ============================================ */

#notestream {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   MODERN COLOR INPUT
   ============================================ */

input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  padding: 0;
  background-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 2px var(--outline);
  transition: all var(--transition-base);
}

input[type="color"]:hover,
input[type="color"]:focus {
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.3), 0 0 0 2px var(--accent-color);
  outline: none;
  transform: scale(1.08);
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
  border-radius: var(--border-radius-md);
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 9px;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 9px;
}

/* ============================================
   MODERN NUMBER INPUT
   ============================================ */

input[type="number"] {
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  padding: 8px 12px;
  border: 1.5px solid var(--outline);
  border-radius: var(--border-radius-md);
  background-color: var(--input);
  color: var(--text-color);
  font-size: var(--user-font-size);
  font-weight: 500;
  transition: all var(--transition-base);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"]:hover {
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

input[type="number"]:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
  outline: none;
  transform: translateY(-1px);
}

/*************************************************************************************************
************************************************* SIDEBAR ****************************************
*************************************************************************************************/

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 60px;
  height: 100vh;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  z-index: 1000;
  border-right: 1px solid var(--outline);
  color: var(--text-color) !important;
  backdrop-filter: blur(10px);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.sidebar-btn {
  background-color: transparent;
  color: var(--text-color);
  border: none;
  margin: 8px 0;
  padding: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sidebar-btn:hover {
  background-color: rgba(var(--accent-rgb), 0.1);
  transform: translateX(2px);
}

.sidebar-btn.active {
  color: var(--accent-color);
  background: rgba(var(--accent-rgb), 0.15);
}

.sidebar-btn.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-accent);
  border-radius: 0 3px 3px 0;
}

/*************************************************************************************************
************************************************* DRAWERS ****************************************
*************************************************************************************************/

.drawer {
  position: fixed;
  top: 0;
  left: calc(-100% + 60px);
  width: calc(100% - 60px);
  height: 100vh;
  background-color: var(--drawerBG);
  z-index: 999;
  transition: left var(--transition-slow);
  overflow: hidden;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.drawer.open {
  left: 60px;
}

/* Hide all content when drawer is closed */
.drawer:not(.open) * {
  visibility: hidden;
  opacity: 0;
}

/* Show content when drawer is open */
.drawer.open * {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--transition-base) 0.2s;
}

.drawer-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 10;
  padding: 12px 20px;
  background: var(--drawerHD);
  color: var(--latex);
  height: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--outline);
  backdrop-filter: blur(10px);
  transition: background-color var(--transition-base);
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  letter-spacing: -0.3px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--accent-color) !important;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.close-btn:hover {
  background: rgba(var(--accent-rgb), 0.1) !important;
  transform: rotate(90deg);
}

.drawer-content {
  padding: 24px;
  overflow-y: auto;
  height: calc(100vh - 50px);
}

/*************************************************************************************************
************************************************* INPUT BAR **************************************
*************************************************************************************************/

.input-wrapper {
  position: fixed;
  bottom: 10px;
  width: 700px;
  left: calc(50vw - 325px);
  display: flex;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
  transition: all var(--transition-fast);
  z-index: 20;
}

.input-container {
  display: flex;
  flex-direction: column;
  background: var(--input);
  border-radius: 30px;
  border: 2px solid var(--inputBorder);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 700px;
  box-sizing: border-box;
  padding: 0 10px;
  z-index: 20;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
  animation: subtleGlowBlue 6s ease-in-out infinite;
}

@keyframes subtleGlowBlue {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(156, 198, 231, 0.3), 0 0 10px rgba(156, 198, 231, 0.2);
  }
}

@keyframes subtleGlowOrange {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(249, 187, 149, 0.3), 0 0 10px rgba(249, 187, 149, 0.2);
  }
}

/* Light mode override */
body.light-mode .input-container,
[data-theme="light"] .input-container {
  animation: subtleGlowOrange 6s ease-in-out infinite;
}

.input-container.no-glow {
  animation: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* User Input Textarea */
.user-input {
  font-family: 'Sora', sans-serif !important;
  width: 95%;
  min-height: 26px !important;
  max-height: 200px;
  overflow-y: auto;
  resize: none;
  padding: 0;
  font-size: 16px;
  line-height: 1.4;
  background: transparent;
  color: var(--text-color);
  border: none;
  outline: none;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-bar) var(--scroll-track);
  transition: height var(--transition-fast);
  margin-bottom: 0px;
  margin-left: 20px;
  margin-top: 20px;
  z-index: 20 !important;
}

.user-input::placeholder {
  color: var(--text-color);
  opacity: 0.5;
  transition: opacity var(--transition-base);
}

.user-input:focus::placeholder {
  opacity: 0.3;
}

/* Custom scrollbar for user input */
.user-input::-webkit-scrollbar {
  width: 8px;
}

.user-input::-webkit-scrollbar-track {
  background: transparent;
}

.user-input::-webkit-scrollbar-thumb {
  background: var(--scroll-bar);
  border-radius: 4px;
}

.user-input::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Chat Action Buttons */
.chat-action {
  display: flex;
  background-color: var(--input);
  color: var(--text-color);
  gap: 8px;
  border: none;
  border-radius: var(--border-radius-lg);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 5px;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.chat-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--accent-rgb), 0.1);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.chat-action:hover::before {
  opacity: 1;
}

.chat-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.2);
}

.chat-action:active {
  transform: scale(0.98) translateY(0);
  color: var(--accent-color);
}

.chat-action.active {
  color: var(--accent-color);
  background: rgba(var(--accent-rgb), 0.15);
  font-weight: 600;
}

/* Button Row */
.button-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  flex-wrap: wrap;
  max-width: 100%;
  box-sizing: border-box;
  z-index: 20 !important;
}

/*************************************************************************************************
****************************************** UNIVERSAL SCROLL **************************************
*************************************************************************************************/

.custom-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-bar) var(--scroll-track);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* WebKit (Chrome, Safari, Edge) */
.custom-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.custom-scroll::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 10px;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background: var(--scroll-bar);
  border-radius: 10px;
  border: 2px solid var(--scroll-track);
  transition: background var(--transition-base);
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.custom-scroll::-webkit-scrollbar-corner {
  background: var(--scroll-track);
}

/*************************************************************************************************
****************************************** BLOCKING MODAL ****************************************
*************************************************************************************************/

#blocking-modal.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  z-index: 10000;
  animation: fadeIn 0.3s ease;
  
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#blocking-modal.modal-content {
  background: var(--topbar-bg) !important;
  color: var(--text);
  padding: 2.5rem;
  border-radius: var(--border-radius-xl);
  text-align: center;
  max-width: 700px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 20px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#blocking-modal .modal-logo {
  display: block;
  margin: 0 auto 1.5rem auto;
  max-width: 320px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
}

#blocking-modal .modal-buttons {
  margin-top: 2rem;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

#blocking-modal .mode-button {
  padding: 1.25rem 1.5rem;
  border-radius: var(--border-radius-lg);
  border: none;
  text-align: left;
  width: 650px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition: all var(--transition-base);
  background-color: #f5f5f5;
  color: #222;
  position: relative;
  overflow: hidden;
}

#blocking-modal .mode-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: currentColor;
  opacity: 0.3;
  transition: width var(--transition-base), opacity var(--transition-base);
}

#blocking-modal .mode-button:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

#blocking-modal .mode-button:hover::before {
  width: 100%;
  opacity: 0.08;
}

#blocking-modal .mode-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.3px;
}

#blocking-modal .mode-desc {
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.85;
}

#blocking-modal .mode-button.blue {
  background-color: #e6f2ff;
  border-left: 5px solid #3390ff;
  color: #1a5fb4;
}

#blocking-modal .mode-button.blue::before {
  background: #3390ff;
}

#blocking-modal .mode-button.yellow {
  background-color: #fff8e6;
  border-left: 5px solid #ffc107;
  color: #8d6e00;
}

#blocking-modal .mode-button.yellow::before {
  background: #ffc107;
}

/*****************************************************************************************************/
/*MESSAGES *******************************************************************************************/
/*****************************************************************************************************/

#chat-container {
  position: absolute;
  top: 0vh;
  left: 60px;
  width: 100%;
  border: none;
  border-radius: var(--border-radius-sm);
  max-height: calc(100vh - 130px);
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  align-items: center;
  z-index: 0;
  transition: background-color var(--transition-base);
}

#messages {
  flex-grow: 1;
  color: var(--text-color);
  padding: 10px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  margin-top: 0px;
  gap: 10px;
  overflow-y: auto;
  width: 60%;
  overflow-x: hidden;
}

/* ============================================
   CODE BLOCK STYLING
   ============================================ */

.bot-message pre {
  position: relative;
  background-color: var(--code-bg);
  color: var(--text-color);
  padding: 16px;
  border-radius: var(--border-radius-md);
  font-size: var(--user-font-size);
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--outline);
  transition: border-color var(--transition-base);
}

/* Rendered note content */
.rendered-note pre,
.rendered-note code,
.rendered-note pre code {
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: "Fira Code", "Courier New", monospace;
  display: block;
  color: var(--text-color);
  background: var(--code-bg);
}

.bot-message pre code {
  display: block;
}

.bot-message pre code[class*="language-"] {
  color: var(--text-color);
}

/* ============================================
   SYNTAX HIGHLIGHTING TOKENS
   ============================================ */

.token.keyword {
  color: var(--code-keyword);
}

.token.string {
  color: var(--code-string);
}

.token.number {
  color: var(--code-number);
}

.token.function {
  color: var(--code-function);
}

.token.variable {
  color: var(--code-variable);
}

.token.comment {
  color: var(--code-comment);
  font-style: italic;
}

.token.operator {
  color: var(--code-operator);
}

/* ============================================
   TABLES
   ============================================ */

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 12px;
  margin-bottom: 20px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

th, td {
  border: 1px solid var(--outline);
  padding: 10px 12px;
  text-align: left;
  transition: background-color var(--transition-base);
}

td:hover {
  background-color: rgba(var(--accent-rgb), 0.05);
}

thead {
  background-color: var(--tableHead);
  font-weight: 600;
}

/* ============================================
   LOADING DOTS ANIMATION
   ============================================ */

.loading-dots {
  display: flex;
  align-items: center;
  height: 40px;
  margin-top: 20px;
  margin-bottom: 0px;
  padding-left: 45%;
  gap: 10px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  background-color: var(--dots);
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================
   CODE RAINBOW OVERLAY
   ============================================ */

.code-rainbow-overlay {
  background: linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet);
  background-size: 200% 100%;
  animation: rainbowWave 5s linear infinite;
  mix-blend-mode: overlay;
  opacity: 0.15;
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
}

@keyframes rainbowWave {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* ============================================
   USER MESSAGE
   ============================================ */

.user-message {
  background: none;
  color: var(--text-color);
  padding: 10px 0;
  border-radius: var(--border-radius-md);
  word-wrap: break-word;
  text-align: left;
  font-size: var(--user-font-size);
  line-height: 1.6;
  transition: color var(--transition-base);
}

.user-message img {
  display: block;
  margin: 10px auto;
  max-width: 98%;
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================
   MESSAGE CONTAINERS
   ============================================ */

.user-message-container,
.bot-message-container {
  position: relative;
  padding-right: 30px;
}

/* ============================================
   DELETE BUTTON
   ============================================ */

.delete-button {
  background: var(--deleteButton);
  border: none;
  color: var(--text-color);
  font-size: 16px;
  cursor: pointer;
  position: absolute;
  top: 8px;
  width: 24px;
  height: 24px;
  right: 0px;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-base);
  opacity: 0.6;
}

.delete-button:hover {
  background: rgba(var(--accent-rgb), 0.2);
  opacity: 1;
  transform: scale(1.1);
}

/* ============================================
   LATEX STYLING
   ============================================ */

.user-message mjx-container,
.bot-message mjx-container {
  color: var(--latex);
}

/*****************************************************************************************************/
/* GLASS BEAD CARDS **********************************************************************************/
/*****************************************************************************************************/

.drag-handle {
  cursor: move;
  padding: 0.5rem;
  background: var(--postithead);
  border-bottom: 1px solid var(--outline);
  border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
  font-size: 0.9rem;
  text-align: center;
  user-select: none;
  transition: background var(--transition-base);
}

.note-content {
  display: block;
  min-height: 100%;
}

.draggable-box {
  position: absolute;
  resize: both;
  overflow: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--outline);
  background: var(--postitbody);
  color: var(--text-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  min-width: 190px;
  min-height: 190px;
  max-height: 80vh;
  max-width: 50vw;
  box-sizing: border-box;
  z-index: 20;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.draggable-box:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.draggable-box:not(.meta-card) {
  resize: both;
}

.meta-card {
  resize: none;
}

.note-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-bar) transparent;
  background: var(--postitbody);
}

.note-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.note-scroll-container::-webkit-scrollbar-thumb {
  background: var(--scroll-bar);
  border-radius: 6px;
  transition: background var(--transition-base);
}

.note-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.note-static-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.note-static-container iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
}

.document-viewer iframe {
  height: 700px !important;
  width: 70% !important;
}

.youtube-message-container iframe {
  width: 600px !important;
  height: 400px !important;
  display: block;
  margin: 0 auto;
  flex-shrink: 0;
  flex-grow: 0;
}

.note-title {
  margin-left: 10px;
}

.note-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 10px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.note-dropdown-trigger:hover {
  transform: scale(1.1);
}

.link-pending {
  outline: 2px dashed var(--accent-color);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    outline-offset: 0px;
  }
  50% {
    outline-offset: 3px;
  }
}

.note-dropdown-menu {
  position: absolute;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  background-color: rgba(var(--sidebar-rgb), 0.95);
  color: var(--text-color);
  border: 1px solid var(--outline);
  border-radius: var(--border-radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  z-index: 9999;
  padding: 4px 0;
}

.note-dropdown-menu::-webkit-scrollbar {
  width: 8px;
}

.note-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--scroll-bar);
  border-radius: 10px;
  transition: background var(--transition-base);
}

.note-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.note-dropdown-menu::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 10px;
}

.note-dropdown-menu {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-bar) var(--scroll-track);
}

.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background-color: rgba(var(--accent-rgb), 0.15);
}

#canvas-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 4000px;
  transform: translate(0, 0);
  will-change: transform;
}

#link-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 4000px;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
  background-image: radial-gradient(var(--gridCol) 1.0px, transparent 0.5px);
  background-size: 30px 30px;
  cursor: default;
}

#notespace {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 4000px;
  z-index: 2;
  background: transparent !important;
}

.note-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 8px;
  background: var(--postithead);
  color: var(--text-color);
  border-bottom: 1px solid var(--outline);
  border-top-left-radius: var(--border-radius-md);
  border-top-right-radius: var(--border-radius-md);
  z-index: 1;
  transition: background var(--transition-base);
}

.note-title {
  margin-left: 30px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-color);
  flex-grow: 1;
  letter-spacing: -0.2px;
}

.note-title-input {
  margin-left: 24px;
}

.note-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 100%;
  cursor: pointer;
  color: var(--node-color);
  font-size: 18px;
  margin-right: 20px;
  transition: color var(--transition-fast);
}

.note-dropdown-trigger:hover {
  color: var(--accent-color);
}

.note-view-btn,
.link-in-node,
.link-out-node {
  position: absolute;
  top: 45%;
  transform: translateY(-52%);
  width: 20px;
  height: 20px;
  color: var(--node-color);
  border-radius: 50%;
  z-index: 2;
  gap: 5px;
  transition: all var(--transition-fast);
}

.link-in-node {
  left: 6px;
  color: var(--node-color);
}

.link-out-node {
  right: 6px;
  color: var(--node-color);
}

.link-in-node:hover,
.link-out-node:hover {
  color: var(--accent-color);
  transform: translateY(-52%) scale(1.2);
}

.link-label {
  position: absolute;
  pointer-events: none;
  font-size: 12px;
  color: black;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  max-width: 300px;
  overflow-wrap: break-word;
  z-index: 10;
  opacity: 0.85;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.link-out-node,
.link-in-node {
  position: absolute;
  z-index: 10000000000000;
  cursor: pointer;
  pointer-events: auto !important;
}

.meta-card {
  position: absolute;
  background: rgba(240, 240, 255, 0.1);
  border: 2px dashed var(--accent-color);
  border-radius: var(--border-radius-lg);
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(0px);
  z-index: 5;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.meta-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: var(--accent-secondary);
}

.meta-card .meta-header {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 1.1em;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
}

.meta-card .meta-header .meta-title {
  flex-grow: 1;
  padding-right: 8px;
}

.meta-card .meta-content {
  position: relative;
}

.meta-card .draggable-box {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.meta-card {
  pointer-events: auto;
}

.meta-card * {
  pointer-events: auto;
}

.meta-card .link-in-node,
.meta-card .link-out-node {
  background-color: teal;
  border-radius: 4px;
}

/*****************************************************************************************************/
/* SETTINGS ******************************************************************************************/
/*****************************************************************************************************/

.settings-container {
  display: flex;
  width: 780px;
  margin: 40px auto;
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  transition: box-shadow var(--transition-base);
}

.settings-container:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.settings-tabs {
  width: 180px;
  background: var(--input);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--outline);
}

.settings-tab {
  padding: 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-color);
  transition: all var(--transition-base);
  position: relative;
}

.settings-tab:hover {
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateX(4px);
}

.settings-tab.active {
  background: var(--gradient-accent);
  color: var(--bg);
  font-weight: 600;
}

.settings-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--bg);
  border-radius: 0 3px 3px 0;
}

.settings-panel {
  flex: 1;
  padding: 24px;
}

.settings-section {
  display: block;
}

.settings-section.hidden {
  display: none;
}

.settings-section h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--accent-color);
  font-weight: 600;
  letter-spacing: -0.3px;
}

.settings-section label {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Note View Modal */
.note-view-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s ease;
}

.note-view-modal.hidden {
  display: none !important;
}

.note-view-content {
  background: var(--postitbody);
  color: var(--text-color);
  max-width: 80%;
  max-height: 80%;
  overflow: auto;
  padding: 1.5rem;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.note-view-modal.show .note-view-content {
  opacity: 1;
  transform: scale(1);
}

.note-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--outline);
}

.note-view-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  color: var(--text-color);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-base);
}

.note-view-close:hover {
  background: rgba(var(--accent-rgb), 0.15);
  transform: rotate(90deg);
}

.note-view-body {
  line-height: 1.6;
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  position: relative;
}

.note-zone-left,
.note-zone-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.note-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-color);
  pointer-events: none;
  user-select: none;
}

/* Collapsible Sections */
.collapsible {
  background: transparent;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  margin-left: 25px !important;
  border-left: 1px solid var(--outline);
  padding-left: 10px;
  border-radius: 0 !important;
}

.collapsible.open {
  border-radius: var(--border-radius-sm);
  max-height: none;
  padding: 10px;
  color: var(--accent-color);
}

#table-dropdown-panel.open {
  max-height: 800px;
  padding: 0px;
  margin-bottom: 0px;
}

.collapsible.open {
  color: var(--accent-color-light);
}

.collapsible.open * {
  color: inherit;
  stroke: currentColor;
}

.collapsible.open svg {
  stroke: currentColor;
}

/* Button Text Responsive */
.button-text {
  transition: opacity var(--transition-fast);
  display: inline;
}

/* Responsive Input Wrapper */
.input-wrapper {
  min-width: 300px;
  max-width: 700px;
  left: 50%;
  transform: translateX(calc(-50% + 30px));
  width: calc(100vw - 80px);
}

.input-container {
  min-width: 0;
}

.button-row {
  flex-shrink: 0;
  min-width: 0;
}

.chat-action {
  white-space: nowrap;
  min-width: 44px;
  justify-content: center;
}

.chat-action:hover,
.ed-chat-action:hover {
  transform: translateY(-2px);
}

.button-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  gap: 0;
}

.mode-buttons,
.action-buttons {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Large screens - all text visible */
@media (min-width: 1024px) {
  .button-text {
    display: inline;
  }
}

/* Medium screens - keep text visible */
@media (max-width: 1023px) and (min-width: 768px) {
  .button-text {
    display: inline;
  }

  .input-wrapper {
    width: calc(100vw - 100px);
  }
}

/* Small screens - hide button text, keep icons */
@media (max-width: 767px) {
  .button-text {
    display: none;
  }

  .chat-action {
    padding-left: 10px;
    padding-right: 10px;
    min-width: 44px;
  }

  .button-row {
    gap: 6px;
  }

  .input-wrapper {
    width: calc(100vw - 80px);
  }
}

/* Extra small screens - further optimization */
@media (max-width: 480px) {
  .input-wrapper {
    width: calc(100vw - 70px);
  }

  .input-container {
    padding-left: 8px;
    padding-right: 8px;
  }

  .user-input {
    font-size: 16px;
    margin-left: 15px;
    margin-right: 10px;
  }

  .chat-action {
    padding-left: 8px;
    padding-right: 8px;
    min-width: 40px;
  }

  .chat-action svg {
    width: 16px;
    height: 16px;
  }

  .button-row {
    gap: 4px;
  }
}

/* ================================================================ */
/* MODERN SETTINGS MODAL STYLES */
/* ================================================================ */

/* Modal Overlay */
.settings-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.settings-modal-overlay.show {
  display: flex;
  opacity: 1;
}

/* Modal Container */
.settings-modal {
  background: var(--bg);
  border-radius: var(--border-radius-xl);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--outline);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-modal-overlay.show .settings-modal {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--outline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gradient-accent);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title svg {
  color: var(--bg);
  animation: rotate-gear 20s linear infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes rotate-gear {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.modal-title h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--bg);
  letter-spacing: -0.5px;
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Settings Navigation */
.settings-nav {
  width: 220px;
  padding: 16px 8px;
  background: rgba(var(--accent-rgb), 0.05);
  border-right: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: var(--text-color);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
}

.settings-nav-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition-base);
}

.settings-nav-btn:hover {
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateX(4px);
}

.settings-nav-btn:hover svg {
  opacity: 1;
}

.settings-nav-btn.active {
  background: var(--gradient-accent);
  color: var(--bg);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.25);
}

.settings-nav-btn.active svg {
  opacity: 1;
}

/* Settings Content */
.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.settings-content::-webkit-scrollbar {
  width: 10px;
}

.settings-content::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 10px;
}

.settings-content::-webkit-scrollbar-thumb {
  background: var(--scroll-bar);
  border-radius: 10px;
  border: 2px solid var(--scroll-track);
  transition: background var(--transition-base);
}

.settings-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Settings Panel Content */
.settings-panel-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.settings-panel-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Settings Group */
.settings-group {
  margin-bottom: 36px;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-color);
  margin: 0 0 18px 0;
  padding-left: 4px;
}

/* Setting Item */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  background: rgba(var(--accent-rgb), 0.03);
  border-radius: var(--border-radius-lg);
  margin-bottom: 12px;
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.setting-item:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: var(--accent-color);
  transform: translateX(4px);
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.setting-label svg {
  color: var(--accent-color);
  flex-shrink: 0;
}

.setting-label > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.setting-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  letter-spacing: -0.2px;
}

.setting-description {
  font-size: 0.88rem;
  color: var(--text-color);
  opacity: 0.7;
  line-height: 1.5;
}

/* Setting Controls */
.setting-select {
  padding: 10px 18px;
  border-radius: var(--border-radius-md);
  border: 1.5px solid var(--outline);
  background: var(--input);
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  min-width: 130px;
}

.setting-select:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.setting-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

/* Setting Control (for sliders) */
.setting-control {
  display: flex;
  align-items: center;
  gap: 14px;
}

.setting-slider {
  width: 150px;
  height: 6px;
  border-radius: 3px;
  background: rgba(var(--accent-rgb), 0.15);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background var(--transition-base);
}

.setting-slider:hover {
  background: rgba(var(--accent-rgb), 0.25);
}

.setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.4);
  transition: all var(--transition-base);
}

.setting-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.6);
}

.setting-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.4);
  transition: all var(--transition-base);
}

.setting-slider::-moz-range-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.6);
}

.setting-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-color);
  min-width: 50px;
  text-align: right;
}

/* Modern Toggle Switch */
.setting-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

.setting-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(127, 129, 137, 0.3);
  border-radius: 28px;
  transition: all var(--transition-base);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.setting-toggle input:checked + .toggle-slider {
  background: var(--gradient-accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.4);
}

.setting-toggle input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.setting-toggle:hover .toggle-slider:before {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* Modal Footer */
.modal-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--outline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(var(--accent-rgb), 0.03);
}

.modal-btn {
  padding: 12px 26px;
  border-radius: var(--border-radius-md);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-btn-secondary {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text-color);
  border: 1.5px solid var(--outline);
}

.modal-btn-secondary:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
}

.modal-btn-primary {
  background: var(--gradient-accent);
  color: var(--bg);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.modal-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.45);
  transform: translateY(-2px);
}

/* Light Theme Overrides */
:root[data-theme="light"] {
  --settingsBG: #ffffff;
  --nav-bg: rgba(0, 0, 0, 0.03);
  --border-color: rgba(0, 0, 0, 0.1);
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-tertiary: #999;
  --modal-header-bg-1: rgba(249, 187, 149, 0.1);
  --modal-header-bg-2: rgba(243, 109, 30, 0.1);
}

:root[data-theme="light"] .setting-item {
  background: rgba(249, 187, 149, 0.05);
}

:root[data-theme="light"] .setting-item:hover {
  background: rgba(249, 187, 149, 0.12);
}

:root[data-theme="light"] .settings-modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .settings-modal {
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .settings-modal {
    width: 95%;
    max-height: 90vh;
  }

  .modal-body {
    flex-direction: column;
  }

  .settings-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--outline);
  }

  .settings-nav-btn {
    flex-direction: column;
    gap: 6px;
    min-width: 90px;
    text-align: center;
    font-size: 0.85rem;
  }

  .settings-content {
    padding: 20px;
  }

  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .setting-control {
    width: 100%;
    justify-content: space-between;
  }

  .setting-slider {
    flex: 1;
    min-width: 120px;
  }
}

/* Animation for page load */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(40px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}