/* Base styles from base.html */
html, body {
  overflow-x: hidden;
  width: 100%;
}

.app-name,
.app-name-font {
  font-family: 'Libre Baskerville', serif;
}

.app-name {
  font-weight: 700;
}

/* --- Force wrapping in the editor and rendered content --- */
#messageInput {
  max-width: 100%;
  overflow-wrap: anywhere;  /* breaks long URLs/strings */
  word-break: break-word;
  white-space: pre-wrap;   /* preserve newlines */
}

.message-content p {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.markdown-content {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

[contenteditable="true"] {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* --- iOS-friendly loading bar: avoid 100vw --- */
@keyframes loading-bar {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); } /* was 100vw */
}

/* --- Keep the off-canvas sidebar from triggering overflow on mobile --- */
@media (max-width: 1023px) {
  .sidebar {
    width: 16rem;          /* explicit, consistent width */
    overflow: hidden;      /* clip its box while sliding */
    will-change: transform;
  }
}


.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* View Transitions API */
@view-transition {
  navigation: auto;
}

/* Custom page transition animations */
::view-transition-old(root) {
  animation: slide-out-left 0.3s ease-in-out;
}

::view-transition-new(root) {
  animation: slide-in-right 0.3s ease-in-out;
}

@keyframes slide-out-left {
  0% {
    transform: translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateX(-20px);
    opacity: 0;
  }
}

@keyframes slide-in-right {
  0% {
    transform: translateX(20px);
    opacity: 0;
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Fallback for browsers without View Transitions API */
.page-transition {
  animation: fade-in-page 0.4s ease-out;
}

@keyframes fade-in-page {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth hover transitions */
.smooth-hover {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-hover:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dark .smooth-hover:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Button animations */
.btn-animate {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.btn-animate:hover {
  transform: scale(1.02);
}

.btn-animate:active {
  transform: scale(0.98);
}

/* Micro-interactions */
.micro-bounce:hover {
  animation: micro-bounce 0.5s ease-in-out;
}

@keyframes micro-bounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

/* Dark mode styles */
.dark {
  --bg-primary: #020617;
  --bg-secondary: #0f172a;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #1e293b;
}

.dark body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.dark .bg-white {
  background-color: var(--bg-secondary);
}

.dark .text-slate-900 {
  color: var(--text-primary);
}

.dark .text-slate-600 {
  color: var(--text-secondary);
}

.dark .border-slate-200 {
  border-color: var(--border-color);
}

/* Sidebar styles */
.sidebar {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

/* Enhanced focus styles */
.focus-enhanced:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  border-color: #059669;
}

/* Stagger animations for lists */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  animation: stagger-in 0.4s ease-out forwards;
}

.stagger-item:nth-child(1) {
  animation-delay: 0.1s;
}

.stagger-item:nth-child(2) {
  animation-delay: 0.2s;
}

.stagger-item:nth-child(3) {
  animation-delay: 0.3s;
}

.stagger-item:nth-child(4) {
  animation-delay: 0.4s;
}

.stagger-item:nth-child(5) {
  animation-delay: 0.5s;
}

@keyframes stagger-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::-webkit-scrollbar {
  width: 10px;
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  /* slate-200 */
  border-radius: 8px;
  min-height: 40px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
  /* slate-400, more visible on hover */
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-thumb {
    background: #475569;
    /* slate-600 */
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #334155;
    /* slate-700, still subtle */
  }
}

/* Firefox */
.scrollbar-minimal {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

@media (prefers-color-scheme: dark) {
  .scrollbar-minimal {
    scrollbar-color: #475569 transparent;
  }
}

/* Chat page styles from chat.html */
/* Sidebar section headings */
.sidebar-section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.4rem;
  border-left: 2px solid #38bdf8;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.9), rgba(248, 250, 252, 0));
  backdrop-filter: blur(6px);
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-section-heading--spaced {
  margin-top: 0.75rem;
}

.sidebar-section-heading svg {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.85;
}

.sidebar-section-label {
  color: inherit;
}

.sidebar-section-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.dark .sidebar-section-heading {
  color: #e2e8f0;
  border-left-color: #38bdf8;
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.1));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.dark .sidebar-section-heading svg {
  opacity: 0.95;
}

.sidebar-collapsed .sidebar-section-heading {
  padding-left: 1rem;
  padding-right: 1rem;
}

.sidebar-collapsed .sidebar-section-heading svg {
  margin: 0 auto;
}

.sidebar-collapsed .sidebar-section-label {
  display: none;
}

/* Sidebar collapsed styles */
.sidebar-collapsed .sidebar-text {
  display: none;
}

.sidebar-collapsed {
  width: 4rem !important;
}

/* Mobile sidebar */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }

  .sidebar-open {
    transform: translateX(0) !important;
  }

  .sidebar-collapsed {
    width: 16rem !important;
  }

  .sidebar-collapsed .sidebar-text {
    display: block;
  }
}

/* Smooth transitions */
.sidebar {
  transition: width 0.3s ease-in-out;
}

.sidebar-text {
  transition: opacity 0.2s ease-in-out;
}

.sidebar-collapsed .sidebar-text {
  opacity: 0;
}

/* Line clamp utilities for file previews */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Custom scrollbar for file preview container */
#filePreviewContainer {
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

#filePreviewContainer::-webkit-scrollbar {
  height: 6px;
}

#filePreviewContainer::-webkit-scrollbar-track {
  background: transparent;
}

#filePreviewContainer::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

#filePreviewContainer::-webkit-scrollbar-thumb:hover {
  background-color: rgba(156, 163, 175, 0.7);
}

