/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * Application styles */

/* Import clean markdown styles FIRST - before our custom overrides */
@import url("/assets/clean-markdown-fe20a6c8.css");

/* Model Selector: Hide provider section when in Auto routing mode */
[data-routing-strategy="auto"] .provider-selection-section {
  display: none !important;
}

/* Model Selector: Show provider section when in Manual routing mode */
[data-routing-strategy="manual"] .provider-selection-section {
  display: block !important;
}

/* Fix paragraph spacing in AI messages */
.ai-message-content p {
  margin-bottom: 1rem;
}

.ai-message-content p:last-child {
  margin-bottom: 0;
}

.ai-message-content h1,
.ai-message-content h2,
.ai-message-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.ai-message-content h1:first-child,
.ai-message-content h2:first-child,
.ai-message-content h3:first-child {
  margin-top: 0;
}

/* Enhanced File Upload Styles */
.file-upload-zone {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.file-upload-zone::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, transparent, rgba(34, 197, 94, 0.1), transparent);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.file-upload-zone:hover::before {
  opacity: 1;
}

.file-upload-zone.drag-over {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
}

.file-upload-zone.drag-over::before {
  opacity: 1;
  background: linear-gradient(45deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
}

/* Note Section Enhancements */
.note-section {
  transition: all 0.3s ease;
}

.note-section:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.08);
}

.file-section {
  transition: all 0.3s ease;
}

.file-section:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.08);
}

/* Custom Scroll Animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-preview-enter {
  animation: slideIn 0.3s ease-out forwards;
}

/* Enhanced Textarea */
.enhanced-textarea {
  transition: all 0.2s ease;
  background: linear-gradient(to bottom, #ffffff, #fefefe);
}

.enhanced-textarea:focus {
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Button Hover Effects */
.btn-enhanced {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-enhanced:hover::before {
  left: 100%;
}

/* File Type Icons */
.file-type-icon {
  transition: all 0.2s ease;
}

.file-type-icon:hover {
  transform: scale(1.1);
}

/* Loading Animation */
.loading-spinner {
  animation: spin 1s linear infinite;
}

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

/* Custom File Input - Hide completely */
input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 0; /* This hides the "Choose File" text */
}

/* WebKit specific file button hiding */
input[type="file"]::-webkit-file-upload-button {
  visibility: hidden;
  display: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

/* Firefox specific file button hiding */
input[type="file"]::file-selector-button {
  visibility: hidden;
  display: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

/* Hide the "no file chosen" text */
input[type="file"] {
  color: transparent;
  background: transparent;
  border: none;
}

/* Thinking Modal Styles - Beautiful centered modal with backdrop blur */
.thinking-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.thinking-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.thinking-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 10px 25px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(203, 213, 225, 0.2);
}

.thinking-modal-overlay.active .thinking-modal {
  transform: scale(1) translateY(0);
}

.dark .thinking-modal {
  background: rgb(30, 41, 59);
  border-color: rgba(71, 85, 105, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Modal Header */
.thinking-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.2);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.6));
}

.dark .thinking-modal-header {
  border-bottom-color: rgba(71, 85, 105, 0.3);
  background: linear-gradient(135deg, rgba(51, 65, 85, 0.4), rgba(30, 41, 59, 0.8));
}

.thinking-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dark .thinking-modal-title {
  color: #f1f5f9;
}

.thinking-modal-title::before {
  content: '🧠';
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.thinking-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.thinking-modal-close:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #334155;
  transform: scale(1.05);
}

.dark .thinking-modal-close {
  background: rgba(100, 116, 139, 0.1);
  color: #94a3b8;
}

.dark .thinking-modal-close:hover {
  background: rgba(100, 116, 139, 0.2);
  color: #f1f5f9;
}

/* Modal Body */
.thinking-modal-body {
  padding: 1.5rem;
  max-height: calc(80vh - 120px);
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #475569;
  word-wrap: break-word;
  white-space: pre-wrap;
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0.3), transparent);
}

.dark .thinking-modal-body {
  color: #cbd5e1;
  background: linear-gradient(to bottom, rgba(51, 65, 85, 0.2), transparent);
}

/* Custom scrollbar for modal */
.thinking-modal-body::-webkit-scrollbar {
  width: 6px;
}

.thinking-modal-body::-webkit-scrollbar-track {
  background: rgba(203, 213, 225, 0.1);
  border-radius: 3px;
}

.thinking-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, rgba(147, 51, 234, 0.4), rgba(147, 51, 234, 0.6));
  border-radius: 3px;
}

.thinking-modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, rgba(147, 51, 234, 0.6), rgba(147, 51, 234, 0.8));
}

