/* TypeAgent Website Library - Full Page Design */
/* Copyright (c) Microsoft Corporation. Licensed under the MIT License. */

/* CSS Variables */
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #f8f9ff;
  --border-color: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --sidebar-width: 300px;
  --header-height: 60px;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --border-radius: 0.5rem;
  --border-radius-sm: 0.375rem;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);

  /* Cache indicator colors */
  --cache-fresh-bg: #d4edda;
  --cache-fresh-border: #c3e6cb;
  --cache-fresh-text: #155724;
  --cache-stale-bg: #fff3cd;
  --cache-stale-border: #ffeeba;
  --cache-stale-text: #856404;
  --cache-error-bg: #f8d7da;
  --cache-error-border: #f5c6cb;
  --cache-error-text: #721c24;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: #f8f9fa;
}

/* Top Navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  z-index: 1000;
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--spacing-lg);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-color);
}

.nav-brand i {
  font-size: 1.25rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-connected {
  background-color: var(--success-color);
}

.status-disconnected {
  background-color: var(--danger-color);
}

.status-importing {
  background-color: var(--warning-color);
  animation: pulse 1.5s infinite;
}

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

.settings-btn {
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: var(--accent-color);
}

/* Import Dropdown */
.import-dropdown {
  position: relative;
}

.import-btn {
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-btn:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: var(--accent-color);
}

.import-dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  display: none;
  min-width: 200px;
  padding: 0.5rem 0;
  margin: 0.25rem 0 0;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

.import-dropdown .dropdown-menu.show {
  display: block;
}

.import-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 1rem;
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.import-dropdown .dropdown-item:hover {
  background-color: var(--accent-color);
  color: var(--primary-color);
}

.import-dropdown .dropdown-item i {
  width: 16px;
  margin-right: 0.5rem;
}

/* Main Container */
.main-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  padding-top: var(--header-height);
}

/* Sidebar */
.sidebar {
  background: white;
  border-right: 1px solid var(--border-color);
  padding: var(--spacing-lg);
  overflow-y: auto;
  height: calc(100vh - var(--header-height));
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin: 0 0 var(--spacing-md) 0;
}

/* Main Navigation */
.main-nav {
  margin-bottom: var(--spacing-xl);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  width: 100%;
  padding: var(--spacing-md);
  border: none;
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  margin-bottom: var(--spacing-sm);
  transition: all 0.2s ease;
}

.nav-item:hover {
  background-color: var(--accent-color);
  color: var(--primary-color);
}

.nav-item.active {
  background-color: var(--primary-color);
  color: white;
}

.nav-item i {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

/* Quick Stats */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  max-width: 1200px; /* Prevent cards from getting too wide on very large screens */
}

/* Enhanced stat items for better visual hierarchy */
.quick-stats .stat-item {
  min-width: 200px;
  max-width: 280px; /* Prevent cards from getting too wide */
  transition: all 0.2s ease;
}

.quick-stats .stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* Improved stat number sizing */
.quick-stats .stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
}

.quick-stats .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

.stat-item {
  text-align: center;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.stat-number {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

/* Quick Actions */
.quick-actions {
  margin-bottom: var(--spacing-xl);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  border-color: var(--primary-color);
  background-color: var(--accent-color);
  color: var(--primary-color);
}

.action-btn.primary {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.action-btn.primary:hover {
  background-color: #5a6fd8;
  border-color: #5a6fd8;
}

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

/* Top Domains */
.top-domains {
  margin-bottom: var(--spacing-xl);
}

.domain-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.domain-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
}

.domain-name {
  color: var(--text-primary);
  font-weight: 500;
}

.domain-count {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* AI Insights */
.ai-insights {
  margin-bottom: var(--spacing-xl);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

.insight-item {
  text-align: center;
  padding: var(--spacing-sm);
  background: linear-gradient(135deg, var(--accent-color) 0%, #e9ecff 100%);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.insight-number {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-xs);
}

.insight-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

.empty-message {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: var(--spacing-md);
}

/* Search Interface */
.search-interface {
  background: white;
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow);
  margin-bottom: var(--spacing-xl);
}

.search-bar {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.search-input {
  flex: 1;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-btn {
  padding: var(--spacing-md) var(--spacing-lg);
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-btn:hover {
  background-color: #5a6fd8;
}

/* Search Modes */
/* Search Filters */
.search-filters {
  margin-bottom: var(--spacing-lg);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
}

.filter-toggle:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-content {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-sm);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
}

.date-inputs {
  display: flex;
  gap: var(--spacing-sm);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.8rem;
  cursor: pointer;
}

.checkbox-item input {
  margin: 0;
}

/* Recent Searches */
.recent-searches {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.recent-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#recentSearchesList {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.recent-search-tag {
  display: inline-block;
  background-color: #e9ecef;
  color: #495057;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.recent-search-tag:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Search Results */
.search-results {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--spacing-xl);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.results-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.view-modes {
  display: flex;
  gap: var(--spacing-xs);
}

.view-btn {
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.view-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* AI Summary */
.ai-summary {
  background: linear-gradient(135deg, var(--accent-color) 0%, #e9ecff 100%);
  border-left: 4px solid var(--primary-color);
  padding: var(--spacing-lg);
  margin: var(--spacing-lg);
  border-radius: var(--border-radius-sm);
}

.summary-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.summary-content {
  color: var(--text-primary);
  line-height: 1.6;
}

/* Related Entities */
.entities-section {
  background: linear-gradient(135deg, #f0f8f0 0%, #e8f5e8 100%);
  border-left: 4px solid #28a745;
  padding: var(--spacing-lg);
  margin: var(--spacing-lg);
  border-radius: var(--border-radius-sm);
}

.entities-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  color: #28a745;
  margin-bottom: var(--spacing-sm);
}

.entities-content {
  color: var(--text-primary);
}

.entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(40, 167, 69, 0.2);
  transition: all 0.2s ease;
}

.entity-tag:hover {
  background: rgba(40, 167, 69, 0.15);
  border-color: rgba(40, 167, 69, 0.3);
  transform: translateY(-1px);
}

.entity-count {
  background: rgba(40, 167, 69, 0.8);
  color: white;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 0.75rem;
  margin-left: 2px;
}

/* Search Insights Card */
.search-insights-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: var(--spacing-lg);
  overflow: hidden;
}

.insights-card-header {
  background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-lg);
}

.insights-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-color);
}

.insights-subtitle {
  margin: var(--spacing-xs) 0 0 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.insights-content {
  padding: var(--spacing-lg);
}

.insight-section {
  margin-bottom: var(--spacing-lg);
}

.insight-section:last-child {
  margin-bottom: 0;
}

.insight-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--border-color);
}

.insight-content {
  color: var(--text-primary);
}

/* Update individual section styling for card context */
#topTopicsSection .insight-header {
  color: #ff9800;
  border-bottom-color: rgba(255, 152, 0, 0.2);
}

#suggestedFollowupsSection .insight-header {
  color: #17a2b8;
  border-bottom-color: rgba(23, 162, 184, 0.2);
}

#entitiesSection .insight-header {
  color: #28a745;
  border-bottom-color: rgba(40, 167, 69, 0.2);
}

/* Topic tags in card context */
.insight-content .topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.insight-content .topic-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 152, 0, 0.1);
  color: #ff9800;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(255, 152, 0, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
}

.insight-content .topic-tag:hover {
  background: rgba(255, 152, 0, 0.15);
  border-color: rgba(255, 152, 0, 0.3);
  transform: translateY(-1px);
}

/* Clickable topic tags */
.insight-content .clickable-topic {
  cursor: pointer;
  position: relative;
}