/* Enhanced Prism.js code block styling */
.markdown-content pre[class*="language-"] {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5em;
  overflow-x: auto;
  margin: 1.5em 0;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
  font-size: 0.85em;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .markdown-content pre[class*="language-"] {
  background: #1e1e1e;
  border-color: #333;
  color: #d4d4d4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.markdown-content code[class*="language-"] {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
  text-shadow: none;
}

/* Override Prism default styles for dark mode */
.dark .markdown-content .token.comment,
.dark .markdown-content .token.prolog,
.dark .markdown-content .token.doctype,
.dark .markdown-content .token.cdata {
  color: #6a9955;
}

.dark .markdown-content .token.punctuation {
  color: #d4d4d4;
}

.dark .markdown-content .token.property,
.dark .markdown-content .token.tag,
.dark .markdown-content .token.boolean,
.dark .markdown-content .token.number,
.dark .markdown-content .token.constant,
.dark .markdown-content .token.symbol,
.dark .markdown-content .token.deleted {
  color: #b5cea8;
}

.dark .markdown-content .token.selector,
.dark .markdown-content .token.attr-name,
.dark .markdown-content .token.string,
.dark .markdown-content .token.char,
.dark .markdown-content .token.builtin,
.dark .markdown-content .token.inserted {
  color: #ce9178;
}

.dark .markdown-content .token.operator,
.dark .markdown-content .token.entity,
.dark .markdown-content .token.url,
.dark .markdown-content .language-css .token.string,
.dark .markdown-content .style .token.string {
  color: #d4d4d4;
}

.dark .markdown-content .token.atrule,
.dark .markdown-content .token.attr-value,
.dark .markdown-content .token.keyword {
  color: #569cd6;
}

.dark .markdown-content .token.function,
.dark .markdown-content .token.class-name {
  color: #dcdcaa;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 1.5em 0 0.5em 0;
  font-weight: 600;
  line-height: 1.4;
}

.markdown-content h1 {
  font-size: 1.5em;
}

.markdown-content h2 {
  font-size: 1.3em;
}

.markdown-content h3 {
  font-size: 1.1em;
}

.markdown-content h4 {
  font-size: 1em;
}

.markdown-content h5 {
  font-size: 0.9em;
}

.markdown-content h6 {
  font-size: 0.8em;
}

.markdown-content p {
  margin: 0.75em 0;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0.75em 0;
  padding-left: 1.5em;
}

.markdown-content li {
  margin: 0.25em 0;
}

/* Nested lists should use bullets (•) instead of numbers */
.markdown-content ol ol,
.markdown-content ol ul,
.markdown-content ul ol,
.markdown-content ul ul {
  list-style-type: disc;
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

/* Third-level and deeper nesting also use bullets */
.markdown-content ol ol ol,
.markdown-content ol ol ul,
.markdown-content ol ul ol,
.markdown-content ol ul ul,
.markdown-content ul ol ol,
.markdown-content ul ol ul,
.markdown-content ul ul ol,
.markdown-content ul ul ul {
  list-style-type: disc;
}

.markdown-content blockquote {
  border-left: 4px solid #e5e7eb;
  margin: 1em 0;
  padding-left: 1em;
  color: #6b7280;
  font-style: italic;
}

.dark .markdown-content blockquote {
  border-left-color: #374151;
  color: #9ca3af;
}

/* Smooth transitions for message updates */
.message-content {
  transition: all 0.3s ease-in-out;
}

.message-updating {
  opacity: 0.7;
  transform: scale(0.99);
}

/* Enhanced focus states */
.version-nav-btn:focus {
  outline: 2px solid rgb(59, 130, 246);
  outline-offset: 2px;
}

/* Animation for version changes */
@keyframes version-change {
  0% {
    opacity: 0.8;
    transform: translateX(-5px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.version-changed .message-content {
  animation: version-change 0.3s ease-out;
}

/* Responsive adjustments for version controls */
@media (max-width: 640px) {
  .version-controls {
    opacity: 1;
    /* Always show on mobile */
  }

  .version-nav-btn {
    width: 32px;
    height: 32px;
    touch-action: manipulation;
  }

  .version-indicator {
    font-size: 14px;
    min-width: 40px;
  }
}

/* Accessibility improvements */
.version-nav-btn:focus-visible {
  outline: 2px solid rgb(59, 130, 246);
  outline-offset: 2px;
  background: rgba(59, 130, 246, 0.1);
}

/* Success state for edit operations */
.edit-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  animation: success-pulse 0.6s ease-out;
}

@keyframes success-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Inline editing styles */
.message-editing {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.dark .message-editing {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.edit-interface {
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.dark .edit-interface {
  background: transparent;
  border: none;
}

.editing-content {
  min-height: 3rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: #f9fafb;
  outline: none;
}

.dark .editing-content {
  background: #1f2937;
  border-color: #374151;
  color: #ffffff;
}

.editing-content:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Loading spinner for save button */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.preview-loader {
  border: 2px solid #059669;
  border-top-color: transparent;
  border-radius: 9999px;
  animation: spin 1s linear infinite;
}

.version-controls [data-attachments-container] {
  display: none;
}

.edit-interface button {
  min-width: 20px;
  min-height: 20px;
}

/* Completely disable animations on thinking buttons */
button[onclick*="toggleThinking"] {
  transform: none !important;
  transition: background-color 0.2s ease !important;
}

button[onclick*="toggleThinking"]:hover {
  transform: none !important;
}

button[onclick*="toggleThinking"]:active {
  transform: none !important;
}

button[onclick*="toggleThinking"].btn-animate {
  transform: none !important;
}

button[onclick*="toggleThinking"].smooth-hover {
  transform: none !important;
}

/* Disable ALL animations on user menu button */
#userMenuButton {
  transform: none !important;
  transition: background-color 0.2s ease, color 0.2s ease !important;
}

#userMenuButton:hover {
  transform: none !important;
}

#userMenuButton:active {
  transform: none !important;
}

#userMenuButton:focus {
  transform: none !important;
  outline: none !important;
}

/* Version indicator styling when multiple versions exist */
.version-controls.has-multiple-versions .version-indicator {
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: rgb(59, 130, 246);
}

.dark .version-controls.has-multiple-versions .version-indicator {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
  color: rgb(96, 165, 250);
}

/* Settings page styles from settings.html */
.tab-button.active {
  border-color: #6366f1;
  color: #6366f1;
}

.dark .tab-button.active {
  border-color: #818cf8;
  color: #818cf8;
}

/* Custom radio button styling */
input[type="radio"]:checked + label .w-4.h-4 {
  border-color: #059669;
  background-color: #059669;
}

input[type="radio"]:checked + label .w-2.h-2 {
  opacity: 1;
}

/* Enhanced form input focus states */
input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Smooth transitions */
* {
  transition: all 0.2s ease-in-out;
}

#citationModal {
  backdrop-filter: blur(4px);
}

#citationModalContent {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.citation-status-green {
  @apply bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400;
}

.citation-status-yellow {
  @apply bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400;
}

.citation-status-red {
  @apply bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400;
}

/* Smooth animations for citation cards */
#citationsList > div {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Settings page tabs */
.tab-button {
  /* override the global * transition for cleaner feel */
  transition: color .15s ease, border-bottom-color .15s ease, background-color .15s ease;
}

.tab-button.active {
  border-bottom-color: #6366f1; /* emerald-500 */
  color: #6366f1;
}

.dark .tab-button.active {
  border-bottom-color: #818cf8; /* emerald-400/300 range */
  color: #818cf8;
}

/* Professional pulse animation - more subtle */
@keyframes professional-pulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.8;
    transform: scale(1.01);
  }
}