.dark .thinking-modal-body::-webkit-scrollbar-track {
  background: rgba(71, 85, 105, 0.1);
}

.dark .thinking-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, rgba(167, 139, 250, 0.4), rgba(167, 139, 250, 0.6));
}

.dark .thinking-modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, rgba(167, 139, 250, 0.6), rgba(167, 139, 250, 0.8));
}

/* Responsive modal */
@media (max-width: 768px) {
  .thinking-modal {
    max-width: 95vw;
    max-height: 90vh;
    margin: 0.5rem;
  }
  
  .thinking-modal-header {
    padding: 1rem;
  }
  
  .thinking-modal-body {
    padding: 1rem;
    font-size: 0.8125rem;
    max-height: calc(90vh - 100px);
  }
  
  .thinking-modal-title {
    font-size: 1rem;
  }
}

/* Code Modal Styles */
.code-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.code-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.code-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  width: 90vw;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(203, 213, 225, 0.2);
}

.code-modal-overlay.active .code-modal {
  transform: scale(1) translateY(0);
}

.dark .code-modal {
  background: rgb(15, 23, 42); /* slate-900 */
  border-color: rgba(71, 85, 105, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.code-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.2);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.6));
}

.dark .code-modal-header {
  border-bottom-color: rgba(71, 85, 105, 0.3);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.8));
}

.code-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dark .code-modal-title {
  color: #f1f5f9;
}

.code-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.code-modal-close:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #334155;
  transform: scale(1.05);
}

.dark .code-modal-close {
  background: rgba(100, 116, 139, 0.1);
  color: #94a3b8;
}

.dark .code-modal-close:hover {
  background: rgba(100, 116, 139, 0.2);
  color: #f1f5f9;
}

.code-modal-body {
  padding: 0;
  max-height: calc(90vh - 80px);
  overflow: auto;
}

.code-modal-body pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  max-width: none !important;
  height: 100%;
  padding: 2rem !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
}

/* Copy button in modal */
.code-modal-copy-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.code-modal-copy-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: #475569;
  transform: scale(1.05);
}

.dark .code-modal-copy-btn {
  background: rgba(248, 250, 252, 0.8);
  color: #1e293b;
  border-color: #cbd5e1;
}

.dark .code-modal-copy-btn:hover {
  background: rgba(248, 250, 252, 0.95);
  border-color: #94a3b8;
}

/* Wide AI message content - special handling for tables */
.ai-message-content {
  max-width: none !important;
  width: 100% !important;
}

/* When message contains tables, remove overflow constraints */
.ai-message-content.has-table {
  overflow-x: visible !important;
  overflow-y: visible !important;
}

/* Wider message containers */
.ai-message-container {
  max-width: 95% !important;
  width: 95% !important;
}

/* Special wide container for messages with tables */
.ai-message-container.has-table {
  max-width: 90vw !important;
  width: 90vw !important;
  overflow: visible !important;
}

/* Force code blocks to use full width */
.ai-message-content .code-block-container {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.ai-message-content .code-block-container pre {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Safe full-width code blocks - use larger percentage of available width */
.ai-message-content .code-block-container {
  width: calc(100% + 10rem) !important;
  margin-left: -5rem !important;
  margin-right: -5rem !important;
  position: relative !important;
  overflow-x: auto !important;
  box-sizing: border-box !important;
  max-width: none !important;
}

.ai-message-content .code-block-container pre {
  margin: 0 !important;
  padding: 1.5rem !important;
  background: #0f172a !important;
  border-radius: 0 !important;
  overflow-x: auto !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Force modal code blocks to also be full width */
.code-modal-body pre {
  width: 100% !important;
  margin: 0 !important;
  padding: 2rem !important;
  box-sizing: border-box !important;
  min-width: 100% !important;
}

/* Mobile-safe implementation */
@media (max-width: 768px) {
  .ai-message-content .code-block-container {
    width: calc(100% + 2rem) !important;
    margin-left: -1rem !important;
    margin-right: -1rem !important;
  }
}

/* Desktop wider code blocks */
@media (min-width: 769px) {
  .ai-message-content .code-block-container {
    width: calc(100% + 12rem) !important;
    margin-left: -6rem !important;
    margin-right: -6rem !important;
  }
}

/* Prism.js Base Styles - since we disabled the theme */
pre[class*="language-"], code[class*="language-"] {
  color: #f8f8f2 !important;
  background: none !important;
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;
  text-align: left !important;
  white-space: pre !important;
  word-spacing: normal !important;
  word-break: normal !important;
  word-wrap: normal !important;
  line-height: 1.5 !important;
  tab-size: 4 !important;
  hyphens: none !important;
}

/* ULTRA MAXIMUM SPECIFICITY - Force Prism.js token colors to override everything */

/* Keywords (def, function, if, for, etc.) - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.keyword,
html body .markdown-body .code-block-container pre code .token.keyword,
html body .ai-message-content pre code .token.keyword,
html body .code-block-container pre code .token.keyword,
html body pre code .token.keyword,
html body code .token.keyword,
html body .token.keyword {
  color: #c084fc !important; /* purple-400 - brighter purple for dark backgrounds */
  font-weight: bold !important;
}

/* Strings - ULTRA MAXIMUM SPECIFICITY */  
html body .ai-message-content.markdown-body .code-block-container pre code .token.string,
html body .markdown-body .code-block-container pre code .token.string,
html body .ai-message-content pre code .token.string,
html body .code-block-container pre code .token.string,
html body pre code .token.string,
html body code .token.string,
html body .token.string {
  color: #34d399 !important; /* emerald-400 - bright green for strings */
}

/* Numbers - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.number,
html body .markdown-body .code-block-container pre code .token.number,
html body .ai-message-content pre code .token.number,
html body .code-block-container pre code .token.number,
html body pre code .token.number,
html body code .token.number,
html body .token.number {
  color: #fbbf24 !important; /* amber-400 - bright orange for numbers */
}

/* Functions - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.function,
html body .markdown-body .code-block-container pre code .token.function,
html body .ai-message-content pre code .token.function,
html body .code-block-container pre code .token.function,
html body pre code .token.function,
html body code .token.function,
html body .token.function {
  color: #60a5fa !important; /* blue-400 - bright blue for functions */
  font-weight: bold !important;
}

