@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

/* Root Variables */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.18);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Base Styles */
.font-inter {
  font-family: 'Inter', sans-serif;
}

/* Background Grid Pattern */
.bg-grid-pattern {
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Glassmorphism Effects */
.glass {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.glass-darker {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Enhanced Chat Scrollbar */
.chat-box {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) rgba(243, 244, 246, 0.3);
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-track {
  background: rgba(243, 244, 246, 0.3);
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.6), rgba(147, 51, 234, 0.6));
    border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-box::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(147, 51, 234, 0.8));
}

/* Enhanced Message Bubbles */
.user-message {
  animation: slideInRight 0.3s ease-out;
}

.bot-message {
  animation: slideInLeft 0.3s ease-out;
}

.message-bubble {
  position: relative;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.message-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.user-message .message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
  border-radius: 20px 20px 5px 20px;
}

.bot-message .message-bubble {
  background: rgba(255, 255, 255, 0.9);
  color: #1f2937;
  border-radius: 20px 20px 20px 5px;
  border: 1px solid rgba(99, 102, 241, 0.1);
}

/* Source Documents Styling */
.source-document {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(147, 51, 234, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.source-document:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(147, 51, 234, 0.08));
}

.source-title {
  font-weight: 600;
  color: #4f46e5;
  margin-bottom: 4px;
}

.source-content {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.4;
}

.source-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #9ca3af;
}

.similarity-score {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* Typing Indicator Animation */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 16px;
}

.typing-dots {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  margin: 0 2px;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top: 3px solid #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* File Upload Enhancements */
.file-drop-zone {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.file-drop-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
  transition: left 0.5s;
}

.file-drop-zone:hover::before {
  left: 100%;
}

.file-drop-zone.drag-over {
  border-color: #6366f1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(147, 51, 234, 0.1));
  transform: scale(1.02);
}

.file-preview {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.file-preview:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(4px);
}

/* Progress Bar Enhancements */
.progress-bar-container {
  background: rgba(229, 231, 235, 0.5);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  background-size: 50px 50px;
  animation: move 2s linear infinite;
}

/* Button Enhancements */
.btn-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-gradient::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-gradient:hover::before {
  left: 100%;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-gradient:active {
  transform: translateY(0);
}

/* Table Enhancements */
.table-row {
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(229, 231, 235, 0.3);
}

.table-row:hover {
  background: rgba(99, 102, 241, 0.05);
  transform: scale(1.01);
}

.table-cell {
  padding: 16px;
  vertical-align: middle;
}

.action-button {
  transition: all 0.3s ease;
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
}

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

.action-button.delete:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.action-button.view:hover {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #2563eb;
}

/* Modal Enhancements */
.modal-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  animation: slideInUp 0.3s ease;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Status Indicators */
.status-dot {
    display: inline-block;
  width: 8px;
  height: 8px;
    border-radius: 50%;
  margin-right: 8px;
  animation: pulse 2s infinite;
}

.status-success { background-color: #10b981; }
.status-error { background-color: #ef4444; }
.status-warning { background-color: #f59e0b; }
.status-info { background-color: #3b82f6; }

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

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

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes move {
  0% { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

@keyframes glow {
  0% { box-shadow: 0 0 5px rgba(99, 102, 241, 0.5); }
  50% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.8); }
  100% { box-shadow: 0 0 5px rgba(99, 102, 241, 0.5); }
}

/* Utility Classes */
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

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

/* Responsive Enhancements */
@media (max-width: 768px) {
  .chat-container {
    margin: 0;
    height: 100vh;
    border-radius: 0;
  }
  
  .modal-content {
    margin: 20px;
    max-width: calc(100vw - 40px);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  :root {
    --glass-bg: rgba(0, 0, 0, 0.25);
    --glass-border: rgba(255, 255, 255, 0.1);
  }
}

/* Focus States */
*:focus {
  outline: none;
}

button:focus,
input:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .chat-container {
    box-shadow: none;
    border: 1px solid #ccc;
  }
} 

/* Streaming Response Effects */
.streaming-cursor {
  display: inline-block;
  animation: blink 1s infinite;
  color: #6366f1;
  font-weight: bold;
}

.streaming-message .message-bubble {
  border: 2px solid rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(99, 102, 241, 0.05));
  animation: streamingGlow 2s ease-in-out infinite;
}

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

@keyframes streamingGlow {
  0%, 100% { 
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    }
    50% {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
  }
}

/* Typewriter effect for streaming text */
.message-content {
  overflow-wrap: break-word;
  word-break: break-word;
}

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

.streaming-message .message-content::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, #6366f1, transparent);
  animation: typewriterLine 0.5s ease-in-out infinite alternate;
}

@keyframes typewriterLine {
  0% { opacity: 0; }
  100% { opacity: 1; }
} 

/* Document View Modal Enhancements - FIXED READABILITY */
#document-view-modal {
  animation: modalFadeIn 0.3s ease-out;
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.8) !important; /* Darker backdrop */
  z-index: 10000;
}

#document-view-modal .bg-white\/95 {
  animation: modalSlideIn 0.3s ease-out;
  background: #ffffff !important; /* Solid white background */
  backdrop-filter: none !important; /* Remove blur effect that causes readability issues */
  border: 2px solid #e5e7eb !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

/* Force readable text in document view modal */
#document-view-modal h3,
#document-view-modal h4,
#document-view-modal p,
#document-view-modal span,
#document-view-modal div {
  color: #111827 !important;
  text-shadow: none !important;
}

#document-view-modal .text-gray-900 {
  color: #111827 !important;
}

