@import "/responsive-tables.css";

/* Performance utility: avoid rendering offscreen cards */
.cv-auto {
  content-visibility: auto;
  contain-intrinsic-size: 160px 120px;
}

/* Message highlight animation for search results */
@keyframes highlightFade {
  0% {
    background-color: rgba(255, 230, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

.highlight-message {
  animation: highlightFade 3s ease-out;
  border-radius: 8px;
  position: relative;
}

.highlight-message::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  height: 100%;
  width: 4px;
  background-color: #ffc107;
  border-radius: 4px;
}

/* Agent progress bar animation */
@keyframes progress {
  0% {
    width: 0%;
    left: 0;
  }
  50% {
    width: 100%;
    left: 0;
  }
  100% {
    width: 0%;
    left: 100%;
  }
}

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

/* Feedback modal blur effect */
.blur-app {
  filter: blur(3px);
  transition: filter 0.2s ease-in-out;
}

/* Loading message transition styles */
.fade-transition {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.loading-message {
  min-height: 48px; /* Maintain consistent height */
  display: flex;
  align-items: center;
  opacity: 0.9;
}

.loading-message.fade-transition {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0.5;
    transform: translateY(-5px);
  }
  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

.research-enhanced .prose.inline-editor .is-empty {
  display: none;
}

.research-enhanced .prose.inline-editor .is-empty.placeholder {
  display: block;
  opacity: 0.65;
  font-size: 14px;
}

/* Gradient border for hr elements */
.border-gradient {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)/0.5), transparent);
  margin: 2rem 0;
  transform-origin: left;
}

.research-agent-message {
  background: linear-gradient(135deg, hsl(var(--accent)/0.1) 0%, hsl(var(--muted)/0.2) 100%);
  border: 1px solid hsl(var(--border)/0.4);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.research-agent-message::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, hsl(var(--primary)) 0%, hsl(var(--accent)) 100%);
  border-radius: 0 2px 2px 0;
}

/* Tool call section enhancements */
.research-enhanced section {
  background: linear-gradient(135deg, hsl(var(--background)/0.8) 0%, hsl(var(--muted)/0.1) 100%);
  border: 1px solid hsl(var(--border)/0.3);
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 1rem 0;
  position: relative;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.research-enhanced section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)/0.2), transparent);
}

/* Enhanced divider styling */
.research-divider-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 3rem 0;
  position: relative;
}

.research-enhanced-divider {
  border: none;
  height: 1px;
  width: 80%;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)/0.6), transparent);
  margin: 2rem 0;
  position: relative;
}

.research-enhanced-divider::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 5px;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)/0.3), transparent);
  border-radius: 2px;
}

.divider-ornament {
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--accent)) 100%);
  border-radius: 50%;
  border: 2px solid hsl(var(--background));
  box-shadow: 
    0 0 0 1px hsl(var(--border)),
    0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
}

.divider-ornament::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: hsl(var(--background));
  border-radius: 50%;
}

.research-enhanced .close-button:hover {
  background: hsl(var(--destructive)/0.1);
  border-color: hsl(var(--destructive));
  transform: scale(1.05);
  box-shadow: 0 4px 12px hsl(var(--destructive)/0.2);
}

/* Enhanced code block styling for research content */
.research-enhanced .prose pre {
  background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 100%);
  border-radius: 0.75rem;
  color: #fff;
  font-family: "JetBrainsMono", monospace;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid hsl(var(--border));
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.research-enhanced .prose pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.research-enhanced .prose pre code {
  background: none;
  color: inherit;
  font-size: 0.875rem;
  padding: 0;
  line-height: 1.6;
}

.research-enhanced .prose code:not(pre code) {
  background: linear-gradient(135deg, hsl(var(--muted)) 0%, hsl(var(--accent)) 100%);
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875em;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Enhanced syntax highlighting for dark mode */
.dark .research-enhanced .prose pre {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  border: 1px solid hsl(var(--border));
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Enhanced paragraph and heading spacing */
.research-enhanced .prose p {
  margin-bottom: 1.25rem;
  line-height: 1.75;
  color: hsl(var(--foreground)/0.9);
}

.research-enhanced .prose h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
  color: hsl(var(--foreground));
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary)/0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.research-enhanced .prose h2 {
  font-size: 1.625rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  color: hsl(var(--foreground));
  position: relative;
}

.research-enhanced .prose h2::after {
  content: '';
  position: absolute;
  bottom: -0.25rem;
  left: 0;
  width: 3rem;
  height: 2px;
  background: linear-gradient(90deg, hsl(var(--primary)) 0%, transparent 100%);
  border-radius: 1px;
}

.research-enhanced .prose h3 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.875rem;
  line-height: 1.4;
  color: hsl(var(--foreground));
}

/* Enhanced list styling with beautiful bullets */
.research-enhanced .prose ul {
  margin: 1.5rem 0;
  padding-left: 1.75rem;
}

/* ---> Canvas Slides lists: ensure bullets/numbers render in sanitized slide content */
.reveal-slide-preview ul,
.reveal-slide-content ul,
.canvas-slide ul {
  list-style-type: disc !important;
  padding-left: 1.25rem;
}
.reveal-slide-preview ol,
.reveal-slide-content ol,
.canvas-slide ol {
  list-style-type: decimal !important;
  padding-left: 1.25rem;
}
.reveal-slide-preview li,
.reveal-slide-content li,
.canvas-slide li {
  margin: 0.25rem 0;
}

.research-enhanced .prose li {
  margin: 0.75rem 0;
  line-height: 1.7;
  position: relative;
}

.research-enhanced .prose ul > li::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 0.75em;
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--accent)) 100%);
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.research-enhanced .prose ol {
  margin: 1.5rem 0;
  padding-left: 1.75rem;
}

.research-enhanced .prose ol > li {
  counter-increment: list-counter;
}

