/**
 * @file
 * Styles for FFmpeg Media conversion profiles page.
 */

/* Container */
.ffmpeg-profiles {
  font-family: var(--gin-font, inherit);
  color: var(--ffmpeg-text);
}

/* Sections — shared base with dashboard */
.ffmpeg-profiles__section {
  --ffmpeg-section-accent: var(--ffmpeg-accent);
  --ffmpeg-section-soft: var(--ffmpeg-accent-soft);
  position: relative;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--ffmpeg-border);
  border-radius: var(--ffmpeg-radius-l);
  background: linear-gradient(135deg, var(--ffmpeg-surface), var(--ffmpeg-surface-2));
  box-shadow: var(--ffmpeg-shadow);
  overflow: hidden;
}

.ffmpeg-profiles__section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px circle at top right, var(--ffmpeg-section-soft), transparent 45%);
  opacity: 0.85;
  pointer-events: none;
}

.ffmpeg-profiles__section::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--ffmpeg-section-accent), transparent 75%);
  opacity: 0.9;
  pointer-events: none;
}

.ffmpeg-profiles__section > * {
  position: relative;
  z-index: 1;
}

.ffmpeg-profiles__section h3 {
  margin: 0 0 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--ffmpeg-border);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ffmpeg-title);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: relative;
}

.ffmpeg-profiles__section h3::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: -1px;
  width: 42px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ffmpeg-section-accent), transparent);
}

/* Section accents */
.ffmpeg-profiles__intro {
  --ffmpeg-section-accent: var(--ffmpeg-info);
  --ffmpeg-section-soft: var(--ffmpeg-info-bg);
}

.ffmpeg-profiles__reference {
  --ffmpeg-section-accent: var(--ffmpeg-warning);
  --ffmpeg-section-soft: var(--ffmpeg-warning-bg);
}

/* Category group accents */
.ffmpeg-profiles__group--standard {
  --ffmpeg-section-accent: var(--ffmpeg-accent);
  --ffmpeg-section-soft: var(--ffmpeg-accent-soft);
}

.ffmpeg-profiles__group--streaming {
  --ffmpeg-section-accent: var(--ffmpeg-info);
  --ffmpeg-section-soft: var(--ffmpeg-info-bg);
}

.ffmpeg-profiles__group--gpu {
  --ffmpeg-section-accent: var(--ffmpeg-warning);
  --ffmpeg-section-soft: var(--ffmpeg-warning-bg);
}

/* Group icons */
.ffmpeg-profiles__group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: var(--ffmpeg-radius-s);
  font-size: 0.85rem;
  line-height: 1;
}

.ffmpeg-profiles__group-icon--standard::before {
  content: "\2699";
}

.ffmpeg-profiles__group-icon--streaming::before {
  content: "\25B6";
}

.ffmpeg-profiles__group-icon--gpu::before {
  content: "\26A1";
}

/* Intro section */
.ffmpeg-profiles__intro p {
  margin: 0 0 0.75rem;
  line-height: 1.6;
  color: var(--ffmpeg-text);
}

.ffmpeg-profiles__intro p:last-of-type {
  margin-bottom: 1.25rem;
}

/* Use case cards */
.ffmpeg-profiles__use-cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.ffmpeg-profiles__use-case {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--ffmpeg-surface);
  border: 1px solid var(--ffmpeg-border);
  border-radius: var(--ffmpeg-radius-m);
  box-shadow: var(--ffmpeg-shadow-soft);
}

.ffmpeg-profiles__use-case-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-radius: var(--ffmpeg-radius-s);
  background: var(--ffmpeg-accent-soft);
  font-size: 1.1rem;
  line-height: 1;
}

.ffmpeg-profiles__use-case strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ffmpeg-title);
  margin-bottom: 0.15rem;
}

.ffmpeg-profiles__use-case span {
  font-size: 0.8rem;
  color: var(--ffmpeg-text-muted);
  line-height: 1.4;
}

/* Settings reference grid */
.ffmpeg-profiles__settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.ffmpeg-profiles__setting {
  padding: 0.85rem 1rem;
  background: var(--ffmpeg-surface);
  border: 1px solid var(--ffmpeg-border);
  border-radius: var(--ffmpeg-radius-m);
  box-shadow: var(--ffmpeg-shadow-soft);
}

.ffmpeg-profiles__setting-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ffmpeg-warning);
  margin-bottom: 0.3rem;
}

.ffmpeg-profiles__setting-desc {
  font-size: 0.82rem;
  color: var(--ffmpeg-text-muted);
  line-height: 1.5;
}

/* Profile count badge */
.ffmpeg-profiles__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.5rem;
  background: var(--ffmpeg-surface-2);
  color: var(--ffmpeg-text);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--ffmpeg-border);
}

/* ========================================
   Profile table (row-based layout)
   ======================================== */

.ffmpeg-profiles__table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Profile row */
.ffmpeg-profiles__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ffmpeg-border);
  transition: background 0.15s ease;
}

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

.ffmpeg-profiles__row:hover {
  background: color-mix(in srgb, var(--ffmpeg-surface) 50%, var(--ffmpeg-surface-2));
}

.ffmpeg-profiles__row--default {
  background: color-mix(in srgb, var(--ffmpeg-success-bg) 30%, transparent);
}

.ffmpeg-profiles__row--default:hover {
  background: color-mix(in srgb, var(--ffmpeg-success-bg) 50%, transparent);
}

/* Row main area (left side) */
.ffmpeg-profiles__row-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

