/* The Media file tab (frontend/panel/content/media-file/). Values from
   output/reference/behaviours/content-videofile.md (vf#), cited per block;
   the reference's own CSS text is not copied. */

.mf {
  display: flex;
  flex-direction: column;
  height: var(--page-h);
  background: var(--bg);
}

/* The setup screen: a centred column, the card box on big screens (vf#10; md:L38349–38382). */
.mf-setup {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding: 80px 20px 40px;
  overflow-y: auto;
}

.mf-box {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin-bottom: 90px;
  border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised) 95%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

/* The heading in monospace: blue, green, then the version faded (vf#8; md:L38383–38424). */
.mf-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
  font-family: "Courier New", monospace;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.mf-head-file {
  color: var(--info-text);
  font-weight: 700;
}

.mf-head-player {
  color: var(--success-bright);
  font-weight: 700;
}

.mf-head-version {
  color: color-mix(in srgb, var(--ink) 70%, transparent);
  font-weight: 400;
}

.mf-body {
  padding: 16px 24px 24px;
}

/* The three cards and their states (vf#11; vfcss:L108–175): required blue, done green, warning amber, not yet usable faded. */
.mf-card {
  --mf-state: var(--info-text);
  margin-bottom: 8px;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--mf-state) 30%, transparent);
  border-left: 3px solid var(--mf-state);
  border-radius: 4px;
  background: color-mix(in srgb, var(--mf-state) 2%, var(--surface));
}

.mf-card.is-valid {
  --mf-state: var(--success-bright);
}

.mf-card.is-warning {
  --mf-state: var(--warning-text);
}

.mf-card.is-disabled {
  --mf-state: var(--ink);
  opacity: 0.5;
}

.mf-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
}

.mf-card-icon {
  flex-shrink: 0;
  color: var(--mf-state);
}

.mf-required {
  margin-left: 8px;
  color: oklch(from #f44336 min(l, var(--max-lightness, 1)) c h);
}

.mf-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--ink) 50.2%, transparent);
  font-size: 12px;
  line-height: 1.5;
}

.mf-caption.is-warning {
  margin-top: 8px;
  color: var(--warning-text);
}

.mf-hint {
  margin-bottom: 4px;
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-size: 14px;
}

/* "Choose File": full width in the media card, small under the subtitle file option (vf#12, #26). */
.mf-choose {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
  cursor: pointer;
}

.mf-choose.is-small {
  display: inline-flex;
  width: auto;
  height: 26px;
  padding: 0 10px;
  font-size: 0.7rem;
}

/* The chosen file: a success alert with its name and what was read of it (vf#18; md:L38484–38660). */
.mf-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.mf-alert.is-success {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.mf-alert.is-error {
  margin: 0 0 16px;
  background: rgba(244, 67, 54, 0.12);
  color: oklch(from #ef9a9a min(l, var(--max-lightness, 1)) c h);
}

.mf-alert-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--success);
}

.mf-alert-body {
  flex: 1 1 auto;
  min-width: 0;
}

.mf-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mf-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
  font-family: "Courier New", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
}

.mf-part.is-container {
  color: color-mix(in srgb, var(--ink) 60%, transparent);
}

.mf-part.is-dimensions {
  color: color-mix(in srgb, var(--info-text) 70%, transparent);
}

.mf-part.is-duration {
  color: color-mix(in srgb, var(--success-bright) 60%, transparent);
}

.mf-part.is-size {
  color: color-mix(in srgb, var(--ink) 50%, transparent);
}

/* A video's codec and a sound file's codec in amber (orange in the reference), its rate like the picture's size, its channels in the brand's light blue (violet in md:L38535–38615). */
.mf-part.is-codec {
  color: color-mix(in srgb, var(--warning-text) 70%, transparent);
}

.mf-part.is-rate {
  color: color-mix(in srgb, var(--info-text) 70%, transparent);
}

.mf-part.is-channels {
  color: var(--accent-soft);
}

/* "No audio tracks found" as an info alert (vf#21; md:L38771–38782). */
.mf-alert.is-info {
  margin-top: 0;
  background: color-mix(in srgb, var(--info-text) 12%, transparent);
  color: var(--info-text);
}

/* "(N tracks available)" after the audio card's title (vf#20; md:L38730–38745). */
.mf-card-count {
  margin-left: 8px;
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
}

/* The track selects (vf#22, #25; md:L38783–38862, L38999–39098): full width for audio, 200 px under the embedded option. */
.mf-track-select,
.mf-embedded-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--ink) 23%, transparent);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
}

.mf-embedded-select {
  width: 200px;
  max-width: 100%;
}