/* Comments - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.comment,
html body .markdown-body .code-block-container pre code .token.comment,
html body .ai-message-content pre code .token.comment,
html body .code-block-container pre code .token.comment,
html body pre code .token.comment,
html body code .token.comment,
html body .token.comment {
  color: #9ca3af !important; /* gray-400 - muted for comments */
  font-style: italic !important;
}

/* Operators - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.operator,
html body .markdown-body .code-block-container pre code .token.operator,
html body .ai-message-content pre code .token.operator,
html body .code-block-container pre code .token.operator,
html body pre code .token.operator,
html body code .token.operator,
html body .token.operator {
  color: #f472b6 !important; /* pink-400 - bright pink for operators */
}

/* Punctuation - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.punctuation,
html body .markdown-body .code-block-container pre code .token.punctuation,
html body .ai-message-content pre code .token.punctuation,
html body .code-block-container pre code .token.punctuation,
html body pre code .token.punctuation,
html body code .token.punctuation,
html body .token.punctuation {
  color: #cbd5e1 !important; /* slate-300 - light for punctuation */
}

/* Variables and properties - ULTRA MAXIMUM SPECIFICITY */
html body .ai-message-content.markdown-body .code-block-container pre code .token.property,
html body .markdown-body .code-block-container pre code .token.property,
html body .ai-message-content pre code .token.property,
html body .code-block-container pre code .token.property,
html body pre code .token.property,
html body code .token.property,
html body .token.property {
  color: #22d3ee !important; /* cyan-400 - bright cyan for properties */
}

/* LIGHT MODE SYNTAX COLORS - Better contrast for light backgrounds */
html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.keyword,
html:not(.dark) body .markdown-body .code-block-container pre code .token.keyword,
html:not(.dark) body .ai-message-content pre code .token.keyword,
html:not(.dark) body .code-block-container pre code .token.keyword,
html:not(.dark) body pre code .token.keyword,
html:not(.dark) body code .token.keyword,
html:not(.dark) body .token.keyword {
  color: #7c3aed !important; /* purple-600 - darker purple for light backgrounds */
  font-weight: bold !important;
}

html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.string,
html:not(.dark) body .markdown-body .code-block-container pre code .token.string,
html:not(.dark) body .ai-message-content pre code .token.string,
html:not(.dark) body .code-block-container pre code .token.string,
html:not(.dark) body pre code .token.string,
html:not(.dark) body code .token.string,
html:not(.dark) body .token.string {
  color: #059669 !important; /* emerald-600 - darker green for strings */
}

html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.number,
html:not(.dark) body .markdown-body .code-block-container pre code .token.number,
html:not(.dark) body .ai-message-content pre code .token.number,
html:not(.dark) body .code-block-container pre code .token.number,
html:not(.dark) body pre code .token.number,
html:not(.dark) body code .token.number,
html:not(.dark) body .token.number {
  color: #d97706 !important; /* amber-600 - darker orange for numbers */
}

