/* ─── Media Compressor — Charcoal + Orange Design System ──────────────────── */

/* ─── Reset & Variables ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:              #141414;
  --bg-card:         #1f1f1f;
  --bg-card-hover:   #242424;
  --bg-input:        #181818;
  --border:          #2a2a2a;
  --border-hover:    #3d3d3d;
  --text:            #f0f0eb;
  --text-dim:        #888888;
  --text-muted:      #555555;
  --primary:         #f97316;
  --primary-hover:   #fb923c;
  --primary-dim:     rgba(249, 115, 22, 0.12);
  --primary-border:  rgba(249, 115, 22, 0.35);
  --green:           #22c55e;
  --green-glow:      rgba(34, 197, 94, 0.10);
  --red:             #ef4444;
  --yellow:          #eab308;
  --radius:          10px;
  --radius-sm:       7px;
  --radius-xs:       5px;
  --shadow:          0 4px 24px rgba(0, 0, 0, 0.5);
  --transition:      0.18s ease;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(249, 115, 22, 0.05) 0%, transparent 55%);
  pointer-events: none;
  z-index: -1;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.header {
  border-bottom: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.97);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.logo h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

/* ─── Container ───────────────────────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 2rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ─── Drop Zone ───────────────────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
}

.drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-icon {
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.drop-icon svg {
  width: 38px;
  height: 38px;
  opacity: 0.9;
}

.drop-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}

.drop-subtext {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.drop-formats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
}

.format-chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: #252525;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  font-family: "SF Mono", "Fira Code", monospace;
  letter-spacing: 0.03em;
}

.drop-formats small {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ─── File Info / File List Table ─────────────────────────────────────────── */
.file-info {
  margin-top: 1.25rem;
  animation: fadeIn 0.3s ease;
}

.file-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.file-list-table thead th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}

.file-list-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background var(--transition);
}

.file-list-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.file-list-table tbody td {
  padding: 0.6rem 0.85rem;
  vertical-align: middle;
  color: var(--text);
}

.table-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  flex-shrink: 0;
  background: #252525;
  border: 1px solid var(--border);
}

.table-thumb img,
.table-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-name-cell {
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.file-info-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

/* ─── Status Badges ───────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-badge.pending {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-badge.processing {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-badge.done {
  background: rgba(34, 197, 94, 0.10);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.10);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ─── Action Buttons (table) ──────────────────────────────────────────────── */
.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  margin-left: 0.25rem;
}

.btn-icon:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}

.btn-icon.retry { font-size: 1.1rem; }

.btn-icon.retry:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn-secondary {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-secondary:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 68, 68, 0.06);
}

.btn-compress {
  width: 100%;
  padding: 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}

.btn-compress:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.3);
}