.mf-option-body.mf-embedded {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* The chosen track's second line: codec, channels, rate, language (md:L38818–38845). */
.mf-track-details {
  margin-top: 2px;
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-size: 0.75rem;
}

/* "(không có sẵn)" after an option with nothing to offer (vf#25, #30). */
.mf-none {
  color: color-mix(in srgb, var(--ink) 38%, transparent);
}

.mf-icon-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.mf-icon-button:hover {
  background: var(--hover);
}

.spinner.mf-spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner.mf-spinner.is-light {
  border-top-color: var(--on-accent);
}

/* The subtitle options (vf#24–#31; md:L38932–39530): a radio each, its icon on big screens, what it needs under it. */
.mf-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mf-option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.mf-option.is-unavailable .mf-option-label {
  color: color-mix(in srgb, var(--ink) 38%, transparent);
  cursor: default;
}

.mf-option-icon,
.mf-info {
  display: inline-flex;
  color: color-mix(in srgb, var(--ink) 50.2%, transparent);
}

.mf-option-body {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 2px 0 4px 28px;
}

.mf-loaded {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-size: 12px;
}

.mf-loaded-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mf-text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font: inherit;
  font-size: 0.65rem;
  cursor: pointer;
}

.mf-text-button:hover {
  background: var(--hover);
  color: var(--selected-text);
}

/* The hand moves: "−0.5s  Sync offset: +0.0s  +0.5s" (vf#36; md:L39586–39625). */
.mf-nudge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 6px 0 0 32px;
}

.mf-nudge-buttons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* The sync check (vf#34, #35; md:L39538–39585): running with a 12-px spinner, done in green, failed in amber. */
.mf-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.mf-sync.is-running {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
}

.mf-sync.is-done {
  color: var(--success-bright);
}

.mf-sync.is-failed {
  color: var(--warning-text);
}

.spinner.mf-spinner.is-tiny {
  width: 12px;
  height: 12px;
}

.mf-offset {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-family: "Courier New", monospace;
  font-size: 12px;
}

/* Speech recognition's language (vf#30; md:L39264–39386): a 200-px select, the hint under it at 0.65rem, 70 %. */
.mf-asr {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.mf-asr-lang {
  width: 200px;
  max-width: 100%;
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--ink) 23%, transparent);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
}

.mf-asr-hint {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-size: 0.65rem;
}