html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.function,
html:not(.dark) body .markdown-body .code-block-container pre code .token.function,
html:not(.dark) body .ai-message-content pre code .token.function,
html:not(.dark) body .code-block-container pre code .token.function,
html:not(.dark) body pre code .token.function,
html:not(.dark) body code .token.function,
html:not(.dark) body .token.function {
  color: #2563eb !important; /* blue-600 - darker blue for functions */
  font-weight: bold !important;
}

html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.comment,
html:not(.dark) body .markdown-body .code-block-container pre code .token.comment,
html:not(.dark) body .ai-message-content pre code .token.comment,
html:not(.dark) body .code-block-container pre code .token.comment,
html:not(.dark) body pre code .token.comment,
html:not(.dark) body code .token.comment,
html:not(.dark) body .token.comment {
  color: #6b7280 !important; /* gray-500 - darker gray for comments */
  font-style: italic !important;
}

html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.operator,
html:not(.dark) body .markdown-body .code-block-container pre code .token.operator,
html:not(.dark) body .ai-message-content pre code .token.operator,
html:not(.dark) body .code-block-container pre code .token.operator,
html:not(.dark) body pre code .token.operator,
html:not(.dark) body code .token.operator,
html:not(.dark) body .token.operator {
  color: #db2777 !important; /* pink-600 - darker pink for operators */
}

html:not(.dark) body .ai-message-content.markdown-body .code-block-container pre code .token.punctuation,
html:not(.dark) body .markdown-body .code-block-container pre code .token.punctuation,
html:not(.dark) body .ai-message-content pre code .token.punctuation,
html:not(.dark) body .code-block-container pre code .token.punctuation,
html:not(.dark) body pre code .token.punctuation,
html:not(.dark) body code .token.punctuation,
html:not(.dark) body .token.punctuation {
  color: #475569 !important; /* slate-600 - darker for punctuation */
}

/* MAXIMUM SPECIFICITY CODE BLOCK OVERRIDES - These must come AFTER clean-markdown.css import */

/* Container level overrides with maximum specificity */
.ai-message-content.markdown-body .code-block-container,
.markdown-body .code-block-container,
.code-block-container {
  position: relative !important;
  margin: 1rem 0 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 1 !important;
  width: 95% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

/* Pre element overrides with maximum specificity */
.ai-message-content.markdown-body .code-block-container pre,
.markdown-body .code-block-container pre,
.ai-message-content .code-block-container pre,
.code-block-container pre,
pre {
  background: #0f172a !important; /* slate-900 */
  color: #f1f5f9 !important; /* slate-100 - high contrast white */
  padding: 1.5rem !important;
  border-radius: 0.5rem !important;
  overflow-x: auto !important;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  white-space: pre !important;
  word-wrap: break-word !important;
  user-select: text !important;
  pointer-events: auto !important;
}

/* Code element overrides with maximum specificity */
.ai-message-content.markdown-body .code-block-container pre code,
.markdown-body .code-block-container pre code,
.ai-message-content .code-block-container pre code,
.code-block-container pre code,
.ai-message-content pre code,
pre code {
  background: transparent !important;
  color: #f1f5f9 !important; /* force white text */
  padding: 0 !important;
  font-size: inherit !important;
  font-family: inherit !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  white-space: inherit !important;
  user-select: text !important;
  pointer-events: auto !important;
}

.code-block-expand-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.code-block-expand-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: #475569;
  transform: scale(1.05);
}

.dark .code-block-expand-btn {
  background: rgba(248, 250, 252, 0.8);
  color: #1e293b;
  border-color: #cbd5e1;
}

.dark .code-block-expand-btn:hover {
  background: rgba(248, 250, 252, 0.95);
  border-color: #94a3b8;
}

/* Ensure syntax highlighting works in both light and dark modes */
pre[class*="language-"] {
  background: inherit !important;
  color: inherit !important;
}

code[class*="language-"] {
  background: inherit !important;
  color: inherit !important;
}

/* TABLE LAYOUT - Override clean-markdown completely */
html body .ai-message-content.markdown-body .table-wrapper,
html body .markdown-body .table-wrapper,
html body .ai-message-content .table-wrapper,
html body .table-wrapper {
  width: auto !important;
  max-width: none !important;
  margin: 1rem 0 !important;
  overflow-x: auto !important;
  position: relative !important;
  border-radius: 0.5rem !important;
  background: rgba(0,0,0,0.02) !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
  box-sizing: border-box !important;
  display: inline-block !important;
}

.dark .table-wrapper {
  background: rgba(255,255,255,0.05) !important;
  border-color: rgba(255,255,255,0.1) !important;
}

/* ULTRA HIGH SPECIFICITY - Override clean-markdown.css table width */
html body .ai-message-content.markdown-body .table-wrapper table,
html body .markdown-body .table-wrapper table,
html body .ai-message-content .table-wrapper table,
html body .table-wrapper table {
  width: auto !important;
  max-width: none !important;
  min-width: 50% !important;
  box-sizing: border-box !important;
  table-layout: auto !important;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9375em;
}