#document-view-modal .text-gray-600,
#document-view-modal .text-gray-500 {
  color: #4b5563 !important;
}

#document-view-modal .text-gray-700 {
  color: #374151 !important;
}

/* Enhanced Delete Modal - FIXED READABILITY */
#delete-modal {
  animation: modalFadeIn 0.2s ease-out;
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.85) !important; /* Much darker backdrop */
  z-index: 10000;
}

#delete-modal .bg-white\/90 {
  animation: modalSlideIn 0.2s ease-out;
  background: #ffffff !important; /* Solid white background */
  backdrop-filter: none !important; /* Remove problematic blur */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6) !important;
  border: 3px solid #ef4444 !important; /* Strong red border */
}

/* Force readable text in delete modal */
#delete-modal h3 {
  color: #111827 !important;
  font-weight: 700 !important;
  font-size: 1.25rem !important;
}

#delete-modal p {
  color: #374151 !important;
  line-height: 1.6 !important;
  font-weight: 500 !important;
}

/* Enhanced Delete Modal Buttons - BETTER CONTRAST */
#cancel-delete {
  background: #f9fafb !important;
  color: #111827 !important;
  border: 2px solid #d1d5db !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
  font-weight: 600 !important;
}

#cancel-delete:hover {
  background: #f3f4f6 !important;
  border-color: #9ca3af !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

#confirm-delete {
  background: #ef4444 !important;
  color: #ffffff !important;
  border: 2px solid #dc2626 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
  font-weight: 600 !important;
}

#confirm-delete:hover {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5) !important;
}

#confirm-delete:disabled {
  background: #9ca3af !important;
  border-color: #6b7280 !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none !important;
}

/* Modal Warning Icon Enhancement */
#delete-modal .bg-red-100 {
  background: #fef2f2 !important;
  border: 2px solid #fecaca !important;
}

#delete-modal .text-red-600 {
  color: #dc2626 !important;
  font-size: 1.5rem !important;
}

/* Stats cards in view modal - BETTER READABILITY */
.bg-gradient-to-r.from-blue-50.to-indigo-50 {
  background: #eff6ff !important;
  border: 2px solid #dbeafe !important;
}

.bg-gradient-to-r.from-green-50.to-emerald-50 {
  background: #f0fdf4 !important;
  border: 2px solid #dcfce7 !important;
}

.bg-gradient-to-r.from-purple-50.to-pink-50 {
  background: #faf5ff !important;
  border: 2px solid #e9d5ff !important;
}

/* Force text colors in stats cards */
.text-blue-600 {
  color: #2563eb !important;
}

.text-blue-900 {
  color: #1e3a8a !important;
}

.text-green-600 {
  color: #16a34a !important;
}

.text-green-900 {
  color: #14532d !important;
}

.text-purple-600 {
  color: #9333ea !important;
}

.text-purple-900 {
  color: #581c87 !important;
}

/* Ensure modal content area has solid background */
#document-view-modal .bg-gray-50\/50 {
  background: #f9fafb !important;
  border: 2px solid #e5e7eb !important;
}

#document-view-modal .bg-white\/70 {
  background: #ffffff !important;
  border: 2px solid #e5e7eb !important;
}

