/* style.css – Premium dark glassmorphism design for AD Pipeline */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base: #0d0f14;
  --bg-surface: #13161e;
  --bg-card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(139, 92, 246, 0.4);

  --violet: #8b5cf6;
  --teal: #06b6d4;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout ────────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  background: rgba(13, 15, 20, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header h1 span {
  color: var(--violet);
}

.header-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

.main-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  height: calc(100vh - 73px);
}

/* ── Sidebar / Steps ───────────────────────────────────────────── */

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-left: 12px;
}

.step-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition);
  width: 100%;
}

.step-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.step-btn.active {
  background: rgba(139, 92, 246, 0.12);
  color: var(--violet);
  border: 1px solid var(--border-accent);
}

.step-btn.done {
  color: var(--green);
}

.step-btn.done .step-num {
  background: var(--green);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition);
}

.step-btn.active .step-num {
  background: var(--violet);
  border-color: var(--violet);
  color: white;
}

.step-label {
  flex: 1;
  font-weight: 500;
}

.step-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.step-btn.done .step-status-dot {
  background: var(--green);
}

.step-btn.active .step-status-dot {
  background: var(--violet);
  box-shadow: 0 0 6px var(--violet);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ── Content ───────────────────────────────────────────────────── */

.content {
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.step-panel {
  display: none;
}

.step-panel.visible {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.step-icon {
  font-size: 2rem;
  line-height: 1;
}

.step-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.step-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ── Cards ─────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(8px);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

/* ── Forms ─────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-row input[type=range] {
  flex: 1;
  accent-color: var(--violet);
  padding: 0;
}

.range-val {
  min-width: 48px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--violet);
  font-weight: 600;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--violet), #7c3aed);
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-primary:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:not(:disabled):hover {
  border-color: var(--violet);
  color: var(--violet);
}

.btn-teal {
  background: linear-gradient(135deg, var(--teal), #0891b2);
  color: white;
}

.btn-green {
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: white;
}

.btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Upload Drop Zone ──────────────────────────────────────────── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--violet);
  background: rgba(139, 92, 246, 0.05);
}

.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.drop-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.drop-sub {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ── Progress Bar ──────────────────────────────────────────────── */

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--teal));
  border-radius: 99px;
  transition: width 0.4s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.progress-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Status Badges ─────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.badge-yellow {
  background: rgba(245, 158, 11, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

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

.badge-violet {
  background: rgba(139, 92, 246, 0.12);
  color: var(--violet);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.badge-teal {
  background: rgba(6, 182, 212, 0.12);
  color: var(--teal);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* ── Tables ────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  max-height: 340px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Alert boxes ───────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-info {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: #7dd3fc;
}

.alert-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.alert-warn {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* ── Image Gallery ─────────────────────────────────────────────── */

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.gallery-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition);
}

.gallery-img:hover {
  transform: scale(1.04);
}

/* ── Download Links ────────────────────────────────────────────── */

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

.download-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.download-item:hover {
  border-color: var(--violet);
  background: rgba(139, 92, 246, 0.06);
  color: var(--violet);
}

.download-icon {
  font-size: 1.2rem;
}

.download-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.download-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── GPT progress feed ─────────────────────────────────────────── */

.gpt-feed {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
}

.feed-line {
  padding: 2px 8px;
  border-radius: 4px;
}

.feed-line.ok {
  color: var(--green);
}

.feed-line.skip {
  color: var(--yellow);
}

.feed-line.err {
  color: var(--red);
}

/* ── Video Stats ───────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow-wrap: break-word;
  word-break: break-all;
  min-width: 0;
}

/* ── Tab toggle (Broadcast vs Directors) ───────────────────────── */

.tab-bar {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}

.tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--violet);
  color: white;
}

/* ── Upload progress ───────────────────────────────────────────── */

.upload-progress {
  display: none;
}

.upload-progress.visible {
  display: block;
}

/* ── Spinner ───────────────────────────────────────────────────── */

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── Scrollbar ─────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 16px;
  }
}