:root {
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --bg: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --error: #ef4444;
  --success: #10b981;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 900px;
  padding: 2rem;
  z-index: 10;
}

body::before {
  content: "";
  position: fixed;
  top: -10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  z-index: -1;
}

body::after {
  content: "";
  position: fixed;
  bottom: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
  z-index: -1;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

.logo {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #a78bfa 0%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.3));
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search-container {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  padding: 1.5rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.input-wrapper {
  display: flex;
  gap: 1rem;
}

input {
  flex: 1;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(15, 23, 42, 0.5);
  color: white;
  font-size: 1.1rem;
  transition: border-color 0.3s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.8);
}

#searchBtn {
  padding: 0 2.5rem;
  border-radius: 1rem;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}

#searchBtn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.4);
}

.result-area {
  margin-top: 2.5rem;
  animation: slideUp 0.5s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.video-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-container {
  padding: 2rem;
}

.info-container h2 {
  margin-bottom: 1rem;
  font-size: 1.4rem;
  line-height: 1.4;
}

.uploader {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.selection-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.quality-dropdown {
  width: 100%;
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.5rem;
}

.main-dl-btn {
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 1.25rem;
  border-radius: 1rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.3s;
}

.main-dl-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.02);
  box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.4);
}

.error-message {
  margin-top: 1.5rem;
  color: var(--error);
  font-weight: 500;
  text-align: center;
}

.hidden {
  display: none !important;
}

.loader {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

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

  .input-wrapper {
    flex-direction: column;
  }
}

.ffmpeg-warning {
  background: rgba(255, 193, 7, 0.1);
  border-left: 4px solid #ffbc00;
  padding: 1rem;
  border-radius: 0.75rem;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #ffbc00;
  line-height: 1.4;
}

.ffmpeg-warning i {
  font-size: 1.2rem;
}

.ffmpeg-warning b {
  color: white;
  text-decoration: underline;
}
/* Final Modal Fix */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9) !important; backdrop-filter: blur(10px) !important; display: flex !important; justify-content: center !important; align-items: center !important; z-index: 99999 !important; opacity: 0; visibility: hidden; transition: all 0.3s; }
.modal-overlay:not(.hidden) { opacity: 1 !important; visibility: visible !important; }
.modal-content { background: #1e293b !important; color: white !important; padding: 2.5rem !important; border-radius: 24px !important; max-width: 500px !important; width: 90% !important; text-align: center !important; border: 1px solid rgba(255,255,255,0.2) !important; box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important; transform: translateY(20px); transition: all 0.3s; }
.modal-overlay:not(.hidden) .modal-content { transform: translateY(0) !important; }
.close-btn { position: absolute !important; top: 10px !important; right: 20px !important; font-size: 2.5rem !important; color: white !important; background: none !important; border: none !important; cursor: pointer !important; }
.modal-thumb { width: 100% !important; border-radius: 12px !important; margin-bottom: 1.5rem !important; }
.confirm-btn { width: 100% !important; padding: 1.2rem !important; background: linear-gradient(135deg, #8b5cf6, #d946ef) !important; border: none !important; border-radius: 12px !important; color: white !important; font-weight: 800 !important; font-size: 1.1rem !important; cursor: pointer !important; }
.thanks-msg { color: #10b981 !important; font-size: 1.3rem !important; font-weight: 700 !important; margin-bottom: 1rem !important; }
body.modal-open { overflow: hidden !important; }

footer {
  width: 100%;
  text-align: center;
  margin-top: 6rem;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  opacity: 0.6;
}
