/* ===== MODERN DOCUMENTS PANEL STYLING ===== */

/* CSS Variables for consistent theming */
:root {
  --primary-blue: #3b82f6;
  --primary-blue-dark: #2563eb;
  --secondary-blue: #6366f1;
  --accent-purple: #8b5cf6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --success-green: #10b981;
  --warning-orange: #f59e0b;
  --danger-red: #ef4444;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== DOCUMENT SUMMARY ===== */
.docs-summary {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.docs-summary strong {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
}

.docs-summary .summary-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.docs-summary .divider {
  color: var(--text-muted);
  font-weight: 300;
  margin: 0 0.25rem;
}

/* ===== DELETE ALL BUTTON ===== */
#delete-all-docs-btn {
  background: var(--danger-red);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

#delete-all-docs-btn:hover {
  background: #dc2626;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

#delete-all-docs-btn:active {
  transform: translateY(0);
}

/* ===== HIGHLIGHT LEGEND ===== */
.hl-legend {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.hl-key {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hl-key i {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
  display: inline-block;
  flex-shrink: 0;
}

.hl-key .k-term {
  background: var(--warning-orange);
}

.hl-key .k-sent {
  background: var(--primary-blue);
}

/* ===== DOCUMENTS LIST ===== */
.docs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===== DOCUMENT ITEMS ===== */
.doc-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.doc-item:hover {
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.doc-item:active {
  transform: translateY(0);
}

.doc-item.selected {
  border-color: var(--primary-blue);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
  box-shadow: var(--shadow-md);
}

/* Override status borders when selected - use blue instead of status colors */
.doc-item.selected {
  border-left: 4px solid var(--primary-blue) !important;
}

/* ===== LOADING DOCUMENT STYLES ===== */
.doc-item.loading-doc {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-color: var(--warning-orange);
}

.doc-item.loading-doc .doc-icon i {
  color: var(--warning-orange);
}

/* ===== DOCUMENT ICON ===== */
.doc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.doc-item:hover .doc-icon {
  background: var(--primary-blue);
  color: white;
}

.doc-icon i {
  font-size: 1.25rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.doc-item:hover .doc-icon i {
  color: white;
}

/* ===== DOCUMENT NAME ===== */
.doc-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-badge {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

/* ===== DOCUMENT STATUS ===== */
.doc-item small {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0;
  min-width: 120px;
  text-align: right;
}

/* ===== DELETE BUTTON ===== */
.delete-doc-btn {
  background: var(--danger-red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  transform: scale(0.9);
  flex-shrink: 0;
}

.doc-item:hover .delete-doc-btn {
  opacity: 1;
  transform: scale(1);
}

.delete-doc-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.delete-doc-btn:active {
  transform: scale(0.95);
}

.delete-doc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: scale(0.9);
}

/* ===== EMPTY STATE ===== */
.docs-list li:only-child {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-secondary);
  /* border: 2px dashed var(--border-light); */
}

/* ===== STATUS INDICATORS ===== */
.doc-item[data-status="pending"] {
  border-left: 4px solid var(--text-muted);
}

.doc-item[data-status="processing"] {
  border-left: 4px solid var(--warning-orange);
}

.doc-item[data-status="complete"] {
  border-left: 4px solid var(--success-green);
}

.doc-item[data-status="failed"] {
  border-left: 4px solid var(--danger-red);
}

.doc-item[data-status="paused"] {
  border-left: 4px solid var(--text-secondary);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .docs-summary {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 1rem;
    gap: 0.5rem;
    font-size: 0.9rem;
  }
  
  .docs-summary strong {
    font-size: 1rem;
  }
  
  .hl-legend {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
  }
  
  .doc-item {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
  }
  
  .doc-icon {
    width: 2.25rem;
    height: 2.25rem;
  }
  
  .doc-icon i {
    font-size: 1.125rem;
  }
  
  .doc-name {
    font-size: 0.9rem;
  }
  
  .doc-item small {
    font-size: 0.75rem;
    min-width: 100px;
  }
  
  .delete-doc-btn {
    opacity: 1;
    transform: scale(1);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .docs-summary {
    padding: 1rem;
  }
  
  .hl-legend {
    padding: 0.75rem;
  }
  
  .doc-item {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .doc-icon {
    width: 2rem;
    height: 2rem;
  }
  
  .doc-icon i {
    font-size: 1rem;
  }
  
  .doc-name {
    font-size: 0.85rem;
  }
  
  .doc-item small {
    font-size: 0.7rem;
    min-width: 80px;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --bg-primary: #1f2937;
    --bg-secondary: #374151;
    --bg-tertiary: #4b5563;
    --border-light: #4b5563;
    --border-medium: #6b7280;
  }
  
  .docs-summary {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  }
  
  .hl-legend {
    background: var(--bg-secondary);
  }
  
  .doc-item {
    background: var(--bg-primary);
  }
  
  .doc-item.loading-doc {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  }
  
  .doc-icon {
    background: var(--bg-secondary);
  }
  
  .doc-item:hover .doc-icon {
    background: var(--primary-blue);
  }
}