/*
 * 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-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* =============================================================================
   EKN CHAT RESPONSE TYPOGRAPHY
   Sophisticated typography for graph-constrained collaborative intelligence
   ============================================================================= */

/* Base Typography System - Override Tailwind prose defaults */
.prose {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 16px !important;
  line-height: 1.75 !important;
  color: #1f2937 !important; /* gray-800 */
  max-width: none !important;
}

/* =============================================================================
   TOPIC LISTS - Research Topics & Items
   ============================================================================= */

/* Topic list container */
.prose .topic-list {
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual topic items */
.prose .topic-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  border-left: 4px solid #3b82f6; /* blue-500 */
  transition: all 0.2s ease;
}

.prose .topic-item:hover {
  background: #f3f4f6;
  border-left-color: #1d4ed8; /* blue-700 */
}

/* Topic title */
.prose .topic-title {
  font-weight: 600;
  color: #111827; /* gray-900 */
  line-height: 1.4;
  margin: 0;
  font-size: 15px;
}

/* Topic metadata (Idea: ...) */
.prose .topic-metadata {
  font-size: 13px;
  color: #6b7280; /* gray-500 */
  font-weight: 400;
  margin: 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  background: #f9fafb;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  display: inline-block;
  width: fit-content;
}

/* ID references within metadata */
.prose .topic-metadata .entity-id {
  color: #3730a3; /* indigo-800 */
  font-weight: 500;
  background: #e0e7ff; /* indigo-100 */
  padding: 1px 4px;
  border-radius: 3px;
  margin: 0 1px;
}

/* Primary Content - Main Response Text */
.prose p {
  margin: 0 0 20px 0 !important;
  line-height: 1.75 !important;
  color: #1f2937 !important; /* gray-800 */
}

.prose p:last-child {
  margin-bottom: 0 !important;
}

/* Headers within responses */
.prose h1 {
  font-size: 24px !important;
  font-weight: 700 !important;
  margin: 32px 0 16px 0 !important;
  color: #111827 !important;
  line-height: 1.3 !important;
}

.prose h2 {
  font-size: 20px !important;
  font-weight: 600 !important;
  margin: 28px 0 14px 0 !important;
  color: #111827 !important;
  line-height: 1.4 !important;
}

.prose h3 {
  font-size: 18px !important;
  font-weight: 600 !important;
  margin: 24px 0 12px 0 !important;
  color: #111827 !important;
  line-height: 1.4 !important;
}

.prose h4 {
  font-size: 16px !important;
  font-weight: 600 !important;
  margin: 20px 0 10px 0 !important;
  color: #374151 !important;
  line-height: 1.5 !important;
}

/* Lists */
.prose ul, .prose ol {
  margin: 20px 0 !important;
  padding-left: 24px !important;
}

.prose ul {
  list-style-type: disc !important;
}

.prose ol {
  list-style-type: decimal !important;
}

.prose li {
  margin: 8px 0 !important;
  line-height: 1.7 !important;
}

/* Links */
.prose a {
  color: #4f46e5 !important; /* indigo-600 */
  text-decoration: underline !important;
  transition: color 0.15s ease !important;
}

.prose a:hover {
  color: #4338ca !important; /* indigo-700 */
}

/* Code */
.prose code {
  background: #f3f4f6 !important; /* gray-100 */
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace !important;
  font-size: 14px !important;
  color: #1f2937 !important;
}

/* =============================================================================
   ENTITY REFERENCES - Interactive Graph Node Pills
   ============================================================================= */

/* Base entity reference styling */
.prose .entity-reference {
  display: inline-block;
  text-decoration: none !important;
  border-radius: 6px;
  padding: 3px 10px;
  margin: 0 2px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
  white-space: nowrap;
}

/* Pool-specific color schemes */
.prose .entity-pool-idea {
  color: #1e40af; /* blue-800 */
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); /* blue-100 to blue-200 */
  border: 1px solid #93c5fd; /* blue-300 */
}

.prose .entity-pool-idea:hover {
  color: #1e3a8a; /* blue-900 */
  background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%); /* blue-200 to blue-300 */
  border-color: #60a5fa; /* blue-400 */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.prose .entity-pool-manifest {
  color: #166534; /* green-800 */
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); /* green-100 to green-200 */
  border: 1px solid #86efac; /* green-300 */
}

