/* ===========================
   VideoForge — Design System
   Dark editorial + cinematic
   =========================== */

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

:root {
  --bg:        #0a0a0f;
  --bg2:       #11111a;
  --bg3:       #181825;
  --border:    rgba(255,255,255,0.07);
  --border-h:  rgba(255,255,255,0.14);
  --accent:    #e8ff47;
  --accent2:   #7c3aed;
  --text:      #f0f0f8;
  --text-sub:  #8888a8;
  --text-dim:  #55556a;
  --card-bg:   rgba(255,255,255,0.03);
  --card-brd:  rgba(255,255,255,0.06);
  --r:         14px;
  --r-lg:      20px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --shadow:    0 24px 64px rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

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

.bg-glow {
  position: fixed; top: -30%; left: 50%; transform: translateX(-50%);
  width: 700px; height: 600px;
  background: radial-gradient(ellipse, rgba(124,58,237,0.12) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* Header */
header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 40px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 32px; height: 32px;
  background: var(--accent); color: var(--bg);
  border-radius: 8px; display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
}
.logo-text {
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  letter-spacing: -0.3px;
}

.header-badge {
  font-size: 11px; font-weight: 500; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(232,255,71,0.25);
  padding: 4px 12px; border-radius: 20px;
  background: rgba(232,255,71,0.06);
}

/* Hero */
.hero {
  position: relative; z-index: 2;
  text-align: center;
  padding: 72px 40px 56px;
  max-width: 720px; margin: 0 auto;
}

.hero-eyebrow {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent); font-weight: 500; margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-head); font-size: clamp(36px, 5vw, 58px);
  font-weight: 800; line-height: 1.08; letter-spacing: -1.5px;
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 16px; color: var(--text-sub); font-weight: 300;
  max-width: 480px; margin: 0 auto;
}

/* App Container */
.app-container {
  position: relative; z-index: 2;
  max-width: 780px; margin: 0 auto;
  padding: 0 24px 80px;
  display: flex; flex-direction: column; gap: 20px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  border-radius: var(--r-lg);
  padding: 32px 36px;
  position: relative;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-h); }

.card-step {
  position: absolute; top: 28px; right: 32px;
  font-family: var(--font-head); font-size: 32px; font-weight: 800;
  color: rgba(255,255,255,0.04); line-height: 1; pointer-events: none;
  user-select: none;
}

.card-title {
  font-family: var(--font-head); font-size: 20px; font-weight: 700;
  margin-bottom: 6px; letter-spacing: -0.3px;
}

.card-desc { font-size: 13px; color: var(--text-sub); margin-bottom: 24px; }

/* Upload Zone */
.upload-zone {
  border: 1.5px dashed var(--border-h);
  border-radius: var(--r);
  min-height: 160px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent); background: rgba(232,255,71,0.03);
}

.upload-content {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 32px; text-align: center;
  color: var(--text-sub); font-size: 14px;
}
.upload-icon { font-size: 28px; margin-bottom: 4px; opacity: 0.5; }
.upload-content small { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.link-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-family: inherit; font-size: inherit;
  text-decoration: underline; padding: 0;
}

.image-preview {
  width: 100%; height: 240px; object-fit: cover;
  border-radius: calc(var(--r) - 2px);
}

.remove-img {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(10,10,15,0.85); color: var(--text-sub);
  border: 1px solid var(--border-h); border-radius: 8px;
  padding: 6px 14px; font-size: 12px; cursor: pointer;
  font-family: inherit; backdrop-filter: blur(4px);
  transition: color 0.2s;
}
.remove-img:hover { color: var(--text); }

/* Prompt */
.prompt-textarea {
  width: 100%; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-h); border-radius: var(--r);
  color: var(--text); font-family: var(--font-body); font-size: 14px;
  line-height: 1.7; padding: 16px 18px; resize: vertical;
  transition: border-color 0.2s;
  outline: none;
}
.prompt-textarea:focus { border-color: rgba(124,58,237,0.5); }
.prompt-textarea::placeholder { color: var(--text-dim); }