.professional-pulse {
  animation: professional-pulse 3s ease-in-out infinite;
}

/* Professional bounce - slower and more subtle */
@keyframes professional-bounce {
  0%, 100% { 
    transform: translateY(0);
    opacity: 0.6;
  }
  50% { 
    transform: translateY(-2px);
    opacity: 1;
  }
}

.professional-bounce {
  animation: professional-bounce 1.5s ease-in-out infinite;
}

/* Smoother message transitions */
.message-transition {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Professional color scheme for dark mode */
.dark .professional-indicator {
  background-color: #475569; /* slate-600 */
  border-color: #334155; /* slate-700 */
}

/* Ensure text remains readable in both modes */
.professional-text {
  color: #334155; /* slate-700 */
  font-weight: 500;
  letter-spacing: -0.01em;
}

.dark .professional-text {
  color: #cbd5e1; /* slate-300 */
}

/* Research mode indicator styling */
.research-mode-indicator {
  background: linear-gradient(135deg, #1e40af 0%, #3730a3 100%);
}

.dark .research-mode-indicator {
  background: linear-gradient(135deg, #059669 0%, #6366f1 100%);
}

/* More conservative animations for professional environment */
.conservative-fade {
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* Reduced motion for accessibility and professionalism */
@media (prefers-reduced-motion: reduce) {
  .professional-pulse,
  .professional-bounce {
    animation: none;
  }
  
  .professional-pulse {
    opacity: 0.9;
  }
  
  .professional-bounce {
    opacity: 0.8;
  }
}

/* ===========================
   CLEAN TOOLTIP SYSTEM
   =========================== */

.tooltip-container {
  position: relative;
  display: inline-block;
}

/* Base tooltip styles */
.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tooltip arrow */
.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

/* Right-positioned tooltip (for sidebar) */
.tooltip-right {
  bottom: auto !important;
  left: calc(100% + 8px) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin-bottom: 0 !important;
}

.tooltip-right::after {
  top: 50% !important;
  left: -5px !important;
  transform: translateY(-50%) !important;
  border: 5px solid transparent !important;
  border-right-color: rgba(0, 0, 0, 0.9) !important;
  border-top-color: transparent !important;
}

/* Show tooltip on hover */
.tooltip-container:hover .tooltip {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Dark mode tooltips */
.dark .tooltip {
  background: rgba(255, 255, 255, 0.95);
  color: #1f2937;
}

.dark .tooltip::after {
  border-top-color: rgba(255, 255, 255, 0.95);
}

.dark .tooltip-right::after {
  border-right-color: rgba(255, 255, 255, 0.95) !important;
  border-top-color: transparent !important;
}

/* Ensure sidebar items can show tooltips */
.sidebar .tooltip-container {
  display: block;
  width: 100%;
}

/* Keep sidebar (and its tooltips) above main content */
@media (min-width: 1024px) {
  .sidebar {
    position: relative;
    z-index: 60;
  }
}

.fixed.inset-0[id$="Modal"],
.fixed.inset-0[id$="Drawer"] {
  z-index: 80 !important;
}

.sidebar .tooltip-container > a,
.sidebar .tooltip-container > button {
  display: flex;
  width: 100%;
}

/* Ensure the template library overlay sits above the elevated sidebar */
#templateLibraryPanel {
  z-index: 70;
}

/* Ensure tooltips can escape collapsed sidebar */
@media (min-width: 1024px) {
  .sidebar.sidebar-collapsed {
    overflow: visible !important;
    z-index: 60;
  }
  
  .sidebar.sidebar-collapsed .tooltip-container {
    position: relative;
    z-index: 1001;
  }
  
  /* Ensure tooltip shows in collapsed state */
  .sidebar.sidebar-collapsed .tooltip-right {
    left: calc(100% + 12px) !important;
  }
}

/* Ensure user menu positioning doesn't interfere */
.sidebar.sidebar-collapsed #userMenu {
  position: absolute;
  left: calc(100% + 6px) !important;
  right: auto !important;
  bottom: 100% !important;
  top: auto !important;
  transform: none !important;
  width: 12rem;
  white-space: nowrap;
  z-index: 10000;
  margin-bottom: 0 !important;
}

/* Hide chat history when collapsed */
.sidebar.sidebar-collapsed .sidebar-helper-card,
.sidebar.collapsed .sidebar-helper-card {
  display: none !important;
}

.sidebar.sidebar-collapsed #chatHistory {
  display: none !important;
}

.sidebar.sidebar-collapsed #chatHistoryLoader {
  display: none !important;
}

.sidebar.sidebar-collapsed #upgradeBanner {
  display: none !important;
}