/* Table cell styles */
.ai-message-content .table-wrapper table th,
.ai-message-content .table-wrapper table td {
  padding: 0.75rem 1.25rem;
  border: 1px solid rgba(0,0,0,0.08);
  vertical-align: top;
  text-align: left;
  line-height: 1.5;
  white-space: normal;
  word-wrap: break-word;
}

.dark .ai-message-content .table-wrapper table th,
.dark .ai-message-content .table-wrapper table td {
  border-color: rgba(255,255,255,0.1);
}

.ai-message-content .table-wrapper table th {
  background: rgba(0,0,0,0.03);
  font-weight: 600;
  color: #1e293b;
}

.dark .ai-message-content .table-wrapper table th {
  background: rgba(255,255,255,0.08);
  color: #f8fafc;
}

/* Better column distribution for wider tables */
/* Remove fixed column widths - let content determine width naturally */

/* Table expand button */
.table-expand-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
  opacity: 0;
}

.table-wrapper:hover .table-expand-btn {
  opacity: 1;
}

.table-expand-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: #475569;
  transform: scale(1.05);
}

.dark .table-expand-btn {
  background: rgba(248, 250, 252, 0.8);
  color: #1e293b;
  border-color: #cbd5e1;
}

.dark .table-expand-btn:hover {
  background: rgba(248, 250, 252, 0.95);
  border-color: #94a3b8;
}

/* Table Modal Styles */
.table-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.table-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  width: 95vw;
  max-width: 1400px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(203, 213, 225, 0.2);
}

.table-modal-overlay.active .table-modal {
  transform: scale(1) translateY(0);
}

.dark .table-modal {
  background: rgb(15, 23, 42);
  border-color: rgba(71, 85, 105, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.table-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.2);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.6));
}

.dark .table-modal-header {
  border-bottom-color: rgba(71, 85, 105, 0.3);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.8));
}

.table-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dark .table-modal-title {
  color: #f1f5f9;
}

.table-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.table-modal-close:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #334155;
  transform: scale(1.05);
}

.dark .table-modal-close {
  background: rgba(100, 116, 139, 0.1);
  color: #94a3b8;
}

.dark .table-modal-close:hover {
  background: rgba(100, 116, 139, 0.2);
  color: #f1f5f9;
}

.table-modal-body {
  padding: 0;
  max-height: calc(90vh - 80px);
  overflow: auto;
}

.table-modal-table-wrapper {
  padding: 1.5rem;
  overflow-x: auto;
}

.table-modal-table-wrapper table {
  margin: 0 !important;
  border-radius: 0 !important;
  width: 100% !important;
  min-width: auto !important;
  table-layout: auto !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .ai-message-content .table-wrapper {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    border-radius: 0.375rem;
  }
  
  .ai-message-content .table-wrapper table {
    min-width: 100%;
  }
  
  .ai-message-content .table-wrapper table th,
  .ai-message-content .table-wrapper table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875em;
  }
  
  .table-modal {
    width: 98vw;
    max-height: 95vh;
    margin: 1rem;
  }
  
  .table-modal-header {
    padding: 1rem;
  }
  
  .table-modal-table-wrapper {
    padding: 1rem;
  }
}

/* Desktop adjustments */
@media (min-width: 769px) {
  .ai-message-content .table-wrapper {
    width: 100% !important;
    margin: 1rem 0 !important;
  }
  
  .ai-message-content .table-wrapper table {
    width: 100%;
    min-width: 600px;
  }
}

/* Remove column width overrides - let content determine width naturally */

/* CRITICAL: Override clean-markdown.css code block styles with maximum specificity */

/* Fix code block visibility issues - force dark theme and proper display */
.ai-message-content .code-block-container pre,
.ai-message-content .markdown-body pre,
.code-block-container pre,
.markdown-body pre {
  background: #0f172a !important; /* Force slate-900 background */
  color: #f1f5f9 !important; /* Force slate-100 text */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  overflow-x: auto !important;
  padding: 1.5rem !important;
  border-radius: 0.5rem !important;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace !important;
}

/* Fix code element visibility within pre blocks */
.ai-message-content .code-block-container pre code,
.ai-message-content .markdown-body pre code,
.code-block-container pre code,
.markdown-body pre code {
  background: transparent !important;
  color: #f1f5f9 !important; /* Force white text */
  padding: 0 !important;
  font-size: inherit !important;
  font-family: inherit !important;
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
  user-select: text !important;
  pointer-events: auto !important;
}

