@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1c2130;
  --muted: #6b7280;
  --accent: #1FB88C;
  --accent-dark: #17966f;
  --accent-soft: rgba(31, 184, 140, 0.1);
  --warn: #f0a92e;
  --warn-soft: rgba(240, 169, 46, 0.12);
  --err: #e05a52;
  --err-soft: rgba(224, 90, 82, 0.1);
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
}

h1, h2 { font-family: 'Space Grotesk', sans-serif; margin: 0; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.user-box { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 12px; }

.logo-bars { display: flex; align-items: flex-end; gap: 3px; height: 24px; }
.logo-bars i {
  width: 5px;
  background: var(--c);
  border-radius: 2px;
  display: inline-block;
  animation: bar-bounce 1.4s ease-in-out infinite;
}
.logo-bars i:nth-child(1) { height: 60%; animation-delay: 0s; }
.logo-bars i:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.logo-bars i:nth-child(3) { height: 40%; animation-delay: 0.3s; }
.logo-bars i:nth-child(4) { height: 80%; animation-delay: 0.45s; }

@keyframes bar-bounce {
  0%, 100% { transform: scaleY(0.6); opacity: 0.75; }
  50% { transform: scaleY(1); opacity: 1; }
}

.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar .tagline { margin: 1px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Layout ---------- */
.app { max-width: 1040px; margin: 0 auto; padding: 24px 24px 80px; }

.hidden { display: none; }

/* ---------- Upload bar ---------- */
.upload-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone svg { color: var(--muted); margin-bottom: 6px; }
.dropzone p { margin: 3px 0; font-size: 13.5px; }
.dropzone .hint { color: var(--muted); font-size: 12px; }

.dropzone-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dropzone-divider::before, .dropzone-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

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

.url-input {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.url-input::placeholder { color: #a3a9b5; }

.btn-outline-sm {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-outline-sm:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-dark); }
.btn-outline-sm:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-options {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.upload-status { font-size: 12.5px; color: var(--muted); }
.upload-status.error { color: var(--err); }

.picked-filename { font-size: 13px; color: var(--muted); flex: 1; min-width: 120px; }

.select-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.select-inline select {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--bg);
}

button { cursor: pointer; border: none; font-family: inherit; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-outline {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-dark); }

.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.btn-ghost-sm:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Files table ---------- */
.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.files-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.files-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.files-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease;
}
.files-table tbody tr:last-child { border-bottom: none; }
.files-table tbody tr:hover { background: #fafbfc; }
.files-table tbody tr.selected { background: var(--accent-soft); }

.files-table td { padding: 11px 16px; vertical-align: middle; }

.file-name-cell { font-weight: 500; }
.file-time-cell { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }

.empty-cell { text-align: center; color: var(--muted); padding: 28px 16px; cursor: default; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
}
.status-pill.done { color: var(--accent-dark); background: var(--accent-soft); }
.status-pill.progress { color: #a67615; background: var(--warn-soft); }
.status-pill.error { color: var(--err); background: var(--err-soft); }

.actions-col { width: 90px; }
.row-actions { display: flex; gap: 10px; }
.row-actions button {
  background: transparent;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.row-actions button:hover { color: var(--text); background: var(--bg); }
.row-actions button.danger:hover { color: var(--err); }

/* ---------- Detail panel ---------- */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.detail-head h2 { font-size: 15px; font-weight: 600; }

.pill {
  font-size: 11px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

.col-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.transcript-box {
  width: 100%;
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

.transcript-line { margin-bottom: 2px; }

.timestamp-link {
  display: inline-block;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0 4px;
  margin-right: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.timestamp-link:hover { background: var(--accent); color: #fff; }

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.preset-btn {
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.preset-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }

.task-box {
  width: 100%;
  min-height: 90px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  font-family: inherit;
  font-size: 13.5px;
  margin-bottom: 10px;
  color: var(--text);
}
.transcript-box.error-mode {
  color: var(--err);
  font-family: 'Inter', sans-serif;
  white-space: pre-wrap;
}

.analyses-list { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }

.analysis-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg);
}
.analysis-card .task-label {
  font-size: 10.5px;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  font-weight: 600;
}
.analysis-card .result-text {
  font-size: 13px;
  white-space: pre-wrap;
  font-family: 'IBM Plex Mono', monospace;
}
.error-text { color: var(--err); font-size: 13px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
  .upload-bar { flex-direction: column; align-items: stretch; }
}

.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.video-modal.hidden { display: none; }

.video-modal-inner {
  position: relative;
  background: #000;
  border-radius: 10px;
  padding: 10px;
  max-width: 90vw;
  max-height: 88vh;
}

.video-modal-inner video {
  display: block;
  max-width: 86vw;
  max-height: 80vh;
  border-radius: 6px;
  background: #000;
}

.video-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-modal-close:hover { background: var(--err); color: #fff; border-color: var(--err); }

.video-modal-error {
  color: #fff;
  background: var(--err);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin: 10px 0 0;
}
.video-modal-error.hidden { display: none; }