.chat-menu {
  top: calc(100% + 0.25rem);
}

.chat-menu.drop-up {
  top: auto;
  bottom: calc(100% + 0.25rem);
}

.sidebar.sidebar-collapsed [id^="chatMenu-"] {
  display: none !important;
}

@media (max-width: 1023px) {
  /* Hide collapse toggle and tooltip on mobile layouts */
  #sidebarToggle,
  #sidebarTooltip {
    display: none !important;
  }
}

/* Collapsed sidebar button alignment */
.sidebar-collapsed #sidebarToggle {
  /* Keep button at same size and position when collapsed */
  height: 2.25rem;
  width: 2.25rem;
}

.sidebar-collapsed #sidebarToggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar-collapsed #userMenuButton {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  height: 2.25rem;
}

.sidebar-collapsed #userMenuButton .min-w-0 {
  justify-content: center;
  gap: 0;
}

.sidebar-collapsed #userMenuButton .sidebar-text {
  display: none;
}

/* Apple-style Jump to Bottom Button */
#jumpToBottom {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  transform-origin: center;
  will-change: transform, opacity;
}

.dark #jumpToBottom {
  background: rgba(31, 41, 55, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24), 0 2px 8px rgba(0, 0, 0, 0.16);
}

#jumpToBottom:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark #jumpToBottom:hover {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

