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

:root {
  --bg: #0d0f12;
  --panel: #161a1f;
  --panel-2: #1f242b;
  --accent: #f97316;
  --accent-2: #06b6d4;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #2b313a;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: radial-gradient(circle at top left, #1f2937 0%, #0b0c0f 45%, #09090b 100%);
  color: var(--text);
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--accent-2);
  margin: 0 0 12px;
}

h1 {
  margin: 0 0 8px;
  font-size: 2.2rem;
}

.subhead {
  margin: 0;
  color: var(--muted);
}

.status {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select, button {
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--panel-2);
  color: var(--text);
}

input:focus, select:focus {
  outline: 2px solid rgba(249, 115, 22, 0.6);
  border-color: transparent;
}

button {
  cursor: pointer;
  font-weight: 600;
}

button.primary {
  background: linear-gradient(135deg, #f97316, #fb7185);
  border: none;
  color: #0b0c0f;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button:hover {
  opacity: 0.9;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.episodes {
  max-height: 720px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.episodes-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#episodeList {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  overflow-y: auto;
}

#episodeList li {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

#episodeList li.active {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.12);
}

.viewer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.muted {
  color: var(--muted);
  margin: 4px 0 0;
}

.video-shell {
  background: #0b0e14;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--border);
}

video {
  width: 100%;
  max-height: 360px;
  border-radius: 12px;
  background: #050505;
}

/* Video time display with millisecond precision */
.video-time-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 12px;
}

.time-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.time-value {
  font-family: 'Source Code Pro', monospace;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-2);
  letter-spacing: 0.02em;
}

.time-separator {
  color: var(--muted);
  font-size: 1.1rem;
}

.timeline {
  margin-top: 12px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 10px;
  padding: 6px;
  min-height: 22px;
  display: flex;
  gap: 4px;
}

.timeline span {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: var(--accent-2);
}

.tabs {
  display: flex;
  gap: 12px;
}

.tab {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid transparent;
}

.tab.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.segment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.08);
  margin-bottom: 12px;
}

.segment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.segment-item {
  display: grid;
  grid-template-columns: 36px 80px 80px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(31, 41, 55, 0.7);
}

.segment-item .segment-inputs {
  display: flex;
  gap: 8px;
}

.segment-item input {
  width: 100%;
}

.segment-item button {
  padding: 6px 10px;
}

.helper {
  color: var(--muted);
  margin-top: 8px;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.grow {
  flex: 1;
}

.export-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.export-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.export-section h3 {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--accent-2);
}

.link-small {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.8rem;
}

.link-small:hover {
  text-decoration: underline;
}

.helper a {
  color: var(--accent-2);
  text-decoration: none;
}

.helper a:hover {
  text-decoration: underline;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* Status boxes */
.status-box {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  margin-top: 8px;
}

.status-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-error {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.status-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.status-success .status-icon {
  color: #22c55e;
}

.status-error .status-icon {
  color: #f97316;
}

.status-content {
  flex: 1;
}

.status-content strong {
  display: block;
  margin-bottom: 4px;
}

.status-success .status-content strong {
  color: #22c55e;
}

.status-error .status-content strong {
  color: #f97316;
}

.status-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 500;
}

.status-link:hover {
  text-decoration: underline;
}

.status-loading {
  display: flex;
  align-items: center;
  color: var(--muted);
}

@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .episodes {
    max-height: none;
  }
}

@media (max-width: 720px) {
  h1 {
    font-size: 1.6rem;
  }

  .segment-item {
    grid-template-columns: 1fr;
  }
}