/* Codec badge */
.ffmpeg-profiles__codec-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 3rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--ffmpeg-radius-s);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ffmpeg-accent-soft);
  color: var(--ffmpeg-accent);
  border: 1px solid var(--ffmpeg-accent);
}

.ffmpeg-profiles__codec-badge--av1 {
  background: color-mix(in srgb, #3b82f6 12%, transparent);
  color: #3b82f6;
  border-color: color-mix(in srgb, #3b82f6 40%, transparent);
}

.ffmpeg-profiles__codec-badge--vp9 {
  background: color-mix(in srgb, #10b981 12%, transparent);
  color: #10b981;
  border-color: color-mix(in srgb, #10b981 40%, transparent);
}

.ffmpeg-profiles__codec-badge--ffv1 {
  background: color-mix(in srgb, #8b5cf6 12%, transparent);
  color: #8b5cf6;
  border-color: color-mix(in srgb, #8b5cf6 40%, transparent);
}

.ffmpeg-profiles__codec-badge--h264 {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  color: #f59e0b;
  border-color: color-mix(in srgb, #f59e0b 40%, transparent);
}

.ffmpeg-profiles__codec-badge--hevc {
  background: color-mix(in srgb, #ef4444 12%, transparent);
  color: #ef4444;
  border-color: color-mix(in srgb, #ef4444 40%, transparent);
}

/* Row info block */
.ffmpeg-profiles__row-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.ffmpeg-profiles__row-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ffmpeg-profiles__row-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ffmpeg-title);
  white-space: nowrap;
}

.ffmpeg-profiles__row-id {
  font-size: 0.7rem;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  color: var(--ffmpeg-text-muted);
  opacity: 0.7;
}

.ffmpeg-profiles__row-desc {
  font-size: 0.78rem;
  color: var(--ffmpeg-text-muted);
  line-height: 1.45;
  max-width: 60ch;
}

/* Output pills */
.ffmpeg-profiles__row-outputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.ffmpeg-profiles__output-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--ffmpeg-surface-3);
  color: var(--ffmpeg-text);
  border: 1px solid var(--ffmpeg-border);
}

.ffmpeg-profiles__output-pill-codec {
  font-weight: 500;
  opacity: 0.6;
  font-size: 0.6rem;
}

.ffmpeg-profiles__output-pill--thumb {
  background: color-mix(in srgb, var(--ffmpeg-info) 10%, transparent);
  color: var(--ffmpeg-info);
  border-color: color-mix(in srgb, var(--ffmpeg-info) 30%, transparent);
}

/* Badges */
.ffmpeg-profiles__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ffmpeg-profiles__badge--default {
  background: var(--ffmpeg-success-bg);
  color: var(--ffmpeg-success);
  border: 1px solid var(--ffmpeg-success);
}

.ffmpeg-profiles__badge--gpu {
  background: color-mix(in srgb, var(--ffmpeg-warning) 12%, transparent);
  color: var(--ffmpeg-warning);
  border: 1px solid color-mix(in srgb, var(--ffmpeg-warning) 40%, transparent);
}

/* Row actions (right side) */
.ffmpeg-profiles__row-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ffmpeg-profiles__btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border-radius: var(--ffmpeg-radius-s);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.ffmpeg-profiles__btn--edit {
  background: var(--ffmpeg-accent-soft);
  color: var(--ffmpeg-accent);
  border: 1px solid var(--ffmpeg-accent);
}

.ffmpeg-profiles__btn--edit:hover {
  background: var(--ffmpeg-accent);
  color: var(--ffmpeg-on-accent);
}

.ffmpeg-profiles__btn--clone {
  background: transparent;
  color: var(--ffmpeg-text-muted);
  border: 1px solid var(--ffmpeg-border);
}

.ffmpeg-profiles__btn--clone:hover {
  background: var(--ffmpeg-surface-3);
  color: var(--ffmpeg-text);
  border-color: var(--ffmpeg-border-strong);
}

.ffmpeg-profiles__btn--default {
  background: transparent;
  color: var(--ffmpeg-success);
  border: 1px solid var(--ffmpeg-border);
}

.ffmpeg-profiles__btn--default:hover {
  background: var(--ffmpeg-success-bg);
  border-color: var(--ffmpeg-success);
}

.ffmpeg-profiles__btn--delete {
  background: transparent;
  color: var(--ffmpeg-danger);
  border: 1px solid var(--ffmpeg-border);
}

.ffmpeg-profiles__btn--delete:hover {
  background: var(--ffmpeg-danger-bg);
  border-color: var(--ffmpeg-danger);
}

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

/* Empty state */
.ffmpeg-profiles__empty {
  padding: 2rem;
  text-align: center;
  background: var(--ffmpeg-surface-2);
  border-radius: var(--ffmpeg-radius-m);
  border: 1px dashed var(--ffmpeg-border-strong);
}

.ffmpeg-profiles__empty p {
  margin: 0;
  color: var(--ffmpeg-text-muted);
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .ffmpeg-profiles__section {
    padding: 1rem;
  }

  .ffmpeg-profiles__use-cases {
    grid-template-columns: 1fr;
  }

  .ffmpeg-profiles__settings-grid {
    grid-template-columns: 1fr;
  }

  .ffmpeg-profiles__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .ffmpeg-profiles__row-actions {
    flex-wrap: wrap;
  }

  .ffmpeg-profiles__row-desc {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ffmpeg-profiles__row {
    transition: none;
  }

  .ffmpeg-profiles__btn {
    transition: none;
  }
}
