/* ============================================
   ATTACHMENT PREVIEW - RAF-13 Phase 1 + RAF-24 Multiple Attachments
   File preview component (above chat input)
   Supports multiple attachments displayed in a scrollable list
   ============================================ */

/* Preview Container - Optimized spacing */
.attachment-preview-container {
  position: relative;
  padding: 4px 12px;
  margin-bottom: 4px;
  display: none; /* Hidden by default */
  animation: slideDown 0.2s ease-out;
}

.attachment-preview-container.show {
  display: block;
}

/* RAF-24: Attachment List - Scrollable for multiple items */
.attachment-preview-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px; /* Max 3 items visible, then scroll */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(133, 79, 255, 0.3) transparent;
}

.attachment-preview-list::-webkit-scrollbar {
  width: 4px;
}

.attachment-preview-list::-webkit-scrollbar-track {
  background: transparent;
}

.attachment-preview-list::-webkit-scrollbar-thumb {
  background: rgba(133, 79, 255, 0.3);
  border-radius: 2px;
}

.attachment-preview-list::-webkit-scrollbar-thumb:hover {
  background: rgba(133, 79, 255, 0.5);
}

/* Preview Card - Compact layout */
.attachment-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s ease;
}

.attachment-preview-card:hover {
  background: #e9ecef;
}

/* Thumbnail/Icon Container - Smaller */
.attachment-preview-thumbnail {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-preview-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-thumbnail svg {
  width: 26px;
  height: 26px;
  color: #6c757d;
}

/* File Info */
.attachment-preview-info {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.attachment-preview-filename {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #6c757d;
}

.attachment-preview-size,
.attachment-preview-type {
  display: inline-block;
}

.attachment-preview-type::before {
  content: "•";
  margin-right: 8px;
}

/* Remove Button - Clean Style with Black X */
.attachment-preview-remove {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f3f4f6;
  color: #1f2937;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.attachment-preview-remove:hover {
  background: #e5e7eb;
  color: #000;
  transform: scale(1.1);
}

.attachment-preview-remove:active {
  transform: scale(0.95);
}

.attachment-preview-remove svg {
  width: 16px;
  height: 16px;
}

/* Video/Audio specific thumbnails */
.attachment-preview-thumbnail.video,
.attachment-preview-thumbnail.audio {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

.attachment-preview-thumbnail.video svg,
.attachment-preview-thumbnail.audio svg {
  color: white;
}

/* Voice Recording - GREEN THEME */
.attachment-preview-thumbnail.voice-recording {
  background: linear-gradient(135deg, #4BC451 0%, #3da842 100%);
}

.attachment-preview-thumbnail.voice-recording svg {
  color: white;
}

/* Other file types */
.attachment-preview-thumbnail.file {
  background: linear-gradient(135deg, #4BC451, #00b87a);
}

.attachment-preview-thumbnail.file svg {
  color: white;
}

/* Loading State */
.attachment-preview-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

.attachment-preview-card.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid #4BC451;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .attachment-preview-card {
    padding: 10px;
    gap: 10px;
  }
  
  .attachment-preview-thumbnail {
    width: 50px;
    height: 50px;
  }
  
  .attachment-preview-filename {
    font-size: 13px;
  }
  
  .attachment-preview-meta {
    font-size: 11px;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .attachment-preview-card {
    background: #2a2a2a;
    border-color: #444;
  }
  
  .attachment-preview-filename {
    color: #f5f5f5;
  }
  
  .attachment-preview-meta {
    color: #999;
  }
  
  .attachment-preview-thumbnail {
    background: #1f1f1f;
  }
  
  /* Remove button in dark mode */
  .attachment-preview-remove {
    background: #374151;
    color: #d1d5db;
  }
  
  .attachment-preview-remove:hover {
    background: #4b5563;
    color: #fff;
  }
}