/* Ensure container visibility */
.ai-message-content .code-block-container,
.code-block-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  margin: 1rem 0 !important;
}

/* ========================================
   Activity Indicator Animations
   ========================================*/

/* Base activity indicator styles */
.activity-indicator {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 0 0 rgba(var(--indicator-color), 0);
}

/* Pulse animation for processing state */
@keyframes pulse-active {
  0% { 
    opacity: 1; 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  50% { 
    opacity: 0.6; 
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
  }
  100% { 
    opacity: 1; 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.animate-pulse-active {
  animation: pulse-active 1.5s ease-in-out infinite;
}

/* Breathing animation for background tasks */
@keyframes breathe {
  0%, 100% { 
    opacity: 0.8; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1);
  }
}

.animate-breathe {
  animation: breathe 2s ease-in-out infinite;
}

/* Shake animation for error state */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.animate-shake {
  animation: shake 0.5s ease-in-out infinite;
}

/* Fade out animation for completed state */
@keyframes fade-out {
  0% { 
    opacity: 1; 
    transform: scale(1.1);
  }
  50% { 
    opacity: 0.7; 
    transform: scale(1.2);
  }
  100% { 
    opacity: 0.4; 
    transform: scale(1);
  }
}

.animate-fade-out {
  animation: fade-out 2s ease-out forwards;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .activity-indicator {
    animation: none !important;
  }
  
  .animate-pulse-active {
    animation: none;
    opacity: 0.8;
  }
  
  .animate-breathe {
    animation: none;
    opacity: 0.9;
  }
  
  .animate-shake {
    animation: none;
  }
  
  .animate-fade-out {
    animation: none;
    opacity: 0.6;
  }
}

/* Authentication Form Styles - Password Manager Compatibility */
@keyframes autofill {
  to {
    color: #000;
    background: transparent;
  }
}

/* Autofill detection for Chrome/Safari/Edge */
input:-webkit-autofill {
  animation-duration: 50ms;
  animation-name: autofill;
  animation-fill-mode: both;
}

/* Dark mode autofill styling */
[data-theme="dark"] input:-webkit-autofill,
.dark input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #1e293b inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  color: #f8fafc !important;
}

/* Light mode autofill styling */
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1e293b !important;
  color: #1e293b !important;
}

/* Auth form states */
.auth-form-ready {
  transition: opacity 0.2s ease;
}

.form-valid {
  /* Subtle success indication */
}

.form-invalid {
  /* Subtle error indication - let browser handle validation display */
}

/* 2FA specific styles */
input[autocomplete="one-time-code"] {
  /* Ensure proper spacing and appearance for TOTP codes */
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}

/* Password manager compatibility hints */
.password-manager-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.dark .password-manager-hint {
  color: #94a3b8;
}

/* ========================================
   Conversation Multi-Select Styles
   ========================================*/

/* Selected conversation styling */
.conversation-item.selected {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08)) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
  position: relative;
  transform: translateX(2px);
  transition: all 0.2s ease;
}

/* Dark mode selected conversation styling */
.dark .conversation-item.selected {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.15)) !important;
  border-color: rgba(139, 92, 246, 0.4) !important;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

/* Selected conversation left border indicator */
.conversation-item.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, #6366f1, #8b5cf6);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* Enhanced hover effect for multi-select mode */
.batch-actions:not(.hidden) ~ * .conversation-item:hover {
  background: rgba(99, 102, 241, 0.04) !important;
  border-color: rgba(99, 102, 241, 0.15) !important;
  cursor: pointer;
}

.dark .batch-actions:not(.hidden) ~ * .conversation-item:hover {
  background: rgba(139, 92, 246, 0.08) !important;
  border-color: rgba(139, 92, 246, 0.25) !important;
}

