/**
 * @file
 * Styles for batch operations toolbar.
 *
 * Uses --ffmpeg-* design system variables from dashboard.css for automatic
 * Gin dark mode compatibility. The batch toolbar is always rendered inside
 * .ffmpeg-media-dashboard, so these variables are always available.
 */

/* Batch toolbar */
.ffmpeg-batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--ffmpeg-surface-2);
  border: 1px solid var(--ffmpeg-border);
  border-radius: var(--ffmpeg-radius-m, 8px);
}

.ffmpeg-batch-toolbar--busy {
  opacity: 0.8;
}

.ffmpeg-batch-toolbar__left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ffmpeg-batch-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Select all checkbox */
.ffmpeg-batch-select-all {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  cursor: pointer;
  user-select: none;
}

.ffmpeg-batch-select-all__input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--ffmpeg-accent);
}

.ffmpeg-batch-select-all__label {
  font-size: 0.875rem;
  color: var(--ffmpeg-text);
}

/* Selected count */
.ffmpeg-batch-selected-count {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ffmpeg-accent-badge-text);
  padding: 0.25rem 0.75rem;
  background: var(--ffmpeg-accent-soft);
  border-radius: 20px;
}

/* Dropdown */
.ffmpeg-batch-dropdown {
  position: relative;
}

.ffmpeg-batch-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ffmpeg-text);
  background: var(--ffmpeg-surface);
  border: 1px solid var(--ffmpeg-border-strong);
  border-radius: var(--ffmpeg-radius-s, 6px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ffmpeg-batch-dropdown__trigger:hover:not(:disabled) {
  background: var(--ffmpeg-surface-3);
  border-color: var(--ffmpeg-accent);
}

.ffmpeg-batch-dropdown__trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ffmpeg-batch-dropdown__trigger:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
  border-color: var(--ffmpeg-accent);
}

.ffmpeg-batch-dropdown__menu {
  position: absolute;
  top: 100%;
  inset-inline-end: 0;
  z-index: 100;
  min-width: 200px;
  padding: 0.5rem 0;
  margin-top: 0.25rem;
  background: var(--ffmpeg-surface);
  border: 1px solid var(--ffmpeg-border-strong);
  border-radius: var(--ffmpeg-radius-m, 8px);
  box-shadow: var(--ffmpeg-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.ffmpeg-batch-dropdown__menu--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ffmpeg-batch-dropdown__divider {
  margin: 0.5rem 0;
  border: none;
  border-top: 1px solid var(--ffmpeg-border);
}

/* Action buttons */
.ffmpeg-batch-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  text-align: start;
  color: var(--ffmpeg-text);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ffmpeg-batch-action[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.ffmpeg-batch-action:hover {
  background: var(--ffmpeg-surface-3);
}

.ffmpeg-batch-action:focus-visible {
  outline: none;
  box-shadow: inset var(--ffmpeg-focus-ring);
  background: var(--ffmpeg-surface-3);
}

.ffmpeg-batch-action--danger {
  color: var(--ffmpeg-danger);
}

.ffmpeg-batch-action--danger:hover {
  background: var(--ffmpeg-danger-bg);
}

.ffmpeg-batch-action svg {
  flex-shrink: 0;
}

/* Profile select */
.ffmpeg-batch-profile-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ffmpeg-batch-profile {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--ffmpeg-border-strong);
  border-radius: var(--ffmpeg-radius-s, 6px);
  background: var(--ffmpeg-surface);
  color: var(--ffmpeg-text);
}

.ffmpeg-batch-profile:focus-visible,
.ffmpeg-batch-select-all__input:focus-visible,
.ffmpeg-batch-item-checkbox:focus-visible {
  outline: none;
  box-shadow: var(--ffmpeg-focus-ring);
}

/* Item checkbox wrapper — 44px touch target (WCAG 2.5.5) */
.ffmpeg-batch-item-checkbox-wrapper {
  position: absolute;
  top: 0.25rem;
  inset-inline-start: 0.25rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--ffmpeg-surface);
  border-radius: 4px;
  box-shadow: var(--ffmpeg-shadow-soft);
  opacity: 0;
  transition: opacity 0.15s ease;
}

[data-media-id]:hover .ffmpeg-batch-item-checkbox-wrapper,
.ffmpeg-batch-item-checkbox:checked ~ .ffmpeg-batch-item-checkbox-wrapper,
.ffmpeg-batch-item-checkbox-wrapper:has(:checked) {
  opacity: 1;
}

/* Show checkboxes when in selection mode */
.ffmpeg-batch-toolbar:has(.ffmpeg-batch-select-all__input:checked) ~ * .ffmpeg-batch-item-checkbox-wrapper,
[data-ffmpeg-batch-container].selection-mode .ffmpeg-batch-item-checkbox-wrapper {
  opacity: 1;
}

.ffmpeg-batch-item-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--ffmpeg-accent);
}

/* Selected item styling */
[data-media-id].selected,
[data-media-id]:has(.ffmpeg-batch-item-checkbox:checked) {
  outline: 2px solid var(--ffmpeg-accent);
  outline-offset: -2px;
}

/* Responsive */
@media (max-width: 768px) {
  .ffmpeg-batch-toolbar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .ffmpeg-batch-toolbar__left,
  .ffmpeg-batch-toolbar__actions {
    width: 100%;
    justify-content: space-between;
  }

  .ffmpeg-batch-dropdown__menu {
    inset-inline-start: 0;
    inset-inline-end: auto;
  }
}