#jumpToBottom:active {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
}

.dark #jumpToBottom:active {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24), 0 1px 4px rgba(0, 0, 0, 0.16);
}

/* Smooth entrance animation */
#jumpToBottom:not(.hidden) {
  animation: jumpButtonSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes jumpButtonSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile responsive adjustments - now much simpler since it's in chat area */
@media (max-width: 768px) {
  #jumpToBottom {
    bottom: 11rem;
    right: 2rem;
  }
  
  #jumpToBottom svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* WhatsApp-style chat - COMBINED with overflow protection */
#chatMessages {
  padding: 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
  max-width: 100%;
}

#chatMessages * { 
  min-width: 0; 
}

/* Message spacing */
#chatMessages > div {
  margin-bottom: 1rem;
}

/* User messages - WhatsApp style green bubbles */
.flex.justify-end .max-w-2xl > div {
  background: #dcf8c6;
  border-radius: 18px 18px 4px 18px;
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  color: #000;
}

.flex.justify-end .max-w-2xl .user-message-text {
  color: #000;
}

.dark .flex.justify-end .max-w-2xl > div {
  background: #005c4b;
  color: #fff;
}

.dark .flex.justify-end .max-w-2xl .user-message-text {
  color: #fff;
}

/* Assistant messages - WhatsApp style white/gray bubbles */
.flex.justify-start .max-w-2xl > div {
  color: #000;
}

.dark .flex.justify-start .max-w-2xl > div {
  color: #fff;
}

/* Better typography for chat bubbles */
.markdown-content {
  font-size: 15px;
  line-height: 1.6;
}

/* Override the 2rem line-height for WhatsApp style */
#chatMessages p,
#chatMessages li,
#chatMessages div {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 2;
}

/* Top-level list items keep their default style */
#chatMessages li {
  list-style: auto;
}

/* Force nested lists in chat to use bullets - must be AFTER the #chatMessages li rule above */
#chatMessages .markdown-content ol ol > li,
#chatMessages .markdown-content ol ul > li,
#chatMessages .markdown-content ul ol > li,
#chatMessages .markdown-content ul ul > li {
  list-style-type: disc !important;
}

#chatMessages .markdown-content ol ol > li::marker,
#chatMessages .markdown-content ol ul > li::marker,
#chatMessages .markdown-content ul ol > li::marker,
#chatMessages .markdown-content ul ul > li::marker {
  content: "• " !important;
}

/* Third level nesting in chat */
#chatMessages .markdown-content ol ol ol > li::marker,
#chatMessages .markdown-content ol ol ul > li::marker,
#chatMessages .markdown-content ol ul ol > li::marker,
#chatMessages .markdown-content ol ul ul > li::marker,
#chatMessages .markdown-content ul ol ol > li::marker,
#chatMessages .markdown-content ul ol ul > li::marker,
#chatMessages .markdown-content ul ul ol > li::marker,
#chatMessages .markdown-content ul ul ul > li::marker {
  content: "• " !important;
}

/* Thinking process bubbles get same styling */
.flex.justify-start .bg-white {
  background: #f8f9fa !important;
  border-radius: 12px !important;
  border: 1px solid #e5e7eb !important;
}

.dark .flex.justify-start .bg-white {
  background: #111827 !important;
  border-color: #374151 !important;
}

#chatMessages a {
  color: #059669;
  text-decoration: underline;
}

/* Let flex children shrink instead of pushing overflow */
#chatMessages * { min-width: 0; }


/* Limit aggressive wrapping to markdown text only */
#chatMessages .markdown-content span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Never break the canvas title/action labels into single letters */
#chatMessages .canvas-header span,
#chatMessages .canvas-title {
  overflow-wrap: normal;
  word-break: normal;
}


/* Code blocks: scroll inside the block, not the whole chat area */
#chatMessages pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre; /* keep code formatting intact */
}