.insight-content .clickable-topic::after {
  content: "🔗";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.insight-content .clickable-topic:hover::after {
  opacity: 0.7;
}

.insight-content .clickable-topic:hover {
  background: rgba(255, 152, 0, 0.2);
  border-color: rgba(255, 152, 0, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 152, 0, 0.2);
}

/* Followup suggestions in card context */
.insight-content .followup-suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.insight-content .followup-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: rgba(23, 162, 184, 0.1);
  color: #17a2b8;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  border: 1px solid rgba(23, 162, 184, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.insight-content .followup-item:hover {
  background: rgba(23, 162, 184, 0.15);
  border-color: rgba(23, 162, 184, 0.3);
  transform: translateY(-1px);
  color: #17a2b8;
  text-decoration: none;
}

.insight-content .followup-item i {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Entity tags in card context */
.insight-content .entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.insight-content .entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(40, 167, 69, 0.2);
  transition: all 0.2s ease;
}

.insight-content .entity-tag:hover {
  background: rgba(40, 167, 69, 0.15);
  border-color: rgba(40, 167, 69, 0.3);
  transform: translateY(-1px);
}

/* Clickable entity tags */
.insight-content .clickable-entity {
  cursor: pointer;
  position: relative;
}

.insight-content .clickable-entity::after {
  content: "🔗";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.insight-content .clickable-entity:hover::after {
  opacity: 0.7;
}

.insight-content .clickable-entity:hover {
  background: rgba(40, 167, 69, 0.2);
  border-color: rgba(40, 167, 69, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.2);
}

.insight-content .entity-count {
  background: rgba(40, 167, 69, 0.8);
  color: white;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 0.75rem;
  margin-left: 2px;
}

/* Results Container */
.results-container {
  padding: var(--spacing-lg);
}

/* Content Sections */
.content-section {
  margin-bottom: var(--spacing-xl);
}

.section-header {
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.section-title i {
  color: var(--primary-color);
}

/* Discovery Grid */
.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--spacing-lg);
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.card-body {
  padding: var(--spacing-lg);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--spacing-sm) 0;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

.empty-state h6 {
  font-size: 1.125rem;
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.pagination-controls {
  display: flex;
  gap: var(--spacing-sm);
}

/* Responsive Design */
@media (max-width: 1199px) {
  .main-container {
    grid-template-columns: 250px 1fr;
  }

  :root {
    --sidebar-width: 250px;
  }

  /* Adjust quick-stats for medium screens */
  .quick-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .quick-stats .stat-item {
    min-width: 180px;
  }
}

@media (max-width: 991px) {
  .main-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: -300px;
    width: 300px;
    height: calc(100vh - var(--header-height));
    z-index: 999;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .content-area {
    grid-column: 1;
  }

  /* Adjust quick-stats for tablet screens */
  .quick-stats {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .quick-stats .stat-item {
    min-width: 160px;
  }
}

@media (max-width: 767px) {
  .nav-container {
    padding: 0 var(--spacing-md);
  }

  .content-area {
    padding: var(--spacing-md);
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .results-grid,
  .discovery-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  /* Adjust quick-stats for mobile screens */
  .quick-stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .quick-stats .stat-item {
    min-width: 140px;
  }

  .quick-stats .stat-number {
    font-size: 1.5rem;
  }
}

/* Utility Classes */
.text-primary {
  color: var(--primary-color) !important;
}
.text-success {
  color: var(--success-color) !important;
}
.text-warning {
  color: var(--warning-color) !important;
}
.text-danger {
  color: var(--danger-color) !important;
}
.text-info {
  color: var(--info-color) !important;
}

.mb-3 {
  margin-bottom: var(--spacing-lg) !important;
}
.me-2 {
  margin-right: var(--spacing-sm) !important;
}

/* Search Result Items */
.search-result-item {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

.search-result-item:last-child {
  border-bottom: none;
}

.result-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.result-domain {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-score {
  font-size: 0.8rem;
  color: var(--primary-color);
  font-weight: 500;
}

.entity-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  background-color: var(--accent-color);
  color: var(--primary-color);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Result Card for Grid View */
.result-card {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

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

/* Timeline View */
.timeline-item {
  margin-bottom: var(--spacing-xl);
  padding-left: var(--spacing-lg);
  border-left: 2px solid var(--border-color);
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0;
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
}

.timeline-date {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

/* Domain View */
.domain-group {
  margin-bottom: var(--spacing-xl);
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.domain-header {
  background: #f8f9fa;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.domain-header .badge {
  background-color: var(--text-muted) !important;
}

/* Reading Pattern Chart */
.reading-pattern-chart {
  display: flex;
  align-items: end;
  gap: var(--spacing-sm);
  height: 120px;
  padding: var(--spacing-md) 0;
}

.pattern-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.pattern-bar {
  background-color: var(--primary-color);
  width: 100%;
  max-width: 30px;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.pattern-item.peak .pattern-bar {
  opacity: 1;
  background-color: var(--secondary-color);
}

.pattern-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
}

/* Chart Placeholder */
.chart-placeholder {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Page Content */
.page-content {
  display: none;
  padding: var(--spacing-xl);
}

.page-content.active {
  display: block;
}

.page-header {
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.page-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Content Area */
.content-area {
  overflow-y: auto;
  height: calc(100vh - var(--header-height));
  background: #f8f9fa;
}

/* Bootstrap Modal Compatibility */
/* Hide Bootstrap's modal-backdrop since we have our own background layer */
.modal-backdrop {
  display: none !important;
}
/* Enhanced View Mode Switching and Animations */
.view-modes {
  display: flex;
  gap: var(--spacing-xs);
  background: #f8f9fa;
  padding: 4px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.view-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: calc(var(--border-radius-sm) - 2px);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.875rem;
  font-weight: 500;
}

.view-btn:hover {
  color: var(--primary-color);
  background: rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.view-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
}

.view-btn.active::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  z-index: -1;
  opacity: 0.1;
}

.view-btn i {
  font-size: 1rem;
}

/* View Mode Animations */
.results-container {
  padding: var(--spacing-lg);
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.results-container.transitioning {
  pointer-events: none;
}

.results-content {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center top;
}

.results-content.fade-out {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
}

.results-content.fade-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Enhanced List View */
.search-result-item {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.search-result-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  transition: width 0.3s ease;
}

.search-result-item:hover {
  background-color: #f8f9ff;
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.1);
}

.search-result-item:hover::before {
  width: 4px;
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Inline Insights */
.insight-bar {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.insight-content {
  display: inline-block;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  flex: 1;
}

.insight-section {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.insight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.insight-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.insight-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.insight-chip i {
  font-size: 0.7rem;
}

.topic-chip {
  background-color: rgba(102, 126, 234, 0.1);
  color: var(--primary-color);
  border-color: rgba(102, 126, 234, 0.2);
}

.topic-chip:hover {
  background-color: rgba(102, 126, 234, 0.2);
  border-color: var(--primary-color);
}

.topic-chip.primary {
  background-color: rgba(102, 126, 234, 0.15);
  font-weight: 600;
}

.topic-chip.secondary {
  background-color: rgba(102, 126, 234, 0.08);
}

.topic-chip.related {
  background-color: rgba(102, 126, 234, 0.05);
  opacity: 0.9;
}

.entity-chip {
  background-color: rgba(88, 166, 255, 0.1);
  color: #1976d2;
  border-color: rgba(88, 166, 255, 0.2);
}

.entity-chip:hover {
  background-color: rgba(88, 166, 255, 0.2);
  border-color: #1976d2;
}

.chip-name {
  line-height: 1;
}

.chip-count {
  background-color: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
}

.chip-meta {
  font-size: 0.65rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.insight-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.insight-count {
  padding: 2px 8px;
  background-color: #f0f0f0;
  border-radius: 10px;
  font-weight: 500;
}

.insight-relevance {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--success-color);
  font-weight: 600;
}

.insight-relevance i {
  font-size: 0.7rem;
}

/* Enhanced Grid View */
.grid-view .results-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-lg);
}

.result-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(102, 126, 234, 0.05) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.result-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.result-card:hover::before {
  opacity: 1;
}

/* Enhanced Timeline View */
.timeline-view .results-content {
  position: relative;
  padding-left: var(--spacing-xl);
}

.timeline-view .results-content::before {
  content: "";
  position: absolute;
  left: var(--spacing-lg);
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--primary-color),
    var(--secondary-color)
  );
  opacity: 0.3;
}

.timeline-item {
  margin-bottom: var(--spacing-xl);
  position: relative;
  background: white;
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--spacing-xl) - 4px);
  top: var(--spacing-lg);
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--primary-color);
  transition: all 0.3s ease;
}

.timeline-item:hover {
  transform: translateX(8px);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}

.timeline-item:hover::before {
  background: var(--secondary-color);
  box-shadow: 0 0 0 2px var(--secondary-color);
  transform: scale(1.2);
}

.timeline-date {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.timeline-date::before {
  content: "📅";
  font-size: 1rem;
}

/* Enhanced Domain View */
.domain-view .results-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.domain-group {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.domain-group:hover {
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
  border-color: var(--primary-color);
}

.domain-header {
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.domain-header::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
}

.domain-header .badge {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  ) !important;
  color: white !important;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-weight: 500;
}

/* Knowledge Visualization Enhancements */
.knowledge-badges {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
  margin-top: var(--spacing-sm);
}

.knowledge-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.knowledge-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  opacity: 0.1;
  transition: opacity 0.3s ease;
}

.knowledge-badge:hover::before {
  opacity: 0.2;
}

.knowledge-badge.entity {
  background: linear-gradient(135deg, #17a2b8, #20c997);
  color: white;
}

.knowledge-badge.topic {
  background: linear-gradient(135deg, #6f42c1, #e83e8c);
  color: white;
}

.knowledge-badge.action {
  background: linear-gradient(135deg, #fd7e14, #ffc107);
  color: white;
}

.knowledge-badge.extracted {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

/* Confidence indicators */
.confidence-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.confidence-bar {
  width: 30px;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #dc3545, #ffc107, #28a745);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Responsive enhancements */
@media (max-width: 768px) {
  .view-modes {
    width: 100%;
    justify-content: space-between;
  }

  .view-btn {
    flex: 1;
    justify-content: center;
  }

  .grid-view .results-content {
    grid-template-columns: 1fr;
  }

  .timeline-view .results-content {
    padding-left: var(--spacing-md);
  }

  .timeline-item::before {
    left: calc(-1 * var(--spacing-md) - 4px);
  }
}
/* Knowledge Visualization Dashboard */
.knowledge-dashboard {
  margin-top: var(--spacing-lg);
}

.knowledge-overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.knowledge-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
}

.knowledge-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.knowledge-card-header {
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  position: relative;
}

.knowledge-card-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.knowledge-card.entities .knowledge-card-header::after {
  background: linear-gradient(90deg, #17a2b8, #20c997);
}

.knowledge-card.topics .knowledge-card-header::after {
  background: linear-gradient(90deg, #6f42c1, #e83e8c);
}

.knowledge-card.actions .knowledge-card-header::after {
  background: linear-gradient(90deg, #fd7e14, #ffc107);
}

.knowledge-card-header i {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.knowledge-card-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.knowledge-card-body {
  padding: var(--spacing-lg);
}

.knowledge-metric {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.knowledge-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-lg);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Entity Knowledge Breakdown */
.knowledge-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  background: #f8f9fa;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
}

.breakdown-item:hover {
  background: var(--accent-color);
  transform: translateX(4px);
}

.breakdown-type {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breakdown-count {
  font-weight: 600;
  color: var(--primary-color);
  background: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
}

/* Topic Cloud */
.topic-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.topic-tag {
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.topic-tag::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.topic-tag:hover::before {
  opacity: 1;
}

.topic-tag span {
  position: relative;
  z-index: 1;
}

.topic-tag.size-large {
  font-size: 1rem;
  padding: 0.5rem 1rem;
}

.topic-tag.size-medium {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

.topic-tag.size-small {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

/* Recent Items Display */
.recent-items-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.recent-items-list {
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.recent-item {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.recent-item:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateX(2px);
}

.recent-item .item-icon {
  margin-right: 0.5rem;
  opacity: 0.7;
  font-size: 0.75rem;
}

.recent-item .item-content {
  flex: 1;
  min-width: 0;
}

.recent-item .item-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.recent-item .item-meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
  display: flex;
  gap: 0.5rem;
}

.recent-item .item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 0.5rem;
}

.recent-item.entity-item .item-icon {
  color: #17a2b8;
}

.recent-item.topic-item .item-icon {
  color: #6f42c1;
}

.recent-item.action-item .item-icon {
  color: #fd7e14;
}

.recent-items-list .empty-message {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1rem;
  font-style: italic;
}

/* Entity Pills */
.entity-pill {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
  border: 1px solid rgba(23, 162, 184, 0.2);
  border-radius: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  max-width: 200px;
}

.entity-pill:hover {
  background: linear-gradient(135deg, #e9ecff 0%, #dde2ff 100%);
  border-color: rgba(23, 162, 184, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.15);
}

.entity-pill .pill-icon {
  color: #17a2b8;
  margin-right: 0.5rem;
  font-size: 0.75rem;
}

.entity-pill .pill-content {
  flex: 1;
  min-width: 0;
}

.entity-pill .pill-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.entity-pill .pill-type {
  font-size: 0.7rem;
  color: #17a2b8;
  opacity: 0.8;
  font-weight: 400;
  margin-top: 0.125rem;
}

/* Enhanced styles for clickable entity pills */
.entity-pill.clickable {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.entity-pill.clickable:hover {
  background: linear-gradient(135deg, #e1e7ff 0%, #d4dcff 100%);
  border-color: rgba(23, 162, 184, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.2);
}

.entity-pill.clickable:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(23, 162, 184, 0.15);
}

.entity-pill.clickable::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid #17a2b8;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.entity-pill.clickable:hover::after {
  opacity: 0.6;
}

/* Topic Pills */
.topic-pill {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: linear-gradient(135deg, #f8f2ff 0%, #f0e6ff 100%);
  border: 1px solid rgba(111, 66, 193, 0.2);
  border-radius: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  max-width: 200px;
}

.topic-pill:hover {
  background: linear-gradient(135deg, #f0e6ff 0%, #e6d9ff 100%);
  border-color: rgba(111, 66, 193, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(111, 66, 193, 0.15);
}

.topic-pill .pill-icon {
  color: #6f42c1;
  margin-right: 0.5rem;
  font-size: 0.75rem;
}

.topic-pill .pill-content {
  flex: 1;
  min-width: 0;
}

.topic-pill .pill-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.topic-pill .pill-type {
  font-size: 0.7rem;
  color: #6f42c1;
  opacity: 0.8;
  font-weight: 400;
  margin-top: 0.125rem;
}

/* Relationship Items */
.relationship-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius-sm);
  margin-bottom: 0.25rem;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  max-width: 100%;
  word-wrap: break-word;
}

.relationship-item:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--primary-color);
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.relationship-item .fw-semibold {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
}

.relationship-item .text-muted {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.75rem;
}

.relationship-item .bi-arrow-right {
  color: var(--text-muted);
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Action Pills */
.action-pill {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: linear-gradient(135deg, #fff8f0 0%, #fff0e6 100%);
  border: 1px solid rgba(253, 126, 20, 0.2);
  border-radius: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  max-width: 200px;
}

.action-pill:hover {
  background: linear-gradient(135deg, #fff0e6 0%, #ffe6d9 100%);
  border-color: rgba(253, 126, 20, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(253, 126, 20, 0.15);
}

.action-pill .pill-icon {
  color: #fd7e14;
  margin-right: 0.5rem;
  font-size: 0.75rem;
}

.action-pill .pill-content {
  flex: 1;
  min-width: 0;
}

.action-pill .pill-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.action-pill .pill-type {
  font-size: 0.7rem;
  color: #fd7e14;
  opacity: 0.8;
  font-weight: 400;
  margin-top: 0.125rem;
}

/* Scrollbar styling for recent items */
.recent-items-list::-webkit-scrollbar {
  width: 4px;
}

.recent-items-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}

.recent-items-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.recent-items-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Action Breakdown */
.action-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.action-type {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm);
  background: #f8f9fa;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
}

.action-type:hover {
  background: linear-gradient(135deg, #fff8f0, #f8f9fa);
  transform: translateX(4px);
}

.action-type i {
  font-size: 1.125rem;
  color: #fd7e14;
  width: 1.5rem;
  text-align: center;
}

.action-type span:first-of-type {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.action-count {
  font-weight: 600;
  color: #fd7e14;
  background: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
}

/* Enhanced AI Insights Section */
.ai-insights .insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

.insight-item {
  text-align: center;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--accent-color) 0%, #e9ecff 100%);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.insight-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
}

.insight-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.insight-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: var(--spacing-xs);
}

.insight-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.025em;
}

/* Knowledge Confidence Indicators Enhancement */
.confidence-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #f8f9fa;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.confidence-bar {
  width: 40px;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.confidence-fill {
  height: 100%;
  border-radius: 3px;
  transition: all 0.3s ease;
  position: relative;
}

.confidence-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Mobile Responsiveness for Knowledge Dashboard */
@media (max-width: 768px) {
  .knowledge-overview-cards {
    grid-template-columns: 1fr;
  }

  .topic-cloud {
    justify-content: center;
  }

  .knowledge-metric {
    font-size: 2rem;
  }

  .ai-insights .insights-grid {
    grid-template-columns: 1fr;
  }
}
/* Knowledge Tooltips */
.knowledge-tooltip {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  max-width: 300px;
  z-index: 9999;
  animation: tooltipFadeIn 0.2s ease-out;
}

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

.tooltip-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.tooltip-header i {
  color: var(--primary-color);
  font-size: 1.125rem;
}

.tooltip-header strong {
  color: var(--text-primary);
  font-size: 0.875rem;
}

.tooltip-content {
  padding: var(--spacing-md);
}

.tooltip-content p {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tooltip-examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.example-tag {
  background: var(--accent-color);
  color: var(--primary-color);
  padding: 0.125rem 0.375rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.75rem;
  font-weight: 500;
}

.status-indicator.success {
  color: var(--success-color);
}

/* Knowledge Progress Visualization */
.knowledge-progress-grid {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

.progress-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.progress-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-percentage {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 3rem;
  text-align: right;
}

/* Quality Distribution Visualization */
.quality-distribution {
  display: flex;
  height: 40px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  margin: var(--spacing-md) 0;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quality-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.quality-segment:hover {
  filter: brightness(1.1);
  z-index: 1;
  transform: scaleY(1.1);
}

.quality-segment.high {
  background: linear-gradient(135deg, #28a745, #20c997);
}

.quality-segment.medium {
  background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.quality-segment.low {
  background: linear-gradient(135deg, #dc3545, #c82333);
}

.quality-label {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.quality-legend {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-color.high {
  background: linear-gradient(135deg, #28a745, #20c997);
}

.legend-color.medium {
  background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.legend-color.low {
  background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Enhanced Knowledge Badges with Interactions */
.knowledge-badge {
  position: relative;
  overflow: hidden;
}

.knowledge-badge::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.3s ease;
}

.knowledge-badge:hover::after {
  left: 100%;
}

.knowledge-badge:active {
  transform: scale(0.95);
}

/* View Mode Transition Loading */
.view-transition-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  color: var(--text-muted);
}

.view-transition-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e9ecef;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Mobile Enhancements */
@media (max-width: 768px) {
  .knowledge-tooltip {
    max-width: 250px;
    font-size: 0.8rem;
  }

  .progress-item {
    gap: var(--spacing-xs);
  }

  .quality-distribution {
    height: 30px;
  }

  .quality-legend {
    justify-content: center;
    gap: var(--spacing-sm);
  }

  .knowledge-progress-grid {
    gap: var(--spacing-md);
  }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  .progress-fill::after,
  .confidence-fill::after,
  .knowledge-badge::after {
    animation: none;
  }

  .view-transition-spinner {
    animation: none;
    border-top-color: var(--primary-color);
  }

  .results-content,
  .knowledge-card,
  .view-btn {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .knowledge-badge,
  .topic-tag,
  .quality-segment {
    border: 2px solid currentColor;
  }

  .progress-bar {
    border: 1px solid var(--text-primary);
  }

  .knowledge-tooltip {
    border: 2px solid var(--text-primary);
  }
}

.suggested-search-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.suggested-search-item:hover {
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
  transform: translateY(-2px);
}

.suggestion-content {
  flex-grow: 1;
}

.suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.suggestion-query {
  font-weight: 600;
  color: #212529;
}

.suggestion-category-tag {
  background-color: #e9ecef;
  color: #6c757d;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
}

.suggestion-description {
  color: #6c757d;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.suggestion-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.suggestion-results {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #6c757d;
}

.suggestion-action {
  color: #007bff;
  transition: transform 0.2s ease-in-out;
}

.suggested-search-item:hover .suggestion-action {
  transform: translateX(4px);
}

.suggestion-more {
  text-align: center;
  margin-top: 1rem;
}

.empty-message {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  border: 2px dashed #dee2e6;
}

.empty-message i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* Enhanced Analytics Styles */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: all 0.2s ease-in-out;
}

.metric-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: #495057;
  font-weight: 600;
}

.metric-header i {
  font-size: 1.25rem;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: bold;
  color: #212529;
  margin-bottom: 1rem;
}

.metric-progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress {
  height: 8px;
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  transition: width 0.5s ease-in-out;
}

.progress-bar.bg-purple {
  background: linear-gradient(90deg, #7b1fa2, #9c27b0);
}

.progress-label {
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
}

/* Animation Classes */
.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

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

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

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

.fade-out {
  animation: fadeOut 0.2s ease-out;
}

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

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Enhanced Result Cards */
.result-card {
  transition: all 0.3s ease-in-out;
  border: 1px solid #e9ecef;
}

.result-card:hover {
  border-color: #007bff;
  box-shadow: 0 8px 24px rgba(0, 123, 255, 0.15);
  transform: translateY(-4px);
}

.result-score {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.result-title {
  transition: color 0.2s ease-in-out;
}

.result-title:hover {
  color: #007bff !important;
}

.result-snippet {
  line-height: 1.4;
}

.result-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

/* Enhanced Search Interface */
.search-interface {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem;
  padding-right: 3.5rem;
  border: 2px solid #e9ecef;
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 0.2s ease-in-out;
}

.search-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
  outline: none;
}

.search-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: #007bff;
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.search-btn:hover {
  background: #0056b3;
  transform: translateY(-50%) scale(1.05);
}

.search-modes {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mode-label {
  font-weight: 600;
  color: #495057;
  white-space: nowrap;
}

.mode-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-size: 0.875rem;
  font-weight: 500;
}

.mode-btn:hover {
  border-color: #007bff;
  color: #007bff;
  transform: translateY(-1px);
}

.mode-btn.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

.mode-btn.active:hover {
  background: #0056b3;
  border-color: #0056b3;
}

/* View Mode Buttons */
.view-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-size: 0.875rem;
}

.view-btn:hover {
  border-color: #007bff;
  color: #007bff;
}

.view-btn.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

/* Enhanced Filters */
.search-filters {
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 500;
  color: #495057;
  background: #f8f9fa;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
}

.filter-toggle:hover {
  background: #e9ecef;
}

.filter-content {
  padding: 1rem;
  border-top: 1px solid #e9ecef;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 500;
  color: #495057;
  font-size: 0.875rem;
}

.date-inputs {
  display: flex;
  gap: 0.5rem;
}

.date-inputs input {
  flex: 1;
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
  .search-interface {
    padding: 1rem;
  }

  .mode-buttons {
    justify-content: center;
  }

  .mode-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .knowledge-badges {
    justify-content: center;
  }

  .result-actions {
    opacity: 1; /* Always show on mobile */
  }
}

@media (max-width: 576px) {
  .confidence-indicator {
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.7rem;
  }

  .confidence-bar {
    width: 100%;
  }

  .suggested-search-item {
    padding: 0.75rem;
  }

  .knowledge-tooltip {
    max-width: 280px;
    font-size: 0.8rem;
  }
}

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

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

/* Enhanced Transitions */
.results-container {
  transition: all 0.3s ease-in-out;
}

.results-container.transitioning {
  pointer-events: none;
}

.results-content {
  transition:
    opacity 0.2s ease-in-out,
    transform 0.2s ease-in-out;
}

.page-content {
  transition:
    opacity 0.3s ease-out,
    transform 0.3s ease-out;
}

.page-content:not(.active) {
  display: none;
}

/* Focus States for Accessibility */
.knowledge-badge:focus,
.confidence-indicator:focus,
.suggested-search-item:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.mode-btn:focus,
.view-btn:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .knowledge-tooltip,
  .search-interface,
  .result-actions {
    display: none !important;
  }

  .search-result-item,
  .result-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* Enhanced Knowledge Display Styles */
.topic-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.topic-tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.topic-tag.size-large {
  padding: 6px 12px;
  font-size: 0.875rem;
  background-color: #e7f3ff;
  color: #0d47a1;
  border-color: #90caf9;
}

.topic-tag.size-medium {
  padding: 5px 10px;
  font-size: 0.8rem;
  background-color: #f3e5f5;
  color: #4a148c;
  border-color: #ce93d8;
}

.topic-tag.size-small {
  padding: 4px 8px;
  font-size: 0.75rem;
  background-color: #e8f5e8;
  color: #1b5e20;
  border-color: #a5d6a7;
}

.topic-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-color: #666;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}

.breakdown-item:last-child {
  border-bottom: none;
}

.breakdown-type {
  font-weight: 500;
  color: #333;
  flex: 1;
  margin-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-count {
  font-size: 0.75rem;
  color: #666;
  text-align: right;
  min-width: fit-content;
}

.knowledge-card .knowledge-breakdown {
  max-height: 300px;
  overflow-y: auto;
}

.knowledge-card .knowledge-breakdown::-webkit-scrollbar {
  width: 4px;
}

.knowledge-card .knowledge-breakdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.knowledge-card .knowledge-breakdown::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.knowledge-card .knowledge-breakdown::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Top Domains Styling */
.loading-message,
.error-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #6c757d;
  font-style: italic;
}

.loading-message i,
.error-message i {
  margin-right: 8px;
  font-size: 1.1rem;
}

.error-message {
  color: #dc3545;
}

.domain-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e5e5e5;
  transition: background-color 0.2s ease;
}

.domain-item:hover {
  background-color: #f8f9fa;
}

.domain-item:last-child {
  border-bottom: none;
}

.domain-info {
  display: flex;
  align-items: center;
  flex-grow: 1;
}

.domain-favicon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border-radius: 2px;
}

.domain-details {
  flex-grow: 1;
}

.domain-name {
  font-weight: 500;
  margin-bottom: 2px;
  color: #333;
}

.domain-stats {
  font-size: 0.875rem;
  color: #6c757d;
  display: flex;
  gap: 8px;
}

.site-count {
  font-weight: 500;
}

.percentage {
  color: #007bff;
}

.domain-bar {
  width: 60px;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  margin-left: 12px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #007bff, #28a745);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.domain-list {
  background: white;
  border-radius: 0.375rem;
  border: 1px solid #e5e5e5;
  overflow: hidden;
}

.top-domains {
  margin-top: 16px;
}

/* Activity Charts Styling */
.activity-summary {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  justify-content: center;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #495057;
}

.activity-chart {
  margin-top: 20px;
}

.chart-container {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 200px;
  padding: 16px 0;
  border-bottom: 1px solid #e9ecef;
  border-left: 1px solid #e9ecef;
  margin-bottom: 20px;
  position: relative;
}

.chart-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  height: 100%;
  position: relative;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.chart-bar:hover {
  opacity: 0.8;
}

.bar-segment {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  transition: all 0.3s ease;
}

.bar-segment.visits {
  background: linear-gradient(180deg, #007bff, #0056b3);
  margin-bottom: 1px;
}

.bar-segment.bookmarks {
  background: linear-gradient(180deg, #28a745, #1e7e34);
}

.bar-label {
  position: absolute;
  bottom: -25px;
  font-size: 0.75rem;
  color: #6c757d;
  text-align: center;
  width: 100%;
  transform: rotate(-45deg);
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.legend-color.visits {
  background: linear-gradient(180deg, #007bff, #0056b3);
}

.legend-color.bookmarks {
  background: linear-gradient(180deg, #28a745, #1e7e34);
}

.empty-message small {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Discover View Styling */
.reading-pattern-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 100px;
  padding: 10px 0;
  gap: 5px;
}

.pattern-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.pattern-bar {
  width: 100%;
  max-width: 30px;
  background: linear-gradient(180deg, #007bff, #0056b3);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: all 0.3s ease;
}

.pattern-item.peak .pattern-bar {
  background: linear-gradient(180deg, #28a745, #1e7e34);
  box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
}

.pattern-time {
  font-size: 0.7rem;
  color: #6c757d;
  margin-top: 5px;
  text-align: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.discover-card {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.discover-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.trending-topic-card {
  border-left: 3px solid #007bff;
  transition: all 0.3s ease;
}

.trending-topic-card.trend-up {
  border-left-color: #28a745;
}

.trending-topic-card.trend-down {
  border-left-color: #dc3545;
}

.trend-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Website Import UI Styles */
/* Import Options */
.import-option {
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.import-option:hover {
  border-color: #667eea;
  background-color: #f8f9ff;
}

.import-option.selected {
  border-color: #667eea;
  background-color: #f0f2ff;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* File Drop Zone */
.file-drop-zone {
  position: relative;
  border: 2px dashed #dee2e6;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s ease;
  background-color: #f8f9fa;
}

.file-drop-zone:hover {
  border-color: #667eea;
  background-color: #f0f2ff;
}

.file-drop-zone.drag-over {
  border-color: #667eea;
  background-color: #e3f2fd;
  border-style: solid;
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  transition: all 0.2s ease;
}

.drop-zone-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #667eea;
}

.overlay-content {
  text-align: center;
  color: #667eea;
}

/* File List */
.file-list-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
}

.file-item {
  transition: background-color 0.15s ease;
}

.file-item:hover {
  background-color: #f8f9fa;
}

.file-item:last-child {
  border-bottom: none !important;
}

/* Import Progress */
.progress-container {
  padding: 2rem;
}

/* Modal Overrides */
.import-modal .modal-header {
  border-bottom: none;
}

.import-modal .form-check-label {
  cursor: pointer;
}

.import-modal .collapse .card {
  border: none;
  box-shadow: none;
}

.import-modal .btn-outline-secondary:hover {
  color: #495057;
  background-color: #f8f9fa;
  border-color: #dee2e6;
}

/* Modal Animations */
.modal-entering .modal-dialog {
  animation: modalSlideIn 0.3s ease-out;
}

.modal-exiting .modal-dialog {
  animation: modalSlideOut 0.3s ease-in;
}

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

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

/* Transition Animations */
.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

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

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

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

/* Progress Animations */
.progress-pulse {
  animation: progressPulse 1.5s infinite;
}

@keyframes progressPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
  }
}

.status-updating {
  animation: statusUpdate 0.2s ease;
}

@keyframes statusUpdate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* File Item Animations */
.file-item-enter {
  animation: fileItemEnter 0.3s ease;
}

.file-item-exit {
  animation: fileItemExit 0.3s ease forwards;
}

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

@keyframes fileItemExit {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.drop-success {
  animation: dropSuccess 0.5s ease;
}

@keyframes dropSuccess {
  0% {
    background-color: inherit;
  }
  50% {
    background-color: rgba(40, 167, 69, 0.1);
  }
  100% {
    background-color: inherit;
  }
}

/* Extraction Mode Slider Styles */
.extraction-mode-slider-container {
  position: relative;
  margin: 0.5rem 0 1rem 0;
}

.extraction-mode-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  outline: none;
  appearance: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.extraction-mode-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.extraction-mode-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.extraction-mode-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.extraction-mode-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  position: relative;
}

.slider-label {
  font-size: 0.7rem;
  color: #6c757d;
  text-align: center;
  flex: 1;
  cursor: pointer;
  transition: color 0.2s ease;
  user-select: none;
}

.slider-label.active {
  color: #667eea;
  font-weight: 600;
}

.slider-ticks {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.slider-tick {
  width: 6px;
  height: 6px;
  background: #dee2e6;
  border-radius: 50%;
  border: 1px solid white;
  transition: background-color 0.2s ease;
}

.slider-tick.active {
  background: #667eea;
}

/* Slider mode colors */
.extraction-mode-slider[data-mode="basic"] {
  background: linear-gradient(
    to right,
    #28a745 0%,
    #28a745 25%,
    #e9ecef 25%,
    #e9ecef 100%
  );
}

.extraction-mode-slider[data-mode="basic"]::-webkit-slider-thumb {
  background: #28a745;
}

.extraction-mode-slider[data-mode="basic"]::-moz-range-thumb {
  background: #28a745;
}

.extraction-mode-slider[data-mode="summary"] {
  background: linear-gradient(
    to right,
    #28a745 0%,
    #28a745 25%,
    #ffc107 25%,
    #ffc107 50%,
    #e9ecef 50%,
    #e9ecef 100%
  );
}

.extraction-mode-slider[data-mode="summary"]::-webkit-slider-thumb {
  background: #ffc107;
}

.extraction-mode-slider[data-mode="summary"]::-moz-range-thumb {
  background: #ffc107;
}

.extraction-mode-slider[data-mode="content"] {
  background: linear-gradient(
    to right,
    #28a745 0%,
    #28a745 25%,
    #ffc107 25%,
    #ffc107 50%,
    #667eea 50%,
    #667eea 75%,
    #e9ecef 75%,
    #e9ecef 100%
  );
}

.extraction-mode-slider[data-mode="content"]::-webkit-slider-thumb {
  background: #667eea;
}

.extraction-mode-slider[data-mode="content"]::-moz-range-thumb {
  background: #667eea;
}

.extraction-mode-slider[data-mode="full"] {
  background: linear-gradient(
    to right,
    #28a745 0%,
    #28a745 25%,
    #ffc107 25%,
    #ffc107 50%,
    #667eea 50%,
    #667eea 75%,
    #dc3545 75%,
    #dc3545 100%
  );
}

.extraction-mode-slider[data-mode="full"]::-webkit-slider-thumb {
  background: #dc3545;
}

.extraction-mode-slider[data-mode="full"]::-moz-range-thumb {
  background: #dc3545;
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .modal-entering .modal-dialog,
  .modal-exiting .modal-dialog,
  .fade-out,
  .fade-in,
  .progress-pulse,
  .status-updating,
  .file-item-enter,
  .file-item-exit,
  .drop-success {
    animation: none !important;
  }

  .file-drop-zone.drag-over {
    transform: none !important;
  }

  .import-option:hover,
  .file-item:hover {
    transform: none !important;
  }
}

/* ===================================================================
   CACHE INDICATORS
   =================================================================== */

.cache-indicator-container {
  margin: var(--spacing-md) 0;
  display: none;
}

.cache-indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  border: 1px solid;
  animation: slideInDown 0.3s ease-out;
}

.cache-indicator i {
  font-size: 1rem;
  flex-shrink: 0;
}

.cache-indicator span {
  font-weight: 500;
  color: inherit;
}

.cache-indicator small {
  margin-left: auto;
  opacity: 0.8;
  font-size: 0.75rem;
}

/* Fresh cache indicator */
.cache-indicator.fresh {
  background-color: var(--cache-fresh-bg);
  border-color: var(--cache-fresh-border);
  color: var(--cache-fresh-text);
}

.cache-indicator.fresh i {
  color: var(--success-color);
}

/* Stale cache indicator */
.cache-indicator.stale {
  background-color: var(--cache-stale-bg);
  border-color: var(--cache-stale-border);
  color: var(--cache-stale-text);
}

.cache-indicator.stale i {
  color: var(--warning-color);
}

/* Error cache indicator */
.cache-indicator.error {
  background-color: var(--cache-error-bg);
  border-color: var(--cache-error-border);
  color: var(--cache-error-text);
}

.cache-indicator.error i {
  color: var(--danger-color);
}

.cache-indicator .retry-btn {
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: var(--spacing-sm);
}

.cache-indicator .retry-btn:hover {
  background-color: currentColor;
  color: white;
}

/* Background refresh indicator */
.background-refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-left: var(--spacing-md);
  opacity: 0.7;
  animation: fadeIn 0.3s ease-in;
}

/* Cache indicator animations */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.7;
  }
}

/* Responsive adjustments for cache indicators */
@media (max-width: 768px) {
  .cache-indicator {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }

  .cache-indicator small {
    margin-left: 0;
    margin-top: var(--spacing-xs);
  }

  .cache-indicator .retry-btn {
    margin-left: 0;
    margin-top: var(--spacing-xs);
    align-self: flex-start;
  }
}

/* Facets styling */
.facets-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.facet-item {
  display: flex;
  align-items: flex-start;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #667eea;
  transition: background-color 0.2s ease;
}

.facet-item:hover {
  background-color: #e9ecef;
}

.facet-name {
  font-weight: 600;
  color: #495057;
  margin-right: 0.5rem;
  min-width: 80px;
  flex-shrink: 0;
}

.facet-value {
  color: #6c757d;
  word-break: break-word;
  flex: 1;
}

.facet-link {
  color: #0d6efd;
  text-decoration: none;
}

.facet-link:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .facet-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .facet-name {
    min-width: auto;
  }
}

/* Knowledge Graph Modal Styles */
.knowledge-graph-status {
  padding: 1rem 0;
}

.status-card {
  background: #f8f9fa;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.status-header h6 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

.status-icon {
  font-size: 0.875rem;
}

.metric-card {
  background: white;
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.metric-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#buildProgress .spinner-border {
  width: 2rem;
  height: 2rem;
}

.progress {
  background-color: #e9ecef;
  border-radius: 0.5rem;
}

.progress-bar {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  border-radius: 0.5rem;
  transition: width 0.3s ease;
}

/* Markdown content styling in AI summary */
#summaryContent {
  line-height: 1.6;
  color: var(--text-color);
}

#summaryContent h1,
#summaryContent h2,
#summaryContent h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

#summaryContent h1 {
  font-size: 1.5em;
}
#summaryContent h2 {
  font-size: 1.3em;
}
#summaryContent h3 {
  font-size: 1.1em;
}

#summaryContent ul,
#summaryContent ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

#summaryContent li {
  margin: 0.25em 0;
}

#summaryContent code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9em;
}

#summaryContent pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 1em;
  border-radius: 5px;
  overflow-x: auto;
}

#summaryContent pre code {
  background: none;
  padding: 0;
}

#summaryContent blockquote {
  border-left: 3px solid var(--primary-color);
  padding-left: 1em;
  margin: 0.5em 0;
  color: var(--text-secondary);
}

#summaryContent a {
  color: var(--link-color);
  text-decoration: none;
}

#summaryContent a:hover {
  text-decoration: underline;
}

#summaryContent strong {
  font-weight: 600;
}

#summaryContent em {
  font-style: italic;
}

#summaryContent p {
  margin: 0.5em 0;
}

#summaryContent p:first-child {
  margin-top: 0;
}

#summaryContent p:last-child {
  margin-bottom: 0;
}

/* ===================================================================
   TOPIC TIMELINE STYLES
   ================================================================== */

/* Topic Timeline CSS Variables */
:root {
  --timeline-bookmark-color: #1976d2;
  --timeline-bookmark-bg: #e3f2fd;
  --timeline-visit-color: #388e3c;
  --timeline-visit-bg: #e8f5e8;
  --timeline-extraction-color: #f57c00;
  --timeline-extraction-bg: #fff3e0;
  --timeline-line-color: #e0e0e0;
  --timeline-marker-size: 24px;
  --timeline-preview-height: auto;
}

/* Enhanced Topic Tags */
.topic-tag-enhanced {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  overflow: hidden;
  transition: all 0.2s ease;
  background: white;
}

.topic-tag-enhanced:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background-color: var(--accent-color);
  border-bottom: 1px solid var(--border-color);
}

.topic-name {
  font-weight: 600;
  color: var(--text-primary);
  flex-grow: 1;
}

.topic-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.topic-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-actions .btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.topic-timeline-preview {
  padding: var(--spacing-md);
  background-color: white;
  min-height: var(--timeline-preview-height);
}

.timeline-loading {
  text-align: center;
  color: var(--text-muted);
  padding: var(--spacing-md);
  font-size: 0.875rem;
}

.timeline-loading i {
  margin-right: var(--spacing-xs);
  animation: spin 1s linear infinite;
}

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

/* Topic Pills Section */
.topic-pills-section {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background-color: var(--accent-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.topic-pills-section .section-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 0.4rem 0.75rem;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-pill:hover {
  border-color: var(--primary-color);
  background-color: rgba(102, 126, 234, 0.05);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topic-pill .pill-name {
  font-weight: 500;
  color: var(--text-primary);
}

.topic-pill .pill-actions {
  display: flex;
  gap: 0.25rem;
  margin-left: 0.25rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-color);
}

.topic-pill .btn-xs {
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.topic-pill .btn-xs:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Topic Timeline Cards in Timeline View */
.topic-timelines-section {
  margin-bottom: var(--spacing-xl);
}

.topic-timelines-section .section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--border-color);
}

.topic-timeline-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.topic-timeline-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: linear-gradient(to right, var(--accent-color), white);
  border-bottom: 1px solid var(--border-color);
}

.topic-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.topic-card-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.topic-card-actions .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-card-actions .btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.topic-timeline-preview-inline {
  padding: var(--spacing-md);
  background-color: white;
  min-height: 150px;
}

/* Timeline Statistics */
.timeline-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.activity-count {
  font-weight: 600;
  color: var(--text-primary);
}

.activity-types {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.activity-type {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.activity-type.bookmarks {
  background-color: var(--timeline-bookmark-bg);
  color: var(--timeline-bookmark-color);
}

.activity-type.visits {
  background-color: var(--timeline-visit-bg);
  color: var(--timeline-visit-color);
}

.activity-type.extractions {
  background-color: var(--timeline-extraction-bg);
  color: var(--timeline-extraction-color);
}

/* Timeline Preview Items */
.timeline-preview-items {
  margin-bottom: 0.75rem;
}

.timeline-item-preview {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.timeline-item-preview:last-child {
  border-bottom: none;
}

.timeline-item-preview:hover {
  background-color: var(--accent-color);
}

.activity-icon {
  width: var(--timeline-marker-size);
  height: var(--timeline-marker-size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.activity-icon.bookmark {
  background-color: var(--timeline-bookmark-bg);
  color: var(--timeline-bookmark-color);
}

.activity-icon.visit {
  background-color: var(--timeline-visit-bg);
  color: var(--timeline-visit-color);
}

.activity-icon.extraction {
  background-color: var(--timeline-extraction-bg);
  color: var(--timeline-extraction-color);
}

.activity-details {
  flex-grow: 1;
  min-width: 0;
}

.activity-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.activity-meta {
  display: flex;
  gap: var(--spacing-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.activity-date,
.activity-domain {
  white-space: nowrap;
}

.activity-domain {
  opacity: 0.8;
}

/* Timeline Actions */
.timeline-actions {
  text-align: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.view-full-timeline {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--primary-color);
  background: white;
  color: var(--primary-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-full-timeline:hover {
  background-color: var(--primary-color);
  color: white;
}

/* ===================================================================
   TIMELINE MODAL STYLES
   ================================================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.modal-content {
  background-color: white;
  margin: 2rem auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.timeline-modal .modal-content {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--accent-color);
  flex-shrink: 0;
}

.modal-header h5 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-grow: 1;
}

.timeline-summary {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: var(--spacing-md);
}

.total-activities,
.time-range {
  white-space: nowrap;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
}

.btn-close:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.modal-header-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-close-btn {
  flex-shrink: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border-color);
  background-color: var(--accent-color);
  gap: var(--spacing-sm);
}

.modal-close-footer-btn {
  padding: 0.5rem 1.5rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex-grow: 1;
}

/* Timeline Filters */
.timeline-filters {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.filter-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Timeline Container */
.timeline-container {
  position: relative;
}

.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--timeline-line-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
  margin-bottom: var(--spacing-md);
}

.timeline-item:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -28px;
  top: 0;
  width: var(--timeline-marker-size);
  height: var(--timeline-marker-size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  border: 2px solid var(--timeline-line-color);
  z-index: 1;
  font-size: 0.75rem;
}

.timeline-marker.bookmark {
  border-color: var(--timeline-bookmark-color);
  background-color: var(--timeline-bookmark-bg);
  color: var(--timeline-bookmark-color);
}

.timeline-marker.visit {
  border-color: var(--timeline-visit-color);
  background-color: var(--timeline-visit-bg);
  color: var(--timeline-visit-color);
}

.timeline-marker.extraction {
  border-color: var(--timeline-extraction-color);
  background-color: var(--timeline-extraction-bg);
  color: var(--timeline-extraction-color);
}

.timeline-content {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  transition: all 0.2s ease;
}

.timeline-content:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: var(--spacing-md);
}

.activity-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  flex-grow: 1;
  line-height: 1.4;
}

.activity-title a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.activity-title a:hover {
  text-decoration: underline;
  color: var(--secondary-color);
}

.activity-time {
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.timeline-details {
  margin-top: 0.75rem;
}

.activity-meta {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.domain-badge,
.relevance-badge,
.activity-type-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.domain-badge {
  background-color: var(--accent-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.relevance-badge {
  background-color: var(--timeline-visit-bg);
  color: var(--timeline-visit-color);
}

.activity-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.activity-type-badge i {
  font-size: 0.75rem;
}

.activity-type-badge.bookmark {
  background-color: var(--timeline-bookmark-bg);
  color: var(--timeline-bookmark-color);
}

.activity-type-badge.visit {
  background-color: var(--timeline-visit-bg);
  color: var(--timeline-visit-color);
}

.activity-type-badge.extraction {
  background-color: var(--timeline-extraction-bg);
  color: var(--timeline-extraction-color);
}

/* Content Snippets */
.activity-snippet,
.knowledge-chunk {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: var(--accent-color);
  border-radius: var(--border-radius-sm);
  border-left: 3px solid var(--primary-color);
}

.knowledge-chunk {
  border-left-color: var(--timeline-extraction-color);
  background-color: var(--timeline-extraction-bg);
}

.activity-snippet p,
.knowledge-chunk p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.knowledge-chunk h6 {
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--timeline-extraction-color);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.activity-metadata {
  margin-top: 0.5rem;
  display: flex;
  gap: var(--spacing-md);
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.activity-metadata span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ===================================================================
   RESPONSIVE DESIGN FOR TIMELINES
   ================================================================== */

@media (max-width: 768px) {
  .topic-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .topic-actions {
    align-self: stretch;
    justify-content: space-between;
  }

  .timeline-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .activity-types {
    justify-content: flex-start;
  }

  .timeline-item-preview {
    padding: 0.75rem 0;
  }

  .activity-title {
    font-size: 0.8rem;
  }

  .activity-meta {
    flex-direction: column;
    gap: 0.25rem;
  }

  .modal-content {
    margin: 1rem;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 2rem);
  }

  .modal-header {
    padding: var(--spacing-md);
  }

  .timeline-summary {
    margin-left: 0;
    margin-top: var(--spacing-sm);
  }

  .timeline-filters {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: var(--spacing-md);
  }

  .timeline {
    padding-left: 30px;
  }

  .timeline::before {
    left: 15px;
  }

  .timeline-marker {
    left: -21px;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .activity-title {
    font-size: 0.9rem;
  }

  .activity-time {
    font-size: 0.8rem;
  }

  .activity-meta {
    gap: var(--spacing-xs);
  }

  .activity-metadata {
    flex-direction: column;
    gap: var(--spacing-xs);
  }
}

@media (max-width: 480px) {
  .topic-timeline-preview {
    padding: var(--spacing-sm);
  }

  .timeline-stats {
    font-size: 0.8rem;
  }

  .activity-type {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  .activity-icon {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    margin-right: var(--spacing-sm);
  }

  .activity-title {
    font-size: 0.75rem;
  }

  .activity-meta {
    font-size: 0.7rem;
  }

  .view-full-timeline {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }

  .modal-body {
    padding: var(--spacing-md);
  }

  .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* ============================================
   ICON RAIL SIDEBAR STYLES
   ============================================ */

/* CSS Variables for Icon Rail */
:root {
  --sidebar-collapsed-width: 60px;
  --sidebar-expanded-width: 220px;
  --sidebar-transition-duration: 0.3s;
  --sidebar-transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-toggle-size: 24px;
  --nav-item-height: 48px;
}

/* Main Wrapper - Adjusted for new sidebar */
.main-wrapper {
  display: flex;
  height: calc(100vh - 60px);
  margin-top: 60px;
  position: relative;
}

/* Icon Rail Sidebar Container */
.icon-rail-sidebar {
  width: var(--sidebar-collapsed-width);
  background: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width var(--sidebar-transition-duration)
    var(--sidebar-transition-easing);
  position: relative;
  z-index: 100;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

/* Force sidebar to always stay collapsed */
.icon-rail-sidebar.expanded {
  width: var(--sidebar-collapsed-width);
}

/* Toggle Button */
.sidebar-toggle-wrapper {
  position: absolute;
  right: calc(var(--sidebar-toggle-size) / -2);
  top: 20px;
  z-index: 101;
}

.sidebar-toggle {
  width: var(--sidebar-toggle-size);
  height: var(--sidebar-toggle-size);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle:hover {
  background: var(--accent-color);
  transform: scale(1.1);
}

.sidebar-toggle i {
  font-size: 12px;
  transition: transform var(--sidebar-transition-duration) ease;
}

.icon-rail-sidebar.expanded .sidebar-toggle i {
  transform: rotate(180deg);
}

/* Navigation Container */
.sidebar-nav {
  flex: 1;
  padding: var(--spacing-sm) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Navigation Items */
.nav-item {
  display: flex;
  align-items: center;
  height: var(--nav-item-height);
  padding: 0 12px;
  margin: 2px 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  color: var(--text-secondary);
}

.nav-item:hover {
  background: var(--accent-color);
  color: var(--primary-color);
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  color: var(--primary-color);
}

/* Active Indicator Bar */
.nav-item.active::before {
  content:;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 0 3px 3px 0;
}

/* Navigation Icons */
.nav-icon {
  min-width: 24px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Navigation Labels */
.nav-label {
  margin-left: var(--spacing-md);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: all var(--sidebar-transition-duration) ease;
}

.icon-rail-sidebar.expanded .nav-label {
  opacity: 1;
  width: auto;
}

/* Tooltip for Collapsed State */
.icon-rail-sidebar:not(.expanded) .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-primary);
  color: white;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

/* Tooltip Arrow */
.icon-rail-sidebar:not(.expanded) .nav-item::before {
  content: "";
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Show Tooltip on Hover (only when collapsed) */
.icon-rail-sidebar:not(.expanded) .nav-item:hover::after,
.icon-rail-sidebar:not(.expanded) .nav-item:hover::before {
  opacity: 1;
}

/* Hide tooltip arrow for active item to avoid conflict with active bar */
.icon-rail-sidebar .nav-item.active::before {
  content: none;
  border: none;
}

/* Navigation Divider */
.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--spacing-sm) 16px;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

/* Content Area Adjustments */
.content-area {
  flex: 1;
  padding: var(--spacing-lg);
  overflow-y: auto;
  transition: margin-left var(--sidebar-transition-duration)
    var(--sidebar-transition-easing);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  /* Auto-collapse on mobile */
  .icon-rail-sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .icon-rail-sidebar.expanded {
    position: absolute;
    z-index: 200;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    height: calc(100vh - 60px);
  }

  /* Show overlay when sidebar is expanded on mobile */
  .icon-rail-sidebar.expanded ~ .sidebar-overlay {
    display: block;
  }
}

/* Accessibility - Focus Styles */
.sidebar-toggle:focus,
.nav-item:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .icon-rail-sidebar,
  .nav-item,
  .nav-label,
  .sidebar-toggle i,
  .content-area {
    transition-duration: 0.01ms !important;
  }
}
