/**
 * @file
 * Poster selector styles.
 *
 * Uses Gin admin theme CSS variables for dark mode compatibility.
 */

.ffmpeg-poster-selector-form {
  max-width: 1200px;
}

.ffmpeg-poster-header {
  margin-bottom: 2rem;
}

.ffmpeg-poster-header h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ffmpeg-title, #111827);
}

.ffmpeg-video-duration {
  color: var(--ffmpeg-text-muted, #6b7280);
  font-size: 0.875rem;
  margin: 0;
}

/* Thumbnail Grid */
.ffmpeg-thumbnail-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.ffmpeg-thumbnail-item {
  position: relative;
  border-radius: var(--ffmpeg-radius-s, 6px);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--ffmpeg-surface-2, #f5f5f5);
}

.ffmpeg-thumbnail-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

.ffmpeg-thumbnail-item.selected,
.ffmpeg-thumbnail-item[aria-selected="true"] {
  box-shadow: 0 0 0 3px var(--ffmpeg-accent, #2563eb), 0 4px 16px rgba(59, 130, 246, 0.3);
}

.ffmpeg-thumbnail-item.selected::after,
.ffmpeg-thumbnail-item[aria-selected="true"]::after {
  content: '\2713';
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 24px;
  height: 24px;
  background: var(--ffmpeg-accent, #2563eb);
  color: var(--ffmpeg-on-accent, #ffffff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.ffmpeg-thumbnail-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.ffmpeg-thumbnail-time {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: var(--ffmpeg-on-accent, #ffffff);
  padding: 1.5rem 0.5rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

/* Custom time section */
.ffmpeg-custom-time {
  background: var(--ffmpeg-surface, #ffffff);
  border: 1px solid var(--ffmpeg-border, #e5e7eb);
  border-radius: var(--ffmpeg-radius-m, 10px);
  box-shadow: var(--ffmpeg-shadow, 0 2px 8px rgba(0, 0, 0, 0.08));
  margin-bottom: 2rem;
}

.ffmpeg-custom-preview {
  margin-top: 1rem;
  text-align: center;
}

.ffmpeg-custom-preview img {
  max-width: 320px;
  border-radius: var(--ffmpeg-radius-s, 6px);
  margin-bottom: 1rem;
}

.ffmpeg-use-custom-btn {
  margin-top: 0.5rem;
}

/* Actions */
.ffmpeg-poster-selector-form #edit-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.ffmpeg-set-poster-btn {
  background: var(--ffmpeg-success, #16a34a) !important;
  border-color: var(--ffmpeg-success, #16a34a) !important;
}

.ffmpeg-set-poster-btn:hover {
  background: var(--ffmpeg-success-hover, #059669) !important;
  border-color: var(--ffmpeg-success-hover, #059669) !important;
}

/* Loading state */
.ffmpeg-thumbnail-grid.loading {
  opacity: 0.6;
  pointer-events: none;
}

.ffmpeg-thumbnail-grid.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--ffmpeg-on-accent, #ffffff);
  padding: 1rem 2rem;
  border-radius: var(--ffmpeg-radius-s, 6px);
  font-weight: 600;
}
