:root {
  --history-ink: #f1f5f9;
  --history-muted: #94a3b8;
  --history-line: rgba(255, 255, 255, 0.09);
  --history-blue: #8b5cf6;
  --history-surface: rgba(30, 41, 59, 0.72);
  --history-bg: #0f172a;
}

.video-history-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, rgba(124, 58, 237, 0.16), transparent 36rem),
    radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.1), transparent 42rem),
    var(--history-bg);
  color: var(--history-ink);
}

.video-history-shell {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.video-history-heading {
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
}

.video-history-eyebrow {
  margin: 0 0 8px;
  color: #c4b5fd !important;
  font-size: 12px !important;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.video-history-heading h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 50px);
  line-height: 1.05;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 52%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.video-history-heading p { margin: 12px 0 0; color: var(--history-muted); font-size: 17px; }

.video-preview-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.video-preview-download:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(124, 58, 237, 0.46); }

.video-history-card {
  overflow: hidden;
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 24px;
  background: var(--history-surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.video-history-state { padding: 72px 24px; text-align: center; color: var(--history-muted); }
.video-history-error { color: #c53030; }
.video-history-table-wrap { width: 100%; overflow-x: auto; }
.video-history-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.video-history-table th {
  padding: 16px 18px;
  border-bottom: 1px solid var(--history-line);
  background: rgba(15, 23, 42, 0.58);
  color: #aebbd0;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.video-history-table td { padding: 18px; border-bottom: 1px solid var(--history-line); vertical-align: middle; color: #e5e7eb; }
.video-history-table tbody tr { transition: background 0.18s ease; }
.video-history-table tbody tr:hover { background: rgba(139, 92, 246, 0.07); }
.video-history-table tr:last-child td { border-bottom: 0; }
.video-history-table th:nth-child(1) { width: 142px; }
.video-history-table th:nth-child(2) { width: 25%; }
.video-history-table th:nth-child(3) { width: 120px; }
.video-history-table th:nth-child(4),
.video-history-table th:nth-child(5) { width: 105px; }
.video-history-table th:nth-child(6) { width: 180px; }
.video-history-table th:nth-child(7) { width: 230px; }

.video-history-thumb {
  position: relative;
  display: block;
  width: 112px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #090f1d;
  cursor: pointer;
}
.video-history-thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.video-history-thumb span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 22px; background: rgba(10, 15, 32, 0.28); transition: background 0.18s ease; }
.video-history-thumb:hover span { background: rgba(124, 58, 237, 0.38); }
.video-history-name { display: block; overflow: hidden; color: var(--history-ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.video-history-id { display: block; margin-top: 6px; overflow: hidden; color: var(--history-muted); font-family: Consolas, monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.video-history-status { display: inline-flex; padding: 5px 10px; border: 1px solid rgba(245, 158, 11, 0.28); border-radius: 999px; background: rgba(245, 158, 11, 0.12); color: #fbbf24; font-size: 12px; font-weight: 700; }
.video-history-status.done { border-color: rgba(52, 211, 153, 0.25); background: rgba(16, 185, 129, 0.14); color: #6ee7b7; }
.video-history-status.failed, .video-history-status.canceled { border-color: rgba(248, 113, 113, 0.25); background: rgba(239, 68, 68, 0.13); color: #fca5a5; }
.video-history-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.video-history-actions button,
.video-history-actions a,
.video-history-pagination button,
.video-preview-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: #ddd6fe;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.video-history-actions button:hover,
.video-history-actions a:hover,
.video-history-pagination button:hover,
.video-preview-nav button:hover { border-color: rgba(196, 181, 253, 0.65); background: rgba(139, 92, 246, 0.16); color: #fff; }
.video-history-actions button:first-child { border-color: transparent; background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff; }
.video-history-actions button:disabled,
.video-history-actions a[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.video-history-pagination { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; border-top: 1px solid var(--history-line); }
.video-history-pagination p { margin: 0; color: var(--history-muted); font-size: 14px; }
.video-history-pagination > div, .video-history-pages { display: flex; align-items: center; gap: 7px; }
.video-history-pagination button.active { border-color: transparent; background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff; }
.video-history-pagination button:disabled { opacity: 0.35; cursor: default; }

.video-preview-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; }
.video-preview-backdrop { position: absolute; inset: 0; border: 0; background: rgba(2, 6, 23, 0.78); backdrop-filter: blur(6px); }
.video-preview-dialog { position: relative; width: min(1040px, 96vw); max-height: 92vh; overflow-y: auto; border: 1px solid rgba(167, 139, 250, 0.28); border-radius: 20px; background: #171d2e; color: #f1f5f9; box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55); }
.video-preview-dialog > header { display: flex; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--history-line); }
.video-preview-dialog > header p { margin: 0 0 5px; color: var(--history-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.video-preview-dialog h2 { margin: 0; max-width: 760px; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.video-preview-close { width: 42px; height: 42px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50%; background: rgba(255, 255, 255, 0.05); color: #c4b5fd; font-size: 28px; cursor: pointer; }
.video-preview-close:hover { background: rgba(139, 92, 246, 0.18); color: #fff; }
.video-preview-stage { padding: 24px; background: #090f1d; }
.video-preview-stage video { display: block; width: 100%; max-height: 58vh; background: #000; }
.video-preview-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 22px 24px; }
.video-preview-details div { min-width: 0; }
.video-preview-details dt { color: var(--history-muted); font-size: 12px; }
.video-preview-details dd { margin: 5px 0 0; overflow-wrap: anywhere; color: #e5e7eb; font-weight: 600; }
.video-preview-dialog > footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 24px 24px; }
.video-preview-nav { display: flex; gap: 8px; }
.hidden { display: none !important; }

@media (max-width: 820px) {
  .video-history-shell { width: min(100% - 24px, 1480px); padding-top: 24px; }
  .video-history-heading { align-items: stretch; flex-direction: column; }
  .video-history-table thead { display: none; }
  .video-history-table, .video-history-table tbody, .video-history-table tr, .video-history-table td { display: block; width: 100%; }
  .video-history-table tr { position: relative; padding: 16px; border-bottom: 1px solid var(--history-line); }
  .video-history-table td { padding: 7px 0 7px 132px; border: 0; min-height: 32px; }
  .video-history-table td:first-child { position: absolute; top: 18px; left: 16px; width: 112px; padding: 0; }
  .video-history-table td:nth-child(2) { min-height: 72px; }
  .video-history-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--history-muted); font-size: 11px; }
  .video-history-table td:first-child::before, .video-history-table td:nth-child(2)::before { display: none; }
  .video-history-pagination { align-items: stretch; flex-direction: column; }
  .video-history-pagination > div { justify-content: space-between; }
  .video-history-pages { display: none; }
  .video-preview-modal { padding: 0; }
  .video-preview-dialog { width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; }
  .video-preview-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-preview-dialog > footer { align-items: stretch; flex-direction: column; }
  .video-preview-download { width: 100%; }
}