.prose .entity-pool-manifest:hover {
  color: #14532d; /* green-900 */
  background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
  border-color: #4ade80; /* green-400 */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.prose .entity-pool-experience {
  color: #7c2d12; /* orange-800 */
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%); /* orange-100 to orange-200 */
  border: 1px solid #fb923c; /* orange-300 */
}

.prose .entity-pool-experience:hover {
  color: #7c2d12; /* orange-900 */
  background: linear-gradient(135deg, #fdba74 0%, #fb923c 100%);
  border-color: #f97316; /* orange-400 */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(251, 146, 60, 0.2);
}

.prose .entity-pool-relational {
  color: #6b21a8; /* purple-800 */
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%); /* purple-100 to purple-200 */
  border: 1px solid #d8b4fe; /* purple-300 */
}

.prose .entity-pool-relational:hover {
  color: #581c87; /* purple-900 */
  background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
  border-color: #c084fc; /* purple-400 */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}

/* Generic/unknown pool fallback */
.prose .entity-reference:not([class*="entity-pool-"]) {
  color: #374151; /* gray-700 */
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%); /* gray-100 to gray-200 */
  border: 1px solid #d1d5db; /* gray-300 */
}

.prose .entity-reference:not([class*="entity-pool-"]):hover {
  color: #1f2937; /* gray-800 */
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  border-color: #9ca3af; /* gray-400 */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.15);
}

/* Icon indicator for interactive elements */
.prose .entity-reference::before {
  content: '◈';
  margin-right: 4px;
  opacity: 0.6;
  font-size: 10px;
  vertical-align: middle;
}

/* Loading state for when fetching entity data */
.prose .entity-reference.loading {
  opacity: 0.6;
  cursor: wait;
}

.prose .entity-reference.loading::after {
  content: '...';
  position: absolute;
  right: -15px;
  animation: pulse 1.5s infinite;
}

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

/* =============================================================================
   ENTITY POPUP - Detailed Entity Information
   ============================================================================= */

/* Main popup container */
.entity-popup {
  position: fixed;
  z-index: 9999;
  background: transparent;
  display: none;
  animation: fadeIn 0.2s ease;
}

.entity-popup.visible {
  display: block;
}

.entity-popup.hidden {
  display: none;
}

/* Popup content box */
.entity-popup-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 420px;
  min-width: 320px;
  overflow: hidden;
}

/* Popup header */
.entity-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.entity-popup-pool {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #4b5563;
}

.entity-popup-pool.pool-idea {
  background: #dbeafe;
  color: #1e40af;
}

.entity-popup-pool.pool-manifest {
  background: #dcfce7;
  color: #166534;
}

.entity-popup-pool.pool-experience {
  background: #fed7aa;
  color: #7c2d12;
}

.entity-popup-pool.pool-relational {
  background: #f3e8ff;
  color: #6b21a8;
}

.entity-popup-pool.pool-actor {
  background: #ede9fe;
  color: #5b21b6;
}

.entity-popup-pool.pool-spatial {
  background: #e0f2fe;
  color: #075985;
}

.entity-popup-pool.pool-method {
  background: #fef3c7;
  color: #92400e;
}

.entity-popup-pool.pool-evolutionary {
  background: #fce7f3;
  color: #9f1239;
}

.entity-popup-pool.pool-emanation {
  background: #f0fdfa;
  color: #134e4a;
}

.entity-popup-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.entity-popup-close:hover {
  background: #e5e7eb;
  color: #1f2937;
}