/* Hide checkboxes by default, show only when selections exist */
.conversation-item input[type="checkbox"] {
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* Show checkboxes when conversation is selected or when batch actions are visible */
.conversation-item.selected input[type="checkbox"],
.batch-actions:not(.hidden) ~ * .conversation-item input[type="checkbox"] {
  opacity: 0.7;
  pointer-events: auto;
}

.conversation-item:hover input[type="checkbox"] {
  opacity: 1;
}

.conversation-item.selected input[type="checkbox"] {
  opacity: 1 !important;
}

/* Checkbox styling enhancement */
.conversation-item input[type="checkbox"] {
  transition: all 0.2s ease;
  border-color: #d1d5db;
}

.dark .conversation-item input[type="checkbox"] {
  border-color: #4b5563;
}

.conversation-item input[type="checkbox"]:checked {
  background-color: #6366f1;
  border-color: #6366f1;
}

.dark .conversation-item input[type="checkbox"]:checked {
  background-color: #8b5cf6;
  border-color: #8b5cf6;
}

/* Checkbox hover effect */
.conversation-item:hover input[type="checkbox"] {
  opacity: 1 !important;
  transform: scale(1.05);
}

/* Batch actions header styling */
.batch-actions {
  backdrop-filter: blur(8px);
  border: 1px solid;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideDown 0.3s ease-out;
}

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

/* Batch action buttons */
.batch-actions button {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.batch-actions button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.batch-actions button:hover::before {
  left: 100%;
}

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

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

/* Select all checkbox styling */
.batch-actions input[type="checkbox"] {
  transition: all 0.2s ease;
}

.batch-actions input[type="checkbox"]:indeterminate {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: #6366f1;
}

.dark .batch-actions input[type="checkbox"]:indeterminate {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border-color: #8b5cf6;
}

/* Selection count animation */
.batch-actions [data-conversation-multi-select-target="selectedCount"] {
  transition: all 0.3s ease;
  font-weight: 600;
}

/* Hover effect for conversation items in multi-select mode */
.multi-select-mode .conversation-item:hover {
  background: rgba(99, 102, 241, 0.05) !important;
}

.dark .multi-select-mode .conversation-item:hover {
  background: rgba(139, 92, 246, 0.1) !important;
}

/* Accessibility focus styles */
.conversation-item.selected:focus-within {
  outline: 2px solid #6366f1;
  outline-offset: -2px;
}

.dark .conversation-item.selected:focus-within {
  outline-color: #8b5cf6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .batch-actions {
    padding: 0.75rem 1rem;
  }
  
  .batch-actions .flex {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .batch-actions button {
    width: 100%;
    justify-content: center;
  }
  
  .conversation-item.selected::before {
    width: 2px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .conversation-item.selected {
    border-width: 2px;
    border-style: solid;
  }
  
  .conversation-item.selected::before {
    width: 4px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .batch-actions,
  .batch-actions button,
  .conversation-item input[type="checkbox"] {
    transition: none;
    animation: none;
  }

  .batch-actions button:hover {
    transform: none;
  }
}

/* ============================================
   Dashboard Stats Cards - Prevent Flash
   ============================================ */

/* Pre-render stat card backgrounds to prevent flash on load */
.stat-gradient-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
}

.stat-gradient-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.stat-gradient-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

.stat-gradient-violet {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
}

/* ============================================
   Smooth Page Transitions (Turbo Drive)
   ============================================ */

/* Turbo progress bar styling */
.turbo-progress-bar {
  height: 3px;
  background: linear-gradient(to right, #4f46e5, #7c3aed, #ec4899);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

/* Smooth fade transition for page navigation */
html.turbo-loading {
  cursor: wait;
}

/* Add smooth transition to body content */
body {
  transition: opacity 0.15s ease-in-out;
}

/* Optional: Fade out effect on navigation (can be disabled if too subtle) */
html.turbo-before-visit body {
  opacity: 0.98;
}

/* Prevent layout shift by maintaining scroll position */
html {
  scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body {
    transition: none;
  }

  html.turbo-before-visit body {
    opacity: 1;
  }
}

/* ============================================
   Notes Image Constraints
   ============================================ */

/* Constrain images in prose/markdown content to prevent UI breaking */
.prose img,
.prose-lg img,
.markdown-body img {
  max-width: 100% !important;
  max-height: 600px !important;
  height: auto !important;
  object-fit: contain !important;
}

/* ============================================
   Mobile-Optimized UI Components
   ============================================ */

/* Mobile icon button - larger touch targets (44x44 minimum) */
.mobile-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 0.5rem;
  color: #64748b;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-icon-btn:hover,
.mobile-icon-btn:active {
  background-color: rgba(0, 0, 0, 0.05);
  color: #475569;
}

.dark .mobile-icon-btn {
  color: #94a3b8;
}

.dark .mobile-icon-btn:hover,
.dark .mobile-icon-btn:active {
  background-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

/* Mobile primary button - compact but still touch-friendly */
.mobile-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-primary-btn:hover,
.mobile-primary-btn:active {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.mobile-primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

/* Mobile form inputs - larger touch targets */
.form-input-mobile {
  min-height: 48px;
  font-size: 16px !important; /* Prevents iOS zoom on focus */
}

/* Mobile button small variant */
.btn-mobile-sm {
  min-height: 40px;
  padding: 0.5rem 1rem;
}

/* Ensure proper spacing on mobile chat pages */
@media (max-width: 640px) {
  .mobile-header-spacing {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .mobile-chat-header-bg {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .dark .mobile-chat-header-bg {
    background: rgba(15, 23, 42, 0.95);
  }

  .mobile-chat-area-spacing {
    padding-bottom: 1rem;
  }

  .mobile-chat-unified-bg {
    background: white;
    border-radius: 0.75rem;
  }

  .dark .mobile-chat-unified-bg {
    background: rgb(30, 41, 59);
  }

  /* Improve touch targets for conversation list items */
  .conversation-item {
    min-height: 56px;
    padding: 0.75rem;
  }

  /* Larger tap targets for action buttons in messages */
  .message-action-btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* Better spacing for model selector on mobile */
  .model-selector-container {
    padding: 0.5rem 0;
  }

  /* Improve search input on mobile */
  .conversation-search-input {
    min-height: 44px;
    font-size: 16px;
  }
}

/* Safe area handling for notched devices */
@supports (padding: max(0px)) {
  .safe-area-inset {
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }

  .safe-area-inset-top {
    padding-top: max(0.5rem, env(safe-area-inset-top));
  }

  .safe-area-inset-bottom {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }
}

/* Smooth scrolling for mobile */
.custom-scrollbar {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Mobile navigation link styles */
.mobile-nav-link-enhanced {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: #475569;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  min-height: 48px;
}

.mobile-nav-link-enhanced:hover,
.mobile-nav-link-enhanced:active {
  background-color: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.mobile-nav-link-enhanced.active {
  background-color: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
  font-weight: 600;
}

.dark .mobile-nav-link-enhanced {
  color: #cbd5e1;
}

.dark .mobile-nav-link-enhanced:hover,
.dark .mobile-nav-link-enhanced:active {
  background-color: rgba(129, 140, 248, 0.15);
  color: #a5b4fc;
}

.dark .mobile-nav-link-enhanced.active {
  background-color: rgba(129, 140, 248, 0.2);
  color: #a5b4fc;
}

/* Mobile text input optimizations */
@media (max-width: 640px) {
  textarea,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"] {
    font-size: 16px !important; /* Prevent iOS zoom */
  }

  /* Ensure buttons have proper touch target sizes */
  button,
  [role="button"],
  a.btn {
    min-height: 44px;
  }

  /* Improve spacing in chat messages on mobile */
  .ai-message-content {
    max-width: 95% !important;
  }

  /* Reduce message bubble padding on mobile */
  .message-bubble {
    padding: 0.75rem 1rem;
  }
}

/* ============================================
   ChatGPT/Claude Style Mobile Chat Input
   ============================================ */

.mobile-chat-input {
  font-size: 16px !important;
  line-height: 1.5;
  transition: height 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
}

.mobile-chat-input:focus {
  outline: none;
}

/* Custom toggle switch styling */
.peer:checked ~ div > div {
  transform: translateX(1rem);
}

/* Model dropdown on mobile - full screen modal */
@media (max-width: 640px) {
  .model-dropdown-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 100 !important;
    background: white;
    border-radius: 0 !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .dark .model-dropdown-panel {
    background: rgb(15, 23, 42);
  }

  /* Improve model item touch targets on mobile */
  .model-item {
    min-height: 56px;
    padding: 12px 16px;
  }

  /* Hide provider section on mobile for cleaner look */
  .provider-selection-section {
    display: none;
  }
}

/* Smooth backdrop blur for mobile header */
@supports (backdrop-filter: blur(12px)) {
  .backdrop-blur-lg {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* Send button animation */
.mobile-chat-input + .absolute button {
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.mobile-chat-input + .absolute button:active {
  transform: scale(0.95);
}

/* Dropdown menu animation */
[data-dropdown-target="menu"] {
  transform-origin: top right;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

[data-dropdown-target="menu"]:not(.hidden) {
  animation: dropdown-appear 0.15s ease;
}

@keyframes dropdown-appear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Compact model selector on mobile */
@media (max-width: 640px) {
  .mobile-model-selector .model-combobox-button {
    padding: 8px 12px;
    min-height: 44px;
    border-radius: 12px;
    background: rgba(100, 116, 139, 0.1);
  }

  .dark .mobile-model-selector .model-combobox-button {
    background: rgba(100, 116, 139, 0.2);
  }

  .mobile-model-selector .model-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .mobile-model-selector .model-display-name {
    font-size: 14px;
    font-weight: 500;
  }

  .mobile-model-selector .model-display-meta {
    font-size: 11px;
    opacity: 0.7;
  }

  /* Hide label on mobile */
  .mobile-model-selector label.block {
    display: none;
  }

  /* Make badges smaller */
  .mobile-model-selector .model-free-badge,
  .mobile-model-selector .capability-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  /* Hide chevron icon badges row on mobile for cleaner look */
  .mobile-model-selector .model-chevron {
    width: 20px;
    height: 20px;
  }
}

