/* Self-hosted fonts (no external CDN - works fully offline).
   Heebo Variable covers weights 100-900 in a single file per script; IBM
   Plex Mono ships as separate static weight files. Source: @fontsource,
   copied from node_modules/@fontsource*/... at build time. */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/heebo-hebrew-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/heebo-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/static/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('/static/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #12151a;
  --surface: #1b1f26;
  --surface-2: #232833;
  --line: #2d333f;
  --ivory: #eae6dd;
  --muted: #9aa1ad;
  --amber: #e8a33d;
  --amber-dim: #6b5326;
  --teal: #35c2a6;
  --danger: #e06a5f;
  --radius: 10px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--sans);
  margin: 0;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

.scan-line {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.5;
  animation: sweep 6s linear infinite;
  pointer-events: none;
  z-index: 5;
}
@keyframes sweep {
  0% { transform: translateY(0); opacity: 0; }
  5% { opacity: .6; }
  50% { transform: translateY(50vh); opacity: .25; }
  95% { opacity: .6; }
  100% { transform: translateY(100vh); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .scan-line { animation: none; display: none; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark {
  display: inline-flex;
  filter: drop-shadow(0 0 10px rgba(61, 220, 255, 0.35));
}
.brand-mark img {
  display: block;
  mix-blend-mode: screen;
}
.brand h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: 0.2px; }
.brand-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.health {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.health.ok { color: var(--teal); border-color: var(--teal); }
.health.bad { color: var(--danger); border-color: var(--danger); }

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.user-bar #usernameLabel {
  color: var(--ivory);
}
.user-bar #usernameLabel::before {
  content: '👤 ';
}

main {
  flex: 1;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.drag-over {
  border-color: var(--amber);
  background: rgba(232, 163, 61, 0.06);
}
.drop-icon { color: var(--amber); margin-bottom: 10px; }
.drop-title { font-size: 17px; font-weight: 500; margin: 6px 0; }
.drop-sub { color: var(--muted); margin: 0 0 4px; font-size: 14px; }
.drop-formats { color: var(--muted); font-size: 12px; font-family: var(--mono); margin: 10px 0 0; }

.link-btn {
  background: none;
  border: none;
  color: var(--amber);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mode-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}
@media (max-width: 720px) {
  .mode-select { grid-template-columns: 1fr; }
}

.mode-option input { position: absolute; opacity: 0; }
.mode-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  height: 100%;
}
.mode-card strong { display: block; font-size: 14.5px; margin-bottom: 6px; }
.mode-card small { color: var(--muted); font-size: 12.5px; line-height: 1.5; display: block; }
.mode-option input:checked + .mode-card {
  border-color: var(--amber);
  background: rgba(232, 163, 61, 0.08);
}
.mode-option input:focus-visible + .mode-card {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.quality-select {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 720px) {
  .quality-select { grid-template-columns: 1fr; }
}
.quality-option input { position: absolute; opacity: 0; }
.quality-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  height: 100%;
}
.quality-card strong { display: block; font-size: 14.5px; margin-bottom: 6px; }
.quality-card small { color: var(--muted); font-size: 12.5px; line-height: 1.5; display: block; }
.quality-option input:checked + .quality-card {
  border-color: var(--teal);
  background: rgba(53, 194, 166, 0.08);
}
.quality-option input:focus-visible + .quality-card {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.summary-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--ivory);
  cursor: pointer;
}
.summary-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
  cursor: pointer;
}
.disabled-toggle {
  opacity: 0.5;
  cursor: not-allowed;
}
.disabled-toggle input {
  cursor: not-allowed;
}

.primary-btn {
  margin-top: 20px;
  background: var(--amber);
  color: #221806;
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .1s ease, opacity .15s ease;
}
.primary-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.primary-btn:not(:disabled):hover { transform: translateY(-1px); }

.selected-files {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 12px 2px 0;
}

.jobs-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.jobs-header h2 { font-size: 16px; margin: 0; }
.jobs-count { color: var(--muted); font-family: var(--mono); font-size: 12px; }

.empty-state { color: var(--muted); font-size: 14px; text-align: center; padding: 30px 0; }

.job-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.job-name { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.job-status {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.job-status.processing { color: var(--amber); border-color: var(--amber-dim); }
.job-status.done { color: var(--teal); border-color: var(--teal); }
.job-status.error { color: var(--danger); border-color: var(--danger); }

.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--amber);
  width: 8%;
  transition: width .4s ease;
}
.progress-fill.indeterminate {
  width: 30%;
  animation: indet 1.4s ease-in-out infinite;
}
@keyframes indet {
  0% { margin-right: 0; }
  50% { margin-right: 70%; }
  100% { margin-right: 0; }
}

.job-meta { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-top: 8px; }

.live-label {
  color: var(--teal);
  font-size: 11.5px;
  font-family: var(--mono);
  margin-top: 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) {
  .live-label::before { animation: none; }
}
.job-transcript.live {
  border-color: var(--teal);
  opacity: 0.92;
}

.job-transcript {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  direction: rtl;
  text-align: right;
  font-size: 14.5px;
  line-height: 1.9;
}

.job-downloads { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dl-btn {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ivory);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
}
.dl-btn:hover { border-color: var(--amber); color: var(--amber); }

.job-error { color: var(--danger); font-size: 13px; margin-top: 8px; }

.media-strip {
  display: block;
  width: 100%;
  margin-top: 12px;
  border-radius: 8px;
  outline: none;
}
audio.media-strip {
  height: 36px;
}
video.media-strip {
  max-height: 280px;
  background: #000;
}

.job-warning {
  color: var(--amber);
  background: rgba(232, 163, 61, 0.1);
  border: 1px solid var(--amber-dim);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.6;
}

.summary-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.summary-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--teal);
  margin-bottom: 8px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 20px;
  border-top: 1px solid var(--line);
}
.footer-logo {
  display: block;
  mix-blend-mode: screen;
  opacity: 0.85;
}

/* --- Admin page --- */
.admin-form { margin-top: 4px; }
.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 640px) {
  .admin-form-row { grid-template-columns: 1fr; }
}
.admin-field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.admin-field input {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 14px;
  box-sizing: border-box;
}
.admin-field input:focus { outline: none; border-color: var(--amber); }
.admin-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 1.2em;
  margin: 10px 0;
}

.admin-user-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface-2);
}
.admin-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-user-name { font-weight: 600; font-size: 14.5px; }
.admin-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  border: 1px solid var(--amber-dim);
  border-radius: 999px;
  padding: 2px 10px;
}
.admin-user-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.admin-edit-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.admin-edit-buttons {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.admin-save-btn {
  padding: 8px 20px !important;
  font-size: 13px !important;
}