.btn-compress:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-loader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-xs);
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-download:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-new {
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-new:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* ─── Options ─────────────────────────────────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.option-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.option-val {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 1.6rem;
  text-align: center;
}

.option-hint {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0;
}

.option-group select,
.option-group input[type="number"] {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

.option-group select:focus,
.option-group input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.option-group select option {
  background: #1f1f1f;
  color: var(--text);
}

.option-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.option-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.option-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.option-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ─── Progress Card ───────────────────────────────────────────────────────── */
.progress-card {
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  animation: fadeIn 0.3s ease;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.progress-status-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-stage-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress-timer {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-family: "SF Mono", monospace;
}

.progress-percent {
  color: var(--primary);
  font-weight: 700;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress-bar-wrapper {
  margin: 0 0 0.75rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  width: 0%;
  transition: width 0.12s ease-out;
}

.progress-animated {
  background-color: var(--primary);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(255, 255, 255, 0.12) 6px,
    rgba(255, 255, 255, 0.12) 12px
  );
  background-size: 28px 28px;
  animation: progress-stripes 0.7s linear infinite;
}

@keyframes progress-stripes {
  from { background-position: 28px 0; }
  to   { background-position: 0 0; }
}

.progress-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
  margin: 0;
  font-family: "SF Mono", "Fira Code", monospace;
}

.progress-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── Results ─────────────────────────────────────────────────────────────── */
.results-card { animation: fadeIn 0.4s ease; }
.result-actions { margin-top: 1.5rem; }

.result-item {
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
  animation: slideUp 0.35s ease;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.result-filename {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

/* ─── Stats ───────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
}

.stat-card {
  text-align: center;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.02);
}

.stat-arrow {
  border: none;
  background: none;
  color: var(--text-muted);
  padding: 0;
}

.stat-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Preview ─────────────────────────────────────────────────────────────── */
.preview-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.preview-card-header {
  padding: 0.4rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.preview-card-body {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e0e0e;
  min-height: 120px;
}

.preview-card-body img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 3px;
}

.preview-card-body video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 3px;
}

/* ─── Details Toggle & Panel ──────────────────────────────────────────────── */
.btn-details {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  margin-top: 0.75rem;
}

.btn-details:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

.btn-details svg { transition: transform var(--transition); }
.btn-details.open svg { transform: rotate(180deg); }

.details-panel {
  margin-top: 0.75rem;
  animation: fadeIn 0.3s ease;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.details-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.details-table td:first-child {
  color: var(--text-muted);
  font-weight: 500;
  width: 45%;
}

.details-table td:last-child {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 1.25rem 1rem 3rem; }
  .card { padding: 1.25rem; }
  .drop-zone { padding: 2rem 1.25rem; }
  .options-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat-arrow { display: none; }
  .preview-section { grid-template-columns: 1fr; }
  .file-name-cell { max-width: 130px; }
  .file-list-table thead th:nth-child(2),
  .file-list-table tbody td:nth-child(2) { display: none; }
}

/* ─── Team Stats Badge ────────────────────────────────────────────────────── */
.team-stats-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  padding: 0.35rem 0.85rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

/* ─── Options Header ──────────────────────────────────────────────────────── */
.options-header-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.85rem;
}

/* ─── Profile Pills ───────────────────────────────────────────────────────── */
.profile-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 720px) { .profile-pills { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .profile-pills { grid-template-columns: 1fr; } }

.profile-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.9rem 1rem 0.9rem 1.2rem;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  overflow: hidden;
}

.profile-pill::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background var(--transition);
}

.profile-pill:hover {
  background: #222;
  border-color: var(--border-hover);
}

.profile-pill.active {
  background: rgba(249, 115, 22, 0.06);
  border-color: var(--primary);
}

.profile-pill.active::before {
  background: var(--primary);
}

.pill-badge { display: none; }

.pill-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text);
  transition: color var(--transition);
}

.profile-pill.active .pill-title { color: var(--primary); }

.pill-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.profile-pill.active::after {
  content: "ACTIVE";
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--primary);
  opacity: 0.8;
}

/* ─── Quick Toggles ───────────────────────────────────────────────────────── */
.quick-toggles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}

.toggle-control input { display: none; }

.toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  transition: var(--transition);
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: var(--transition);
}

.toggle-control input:checked + .toggle-slider { background: var(--primary); }
.toggle-control input:checked + .toggle-slider::after { transform: translateX(16px); }

.toggle-label { font-size: 0.85rem; color: var(--text); }
.toggle-label small { color: var(--text-dim); }

/* ─── Custom Drawer ───────────────────────────────────────────────────────── */
.custom-drawer {
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

/* ─── Video Preview ───────────────────────────────────────────────────────── */
.video-preview-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.video-responsive-player {
  width: 100%;
  max-height: 440px;
  display: block;
  object-fit: contain;
  background: #000;
}

.preview-overlay-bar {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.preview-overlay-bar > * { pointer-events: auto; }

.btn-expand-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-hover);
  color: var(--text);
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-expand-preview:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ─── Quality Score Badge ─────────────────────────────────────────────────── */
.quality-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--green);
}

/* ─── Video Modal ─────────────────────────────────────────────────────────── */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
}

.video-modal-container {
  position: relative !important;
  z-index: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 96vw !important;
  max-width: 1600px !important;
  height: 92vh !important;
  max-height: 92vh !important;
  background: #111 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9) !important;
  overflow: hidden !important;
}

.video-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #111;
}

