/**
 * @file
 * Styles for queue editor component.
 */

/* Queue editor container */
.ffmpeg-queue-editor {
  background: var(--ffmpeg-surface, #ffffff);
  border: 1px solid var(--ffmpeg-border, #e5e7eb);
  border-radius: 8px;
  overflow: hidden;
}

[data-ffmpeg-queue-editor] {
  display: block;
  margin-bottom: 2rem;
}

/* Header */
.ffmpeg-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--ffmpeg-border, #e5e7eb);
  background: var(--ffmpeg-surface-2, #f5f5f5);
}

.ffmpeg-queue-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ffmpeg-queue-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ffmpeg-queue-count {
  font-size: 0.875rem;
  color: var(--ffmpeg-text-muted, #6b7280);
}

.ffmpeg-queue-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Search */
.ffmpeg-queue-search {
  position: relative;
}

.ffmpeg-queue-search__input {
  padding: 0.375rem 0.75rem;
  padding-inline-start: 2rem;
  font-size: 0.875rem;
  border: 1px solid var(--ffmpeg-border-strong, #d1d5db);
  border-radius: 6px;
  background: var(--ffmpeg-surface, #ffffff);
  width: 180px;
  min-height: 44px;
}

.ffmpeg-queue-search__input:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
  border-color: var(--ffmpeg-accent, #2563eb);
}

.ffmpeg-queue-search__icon {
  position: absolute;
  inset-inline-start: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ffmpeg-text-muted, #6b7280);
  pointer-events: none;
}

/* Sort select */
.ffmpeg-queue-sort {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--ffmpeg-border-strong, #d1d5db);
  border-radius: 6px;
  background: var(--ffmpeg-surface, #ffffff);
  min-height: 44px;
}

.ffmpeg-queue-sort:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
  border-color: var(--ffmpeg-accent, #2563eb);
}

/* Refresh button */
.ffmpeg-queue-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--ffmpeg-border-strong, #d1d5db);
  border-radius: 6px;
  background: var(--ffmpeg-surface, #ffffff);
  color: var(--ffmpeg-text-muted, #6b7280);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ffmpeg-queue-refresh:hover {
  background: var(--ffmpeg-surface-3, #eef0f3);
  color: var(--ffmpeg-text, #111827);
}

.ffmpeg-queue-refresh:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
  border-color: var(--ffmpeg-accent, #2563eb);
}

/* Queue list */
.ffmpeg-queue-list {
  max-height: 500px;
  overflow-y: auto;
}

.ffmpeg-queue-notice {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--ffmpeg-warning, #f59e0b);
  background: var(--ffmpeg-warning-bg, rgba(245, 158, 11, 0.1));
  color: var(--ffmpeg-warning, #92400e);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* Loading state */
.ffmpeg-queue-loading {
  padding: 3rem;
  text-align: center;
  color: var(--ffmpeg-text-muted, #6b7280);
}

/* Empty state */
.ffmpeg-queue-empty {
  padding: 3rem;
  text-align: center;
  color: var(--ffmpeg-text-muted, #6b7280);
}

.ffmpeg-queue-empty svg {
  margin-bottom: 1rem;
}

.ffmpeg-queue-empty p {
  margin: 0;
  font-size: 0.875rem;
}

/* Error state */
.ffmpeg-queue-error {
  padding: 2rem;
  text-align: center;
  color: var(--ffmpeg-danger, #dc2626);
  background: var(--ffmpeg-danger-bg, #fee2e2);
}

/* Queue item */
.ffmpeg-queue-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ffmpeg-surface-3, #eef0f3);
  transition: background 0.15s ease;
}

.ffmpeg-queue-item:last-child {
  border-bottom: none;
}

.ffmpeg-queue-item:hover {
  background: var(--ffmpeg-surface-2, #f5f5f5);
}

.ffmpeg-queue-item:focus-visible {
  outline: none;
  box-shadow: inset var(--ffmpeg-focus-ring);
}

.ffmpeg-queue-item--dragging {
  opacity: 0.5;
  background: var(--ffmpeg-surface-3, #eef0f3);
}

.ffmpeg-queue-item--processing {
  background: var(--ffmpeg-accent-soft);
}

/* Drag handle */
.ffmpeg-queue-item__drag-handle {
  cursor: grab;
  color: var(--ffmpeg-text-muted, #6b7280);
  flex-shrink: 0;
}

.ffmpeg-queue-item__drag-handle:active {
  cursor: grabbing;
}

/* Item info */
.ffmpeg-queue-item__info {
  flex: 1;
  min-width: 0;
}

.ffmpeg-queue-item__name {
  font-weight: 500;
  color: var(--ffmpeg-text, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ffmpeg-queue-item__meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--ffmpeg-text-muted, #6b7280);
  margin-top: 0.25rem;
}

/* Status badges */
.ffmpeg-queue-item__status {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.675rem;
  font-weight: 500;
  text-transform: uppercase;
  border-radius: 10px;
}

.ffmpeg-queue-item__status--pending {
  background: var(--ffmpeg-border, #e5e7eb);
  color: var(--ffmpeg-text-muted, #6b7280);
}

.ffmpeg-queue-item__status--processing {
  background: var(--ffmpeg-info-bg, rgba(14, 165, 233, 0.1));
  color: var(--ffmpeg-accent, #2563eb);
}

.ffmpeg-queue-item__status--paused {
  background: var(--ffmpeg-warning-bg, rgba(245, 158, 11, 0.1));
  color: var(--ffmpeg-warning, #f59e0b);
}

.ffmpeg-queue-item__status--completed {
  background: var(--ffmpeg-success-bg, rgba(22, 163, 74, 0.1));
  color: var(--ffmpeg-success, #16a34a);
}

.ffmpeg-queue-item__status--failed {
  background: var(--ffmpeg-danger-bg, rgba(220, 38, 38, 0.1));
  color: var(--ffmpeg-danger, #dc2626);
}

/* WCAG 1.4.1 — status icons so color is not the sole differentiator */
.ffmpeg-queue-item__status--pending::before {
  content: "\25CB";
}

.ffmpeg-queue-item__status--processing::before {
  content: "\25B6";
}

.ffmpeg-queue-item__status--paused::before {
  content: "\23F8";
}

.ffmpeg-queue-item__status--completed::before {
  content: "\2713";
}

.ffmpeg-queue-item__status--failed::before {
  content: "\2717";
}

/* Progress bar */
.ffmpeg-queue-item__progress {
  height: 4px;
  background: var(--ffmpeg-border, #e5e7eb);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.ffmpeg-queue-item__progress-bar {
  height: 100%;
  background: var(--ffmpeg-accent, #2563eb);
  transition: width 0.3s ease;
}

.ffmpeg-queue-item__progress-text {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ffmpeg-accent, #2563eb);
  margin-top: 0.25rem;
}

/* Priority select */
.ffmpeg-queue-item__priority {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ffmpeg-queue-item__priority-label {
  font-size: 0.675rem;
  color: var(--ffmpeg-text-muted, #6b7280);
  text-transform: uppercase;
}

.ffmpeg-queue-item__priority-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--ffmpeg-border-strong, #d1d5db);
  border-radius: 4px;
  background: var(--ffmpeg-surface, #ffffff);
  min-height: 44px;
}

.ffmpeg-queue-item__priority-select:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
  border-color: var(--ffmpeg-accent, #2563eb);
}

/* Actions */
.ffmpeg-queue-item__actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ffmpeg-queue-item__action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ffmpeg-text-muted, #6b7280);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ffmpeg-queue-item__action:hover {
  background: var(--ffmpeg-surface-3, #eef0f3);
  color: var(--ffmpeg-text, #111827);
}

.ffmpeg-queue-item__action:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
}

.ffmpeg-queue-item__action--danger:hover {
  background: var(--ffmpeg-danger-bg, #fee2e2);
  color: var(--ffmpeg-danger, #dc2626);
}

/* Modal */
body.ffmpeg-queue-modal-open {
  overflow: hidden;
}

.ffmpeg-queue-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ffmpeg-queue-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.ffmpeg-queue-modal__content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--ffmpeg-surface, #ffffff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.ffmpeg-queue-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--ffmpeg-border, #e5e7eb);
}

.ffmpeg-queue-modal__header h4 {
  margin: 0;
  font-size: 1rem;
}

.ffmpeg-queue-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ffmpeg-text-muted, #6b7280);
  cursor: pointer;
}

.ffmpeg-queue-modal__close:hover {
  background: var(--ffmpeg-surface-3, #eef0f3);
  color: var(--ffmpeg-text, #111827);
}

.ffmpeg-queue-modal__close:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
}

.ffmpeg-queue-modal__body {
  padding: 1rem;
}

/* Details list */
.ffmpeg-queue-details {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.5rem;
  margin: 0;
}

.ffmpeg-queue-details dt {
  font-weight: 500;
  color: var(--ffmpeg-text-muted, #6b7280);
}

.ffmpeg-queue-details dd {
  margin: 0;
  color: var(--ffmpeg-text, #111827);
}

/* Sidebar compact layout */
.ffmpeg-dashboard-sidebar .ffmpeg-queue-header {
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-title h3 {
  font-size: 0.875rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-controls {
  width: 100%;
  gap: 0.5rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-search {
  flex: 1;
  min-width: 0;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-search__input {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.8125rem;
  padding: 0.3rem 0.5rem 0.3rem 1.75rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-sort {
  display: none;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-refresh {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item {
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__info {
  flex: 1 1 calc(100% - 32px);
  order: 1;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__drag-handle {
  order: 0;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__name {
  font-size: 0.8125rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__meta {
  font-size: 0.6875rem;
  gap: 0.5rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__priority,
.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__actions {
  order: 2;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__priority-select {
  font-size: 0.6875rem;
  padding: 0.2rem 0.375rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-item__action {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-empty {
  padding: 2rem 1rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-empty svg {
  width: 36px;
  height: 36px;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-empty p {
  font-size: 0.8125rem;
}

.ffmpeg-dashboard-sidebar .ffmpeg-queue-list {
  max-height: 350px;
}

/* Responsive */
@media (max-width: 768px) {
  .ffmpeg-queue-header {
    flex-wrap: wrap;
  }

  .ffmpeg-queue-controls {
    width: 100%;
    justify-content: space-between;
  }

  .ffmpeg-queue-search__input {
    width: 140px;
  }

  .ffmpeg-queue-item {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .ffmpeg-queue-item__info {
    flex: 1 1 calc(100% - 40px);
    order: 1;
  }

  .ffmpeg-queue-item__drag-handle {
    order: 0;
  }

  .ffmpeg-queue-item__priority,
  .ffmpeg-queue-item__actions {
    order: 2;
  }
}
