/** Custom CSS */

/* Thread Files Display Styles */
.thread-files-container {
  font-family: inherit;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.thread-files-container.minimized {
  padding-bottom: 8px;
}

.thread-files-header {
  user-select: none;
}

.thread-files-header button {
  transition: background-color 0.2s ease;
}

.thread-files-header button:hover {
  transform: scale(1.05);
}

.thread-files-header button:active {
  transform: scale(0.95);
}

.thread-files-list {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.thread-files-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.thread-files-list::-webkit-scrollbar-track {
  background: transparent;
}

.thread-files-list::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.thread-files-list::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-secondary);
}

.thread-file-item {
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.thread-file-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border-color: var(--primary, #007bff);
}

/* Responsive design */
@media (max-width: 768px) {
  .thread-files-container {
    padding: 6px 12px;
  }

  .thread-files-header {
    font-size: 13px;
  }

  .thread-file-item {
    font-size: 12px;
    padding: 3px 6px;
    max-width: 150px;
  }

  .thread-files-list {
    gap: 6px;
    max-height: 100px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .thread-files-container {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }

  .thread-file-item {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  .thread-file-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }
}

/* Animation for files appearing/disappearing */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.thread-file-item {
  animation: fadeInUp 0.3s ease;
}

/* Ensure proper integration with Chainlit UI */
#thread-files-container {
  z-index: 999;
}

/* Override any conflicting styles */
.thread-files-container * {
  box-sizing: border-box;
}

/* Loading state */
.thread-files-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 4px 0;
}

.thread-files-loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--primary, #007bff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* File upload progress indicators */
.file-upload-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--background-secondary, #f8f9fa);
  border: 1px solid var(--border, #e9ecef);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 300px;
  animation: slideInRight 0.3s ease;
}

.file-upload-indicator.success {
  border-color: #28a745;
  background: #d4edda;
}

.file-upload-indicator.error {
  border-color: #dc3545;
  background: #f8d7da;
}

.file-upload-indicator.processing {
  border-color: #007bff;
  background: #d1ecf1;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.upload-progress .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: var(--primary, #007bff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Enhanced file input styling when multiple files are being processed */
.chainlit-file-input[data-processing='true'] {
  opacity: 0.6;
  pointer-events: none;
}

.chainlit-file-input[data-processing='true']::after {
  content: 'Processing files...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 1;
}