/* The status log (vf#75; the reference's CLIStatusToolbar CSS, clicss:L1–148): a terminal over PLAY. */
.mf-log {
  margin: 8px 0 6px;
  padding: 10px 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  border-radius: 6px;
  background: var(--field-bg);
  font-family: "Courier New", Consolas, Monaco, monospace;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.mf-log:hover {
  border-color: var(--hover-line);
  background: var(--press);
}

.mf-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.mf-log-title {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.mf-log-spinner {
  display: inline-block;
  color: var(--info-text);
  animation: mf-pulse 1s ease-in-out infinite;
}

.mf-log-clock {
  color: color-mix(in srgb, var(--ink) 40%, transparent);
  font-size: 10px;
}

.mf-log-content {
  min-height: 40px;
  max-height: 120px;
  overflow: hidden auto;
  padding-right: 4px;
}

.mf-log-line {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 16px;
}

.mf-log-stamp {
  min-width: 65px;
  color: color-mix(in srgb, var(--ink) 30.2%, transparent);
  font-size: 9px;
}

.mf-log-text {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.mf-log-line.is-idle {
  color: color-mix(in srgb, var(--ink) 40%, transparent);
}

.mf-log-line.is-success {
  color: var(--success-bright);
}

.mf-log-line.is-error {
  color: oklch(from #f44336 min(l, var(--max-lightness, 1)) c h);
}

.mf-log-line.is-progress {
  color: var(--info-text);
}

.mf-log-line.is-info {
  color: color-mix(in srgb, var(--ink) 70%, transparent);
}

.mf-log-cursor {
  height: 12px;
  margin-top: 2px;
  color: color-mix(in srgb, var(--ink) 50.2%, transparent);
  font-size: 10px;
  animation: mf-blink 1s step-end infinite;
}

@keyframes mf-blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .mf-log {
    padding: 10px 12px;
  }

  .mf-log-title {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .mf-log-clock {
    font-size: 9px;
  }

  .mf-log-content {
    min-height: 50px;
    max-height: 100px;
  }

  .mf-log-line {
    font-size: 10px;
    line-height: 14px;
  }

  .mf-log-stamp {
    min-width: 55px;
    font-size: 8px;
  }
}

/* "Hủy bỏ" beside PLAY while the server's job waits or runs (content-port.md N41). */
.mf-asr-cancel {
  margin-left: 12px;
}

/* PLAY (vf#73; md:L39939–40000): green in monospace, faded while it cannot start, "⋯" pulsing while busy. */
.mf-play-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.mf-play {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  border: 1px solid color-mix(in srgb, var(--success-bright) 50%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--success-bright) 5%, transparent);
  color: var(--success-bright);
  font: 600 0.9rem "Courier New", monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.mf-play:hover:not(:disabled) {
  box-shadow: 0 0 12px color-mix(in srgb, var(--success-bright) 35%, transparent);
}

.mf-play:disabled {
  border-color: color-mix(in srgb, var(--ink) 30%, transparent);
  background: transparent;
  color: color-mix(in srgb, var(--ink) 20%, transparent);
  cursor: default;
}

.mf-dots {
  animation: mf-pulse 1.2s ease-in-out infinite;
}

@keyframes mf-pulse {
  50% {
    opacity: 0.3;
  }
}

/* The OpenSubtitles dialog (vf#42–#45; md:L39634–39936): "sm" wide, full screen on small screens. */
.dialog.mf-os-dialog {
  width: min(600px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.mf-os-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 16px 16px 8px;
}

.mf-os-title-icon {
  color: var(--accent);
}

.mf-os-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}

.mf-os-row {
  display: flex;
  gap: 8px;
}

.mf-os-query-wrap {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
}

.mf-os-query-icon {
  position: absolute;
  left: 10px;
  color: color-mix(in srgb, var(--ink) 50.2%, transparent);
  pointer-events: none;
}

.text-field.mf-os-query {
  height: 40px;
  padding: 0 12px 0 38px;
}

.select-field.mf-os-language {
  flex: 0 0 140px;
  width: 140px;
}

.btn-primary.mf-os-search {
  justify-content: center;
  min-width: 80px;
}

.mf-os-list {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  max-height: 50vh;
}

.mf-os-center {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
}

.mf-os-empty {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  text-align: center;
}

.mf-os-results {
  flex: 1 1 auto;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  border-radius: 4px;
  background: var(--field-bg);
}

.mf-os-result {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 4%, transparent);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mf-os-result:last-child {
  border-bottom: 0;
}

.mf-os-result:hover:not(:disabled) {
  background: var(--hover);
}

.mf-os-result:disabled {
  cursor: default;
}

.mf-os-result.is-loaded {
  background: color-mix(in srgb, var(--success-bright) 8%, transparent);
}

.mf-os-result-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mf-os-result-name {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.mf-os-result.is-loaded .mf-os-result-name {
  color: var(--success-bright);
  font-weight: 600;
}

.mf-os-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.mf-os-downloads {
  color: color-mix(in srgb, var(--ink) 70.2%, transparent);
  font-size: 12px;
}

.mf-os-chip {
  --mf-chip: color-mix(in srgb, var(--ink) 50%, transparent);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--mf-chip);
  border-radius: 10px;
  color: var(--mf-chip);
  font-size: 0.65rem;
}

.mf-os-chip.is-primary {
  --mf-chip: var(--accent-soft);
}

.mf-os-chip.is-success {
  --mf-chip: var(--success);
}

.mf-os-chip.is-info {
  --mf-chip: var(--info-text);
}

/* The player (vf#77–#90): the bar with the way back and the file's name, then the recording column. */
.mf-player {
  flex: 1 1 auto;
  min-height: 0;
}

.mf-bar-name {
  min-width: 0;
  max-width: min(42vw, 520px);
  margin-left: 8px;
  overflow: hidden;
  color: color-mix(in srgb, var(--ink) 90%, transparent);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The dub's button at the bar's end (dub.js): YouTube Dubbing's local player control, 3em wide with a 20 px picture
   that glows on hover and focus (its local-player CSS, .yd-local-dubbing-control and -icon). */
.mf-dub {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 3em;
  height: 100%;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mf-dub:disabled {
  cursor: default;
}

.mf-dub-icon {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.mf-dub:hover .mf-dub-icon,
.mf-dub:focus-visible .mf-dub-icon {
  filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.75));
}

@media (max-width: 900px) {
  .mf-setup {
    padding: 60px 10px 20px;
  }

  .mf-box {
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .mf-head {
    font-size: 0.95rem;
  }

  .mf-body {
    padding: 12px 16px 16px;
  }

  .mf-option-icon {
    display: none;
  }

  .mf-os-row {
    flex-direction: column;
  }

  .select-field.mf-os-language {
    flex-basis: auto;
    width: 100%;
  }

  .dialog.mf-os-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .mf-bar-name {
    max-width: calc(100vw - 220px);
  }
}