/* Media should never exceed the chat width */
#chatMessages img,
#chatMessages video,
#chatMessages iframe {
  max-width: 100%;
  height: auto;
  display: block;
}/* Canvas Styles */
.canvas-container {
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.dark .canvas-container {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.canvas-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.dark .canvas-header {
    background: #111827;
    border-bottom-color: #374151;
}

.canvas-title-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.canvas-icon {
    color: #6b7280;
    flex-shrink: 0;
    font-size: 1rem;
}

.dark .canvas-icon {
    color: #9ca3af;
}

.canvas-title {
    font-weight: 600;
    color: #111827;
    font-size: 0.9rem;
}

.dark .canvas-title {
    color: #f3f4f6;
}

.canvas-type-badge {
    padding: 0.125rem 0.5rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.dark .canvas-type-badge {
    background: #1e3a8a;
    color: #93c5fd;
}

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

.canvas-status {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    margin-right: 0.5rem;
}

.canvas-status.editing {
    color: #92400e;
    background: #fef3c7;
}

.canvas-status.saving {
    color: #1e40af;
    background: #dbeafe;
}

.canvas-status.saved {
    color: #14532d;
    background: #d1fae5;
}

.canvas-status.error {
    color: #991b1b;
    background: #fee2e2;
}

.dark .canvas-status.editing {
    color: #fbbf24;
    background: #78350f;
}

.dark .canvas-status.saving {
    color: #93c5fd;
    background: #1e3a8a;
}

.dark .canvas-status.saved {
    color: #86efac;
    background: #14532d;
}

.dark .canvas-status.error {
    color: #fca5a5;
    background: #7f1d1d;
}

.canvas-action-btn {
    padding: 0.375rem;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-action-btn i {
    font-size: 0.875rem;
}

.canvas-action-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.dark .canvas-action-btn:hover {
    background: #374151;
    color: #f3f4f6;
}

.canvas-action-btn.success {
    color: #10b981;
    background: #d1fae5;
}

.canvas-editor {
    padding: 2rem;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    outline: none;
    position: relative;
}

.canvas-editor:focus {
    background: #fafafa;
}

.dark .canvas-editor:focus {
    background: #0f172a;
}

.canvas-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    color: #111827;
}

.dark .canvas-content {
    color: #f3f4f6;
}

.canvas-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 1.5rem 0 1rem;
    color: #111827;
}

.canvas-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: #111827;
}

.canvas-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
    color: #111827;
}

.dark .canvas-content h1,
.dark .canvas-content h2,
.dark .canvas-content h3 {
    color: #f3f4f6;
}

.canvas-content p {
    margin: 0.75rem 0;
}

.canvas-content ul,
.canvas-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.canvas-content li {
    margin: 0.25rem 0;
}

.canvas-content strong {
    font-weight: 600;
    color: #111827;
}

.dark .canvas-content strong {
    color: #f9fafb;
}

.canvas-content em {
    font-style: italic;
}

.canvas-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6b7280;
    font-style: italic;
}

.dark .canvas-content blockquote {
    border-left-color: #4b5563;
    color: #9ca3af;
}

.canvas-formatting-toolbar {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.25rem;
    display: flex;
    gap: 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.dark .canvas-formatting-toolbar {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.format-btn {
    padding: 0.375rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.format-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.dark .format-btn:hover {
    background: #374151;
    color: #f3f4f6;
}

.canvas-formatting-toolbar.hidden {
    display: none;
}

.canvas-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    margin: 0;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
}

.canvas-fullscreen .canvas-editor {
    max-height: calc(100vh - 60px);
    padding: 3rem;
}

.canvas-fullscreen .canvas-content {
    max-width: 1000px;
}

.canvas-editor::-webkit-scrollbar {
    width: 8px;
}

.canvas-editor::-webkit-scrollbar-track {
    background: transparent;
}

.canvas-editor::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.canvas-editor::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark .canvas-editor::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark .canvas-editor::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (max-width: 768px) {
    .canvas-editor {
        padding: 1rem;
    }
    .canvas-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .canvas-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .canvas-content {
        font-size: 0.9rem;
    }
}

.canvas-editor:focus-visible {
    outline: 2px solid #059669;
    outline-offset: -2px;
}

@media print {
    .canvas-header {
        display: none;
    }
    .canvas-container {
        border: none;
        box-shadow: none;
    }
    .canvas-editor {
        padding: 0;
        max-height: none;
    }
}

/* Streaming canvas indicators */
.canvas-streaming-badge {
    background: linear-gradient(45deg, #059669, #8b5cf6);
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

.canvas-streaming-indicator {
    background: #f1f5f9;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    color: #64748b;
    font-style: italic;
    text-align: center;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.canvas-streaming-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.1), transparent);
    animation: shimmer 2s infinite;
}

.canvas-wrapper.canvas-streaming {
    position: relative;
    overflow: hidden;
}

.canvas-wrapper.canvas-streaming::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #059669, transparent);
    animation: progress 2s infinite;
    z-index: 10;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes progress {
    0% { left: -100%; }
    100% { left: 100%; }
}

.canvas-streaming .canvas-content {
    position: relative;
}

.canvas-streaming .canvas-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 3px;
    height: 20px;
    background: #059669;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.markdown-content ol + ul li {
  position: relative;
}

.markdown-content ol + ul li::marker {
  content: "• ";
  color: #64748b; /* Subtle bullet color */
}

/* Reduce spacing between related lists */
.markdown-content ol + ul,
.markdown-content ul + ol {
  margin-top: 0.25em;
}

/* Streaming progress list styling */
.streaming-progress ul {
  list-style: disc;
  margin-left: 1.25rem;
}

.streaming-progress li {
  margin-bottom: 0.25rem;
}

/* Professional citation pills inspired by ChatGPT */
.citation-pill-container {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    position: relative;
    top: -0.094rem;
}/* Base */
.citation-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 9px;
  background: #818cf8;            /* indigo-400 */
  color: #fff !important;         /* force white text */
  transition: background-color 150ms ease-in-out, color 150ms ease-in-out, box-shadow 150ms ease-in-out, transform 150ms ease-in-out;
  border: none;
  position: relative;
  overflow: hidden;               /* pill clips overflow */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  letter-spacing: 0.01em;
  /* Optional: constrain pill width so ellipsis can occur */
  /* max-width: 20ch; */
}

