/**
 * Component Styles
 * Uploader, Comparison Slider, Batch Queue, Buttons, Badges
 */

/* Utility Visibility */
.is-hidden {
  display: none !important;
}

/* Notification Bar / Toast */
.notification-bar {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
  max-width: 90vw;
}

.notification-bar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.notification-bar.is-info {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.notification-bar.is-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.notification-bar.is-warn {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.notification-bar.is-error {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: var(--text-inverse);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
}

/* Uploader Dropzone Component */
.uploader-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-md);
  max-width: 780px;
  margin: 0 auto;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-body);
  transition: all var(--transition-normal);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dropzone:hover {
  border-color: var(--accent-primary);
  background-color: var(--accent-light);
}

.dropzone.is-dragover {
  border-color: var(--accent-primary);
  background-color: #dbeafe;
  border-style: solid;
  transform: scale(0.995);
}

.dropzone-icon-wrapper,
.dropzone-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.dropzone:hover .dropzone-icon-wrapper,
.dropzone:hover .dropzone-icon-wrap {
  transform: translateY(-2px);
}

.dropzone-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-align: center;
}

.dropzone-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-align: center;
  max-width: 480px;
}

.dropzone-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
}

.dropzone-formats,
.format-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.format-pill,
.format-pills .pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.privacy-notice,
.privacy-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 16px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.privacy-notice svg,
.privacy-note svg {
  color: #10b981;
  flex-shrink: 0;
}

/* Single Result Card */
.result-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 900px;
  margin: 0 auto;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background-color: var(--bg-body);
  border-bottom: 1px solid var(--border-subtle);
}

.provenance-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.badge-google {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-standard {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.meta-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.meta-stat-item strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Comparison Slider Component */
.comparison-container {
  position: relative;
  width: 100%;
  background-color: #0b0f19;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.comparison-wrapper {
  position: relative;
  width: 100%;
  max-height: 680px;
  overflow: hidden;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-layer {
  position: relative;
  width: 100%;
  height: 100%;
}

.comparison-layer img {
  display: block;
  max-width: 100%;
  max-height: 680px;
  margin: 0 auto;
  object-fit: contain;
  pointer-events: none;
}

.comparison-before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  pointer-events: none;
}

/* Badges positioned at TOP so they never obscure the bottom watermark */
.comparison-badge {
  position: absolute;
  top: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 15;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.badge-original {
  top: 16px;
  left: 16px;
  background-color: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
}

.badge-cleaned {
  top: 16px;
  right: 16px;
  background-color: rgba(37, 99, 235, 0.92);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
}

/* Handle */
.comparison-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background-color: #ffffff;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.handle-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background-color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  cursor: ew-resize;
}

/* Result Action Bar */
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.result-action-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

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

/* Batch Results Card */
.batch-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 860px;
  margin: 0 auto;
  overflow: hidden;
}

.batch-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.batch-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.batch-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.batch-progress-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.batch-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.batch-progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--accent-primary);
  border-radius: var(--radius-pill);
  transition: width var(--transition-normal);
}

/* Batch Items List */
.batch-list {
  max-height: 440px;
  overflow-y: auto;
  divide-y: 1px solid var(--border-subtle);
}

.batch-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.batch-item:hover {
  background-color: var(--bg-body);
}

.batch-item-preview {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
}

.batch-item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.batch-item-info {
  flex: 1;
  min-width: 0;
}

.batch-item-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-item-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.batch-item-status {
  flex-shrink: 0;
}

.batch-item-action {
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.status-pill.is-pending {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
}

.status-pill.is-processing {
  background-color: var(--accent-light);
  color: var(--accent-primary);
}

.status-pill.is-success {
  background-color: var(--success-bg);
  color: var(--success-text);
}

.status-pill.is-failed {
  background-color: var(--danger-bg);
  color: var(--danger-text);
}

.batch-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  background-color: var(--bg-body);
  border-top: 1px solid var(--border-subtle);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .uploader-card {
    padding: 10px;
  }

  .dropzone {
    padding: 36px 16px;
  }

  .dropzone-title {
    font-size: 1.125rem;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .result-action-group {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .comparison-container {
    min-height: 280px;
  }

  .batch-item {
    flex-wrap: wrap;
  }

  .batch-footer {
    flex-direction: column;
  }
}