#document-view-modal .bg-blue-50\/50 {
  background: #eff6ff !important;
  border: 2px solid #dbeafe !important;
}

/* Remove any problematic glassmorphism effects */
.backdrop-blur-lg,
.backdrop-blur-md,
.backdrop-blur-sm {
  backdrop-filter: none !important;
}

/* Ensure buttons in document view modal are readable */
#document-view-modal button {
  font-weight: 600 !important;
  text-shadow: none !important;
}

#document-view-modal .bg-gray-200 {
  background: #e5e7eb !important;
  color: #111827 !important;
}

#document-view-modal .bg-red-500 {
  background: #ef4444 !important;
  color: #ffffff !important;
}

/* Force all modal text to be readable */
[id*="modal"] * {
  text-shadow: none !important;
}

/* Ensure high contrast for all modal content */
#delete-modal *, #document-view-modal * {
  color: inherit !important;
}

/* Override any conflicting Tailwind classes */
.text-gray-400 {
  color: #6b7280 !important;
}

.text-gray-800 {
  color: #1f2937 !important;
} 

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

@keyframes modalSlideIn {
  from { 
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to { 
        opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Action Button Improvements */
.action-button {
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
}

.action-button:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-button.view:hover {
  background: rgba(59, 130, 246, 0.1);
}

.action-button.delete:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Modal content scrollbar */
.max-h-\[90vh\]::-webkit-scrollbar {
  width: 6px;
}

.max-h-\[90vh\]::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.max-h-\[90vh\]::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

.max-h-\[90vh\]::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

/* Enhanced stats cards */
.stats-card {
  background: #ffffff !important;
  backdrop-filter: none !important;
  border: 2px solid #e5e7eb !important;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Better focus states for accessibility */
#delete-modal button:focus,
#document-view-modal button:focus {
  outline: 3px solid #3b82f6 !important;
  outline-offset: 2px;
}

/* Loading state for delete button */
#confirm-delete .fa-spinner {
  animation: spin 1s linear infinite;
}

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

/* Enhanced button hover effects */
button[onclick]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Table row hover enhancement */
.table-row:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.03));
  border-color: rgba(99, 102, 241, 0.2);
}

/* Ensure modal is always on top and properly positioned */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 10000 !important;
}

/* Force solid backgrounds on problematic elements */
.bg-white\/30,
.bg-white\/60,
.bg-white\/80 {
  background: #ffffff !important;
}

/* Additional text contrast fixes */
#document-view-modal .font-medium,
#document-view-modal .font-semibold,
#document-view-modal .font-bold {
  color: #111827 !important;
}

#delete-modal .font-medium,
#delete-modal .font-semibold,
#delete-modal .font-bold {
  color: #111827 !important;
}

/* Improved notification positioning */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 11000;
  max-width: 400px;
}

/* Loading states */
.loading-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* Inline source icon styling */
.inline-source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  margin-left: 0.35rem;
  font-size: 0.85rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(79, 70, 229, 0.3));
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #4338ca;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.inline-source-icon:hover,
.inline-source-icon:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(79, 70, 229, 0.55));
}

.inline-source-icon span {
  pointer-events: none;
}

.inline-source-tooltip {
  position: absolute;
  width: min(420px, calc(100vw - 32px));
  height: 320px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
  background: #ffffff;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 12000;
}

.inline-source-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.inline-source-tooltip__iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #f9fafb;
}

/* Source preview panel */
.source-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.9);
  color: #4c1d95;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.08);
}

.source-nav-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.2);
}

.source-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.source-active-card {
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 18px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(255, 255, 255, 0.95));
  box-shadow: 0 20px 45px rgba(79, 70, 229, 0.1);
  min-height: 180px;
}

.source-active-card .source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4338ca;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.95);
  transition: all 0.2s ease;
}

.source-active-card .source-link:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(79, 70, 229, 0.25));
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.25);
}

.source-preview-card {
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  padding: 16px;
  background: rgba(249, 250, 251, 0.95);
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
  cursor: pointer;
}

.source-preview-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.source-preview-card.active {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 15px 35px rgba(79, 70, 229, 0.2);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(255, 255, 255, 0.98));
}

.source-preview-card:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.7);
  outline-offset: 2px;
}

.source-preview-chip {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4c1d95;
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(192, 132, 252, 0.4);
  padding: 2px 8px;
  border-radius: 999px;
}