.prompt-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}

.char-count { font-size: 12px; color: var(--text-dim); }

.btn-enhance {
  display: flex; align-items: center; gap: 7px;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3);
  color: #c4b5fd; padding: 8px 18px; border-radius: 8px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-enhance:hover { background: rgba(124,58,237,0.25); border-color: rgba(124,58,237,0.5); }
.btn-enhance:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { font-size: 11px; }

/* Enhanced box */
.enhanced-box {
  margin-top: 16px; padding: 18px 20px;
  background: rgba(124,58,237,0.07);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--r);
}
.enhanced-label {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: #a78bfa; font-weight: 500; margin-bottom: 10px;
}
.enhanced-box p {
  font-size: 14px; color: var(--text-sub); line-height: 1.7; margin-bottom: 14px;
}
.enhanced-actions { display: flex; gap: 10px; }
.btn-use {
  background: rgba(124,58,237,0.3); border: 1px solid rgba(124,58,237,0.4);
  color: #c4b5fd; padding: 7px 16px; border-radius: 7px;
  font-family: inherit; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.btn-use:hover { background: rgba(124,58,237,0.45); }
.btn-discard {
  background: none; border: 1px solid var(--border-h); color: var(--text-sub);
  padding: 7px 16px; border-radius: 7px;
  font-family: inherit; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.btn-discard:hover { border-color: var(--border); color: var(--text); }

/* Settings Grid */
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.setting-group { display: flex; flex-direction: column; gap: 7px; }
.setting-group label { font-size: 12px; color: var(--text-sub); font-weight: 500; letter-spacing: 0.3px; }
.setting-group select {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-h);
  color: var(--text); border-radius: 9px; padding: 10px 14px;
  font-family: var(--font-body); font-size: 14px;
  cursor: pointer; outline: none; transition: border-color 0.2s;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.setting-group select:focus { border-color: rgba(124,58,237,0.5); }

/* Generate button */
.generate-section { text-align: center; padding: 8px 0; }

.btn-generate {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 12px;
  padding: 18px 48px; font-family: var(--font-head);
  font-size: 17px; font-weight: 700; letter-spacing: -0.2px;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 8px 32px rgba(232,255,71,0.2);
}
.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(232,255,71,0.35);
}
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled {
  opacity: 0.4; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.btn-arrow { font-size: 20px; transition: transform 0.2s; }
.btn-generate:hover .btn-arrow { transform: translateX(4px); }

.generate-note { margin-top: 12px; font-size: 12px; color: var(--text-dim); }

/* Status Card */
.status-card {
  padding: 40px 36px;
  background: var(--card-bg); border: 1px solid var(--card-brd);
  border-radius: var(--r-lg); text-align: center;
}

.status-animation {
  position: relative; width: 72px; height: 72px;
  margin: 0 auto 24px;
}
.status-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1.2s linear infinite;
}
.ring-2 {
  inset: 8px; border-top-color: rgba(124,58,237,0.6);
  animation-duration: 1.8s; animation-direction: reverse;
}
.ring-3 {
  inset: 16px; border-top-color: rgba(232,255,71,0.3);
  animation-duration: 2.4s;
}

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

#statusTitle {
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  margin-bottom: 6px;
}
.status-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 20px; }

.progress-bar {
  height: 3px; background: rgba(255,255,255,0.07);
  border-radius: 2px; overflow: hidden; margin-top: 12px;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; width: 0%;
  transition: width 1s ease-out;
}

/* Result Card */
.result-card {
  background: var(--card-bg); border: 1px solid rgba(232,255,71,0.15);
  border-radius: var(--r-lg); padding: 36px; overflow: hidden;
}