/* Popup body */
.entity-popup-body {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.entity-popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.entity-popup-details {
  margin-bottom: 16px;
}

.entity-description {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.entity-temporal,
.entity-spatial {
  font-size: 13px;
  color: #6b7280;
  margin: 4px 0;
}

.entity-popup-relationships {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.entity-popup-relationships h4 {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.entity-popup-relationships ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.entity-popup-relationships li {
  padding: 4px 0;
  font-size: 13px;
  color: #4b5563;
}

.relationship-verb {
  color: #6b7280;
  font-style: italic;
  margin-right: 4px;
}

.entity-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.entity-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Popup footer */
.entity-popup-footer {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.entity-popup-explore {
  display: inline-flex;
  align-items: center;
  color: #4f46e5;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.entity-popup-explore:hover {
  color: #4338ca;
}

/* Quick preview tooltip */
.entity-quick-preview {
  position: absolute;
  background: rgba(31, 41, 55, 0.95);
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9998;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.entity-quick-preview.visible {
  opacity: 1;
}

.entity-quick-preview .preview-text {
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.025em;
}

.entity-quick-preview::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid #1f2937;
}

.preview-pool {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin-right: 6px;
}

.preview-name {
  font-weight: 500;
}

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

/* =============================================================================
   CITATION LISTS - Source References
   ============================================================================= */

/* Citations container - visually separated from main content */
.prose .citations {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid #e5e7eb; /* gray-200 */
  position: relative;
}

.prose .citations::before {
  content: 'Citations';
  position: absolute;
  top: -12px;
  left: 0;
  background: #ffffff;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #374151; /* gray-700 */
  text-transform: uppercase;
  letter-spacing: 0.75px;
}

/* Citation list styling */
.prose ul.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Individual citation entries - more compact and professional */
.prose ul.source-list li {
  background: #ffffff;
  border: 1px solid #e5e7eb; /* gray-200 */
  border-radius: 6px;
  padding: 12px 16px;
  margin: 0;
  transition: all 0.15s ease;
  position: relative;
  border-left: 3px solid #9ca3af; /* gray-400 */
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.prose ul.source-list li:hover {
  background: #f9fafb; /* gray-50 */
  border-color: #d1d5db; /* gray-300 */
  border-left-color: #3b82f6; /* blue-500 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Citation content typography */
.prose ul.source-list li p {
  margin: 0;
  line-height: 1.5;
  font-size: 13px;
  color: #374151; /* gray-700 */
}

/* Citation item labels (Idea:, ID:, etc.) */
.prose ul.source-list li .citation-type {
  color: #6b7280; /* gray-500 */
  font-weight: 500;
}

.prose ul.source-list li .citation-title {
  color: #111827; /* gray-900 */
  font-weight: 600;
}

.prose ul.source-list li .citation-id {
  color: #3730a3; /* indigo-800 */
  background: #e0e7ff; /* indigo-100 */
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}

/* Entity references within citations */
.prose ul.source-list li a[data-node-id] {
  background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%); /* purple-200 to purple-300 */
  border-color: #c4b5fd; /* purple-300 */
  color: #581c87; /* purple-900 */
}

.prose ul.source-list li a[data-node-id]:hover {
  background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%); /* purple-300 to purple-400 */
  border-color: #a78bfa; /* purple-400 */
  color: #4c1d95; /* purple-900 */
}

/* =============================================================================
   CONFIDENCE & METADATA INDICATORS
   ============================================================================= */

/* Confidence indicators */
.prose .confidence-indicator {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  opacity: 0.8;
}

.prose .confidence-high {
  background: #dcfce7; /* green-100 */
  color: #166534; /* green-800 */
}

.prose .confidence-medium {
  background: #fef3c7; /* yellow-100 */
  color: #92400e; /* yellow-800 */
}

.prose .confidence-low {
  background: #fee2e2; /* red-100 */
  color: #991b1b; /* red-800 */
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
  .prose {
    font-size: 15px;
    line-height: 1.6;
  }
  
  .prose p {
    margin-bottom: 20px;
  }
  
  .prose a[data-node-id] {
    font-size: 14px;
    padding: 1px 6px;
  }
  
  .prose ul.source-list li {
    padding: 12px 16px;
  }
  
  .prose .citations {
    margin-top: 24px;
    padding-top: 20px;
  }
}

/* =============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================= */

/* Focus states for keyboard navigation */
.prose a[data-node-id]:focus {
  outline: 2px solid #6366f1; /* indigo-500 */
  outline-offset: 2px;
  background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .prose a[data-node-id] {
    border-width: 2px;
    font-weight: 600;
  }
  
  .prose ul.source-list li {
    border-width: 2px;
  }
}