/* Links inside the pill inherit color and don’t underline */
.citation-pill a {
  color: inherit !important;
  text-decoration: none;
}
.citation-pill:hover a,
.dark .citation-pill:hover a,
.citation-pill a:visited {
  color: inherit !important;
  text-decoration: none;
}

/* Text container: must NOT be flex for ellipsis to work reliably */
.citation-pill span,
.citation-pill > a {
  display: block;                 /* not flex */
  flex: 1 1 auto;                 /* can shrink inside the flex parent */
  min-width: 0;                   /* allow shrinking */
  overflow: hidden;               /* hide overflowed text */
  text-overflow: ellipsis;        /* show … at the end */
  white-space: nowrap;            /* single line */
  /* Remove max-width here—let the pill width drive truncation */
  /* If you really want a hard clamp, use the pill's max-width instead */
  text-align: left;
}

/* Light mode hover – darker bg, keep text white */
.citation-pill:hover {
  background: #6366f1;            /* indigo-500 */
  color: #fff !important;         /* force white text on hover */
  transform: none;
  box-shadow: none;
}

/* Dark mode base */
.dark .citation-pill {
  background: #3b82f6;            /* blue-500 */
  color: #fff !important;
}

/* Dark mode hover – slightly darker blue, keep white text */
.dark .citation-pill:hover {
  background: #2563eb;            /* blue-600 */
  color: #fff !important;
}

/* Remove icons if present */
.citation-pill svg {
  display: none;
}

/* Accessible focus */
.citation-pill:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Pill highlight animation when clicked from web sources */
.citation-pill.pill-highlight {
  animation: pill-pulse 2s ease-in-out;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
}

@keyframes pill-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
  25%, 75% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.6);
  }
}

.dark .citation-pill.pill-highlight {
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.3);
}

@keyframes pill-pulse-dark {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
  25%, 75% {
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.6);
  }
}

/* Source number link styling */
.source-number-link {
  text-decoration: none;
  cursor: pointer;
}

.source-number-link:hover {
  text-decoration: none;
}


/* Matter notebook styles */
.notes-drawer-tab {
  background-color: rgba(255, 255, 255, 0.9);
}

.notes-drawer-tab.active {
  background-color: #0f172a;
  border-color: transparent;
  color: #ffffff;
}

.notes-drawer-tab:not(.active):hover {
  background-color: rgba(16, 185, 129, 0.08);
  color: #0f172a;
}

html.dark .notes-drawer-tab {
  background-color: rgba(15, 23, 42, 0.7);
  color: #cbd5f5;
}

html.dark .notes-drawer-tab:not(.active):hover {
  background-color: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

html.dark .notes-drawer-tab.active {
  background-color: #f8fafc;
  color: #0f172a;
}

.note-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.note-editor-toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background-color: #f8fafc;
  color: #1f2937;
  padding: 0.35rem 0.75rem;
  transition: all 0.2s ease;
}

.note-editor-toolbar-button svg {
  width: 1rem;
  height: 1rem;
}

.note-editor-toolbar-button:hover {
  background-color: #e2e8f0;
}

