:root {
  /* Palette Cyberpunk Neon */
  --primary: #00f2ff;
  --primary-glow: rgba(0, 242, 255, 0.4);
  --secondary: #bd00ff;
  --secondary-glow: rgba(189, 0, 255, 0.4);
  --bg-dark: #050511;
  --glass-bg: rgba(20, 20, 35, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-muted: #a0a0b0;
  --success: #00ff9d;
  --error: #ff4d4d;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--secondary) var(--bg-dark);
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(29, 0, 65, 0.8) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 45, 60, 0.8) 0%, transparent 40%);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background Mesh */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTAwIDB2MjAwTTAgMTAwaDIwMCIgc3Ryb2tlPSJyZ2JhKDI1NSwyNTUsMjU1LDAuMDMpIiBzdHJva2Utd2lkdGg9IjIiLz48L3N2Zz4=');
  background-size: 40px 40px;
  z-index: -1;
  opacity: 0.5;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

/* ===== HEADER ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2rem;
  animation: fadeInDown 0.8s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

.logo-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--primary);
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  margin: 3rem 0;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #fff, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: rgba(189, 0, 255, 0.1);
  border: 1px solid rgba(189, 0, 255, 0.3);
  border-radius: 50px;
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== GLASS CARD (DOWNLOAD BOX) ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.5), inset 0 0 20px rgba(255,255,255,0.02);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 3rem;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.5;
}

.input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.input-wrapper i {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.url-input {
  width: 100%;
  padding: 18px 20px 18px 55px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.url-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 20px var(--secondary-glow);
  background: rgba(0, 0, 0, 0.5);
}

.url-input:focus + i {
  color: var(--secondary);
}

.download-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border: none;
  border-radius: 12px;
  color: #000;
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px var(--secondary-glow);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--primary-glow);
  color: #fff;
}

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

/* ===== LOADING BAR ===== */
.progress-wrapper {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  margin-top: 20px;
  overflow: hidden;
  display: none;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  width: 0%;
  box-shadow: 0 0 10px var(--primary);
  transition: width 0.3s ease;
}

/* ===== RESULT VIDEO CARD ===== */
.result-area {
  display: none;
  margin-top: 2rem;
  animation: slideUp 0.5s ease;
}

.video-card {
  background: rgba(0,0,0,0.4);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.video-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  color: var(--primary);
  font-weight: 700;
}

video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn-action {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  min-width: 140px;
  font-size: 0.95rem;
}

.btn-download {
  background: rgba(0, 242, 255, 0.15);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-download:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn-copy {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

.btn-copy:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

/* ===== FEATURES GRID ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 4rem;
}

.feature-item {
  background: rgba(255,255,255,0.03);
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-5px);
}

.feature-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, rgba(189, 0, 255, 0.2), rgba(0, 242, 255, 0.2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.feature-item h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.feature-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== HISTORY ===== */
.history-panel {
  margin-top: 3rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 2rem;
}

.history-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.history-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.1);
}

.history-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.history-delete {
  color: var(--error);
  opacity: 0.5;
  transition: opacity 0.2s;
}

.history-delete:hover {
  opacity: 1;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 3rem 0;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer a {
  color: var(--primary);
  text-decoration: none;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(10, 10, 20, 0.95);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 1000;
  font-size: 0.9rem;
}

.toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--error); }

/* Animations */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,0,0,0.3);
  border-radius: 50%;
  border-top-color: #000;
  animation: spin 1s ease-in-out infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsiveness */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .glass-card { padding: 1.5rem; }
  .action-row { flex-direction: column; }
}
