/**
 * Progress Bubbles CSS
 * Styling for real-time asset download progress indicators
 */

/* Progress Bubble Container */
.progress-bubble {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.progress-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.progress-bubble.removing {
  opacity: 0;
  transform: translateY(-10px);
}

/* Progress Bubble Header */
.progress-bubble-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-icon {
  font-size: 20px;
  color: #0d6efd;
  animation: pulse 2s ease-in-out infinite;
}

.progress-bubble.downloading .progress-icon {
  animation: spin 1s linear infinite;
}

.progress-bubble.complete .progress-icon,
.progress-bubble.error .progress-icon {
  animation: none;
}

.progress-status-text {
  font-weight: 500;
  color: #212529;
  flex: 1;
}

/* Progress Bar Container */
.progress-bar-container {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0d6efd, #0dcaf0);
  border-radius: 3px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

.progress-bar.complete {
  background: linear-gradient(90deg, #198754, #20c997);
}

.progress-bar.complete::before {
  animation: none;
}

/* Progress Details */
.progress-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #6c757d;
}

.progress-file-counter {
  font-weight: 600;
  color: #495057;
}

.progress-current-file {
  color: #6c757d;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-error-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  color: #dc3545;
}

.progress-error-item i {
  font-size: 14px;
}

/* State Classes */
.progress-bubble.complete {
  border-color: #198754;
  background: #d1e7dd;
}

.progress-bubble.error {
  border-color: #dc3545;
  background: #f8d7da;
}

/* Dark Mode Support */
body[data-theme="dark"] .progress-bubble {
  background: var(--bg-secondary, #151515);
  border-color: var(--border, #2a2a2a);
  box-shadow: var(--shadow-md);
}

body[data-theme="dark"] .progress-status-text {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .progress-bar-container {
  background: var(--bg-tertiary, #1f1f1f);
}

body[data-theme="dark"] .progress-file-counter {
  color: var(--text-secondary, #a3a3a3);
}

body[data-theme="dark"] .progress-current-file {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .progress-bubble.complete {
  background: #1a3a2a;
  border-color: #198754;
}

body[data-theme="dark"] .progress-bubble.error {
  background: #3a1a1a;
  border-color: #dc3545;
}

body[data-theme="dark"] .progress-details {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .progress-bubble .progress-message {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .progress-bubble .progress-bar {
  background: var(--bg-tertiary, #1f1f1f);
}

/* Asset Grid Dark Mode */
body[data-theme="dark"] .asset-grid-item {
  background: var(--bg-tertiary, #1f1f1f);
  border-color: var(--border, #2a2a2a);
}

body[data-theme="dark"] .asset-grid-item:hover {
  background: var(--hover-bg, #252525);
}

body[data-theme="dark"] .asset-grid-item.downloading {
  background: #1c3d5a;
  border-color: #0d6efd;
}

body[data-theme="dark"] .asset-grid-item.success {
  background: #1a3a2a;
  border-color: #198754;
}

body[data-theme="dark"] .asset-grid-item.error {
  background: #3a1a1a;
  border-color: #dc3545;
}

body[data-theme="dark"] .asset-grid-item.skipped {
  background: var(--bg-secondary, #151515);
  border-color: var(--text-muted, #737373);
}

body[data-theme="dark"] .asset-icon {
  color: var(--text-secondary, #a3a3a3);
}

body[data-theme="dark"] .asset-name {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .asset-bubble {
  background: var(--bg-secondary, #151515);
}

body[data-theme="dark"] .asset-bubble.complete {
  background: #1a3a2a;
}

body[data-theme="dark"] .asset-bubble-icon {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .asset-status {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .asset-image-preview {
  background: var(--bg-tertiary, #1f1f1f);
  border-color: var(--border, #2a2a2a);
}

body[data-theme="dark"] .progress-asset-grid::-webkit-scrollbar-track {
  background: var(--bg-secondary, #151515);
}

body[data-theme="dark"] .progress-asset-grid::-webkit-scrollbar-thumb {
  background: var(--text-muted, #737373);
}

body[data-theme="dark"] .progress-asset-grid::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary, #a3a3a3);
}

/* Asset Grid Layout (for many files) */
.progress-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.asset-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: default;
  min-height: 70px;
}

.asset-grid-item:hover {
  background: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.asset-grid-item.downloading {
  border-color: #0d6efd;
  background: #cfe2ff;
}

.asset-grid-item.downloading .asset-icon {
  animation: pulse 1.5s ease-in-out infinite;
  color: #0d6efd;
}

.asset-grid-item.success {
  border-color: #198754;
  background: #d1e7dd;
}

.asset-grid-item.error {
  border-color: #dc3545;
  background: #f8d7da;
}

.asset-grid-item.skipped {
  border-color: #6c757d;
  background: #e9ecef;
  opacity: 0.7;
}

.asset-icon {
  font-size: 24px;
  margin-bottom: 4px;
  color: #6c757d;
}

.asset-name {
  font-size: 10px;
  text-align: center;
  color: #495057;
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
}

.asset-grid-item.success .asset-name,
.asset-grid-item.error .asset-name,
.asset-grid-item.skipped .asset-name {
  font-weight: 500;
}

/* Grid Layout Modifications */
.progress-bubble.grid-layout {
  max-height: 400px;
  overflow: hidden;
}

.progress-bubble.grid-layout .progress-details {
  margin-bottom: 8px;
}

/* Scrollbar Styling for Asset Grid */
.progress-asset-grid::-webkit-scrollbar {
  width: 6px;
}

.progress-asset-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.progress-asset-grid::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.progress-asset-grid::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Agent Progress Specific Styles */
.progress-bubble .progress-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bubble .progress-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.progress-bubble .progress-text {
  flex: 1;
  min-width: 0;
}

.progress-bubble .progress-message {
  font-size: 14px;
  font-weight: 500;
  color: #212529;
  display: block;
  margin-bottom: 8px;
}

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

.progress-bubble .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d6efd, #0dcaf0);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Single Asset Bubble Styles (SINGLE MODE) */
.asset-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.asset-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.asset-bubble.downloading {
  border-left: 3px solid #0d6efd;
}

.asset-bubble.complete {
  border-left: 3px solid #198754;
  background: #d1e7dd;
}

.asset-bubble-icon {
  font-size: 24px;
  color: #6c757d;
}

.asset-bubble.complete .asset-bubble-icon {
  color: #198754;
}

.asset-bubble-content {
  flex: 1;
  min-width: 0;
}

.asset-name {
  font-weight: 500;
  font-size: 14px;
  color: #212529;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-status {
  font-size: 12px;
  color: #6c757d;
  margin-top: 2px;
}

.asset-image-preview {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  background: white;
  border: 1px solid #dee2e6;
}

.asset-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Remove animation */
.asset-bubble.removing {
  opacity: 0;
  transform: translateX(20px);
}

/* Responsive */
@media (max-width: 576px) {
  .progress-bubble {
    padding: 12px;
    margin: 8px 0;
  }

  .progress-bubble-header {
    gap: 8px;
    margin-bottom: 10px;
  }

  .progress-icon {
    font-size: 18px;
  }

  .progress-status-text {
    font-size: 14px;
  }

  .progress-details {
    font-size: 12px;
  }

  .progress-current-file {
    font-size: 11px;
  }

  /* Asset Grid Responsive */
  .progress-asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
    max-height: 150px;
  }

  .asset-grid-item {
    padding: 6px;
    min-height: 60px;
  }

  .asset-icon {
    font-size: 20px;
  }

  .asset-name {
    font-size: 9px;
  }
}