.research-enhanced .prose ol > li::before {
  content: counter(list-counter);
  position: absolute;
  left: -1.5rem;
  top: 0;
  width: 1.25rem;
  height: 1.25rem;
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--accent)) 100%);
  color: hsl(var(--primary-foreground));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Enhanced task list styling */
.research-enhanced .prose ul[data-type="taskList"] li > label {
  margin-right: 0.75rem;
  user-select: none;
  display: flex;
  align-items: center;
}

.research-enhanced .prose ul[data-type="taskList"] li > label input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(135deg, hsl(var(--background)) 0%, hsl(var(--muted)) 100%);
  margin: 0;
  cursor: pointer;
  width: 1.25em;
  height: 1.25em;
  position: relative;
  border: 2px solid hsl(var(--border));
  margin-right: 0.75rem;
  display: grid;
  place-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.research-enhanced .prose ul[data-type="taskList"] li > label input[type="checkbox"]:hover {
  background: linear-gradient(135deg, hsl(var(--accent)) 0%, hsl(var(--muted)) 100%);
  border-color: hsl(var(--primary));
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.research-enhanced .prose ul[data-type="taskList"] li > label input[type="checkbox"]::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  transform: scale(0);
  transition: 150ms transform cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary)/0.8) 100%);
  transform-origin: center;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.research-enhanced .prose ul[data-type="taskList"] li > label input[type="checkbox"]:checked {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary)/0.8) 100%);
  border-color: hsl(var(--primary));
}

.research-enhanced .prose ul[data-type="taskList"] li > label input[type="checkbox"]:checked::before {
  transform: scale(1);
  background: hsl(var(--primary-foreground));
}

.research-enhanced .prose ul[data-type="taskList"] li[data-checked="true"] > div > p {
  color: hsl(var(--muted-foreground));
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  opacity: 0.7;
}

/* Enhanced blockquote styling */
.research-enhanced .prose blockquote {
  border-left: 4px solid hsl(var(--primary));
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  background: linear-gradient(135deg, hsl(var(--muted)/0.3) 0%, hsl(var(--accent)/0.2) 100%);
  padding: 1.5rem 1.5rem 1.5rem 2rem;
  border-radius: 0 0.75rem 0.75rem 0;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.research-enhanced .prose blockquote::before {
  content: '"';
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 3rem;
  color: hsl(var(--primary)/0.3);
  font-family: serif;
  line-height: 1;
}

/* Enhanced table styling */
.research-enhanced .prose table {
  border-collapse: collapse;
  margin: 2rem 0;
  width: auto; /* Changed from 100% to auto to allow natural table width */
  min-width: 100%; /* Ensure minimum width but allow expansion */
  display: table; /* Changed from block to table for proper table behavior */
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  background: hsl(var(--background));
}

/* Table wrapper for horizontal scroll */
.research-enhanced .prose table {
  /* Remove the table-specific display block, we'll handle it with a wrapper */
}

/* Create a scrollable wrapper for tables */
.prose table,
.research-enhanced .prose table {
  border-collapse: collapse;
  width: auto;
  min-width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  background: hsl(var(--background));
}

.research-enhanced .prose th {
  background: linear-gradient(135deg, hsl(var(--muted)) 0%, hsl(var(--accent)) 100%);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid hsl(var(--border));
  color: hsl(var(--foreground));
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.research-enhanced .prose td {
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  transition: background-color 0.15s ease;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 300px; /* Set a reasonable max width for better readability */
}

.research-enhanced .prose tr:hover td {
  background: hsl(var(--muted)/0.3);
}

.research-enhanced .prose tr:last-child td {
  border-bottom: none;
}

/* Enhanced link styling */
.research-enhanced .prose a {
  color: hsl(var(--primary));
  text-decoration: none;
  background: linear-gradient(0deg, hsl(var(--primary)/0.2) 0%, transparent 50%);
  background-size: 100% 200%;
  background-position: 0% 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.125rem 0.25rem;
  margin: 0 -0.25rem;
  border-radius: 0.25rem;
}

.research-enhanced .prose a:hover {
  background-position: 0% 0%;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsl(var(--primary)/0.2);
}

/* Enhanced image styling */
.research-enhanced .prose img {
  border-radius: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid hsl(var(--border));
  overflow: hidden;
}

.research-enhanced .prose img:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  transform: translateY(-4px) scale(1.02);
}

/* Research activities enhancements */
.research-enhanced .activity-item {
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, hsl(var(--background)) 0%, hsl(var(--muted)/0.3) 100%);
  border: 1px solid hsl(var(--border));
  margin: 1rem 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.research-enhanced .activity-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)/0.3), transparent);
}