.note-editor-toolbar-button.is-active {
  background-color: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

html.dark .note-editor-toolbar-button {
  border-color: #334155;
  background-color: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
}

html.dark .note-editor-toolbar-button:hover {
  background-color: rgba(30, 41, 59, 0.9);
}

html.dark .note-editor-toolbar-button.is-active {
  background-color: #f8fafc;
  border-color: #f8fafc;
  color: #0f172a;
}

.note-checklist-editor {
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background-color: #f8fafc;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

html.dark .note-checklist-editor {
  border-color: #1f2937;
  background-color: rgba(15, 23, 42, 0.75);
}

.note-checklist-editor-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  padding: 0.35rem 0.5rem;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.note-checklist-editor-item:hover,
.note-checklist-editor-item:focus-within {
  background-color: rgba(148, 163, 184, 0.16);
}

html.dark .note-checklist-editor-item:hover,
html.dark .note-checklist-editor-item:focus-within {
  background-color: rgba(148, 163, 184, 0.22);
}

.note-checklist-editor-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.35rem;
  border: 1.5px solid #94a3b8;
  accent-color: #10b981;
  cursor: pointer;
}

html.dark .note-checklist-editor-checkbox {
  border-color: #64748b;
  accent-color: #22d3ee;
}

.note-checklist-editor-text {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  color: #1f2937;
  padding: 0.25rem 0;
  outline: none;
}

.note-checklist-editor-text::placeholder {
  color: #94a3b8;
}

html.dark .note-checklist-editor-text {
  color: #e2e8f0;
}

html.dark .note-checklist-editor-text::placeholder {
  color: #64748b;
}

.note-checklist-editor-item.completed .note-checklist-editor-text {
  text-decoration: line-through;
  color: #6b7280;
}

html.dark .note-checklist-editor-item.completed .note-checklist-editor-text {
  color: #94a3b8;
}

.note-checklist-editor-remove {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 9999px;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.note-checklist-editor-item:hover .note-checklist-editor-remove,
.note-checklist-editor-item:focus-within .note-checklist-editor-remove {
  opacity: 1;
}

.note-checklist-editor-remove:hover {
  color: #ef4444;
  background-color: rgba(248, 113, 113, 0.12);
}

html.dark .note-checklist-editor-remove {
  color: #64748b;
}

html.dark .note-checklist-editor-remove:hover {
  color: #fca5a5;
  background-color: rgba(248, 113, 113, 0.22);
}

.note-checklist-editor-remove-disabled {
  opacity: 0 !important;
  pointer-events: none;
}

.note-add-checklist-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  color: #047857;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 0.75rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.note-add-checklist-item svg {
  width: 1rem;
  height: 1rem;
}

.note-add-checklist-item:hover {
  background-color: rgba(16, 185, 129, 0.12);
}

html.dark .note-add-checklist-item {
  color: #34d399;
}

html.dark .note-add-checklist-item:hover {
  background-color: rgba(16, 185, 129, 0.2);
}

.note-inline-action {
  border: none;
  background: transparent;
  padding: 0.35rem 0.6rem;
  border-radius: 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  transition: all 0.2s ease;
}

.note-inline-action:hover {
  background-color: rgba(16, 185, 129, 0.12);
  color: #0f766e;
}

html.dark .note-inline-action {
  color: #cbd5f5;
}

html.dark .note-inline-action:hover {
  background-color: rgba(94, 234, 212, 0.16);
  color: #5eead4;
}

.note-body p {
  margin: 0.5rem 0;
}

.note-body p:first-child {
  margin-top: 0;
}

.note-body p:last-child {
  margin-bottom: 0;
}

.note-checklist {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem 0;
}

.note-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0;
  color: #475569;
}

html.dark .note-checklist li {
  color: #e2e8f0;
}

.note-checklist li .checkbox {
  position: relative;
  display: inline-flex;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.25rem;
  border: 1px solid #94a3b8;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

html.dark .note-checklist li .checkbox {
  border-color: #64748b;
}

.note-checklist li .checkbox::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #ffffff;
}

.note-checklist li.completed .checkbox {
  background-color: #10b981;
  border-color: #0f766e;
}

.note-checklist li.completed .checkbox::after {
  content: '\2713';
}

.note-checklist li.completed span:last-child {
  text-decoration: line-through;
  color: #6b7280;
}

html.dark .note-checklist li.completed span:last-child {
  color: #94a3b8;
}

.note-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.note-priority-high {
  background-color: #fee2e2;
  color: #b91c1c;
}

.note-priority-medium {
  background-color: #fef3c7;
  color: #b45309;
}

.note-priority-low {
  background-color: #dcfce7;
  color: #047857;
}

.note-status-open {
  background-color: #dbeafe;
  color: #0369a1;
}

.note-status-completed {
  background-color: #ede9fe;
  color: #5b21b6;
}

.note-pill-muted {
  background-color: #e2e8f0;
  color: #475569;
}

html.dark .note-priority-high {
  background-color: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

html.dark .note-priority-medium {
  background-color: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}

html.dark .note-priority-low {
  background-color: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
}

html.dark .note-status-open {
  background-color: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
}

html.dark .note-status-completed {
  background-color: rgba(196, 181, 253, 0.26);
  color: #ddd6fe;
}

html.dark .note-pill-muted {
  background-color: rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

.matter-notebook-panel {
  animation: slide-in-notebook 0.25s ease;
}

@keyframes slide-in-notebook {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