.result-header { margin-bottom: 20px; }
.result-badge {
  display: inline-block;
  background: rgba(232,255,71,0.12); color: var(--accent);
  border: 1px solid rgba(232,255,71,0.25);
  font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px; margin-bottom: 10px;
}
.result-header h2 {
  font-family: var(--font-head); font-size: 22px; font-weight: 700;
}

.video-wrapper {
  border-radius: var(--r); overflow: hidden;
  background: #000; margin-bottom: 20px;
  aspect-ratio: 16/9;
}
.video-wrapper video {
  width: 100%; height: 100%; display: block;
  object-fit: contain;
}

.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-download {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--bg);
  border-radius: 10px; padding: 12px 28px;
  font-family: var(--font-head); font-size: 15px; font-weight: 700;
  text-decoration: none; transition: all 0.2s;
}
.btn-download:hover { box-shadow: 0 8px 24px rgba(232,255,71,0.3); transform: translateY(-1px); }

.btn-new {
  background: none; border: 1px solid var(--border-h); color: var(--text-sub);
  border-radius: 10px; padding: 12px 28px;
  font-family: var(--font-head); font-size: 15px; cursor: pointer;
  transition: all 0.2s;
}
.btn-new:hover { border-color: var(--accent); color: var(--accent); }

/* Error */
.error-card {
  display: flex; align-items: center; gap: 16px;
  background: rgba(239,68,68,0.07); border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--r-lg); padding: 24px 28px;
}
.error-icon { font-size: 24px; flex-shrink: 0; }
.error-title { font-weight: 600; margin-bottom: 4px; }
.error-msg { font-size: 13px; color: var(--text-sub); }
.btn-retry {
  margin-left: auto; background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5; border-radius: 8px; padding: 8px 18px;
  font-family: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
}
.btn-retry:hover { background: rgba(239,68,68,0.25); }

/* Config button */
.config-btn {
  position: fixed; bottom: 28px; right: 28px; z-index: 100;
  width: 44px; height: 44px;
  background: var(--bg2); border: 1px solid var(--border-h);
  border-radius: 12px; font-size: 18px; cursor: pointer;
  color: var(--text-sub); transition: all 0.2s;
  display: grid; place-items: center;
}
.config-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.modal {
  background: #14141f; border: 1px solid var(--border-h);
  border-radius: var(--r-lg); width: 100%; max-width: 520px;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h3 { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-sub);
  font-size: 18px; cursor: pointer; padding: 4px; line-height: 1;
}

.modal-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }

.api-field { display: flex; flex-direction: column; gap: 6px; }
.api-field label { font-size: 13px; font-weight: 500; }
.required { color: #f87171; }
.optional { color: var(--text-dim); font-size: 11px; font-weight: 400; }
.field-hint { font-size: 12px; color: var(--text-sub); }
.field-hint a { color: var(--accent); text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }

.api-field input {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-h);
  color: var(--text); border-radius: 9px; padding: 10px 14px;
  font-family: var(--font-mono, monospace); font-size: 13px; outline: none;
  transition: border-color 0.2s;
}
.api-field input:focus { border-color: rgba(124,58,237,0.5); }

.modal-note {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 9px; padding: 12px 14px;
  font-size: 12px; color: var(--text-sub); line-height: 1.6;
}

.modal-footer {
  padding: 0 28px 24px; display: flex; justify-content: flex-end;
}
.btn-save-config {
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 9px; padding: 11px 28px;
  font-family: var(--font-head); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.btn-save-config:hover { box-shadow: 0 4px 20px rgba(232,255,71,0.3); }

/* Utilities */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  header { padding: 16px 20px; }
  .hero { padding: 48px 20px 36px; }
  .app-container { padding: 0 16px 60px; }
  .card { padding: 24px 20px; }
  .settings-grid { grid-template-columns: 1fr; }
  .btn-generate { padding: 16px 36px; font-size: 15px; }
  .config-btn { bottom: 16px; right: 16px; }
}