.research-enhanced .activity-item:hover {
  background: linear-gradient(135deg, hsl(var(--muted)/0.5) 0%, hsl(var(--accent)/0.3) 100%);
  border-color: hsl(var(--primary)/0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Enhanced search result styling */
.research-enhanced .search-result {
  background: linear-gradient(135deg, hsl(var(--accent)) 0%, hsl(var(--muted)) 100%);
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 0.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.research-enhanced .search-result::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.research-enhanced .search-result:hover::before {
  opacity: 1;
}

.research-enhanced .search-result:hover {
  background: linear-gradient(135deg, hsl(var(--accent)/0.8) 0%, hsl(var(--muted)/0.8) 100%);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: hsl(var(--primary)/0.5);
}

/* Fade-in animation for research content */
@keyframes researchFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.research-enhanced .fade-in {
  animation: researchFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced loading animation */
.research-enhanced .loading-shimmer {
  background: linear-gradient(
    110deg,
    hsl(var(--muted)) 8%,
    hsl(var(--muted)/0.5) 18%,
    hsl(var(--muted)) 33%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

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

/* Tab styling enhancements */
.research-enhanced .tabs-list {
  background: linear-gradient(135deg, hsl(var(--muted)) 0%, hsl(var(--accent)) 100%);
  border-radius: 0.75rem;
  padding: 0.25rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.research-enhanced .tabs-trigger {
  border-radius: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.research-enhanced .tabs-trigger[data-state="active"] {
  background: hsl(var(--background));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Dark mode specific enhancements */
.dark .research-enhanced .prose img {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark .research-enhanced .prose img:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.dark .research-enhanced .activity-item:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark .research-enhanced .search-result:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Scroll container enhancements */
.research-enhanced .scroll-container {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--muted)) transparent;
}

.research-enhanced .scroll-container::-webkit-scrollbar {
  width: 8px;
}

.research-enhanced .scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.research-enhanced .scroll-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, hsl(var(--muted)) 0%, hsl(var(--accent)) 100%);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.research-enhanced .scroll-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, hsl(var(--accent)) 0%, hsl(var(--primary)/0.5) 100%);
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  
  .research-enhanced .prose h1 {
    font-size: 1.5rem;
  }
  
  .research-enhanced .prose h2 {
    font-size: 1.25rem;
  }
  
  .research-enhanced .activity-item {
    padding: 1rem;
  }
  
  .research-enhanced .search-result {
    padding: 0.75rem;
    margin: 0.5rem;
  }

  /* Security page mobile responsiveness fixes */
  .mobile-layout {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .mobile-layout .space-y-6 > * {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Prevent card overflow on mobile */
  .mobile-layout .card {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Ensure input fields don't overflow */
  .mobile-layout input {
    max-width: 100%;
    min-width: 0;
  }

  /* Prevent grid overflow issues */
  .mobile-layout .grid {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Analytics components mobile fixes */
  .mobile-layout .recharts-wrapper {
    max-width: 100% !important;
    overflow-x: hidden;
  }

  /* Prevent table overflow */
  .mobile-layout table {
    max-width: 100%;
    table-layout: fixed;
  }

  .mobile-layout td, .mobile-layout th {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Data Protection Logs mobile fixes */
  .mobile-layout .data-protection-logs {
    overflow-x: hidden;
  }

  .mobile-layout .data-protection-logs .mobile-card {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  .mobile-layout .data-protection-logs .mobile-card .text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  /* Tools page mobile responsiveness fixes */
  .mobile-layout .tools-content {
    overflow-x: hidden;
    max-width: 100%;
  }

  .mobile-layout .tools-generated-content {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .mobile-layout .tools-generated-content * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Ensure tools cards don't overflow on mobile */
  .mobile-layout .tools-card {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Tools input sections mobile fixes */
  .mobile-layout .tools-input textarea {
    max-width: 100%;
    min-width: 0;
  }

  /* Tools button grids mobile fixes */
  .mobile-layout .tools-button-grid {
    max-width: 100%;
    overflow-x: hidden;
  }

  .mobile-layout .tools-button-grid button {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .research-enhanced .prose a {
    text-decoration: underline;
  }
  
  .research-enhanced .search-result {
    border-width: 2px;
  }
  
  .research-enhanced .activity-item {
    border-width: 2px;
  }
}

/* Research tool section styling */
.research-tool-section {
  @apply mt-6 mb-8 relative;
  border-left: 3px solid transparent;
  background: linear-gradient(135deg, 
    hsl(var(--muted)/0.03) 0%, 
    hsl(var(--accent)/0.05) 50%, 
    hsl(var(--muted)/0.02) 100%
  );
  border-radius: 8px;
  padding: 1rem;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease-out;
}

.research-tool-section:hover {
  border-left-color: hsl(var(--primary)/0.3);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  background: linear-gradient(135deg, 
    hsl(var(--muted)/0.05) 0%, 
    hsl(var(--accent)/0.08) 50%, 
    hsl(var(--muted)/0.03) 100%
  );
}

.research-tool-header {
  @apply mb-3 flex items-center;
}

.tool-badge {
  @apply flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-medium;
  background: linear-gradient(90deg, 
    hsl(var(--primary)/0.1) 0%, 
    hsl(var(--primary)/0.15) 100%
  );
  border: 1px solid hsl(var(--primary)/0.2);
  color: hsl(var(--primary));
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tool-badge svg {
  opacity: 0.8;
}

/* Dark mode enhancements */
.dark .research-tool-section {
  background: linear-gradient(135deg, 
    hsl(var(--muted)/0.08) 0%, 
    hsl(var(--accent)/0.12) 50%, 
    hsl(var(--muted)/0.06) 100%
  );
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.dark .research-tool-section:hover {
  border-left-color: hsl(var(--primary)/0.5);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, 
    hsl(var(--muted)/0.12) 0%, 
    hsl(var(--accent)/0.18) 50%, 
    hsl(var(--muted)/0.08) 100%
  );
}

.dark .tool-badge {
  background: linear-gradient(90deg, 
    hsl(var(--primary)/0.15) 0%, 
    hsl(var(--primary)/0.25) 100%
  );
  border-color: hsl(var(--primary)/0.3);
}

/* Help dialog highlighting styles */
.help-highlight {
  position: relative;
  z-index: 1000;
  animation: helpPulse 2s infinite;
  border-radius: 8px;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.3), 0 0 20px hsl(var(--primary) / 0.2);
  background: hsl(var(--primary) / 0.05);
}

@keyframes helpPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.3), 0 0 20px hsl(var(--primary) / 0.2);
  }
  50% {
    box-shadow: 0 0 0 6px hsl(var(--primary) / 0.2), 0 0 30px hsl(var(--primary) / 0.3);
  }
}

.dark .help-highlight {
  background: hsl(var(--primary) / 0.1);
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.4), 0 0 20px hsl(var(--primary) / 0.3);
}

/* Mobile safe area and viewport fixes */
@supports (padding: max(0px)) {
  .safe-area-inset-top {
    padding-top: max(env(safe-area-inset-top), 0px);
  }
  .safe-area-inset-bottom {
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
  }
}

/* ---> Artifact/canvas content containers > [Global responsive constraint] > Prevent horizontal overflow in sidebars and previews */
.artifact-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}
.artifact-responsive img,
.artifact-responsive video,
.artifact-responsive canvas,
.artifact-responsive svg,
.artifact-responsive iframe,
.artifact-responsive table {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  box-sizing: border-box !important;
}
.artifact-responsive pre,
.artifact-responsive code {
  max-width: 100% !important;
  overflow-x: auto !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: pre-wrap !important;
  box-sizing: border-box !important;
}
.artifact-responsive .react-syntax-highlighter {
  max-width: 100% !important;
  overflow-x: auto !important;
  box-sizing: border-box !important;
}
.artifact-responsive .react-syntax-highlighter pre,
.artifact-responsive .react-syntax-highlighter code {
  max-width: 100% !important;
  overflow-x: auto !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: pre-wrap !important;
  box-sizing: border-box !important;
}
.artifact-responsive .prose {
  max-width: 100% !important;
  overflow-x: hidden !important;
}
.artifact-responsive .prose * {
  max-width: 100% !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* ---> Canvas preview and editor normalization > [Consistent rendering] > Ensure identical sizing and positioning in edit and view */
.reveal-slide-preview,
.reveal-slide-content {
  line-height: normal;
}
.reveal-slide-preview .canvas-slide,
.reveal-slide-content .canvas-slide {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 16/9 !important;
  box-sizing: border-box;
  text-align: initial; /* prevent inherited centering from wrappers */
}
/* Remove accidental extra spacing around slides during editing/preview */
.reveal-slide-preview .canvas-slide,
.reveal-slide-content .canvas-slide {
  margin: 0 !important;
}
.reveal-slide-preview .canvas-item,
.reveal-slide-content .canvas-item {
  position: absolute !important; /* guarantee absolute layout even if user code stripped it */
}

/* ---> Canvas image normalization > [Fit image to item box] > Ensure images fill their canvas item container */
.reveal-slide-preview .canvas-item[data-type="image"] img,
.reveal-slide-content .canvas-item[data-type="image"] img,
.canvas-slide .canvas-item[data-type="image"] img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  box-shadow: none !important; /* remove faux extended background */
  background: transparent !important; /* ensure no extra bg around images */
}

/* ---> Canvas text safety > [Wrapping/line-height] > Prevent overflows and overlapping */
.reveal-slide-preview .canvas-item[data-type="text"],
.reveal-slide-content .canvas-item[data-type="text"],
.canvas-slide .canvas-item[data-type="text"] {
  line-height: 1.35 !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

/* ---> Slides sidebar dark mode improvements > [Better select/input contrast] > Ensure dropdowns and color inputs are visible */
.dark select {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
  border-color: hsl(var(--border)) !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.7rem center !important;
  background-size: 1rem !important;
  padding-right: 2.5rem !important;
}

.dark select option {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
}

/* Light mode select styling */
select {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
  border-color: hsl(var(--border)) !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.7rem center !important;
  background-size: 1rem !important;
  padding-right: 2.5rem !important;
}

select option {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
}

/* ---> Slides component specific select styling > [Override browser defaults] > Ensure select elements in slides sidebar are fully styled */
.dark .slides-sidebar select,
.slides-sidebar select {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
  border: 2px solid hsl(var(--border) / 0.5) !important;
  border-radius: 0.375rem !important;
  font-size: 0.75rem !important;
  line-height: 1rem !important;
  padding: 0.25rem 2.5rem 0.25rem 0.5rem !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.5rem center !important;
  background-size: 1rem !important;
}

.dark .slides-sidebar select:hover,
.slides-sidebar select:hover {
  border-color: hsl(var(--border)) !important;
}

.dark .slides-sidebar select:focus,
.slides-sidebar select:focus {
  border-color: hsl(var(--primary)) !important;
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.2) !important;
  outline: none !important;
}

.dark .slides-sidebar select option,
.slides-sidebar select option {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
  padding: 0.5rem !important;
}

/* ---> Download menu dark mode > [Ensure readable text] > Force white-ish text and proper contrast for options */
.dark .slides-sidebar .download-menu {
  color: hsl(var(--foreground)) !important;
  background-color: hsl(var(--background)) !important;
}
.dark .slides-sidebar .download-menu button {
  color: hsl(var(--foreground)) !important;
}
.dark .slides-sidebar .download-menu .text-muted-foreground {
  color: hsl(var(--muted-foreground)) !important;
}
.dark .slides-sidebar .download-menu button:hover {
  background-color: hsl(var(--accent)) !important;
}

.dark input[type="color"] {
  background-color: hsl(var(--background)) !important;
  border-color: hsl(var(--border)) !important;
}

.dark input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 1px !important;
  border-radius: 4px !important;
}

.dark input[type="color"]::-webkit-color-swatch {
  border: 1px solid hsl(var(--border)) !important;
  border-radius: 3px !important;
}

@media (max-width: 768px) {
  /* Enhanced mobile layout - prevent body scrolling for chat pages only */
  html, body {
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height where supported */
    overflow-x: hidden !important; /* Prevent horizontal scrolling */
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100vw !important; /* Force viewport constraint */
  }
  
  /* Only lock body position for chat pages */
  body.mobile-chat-page {
    overflow: hidden !important; /* Prevent body scrolling */
    position: fixed !important; /* Lock body position */
    top: 0 !important; /* Ensure body starts at top of viewport */
    left: 0 !important; /* Ensure body starts at left of viewport */
  }

  .mobile-layout {
    min-height: 100vh;
    min-height: 100dvh; /* Use dynamic viewport height where supported */
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent container scrolling */
  }

  /* Fix: When panels open and main content is transformed, prevent pages with top margins from being pushed down */
  [data-main-content-transformed="true"] main > :first-child {
    margin-top: 0 !important;
  }
  /* Stabilize viewport height during transform to prevent vertical jump */
  [data-main-content-transformed="true"] main {
    min-height: 100dvh !important;
    contain: layout paint;
    will-change: transform;
    translate: 0; /* ensure a composited layer */
  }

  /* removed global main min-height/contain to avoid interference */

  /* Mobile header safe area padding */
  header {
    padding-top: max(env(safe-area-inset-top, 0px), 12px) !important;
    flex-shrink: 0; /* Prevent header from shrinking */
  }

  /* Alternative header selectors for different header implementations */
  .header,
  [role="banner"],
  .mobile-header {
    padding-top: max(env(safe-area-inset-top, 0px), 12px) !important;
    flex-shrink: 0;
  }

  /* Ensure chat container fills remaining space */
  .chat-container-default,
  [class*="chat-container-"] {
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .mobile-scroll::-webkit-scrollbar {
    display: none;
  }
  
  .mobile-scroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .mobile-touch-target {
    min-height: 44px;
    min-width: 44px;
  }

  /* Enhanced mobile chat input positioning - Compatible with Capacitor 7 */
  .mobile-chat-input {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 20px) !important;
    transform: translateZ(0); /* Force hardware acceleration */
    will-change: transform; /* Optimize for animations */
    flex-shrink: 0; /* Prevent input from shrinking */
    /* Support Capacitor 7 keyboard handling */
    transition: bottom 0.2s ease-out;
  }

  /* Hide composer while search overlay is open */
  body.search-overlay-open .mobile-chat-input,
  body.search-overlay-open .mobile-chat-container .mobile-chat-input {
    display: none !important;
  }

  /* Ensure chat input is always above the fold */
  .mobile-chat-container {
    flex: 1 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Additional padding for ScrollArea components on mobile */
  .mobile-scroll-area {
    flex: 1 !important;
    overflow: hidden !important;
  }

  /* Ensure message lists have proper bottom spacing */
  .mobile-message-list {
    padding-bottom: calc(40px + max(env(safe-area-inset-bottom, 0px), 10px)) !important;
  }

  /* Comprehensive mobile bottom spacing for all message containers */
  [data-radix-scroll-area-viewport],
  .scroll-area-viewport,
  .message-container,
  .chat-messages,
  .messages-scroll-area {
    padding-bottom: calc(100px + max(env(safe-area-inset-bottom, 0px), 20px)) !important;
  }

  /* Ensure mobile message content is never cut off */
  @media (max-width: 768px) {
    .message-actions,
    .message-footer,
    .like-dislike-buttons,
    [data-message-actions] {
      margin-bottom: 20px !important;
    }
  }

  /* Capacitor 7 compatible keyboard handling */  
  .mobile-input-focused {
    /* Enhanced positioning for Capacitor 7 */
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background: var(--background) !important;
    border-top: 1px solid var(--border) !important;
    padding: 1rem !important;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 20px) !important;
    /* Capacitor 7 viewport resize compatibility */
    transition: transform 0.2s ease-out !important;
    will-change: transform !important;
  }

  /* Capacitor 7 keyboard state handling */
  body.keyboard-will-show .mobile-chat-input,
  body.keyboard-did-show .mobile-chat-input {
    /* Let Capacitor handle the resize automatically */
    position: fixed !important;
    bottom: 0 !important;
    transform: translateZ(0) !important;
  }
  
  /* Force hardware acceleration for smoother keyboard transitions */
  .mobile-chat-input * {
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
  }

  /* Prevent black patch behind greeting on mobile keyboard show */
  @media (max-width: 768px) {
    body.keyboard-will-show .mobile-scroll-area,
    body.keyboard-did-show .mobile-scroll-area {
      padding-bottom: calc(60px + max(env(safe-area-inset-bottom, 0px), 20px)) !important;
    }

    /* Ensure greeting container adapts to keyboard */
    body.keyboard-will-show [data-radix-scroll-area-viewport],
    body.keyboard-did-show [data-radix-scroll-area-viewport] {
      padding-bottom: calc(60px + max(env(safe-area-inset-bottom, 0px), 20px)) !important;
    }
  }

  /* High priority modal overlays - ensures they appear above all other UI elements including chat inputs */
  .modal-high-priority-overlay {
    z-index: 10000 !important;
  }

  .modal-high-priority-content {
    z-index: 10000 !important;
  }

  /* Mobile-specific horizontal overflow fixes */
  .mobile-chat-container,
  .mobile-scroll-area,
  .message-list-container {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
  }

  /* Responsive rules for artifact/canvas content containers */
  .artifact-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .artifact-responsive img,
  .artifact-responsive video,
  .artifact-responsive canvas,
  .artifact-responsive svg,
  .artifact-responsive iframe,
  .artifact-responsive table {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  .artifact-responsive pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
  }
  .artifact-responsive code {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .artifact-responsive .reveal,
  .artifact-responsive .slides,
  .artifact-responsive .chart-container,
  .artifact-responsive .canvas-container {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Force all message containers to respect mobile width */
  .message-content,
  .prose,
  .message-content .prose {
    max-width: calc(100vw - 2rem) !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Improve KaTeX wrapping on small screens */
  .prose .katex,
  .prose .katex-display,
  .message-content .katex,
  .message-content .katex-display {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile-specific table scrolling */
  .message-content table,
  .prose table,
  .prose-table-container {
    width: 100% !important;
    max-width: calc(100vw - 4rem) !important;
    overflow-x: auto !important;
    display: block !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted)) transparent;
  }

  .message-content table th,
  .prose table th,
  .message-content table td,
  .prose table td {
    white-space: normal !important; /* Allow text wrapping */
    word-wrap: break-word !important; /* Break long words */
    overflow-wrap: break-word !important; /* Modern word breaking */
    padding: 0.75rem !important; /* Slightly reduce padding on mobile */
    min-width: 100px !important; /* Minimum cell width */
    max-width: 250px !important; /* Reasonable max width on mobile */
  }
  .message-content table::-webkit-scrollbar,
  .prose table::-webkit-scrollbar {
    height: 6px;
  }

  .message-content table::-webkit-scrollbar-track,
  .prose table::-webkit-scrollbar-track {
    background: hsl(var(--muted)/0.1);
    border-radius: 3px;
  }

  .message-content table::-webkit-scrollbar-thumb,
  .prose table::-webkit-scrollbar-thumb {
    background: hsl(var(--muted));
    border-radius: 3px;
  }

  /* Mobile code block scrolling */
  .message-content pre,
  .prose pre,
  .syntax-highlighter-wrapper,
  .react-syntax-highlighter {
    max-width: calc(100vw - 4rem) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: pre !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted)) transparent;
  }

  .message-content pre::-webkit-scrollbar,
  .prose pre::-webkit-scrollbar,
  .syntax-highlighter-wrapper::-webkit-scrollbar,
  .react-syntax-highlighter::-webkit-scrollbar {
    height: 6px;
  }

  .message-content pre::-webkit-scrollbar-track,
  .prose pre::-webkit-scrollbar-track,
  .syntax-highlighter-wrapper::-webkit-scrollbar-track,
  .react-syntax-highlighter::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
  }

  .message-content pre::-webkit-scrollbar-thumb,
  .prose pre::-webkit-scrollbar-thumb,
  .syntax-highlighter-wrapper::-webkit-scrollbar-thumb,
  .react-syntax-highlighter::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }

  /* Mobile inline code wrapping */
  .message-content code:not(pre code),
  .prose code:not(pre code) {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    max-width: 100% !important;
    display: inline !important;
    vertical-align: baseline !important;
    font-size: 0.875em !important;
    line-height: 1.2 !important;
  }

  /* Mobile user message constraints */
  .user-message {
    max-width: calc(100vw - 6rem) !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    overflow-x: hidden !important;
  }

  /* Mobile assistant message constraints */
  .prose.dark\:prose-invert {
    max-width: calc(100vw - 2rem) !important;
    overflow-x: hidden !important;
  }

  /* Force links to break properly on mobile */
  .message-content a,
  .prose a {
    word-break: break-all !important;
    max-width: 100% !important;
    display: inline-block !important;
  }

  /* Mobile-specific wide content wrapper */
  .mobile-wide-content {
    max-width: calc(100vw - 4rem) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted)) transparent;
  }

  .mobile-wide-content::-webkit-scrollbar {
    height: 8px;
  }

  .mobile-wide-content::-webkit-scrollbar-track {
    background: hsl(var(--muted)/0.1);
    border-radius: 4px;
  }

  .mobile-wide-content::-webkit-scrollbar-thumb {
    background: hsl(var(--muted));
    border-radius: 4px;
  }

  /* Override any existing styles that might cause overflow */
  .message-content *,
  .prose * {
    max-width: 100% !important;
  }

  /* Specific overrides for problematic elements */
  .message-content .react-syntax-highlighter > div,
  .prose .react-syntax-highlighter > div {
    max-width: none !important;
  }
}

/* Nuclear option - force all non-research messages to have normal line-height */
body .message-list-container .message-content {
  line-height: 1.7 !important;
}

body .message-list-container .prose:not(.research-enhanced .prose) * {
  line-height: 1.7 !important;
}

body .message-list-container .prose:not(.research-enhanced .prose) p {
  margin-bottom: 0.5rem !important;
  line-height: 1.7 !important;
}

body .user-message,
body .user-message * {
  line-height: 1.7 !important;
}

/* Mobile project layout fixes */
@media (max-width: 768px) {
  /* Workspace Teams tab mobile fixes - Aggressive overflow prevention */
  .mobile-team-dashboard, 
  [data-testid="team-dashboard"],
  .project-module {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }
  
  .mobile-team-dashboard .grid,
  .project-module .grid {
    gap: 0.5rem !important;
    max-width: 100% !important;
  }
  
  .mobile-team-dashboard .rounded-xl,
  .project-module .rounded-xl {
    padding: 0.75rem !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Ensure team stats cards don't overflow */
  .mobile-team-stats {
    max-width: 100% !important;
    overflow: hidden !important;
  }
  
  .mobile-team-stats .flex {
    gap: 0.5rem !important;
    align-items: center !important;
  }
  
  /* Prevent team dashboard text overflow */
  .mobile-team-stats p {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* File attachment mobile constraints */
  .message-file-display,
  .file-attachment-wrapper,
  .file-attachment-item {
    max-width: calc(100vw - 4rem) !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  
  .file-attachment-name {
    max-width: 100% !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    white-space: pre-wrap !important;
  }
  
  .file-attachment-container {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  /* Artifact preview mobile constraints */
  .artifact-preview-box,
  .slides-preview-box,
  .visualization-preview-box,
  .document-preview-box,
  .code-preview-box,
  .spreadsheet-preview-box {
    max-width: calc(100vw - 6rem) !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  
  .artifact-preview-content {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  
  .artifact-preview-box h4,
  .artifact-preview-box p,
  .artifact-preview-box span {
    max-width: 100% !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }
  
  /* Ensure artifact preview flex containers don't overflow */
  .artifact-preview-box .flex {
    max-width: 100% !important;
    min-width: 0 !important;
  }
  
  .artifact-preview-box .flex-1 {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Inline artifact iframe constraints */
  .artifact-iframe {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Ensure artifact-responsive containers work on mobile */
  .artifact-responsive {
    max-width: calc(100vw - 4rem) !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  
  /* Enhanced mobile styling for artifact preview containers */
  .artifact-preview-container {
    max-width: 100% !important;
    overflow: hidden !important;
  }
  
  .artifact-preview-container button {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  
  /* Better mobile typography and spacing for artifacts */
  @media (max-width: 768px) {
    .artifact-preview-container button {
      padding: 1rem !important;
      min-height: 3.5rem !important;
    }
    
    .artifact-preview-container .flex-1 {
      min-width: 0 !important;
      flex: 1 !important;
    }
    
    .artifact-preview-container span {
      line-height: 1.4 !important;
    }
    
    /* Ensure truncated text works properly */
    .artifact-preview-container .truncate {
      max-width: 100% !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      white-space: nowrap !important;
    }
  }
  
  /* Enhanced document content styling for mobile */
  .artifact-document-content {
    max-width: 100% !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
  }
  
  /* Document canvas overflow protection */
  .document-preview-box,
  .document-preview-box *,
  .doc-compact,
  .doc-compact * {
    max-width: 100% !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
  }
  
  /* Code canvas overflow protection */
  .code-preview-box,
  .code-preview-box *,
  .artifact-preview-box pre,
  .artifact-preview-box code {
    max-width: 100% !important;
    overflow-x: auto !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
  }
  
  /* SyntaxHighlighter overflow protection */
  .react-syntax-highlighter,
  .react-syntax-highlighter *,
  .react-syntax-highlighter pre,
  .react-syntax-highlighter code {
    max-width: 100% !important;
    overflow-x: auto !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
    white-space: pre-wrap !important;
  }
  
  /* Mobile-specific code overflow enhancements */
  @media (max-width: 768px) {
    .react-syntax-highlighter {
      font-size: 12px !important;
      line-height: 1.6 !important;
    }
    
    .react-syntax-highlighter pre,
    .react-syntax-highlighter code {
      word-break: break-all !important;
      overflow-wrap: anywhere !important;
    }
    
    .code-preview-box .artifact-preview-content {
      padding: 0.75rem !important;
    }
    
    .artifact-responsive pre {
      font-size: 12px !important;
      padding: 0.75rem !important;
    }
  }
  
  .artifact-document-content .prose {
    color: inherit !important;
  }
  
  .artifact-document-content .prose h1,
  .artifact-document-content .prose h2,
  .artifact-document-content .prose h3,
  .artifact-document-content .prose h4 {
    scroll-margin-top: 2rem !important;
  }
  
  /* Better mobile readability */
  @media (max-width: 768px) {
    .artifact-document-content {
      padding: 1.25rem !important;
    }
    
    .artifact-document-content .prose {
      font-size: 16px !important;
      line-height: 1.6 !important;
    }
    
    .artifact-document-content .prose p {
      margin-bottom: 1rem !important;
      line-height: 1.6 !important;
    }
    
    .artifact-document-content .prose h1 {
      font-size: 1.5rem !important;
      margin-bottom: 1rem !important;
    }
    
    .artifact-document-content .prose h2 {
      font-size: 1.25rem !important;
      margin-bottom: 0.75rem !important;
    }
    
    .artifact-document-content .prose h3 {
      font-size: 1.125rem !important;
      margin-bottom: 0.75rem !important;
    }
    
    .artifact-document-content .prose blockquote {
      margin: 1rem 0 !important;
      padding: 0.75rem !important;
    }
    
    .artifact-document-content .prose ul,
    .artifact-document-content .prose ol {
      margin-bottom: 1rem !important;
    }
    
    .artifact-document-content .prose li {
      margin-bottom: 0.5rem !important;
    }
  }
  
  .artifact-responsive iframe,
  .artifact-responsive canvas,
  .artifact-responsive svg,
  .artifact-responsive video {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    box-sizing: border-box !important;
  }

  /* Force all project cards and team content to respect mobile constraints */
  .project-card,
  .team-project-card,
  .project-module > * {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Mobile dialog and modal optimizations */
  [data-slot="dialog-content"] {
    max-width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 2rem) !important;
    /* Remove margin as it conflicts with Dialog's centering */
  }
  
  .modal-content,
  .dialog-content {
    max-width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 2rem) !important;
    width: 95vw !important;
    margin: 0.5rem !important;
  }

  /* Mobile button groups - prevent overflow */
  .flex.gap-2,
  .flex.space-x-2 {
    flex-wrap: wrap !important;
  }

  /* Mobile grid layouts - optimize spacing */
  .grid.gap-4 {
    gap: 0.75rem !important;
  }

  .grid.gap-3 {
    gap: 0.5rem !important;
  }

  /* Ensure no element in team dashboard can exceed viewport */
  .team-dashboard *,
  .project-module * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Button and input constraints in team sections */
  .team-dashboard button,
  .team-dashboard input,
  .team-dashboard select {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Project Members Modal mobile overflow prevention */
  .team-members-modal [data-slot="dialog-content"] {
    max-width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 2rem) !important;
    width: calc(100vw - 1rem) !important;
    margin: 0.5rem !important;
    overflow: hidden !important;
  }

  .team-members-modal .scroll-area {
    max-height: calc(70vh) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .team-members-modal .member-item {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .team-members-modal .member-item * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Ensure mobile project header is properly centered and doesn't overflow */
  .mobile-project-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    width: 100%;
    overflow: hidden;
  }
  
  .mobile-project-title {
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--foreground);
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Prevent text overflow in mobile project header */
  .mobile-project-title h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
    text-align: center;
  }
  
  /* Mobile project content area */
  .mobile-project-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5rem; /* Space for bottom navigation */
    width: 100%;
    min-height: 0; /* Allow flex shrinking */
  }
  
  /* Mobile project bottom navigation */
  .mobile-project-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--background);
    border-top: 1px solid var(--border);
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
  }
  
  /* Enhanced touch targets for mobile project navigation */
  .mobile-project-nav button {
    min-height: 3rem;
    min-width: 3rem;
    touch-action: manipulation;
  }
  
  /* Ensure proper text wrapping in mobile chat lists */
  .mobile-chat-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    width: 100%;
    min-width: 0;
  }
  
  .mobile-chat-item h3,
  .mobile-chat-item p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
  }
  
  /* Fix viewport width issues */
  .h-screen {
    height: 100vh;
  }
  
  /* Prevent overflow in mobile project names and titles */
  @media (max-width: 768px) {
    .mobile-project-name,
    .mobile-breadcrumb-item {
      max-width: calc(100vw - 8rem);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
    }
    
    /* Ensure mobile headers don't overflow horizontally */
    .mobile-project-header,
    .mobile-header {
      max-width: 100vw;
      overflow-x: hidden;
      box-sizing: border-box;
    }
    
    /* Force text truncation in mobile project contexts */
    .mobile-project-header h1,
    .mobile-project-header span,
    .mobile-breadcrumb-item span {
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
    }
  }
  
  /* Additional mobile viewport height support */
  @supports (height: 100dvh) {
    .h-screen {
      height: 100dvh; /* Use dynamic viewport height where supported */
    }
  }
  
  /* Ensure project page doesn't overflow horizontally */
  .project-page-mobile {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

}
/* Feature page animations */
@keyframes shine {
  0% {
    transform: translateX(-100%) skewX(-12deg);
  }
  100% {
    transform: translateX(200%) skewX(-12deg);
  }
}

@keyframes gradient-x {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(var(--primary), 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(var(--primary), 0.5);
  }
}

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

.animate-gradient-x {
  background-size: 200% 200%;
  animation: gradient-x 3s ease infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

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

/* Grid pattern background */
.bg-grid-pattern {
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0);
  background-size: 20px 20px;
}

.dark .bg-grid-pattern {
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.1) 1px, transparent 0);
}

/* Feature card stagger animation */
.feature-card-stagger {
  animation-delay: calc(var(--index) * 0.1s);
}
/* ── Card container ───────────────────────────────────────────── */
.driverjs-theme-white-blue .driver-popover {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 14px !important;
  box-shadow:
    0 12px 24px rgba(0,0,0,.08),
    0 4px 8px  rgba(0,0,0,.06) !important;
  padding: 0 !important;
  max-width: 340px !important;   /* a little wider */
  font-family: 'Inter', system-ui, sans-serif !important;
}

/* ── Title row ────────────────────────────────────────────────── */
.driverjs-theme-white-blue .driver-popover-title {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem;
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #111827 !important;       /* gray‑900 */
  padding: 30px 20px 8px !important;
  border-bottom: none !important;
}

/* ── Body text ────────────────────────────────────────────────── */
.driverjs-theme-white-blue .driver-popover-description {
  font-size: 14px !important;
  line-height: 1.5 !important;
  color: #4b5563 !important;       /* gray‑600 */
  padding: 0 20px 20px !important;
}

/* ── Footer: progress + nav buttons ───────────────────────────── */
.driverjs-theme-white-blue .driver-popover-footer {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: #f9fafb !important;  /* gray‑50 */
  border-top: 1px solid #f3f4f6 !important;
  padding: 14px 20px !important;
  border-radius: 0 0 14px 14px !important;
}

.driverjs-theme-white-blue .driver-popover-progress-text {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #6b7280 !important;       /* gray‑500 */
}

/* Buttons */
.driverjs-theme-white-blue .driver-popover-prev-btn,
.driverjs-theme-white-blue .driver-popover-next-btn,
.driverjs-theme-white-blue .driver-popover-close-btn {
  border: none !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  padding: 7px 16px !important;
  cursor: pointer !important;
  transition: background-color .15s !important;
}

/* Force-show the built-in "X" even when allowClose:false */
.driver-popover-close-btn {
  display:block !important;   /* overrides the inline display:none */
  pointer-events:auto;
}


/* Primary action (Next / Done) */
.driverjs-theme-white-blue .driver-popover-next-btn,
.driverjs-theme-white-blue .driver-popover-close-btn {
  background: #3b82f6 !important;  /* blue‑500 */
  color: #fff !important;
  text-shadow: none !important;
  box-shadow: none !important;
  
}

.driverjs-theme-white-blue .driver-popover-next-btn:hover,
.driverjs-theme-white-blue .driver-popover-close-btn:hover {
  background: #2563eb !important;  /* blue‑600 */
}

/* Secondary (Previous) */
.driverjs-theme-white-blue .driver-popover-prev-btn {
  background: #f3f4f6 !important;  /* gray‑100 */
  color: #374151 !important;       /* gray‑700 */
}
.driverjs-theme-white-blue .driver-popover-prev-btn:hover {
  background: #e5e7eb !important;  /* gray‑200 */
}

/* ── Close‑(X) button upgrade ────────────────────────────────── */
.driver-popover-close-btn.driver-skip-btn{
  position:absolute;
  top:12px; right:12px;
  background:transparent !important;
  border:none !important;
  padding-left: 20px !important;
  font:400 14px/1 'Inter', system-ui !important;
  color:#3b82f6 !important;                /* blue-500 like a link */
  border-radius:0 !important;
  cursor:pointer !important;
  text-decoration:none !important;
  transition: color 0.15s ease !important;
  min-width: 50px !important;
  white-space: nowrap !important;
}

.driver-popover-close-btn.driver-skip-btn:hover{
  color:#2563eb !important;                /* blue-600 on hover */
  background:transparent !important;
  text-decoration:underline !important;
}

/* remove the old SVG mask icon */
.driver-popover-close-btn.driver-skip-btn::before{ content:none; }


/* ↓↓ slam‑dunk centering  💥  */
.driver-popover.tour-popover-center{
  position:fixed !important;
  top:50% !important;
  left:50% !important;
  transform:translate(-50%,-50%) !important;
  max-width: 340px !important;
  padding: 0 !important;
  z-index: 99999 !important;
}
.driver-popover.tour-popover-center .driver-popover-arrow{
  display:none !important;
}

/* Enhanced Project Card Animations */
@keyframes shimmer {
  0% { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(200%) skewX(-12deg); }
}

@keyframes shine {
  0% { background-position: 300% 300%; }
  100% { background-position: -300% -300%; }
}

@keyframes aurora {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

.animate-shimmer {
  animation: shimmer 1s ease-out;
}

.animate-shine {
  animation: shine var(--duration, 14s) linear infinite;
}

.animate-aurora {
  animation: aurora 10s ease-in-out infinite;
}

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

.animation-delay-1000 {
  animation-delay: 1s;
}