.modal-info { display: flex; align-items: center; gap: 0.75rem; }

.modal-title { font-weight: 600; font-size: 0.9rem; color: var(--text); }

.modal-dims {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.modal-actions { display: flex; align-items: center; gap: 0.75rem; }

.btn-compare-pill {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-compare-pill:hover,
.btn-compare-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-modal-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.video-modal-body {
  display: flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  padding: 1rem !important;
  background: #000 !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.modal-video-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.modal-video-wrapper video {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-xs);
}

.modal-indicator {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
  pointer-events: none;
}

/* ─── Side-by-Side Comparison ─────────────────────────────────────────────── */
.side-by-side-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}

@media (max-width: 680px) { .side-by-side-preview { grid-template-columns: 1fr; } }

.side-player-card {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.8rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.label-orig {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.label-comp {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--green);
  background: var(--green-glow);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.side-player-body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex: 1;
}

.side-player-body video { width: 100%; max-height: 380px; object-fit: contain; display: block; }
.side-player-body.image-box img { max-width: 100%; max-height: 380px; object-fit: contain; display: block; }

.preview-actions-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.btn-sync-play {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.4rem 0.9rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-sync-play:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.modal-side-by-side {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1.25rem !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

@media (max-width: 768px) {
  .modal-side-by-side {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr 1fr !important;
  }
}

.modal-player-box {
  display: flex !important;
  flex-direction: column !important;
  background: #080808 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden !important;
  min-height: 0 !important;
  height: 100% !important;
}

.modal-player-header {
  padding: 0.5rem 1rem !important;
  background: rgba(255, 255, 255, 0.03) !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
  flex: 0 0 auto !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.modal-player-box video {
  width: 100% !important;
  height: 100% !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: 100% !important;
  object-fit: contain !important;
  background: #000 !important;
  display: block !important;
}

/* ─── Table Spacing ───────────────────────────────────────────────────────── */
.file-list-table th,
.file-list-table td { padding: 0.8rem 1.1rem !important; }

.file-name-cell { max-width: 360px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; }

#history-content table td { white-space: nowrap !important; padding: 0.85rem 1.25rem !important; }

/* ─── Results Header Bar ──────────────────────────────────────────────────── */
.results-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

/* ─── History ─────────────────────────────────────────────────────────────── */
.history-content { overflow-x: auto; }

.btn-toggle-chevron {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.history-header:hover .btn-toggle-chevron {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--primary);
}

.chevron-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(-90deg);
}

.history-header.open .chevron-icon { transform: rotate(0deg); }

/* ─── Error Reporting ─────────────────────────────────────────────────────── */
.status-error-container { display: flex; flex-direction: column; gap: 0.35rem; }

.status-error-text {
  font-size: 0.72rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  line-height: 1.35;
  max-width: 320px;
  word-break: break-word;
}

.result-item-error {
  border-color: rgba(239, 68, 68, 0.35) !important;
  background: rgba(239, 68, 68, 0.03) !important;
}

.error-detail-banner {
  padding: 1rem 1.25rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.error-detail-banner strong { color: #fca5a5; display: block; margin-bottom: 0.25rem; }
.error-detail-banner p { color: #fee2e2; font-size: 0.85rem; margin-bottom: 0.5rem; line-height: 1.4; }

.error-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(239, 68, 68, 0.15);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.error-tip ul { margin: 0.25rem 0 0 1.25rem; }

/* ─── Interrupt Warning Modal ─────────────────────────────────────────────── */
.warning-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.warning-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}

.warning-modal-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  background: #1f1f1f;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.warning-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(239, 68, 68, 0.05);
}

.warning-title-wrapper { display: flex; align-items: center; gap: 0.6rem; }
.warning-icon { font-size: 1.2rem; line-height: 1; }

.warning-modal-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fca5a5;
  letter-spacing: -0.01em;
}

.warning-modal-body { padding: 1.25rem; }

.warning-msg-main {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.warning-msg-detail {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
}

.warning-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border);
}

.btn-primary {
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  background: var(--primary);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-danger-outline {
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-danger-outline:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
