/* ═══════════════════════════════════════════════════════════
   Executor — Premium Dark UI
   Inspired by linear.app — Deep purple accent, glassmorphism
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #08080d;
  --bg-secondary: #0f0f17;
  --bg-card: rgba(255, 255, 255, 0.025);
  --bg-card-hover: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #e8e8ed;
  --text-secondary: #8b8b9e;
  --text-tertiary: #5c5c72;
  --accent: #7c3aed;
  --accent-light: #a855f7;
  --accent-dim: rgba(124, 58, 237, 0.15);
  --accent-glow: rgba(124, 58, 237, 0.4);
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Animated Background ────────────────────────────────── */

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  top: -200px;
  right: -100px;
  animation: glow-float 15s ease-in-out infinite;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
  bottom: -150px;
  left: -100px;
  animation: glow-float 18s ease-in-out infinite reverse;
}

@keyframes glow-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ─── Container ──────────────────────────────────────────── */

.container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  padding-bottom: 100px;
}

/* ─── Header ─────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(8, 8, 13, 0.7);
  border-bottom: 1px solid var(--border);
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 860px;
  margin: 0 auto;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card);
}

/* ─── Hero ───────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 80px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  background: var(--accent-dim);
  border: 1px solid rgba(124, 58, 237, 0.2);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-light);
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-title {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-light), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(15px, 2vw, 17px);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease 0.2s both;
}

/* ─── Input Group ────────────────────────────────────────── */

.input-group {
  max-width: 640px;
  margin: 0 auto;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 16px;
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 30px rgba(124, 58, 237, 0.1);
}

.input-icon {
  flex-shrink: 0;
  color: var(--text-tertiary);
  margin-right: 12px;
}

#url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  padding: 10px 0;
  min-width: 0;
}

#url-input::placeholder {
  color: var(--text-tertiary);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-download {
  width: 100%;
  padding: 16px 32px;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
  margin-top: 24px;
  position: relative;
  overflow: hidden;
}

.btn-download::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: 0.5s;
}

.btn-download:hover::before {
  transform: translateX(100%);
}

.btn-download:hover {
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
  transform: translateY(-2px);
}

.btn-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

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

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

/* ─── Video Info Card ────────────────────────────────────── */

.video-info {
  margin-bottom: 32px;
}

.info-card {
  display: flex;
  gap: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  animation: fadeInUp 0.4s ease;
}

.info-thumbnail-wrap {
  position: relative;
  flex-shrink: 0;
  width: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.info-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.info-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.8);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.info-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.info-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.info-uploader {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.playlist-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-dim);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  width: fit-content;
}

/* ─── Settings Panel ─────────────────────────────────────── */

.settings {
  margin-bottom: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.setting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  animation: fadeInUp 0.4s ease both;
}

.setting-card:nth-child(1) { animation-delay: 0s; }
.setting-card:nth-child(2) { animation-delay: 0.05s; }
.setting-card:nth-child(3) { animation-delay: 0.1s; }
.setting-card:nth-child(4) { animation-delay: 0.15s; }

.setting-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.setting-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.setting-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
}

.setting-header h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.setting-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.setting-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.mt-12 { margin-top: 12px; }

/* ─── Chips ──────────────────────────────────────────────── */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.chip.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent-light);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

.chip.auto-label {
  font-style: italic;
  opacity: 0.7;
}

/* ─── Format Indicator ───────────────────────────────────── */

/* ─── Cookies Banner ─────────────────────────────────────── */

.cookies-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  margin-top: 16px;
  animation: fadeInUp 0.4s ease;
}

.cookies-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.cookies-text {
  flex: 1;
  min-width: 0;
}

.cookies-text strong {
  display: block;
  font-size: 14px;
  color: #f59e0b;
  margin-bottom: 2px;
}

.cookies-text p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.cookies-text code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.btn-cookies {
  padding: 8px 16px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
  flex-shrink: 0;
  font-size: 12px;
}

.btn-cookies:hover {
  background: rgba(245, 158, 11, 0.25);
}

/* ─── Format Indicator ───────────────────────────────────── */

.format-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.format-indicator strong {
  color: var(--accent-light);
}

.format-icon {
  font-size: 18px;
}

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

.progress-section {
  margin-bottom: 32px;
}

.progress-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: fadeInUp 0.4s ease;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.progress-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.progress-pct {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 100px;
  transition: width 0.3s ease;
  position: relative;
}

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

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

.progress-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.progress-meta span:not(:empty)::before {
  margin-right: 4px;
}

.progress-items {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── History ────────────────────────────────────────────── */

.history {
  margin-top: 40px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

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

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  animation: fadeInUp 0.3s ease;
}

.task-item:hover {
  border-color: var(--border-hover);
}

.task-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.task-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.task-status {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 12px;
}

.task-status.completed {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.task-status.downloading {
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.task-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.task-status.queued {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.task-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.task-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-light);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(124, 58, 237, 0.2);
  transition: var(--transition);
}

.task-link:hover {
  background: var(--accent-dim);
}

.task-delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: var(--transition);
}

.task-delete:hover {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ─── Empty State ────────────────────────────────────────── */

.empty-state {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ─── Utility ────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Toast Notifications ────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease;
  max-width: 360px;
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.3);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
    padding-bottom: 60px;
  }

  .header {
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    padding: 48px 0 24px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hide-mobile {
    display: none;
  }

  .input-wrapper {
    flex-direction: column;
    padding: 12px;
    gap: 8px;
  }

  .input-icon {
    display: none;
  }

  #url-input {
    width: 100%;
    font-size: 16px; /* prevent iOS zoom */
  }

  .btn-primary {
    width: 100%;
    padding: 12px;
  }

  .info-card {
    flex-direction: column;
  }

  .info-thumbnail-wrap {
    width: 100%;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .progress-meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  .task-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .task-actions {
    margin-left: 0;
    width: 100%;
  }

  .task-link {
    flex: 1;
    justify-content: center;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 28px;
  }

  .chip {
    padding: 5px 10px;
    font-size: 12px;
  }

  .setting-card {
    padding: 16px;
  }
}

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

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

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

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

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

/* ─── Selection ──────────────────────────────────────────── */

::selection {
  background: var(--accent-dim);
  color: var(--text-primary);
}
