:root {
  --bg-primary: #0f1117;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(30, 36, 46, 0.95);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #6366f1;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-primary: #6366f1;
  --accent-secondary: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  --btn-green: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --btn-blue: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --btn-orange: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family:
    "Plus Jakarta Sans",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 24px 16px;
}

/* Background Ambient Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.glow-1 {
  top: -100px;
  left: 20%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
}
.glow-2 {
  bottom: 10%;
  right: 15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #ec4899, transparent 70%);
}

.container {
  width: 100%;
  max-width: 900px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Header */
.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.logo-icon svg {
  width: 28px;
  height: 28px;
}

.brand-text h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-free {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 3px 8px;
  border-radius: 20px;
}

.brand-text p {
  color: var(--text-secondary);
  font-size: 15px;
}
.brand-text p strong {
  color: #38bdf8;
}

.platform-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}
.tag-tiktok {
  background: rgba(236, 72, 153, 0.15);
  border-color: rgba(236, 72, 153, 0.4);
  color: #f472b6;
}

/* Main Card */
.main-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Input Group */
.input-group {
  display: flex;
  gap: 12px;
  width: 100%;
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(15, 17, 23, 0.8);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  transition: all 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 10px;
}

.input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  padding: 15px 0;
}
.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.btn-paste {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-paste:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}
.btn-paste svg {
  width: 14px;
  height: 14px;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  margin-left: 6px;
}
.btn-clear:hover {
  color: var(--text-primary);
}

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border: none;
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 0 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  flex-shrink: 0;
  min-width: 130px;
}
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}
.btn-submit:active {
  transform: translateY(0);
}
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error Banner */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
}
.error-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Result Section */
.result-section {
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  background: rgba(15, 17, 23, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.media-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 480px;
}

.player-wrapper video {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.image-preview {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.info-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  object-fit: cover;
}

.author-details h3 {
  font-size: 16px;
  font-weight: 700;
}
.author-details span {
  font-size: 13px;
  color: var(--text-muted);
}

.platform-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(129, 140, 248, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.video-title {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
}

/* Slideshow gallery */
.slideshow-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.slideshow-box h4 {
  font-size: 14px;
  font-weight: 600;
}
.slide-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.slide-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.slide-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slide-item a {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.2s;
}
.slide-item:hover a {
  opacity: 1;
}

/* Download buttons */
.downloads-group {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.btn-download:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-download.btn-nowatermark {
  background: var(--btn-green);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3);
}
.btn-download.btn-hd {
  background: var(--btn-blue);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.3);
}
.btn-download.btn-audio {
  background: var(--btn-orange);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.3);
}
.btn-download.btn-generic {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-tag {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 8px;
  border-radius: 4px;
}

/* History */
.history-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.btn-clear-history {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}
.btn-clear-history:hover {
  color: #ef4444;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.history-card {
  display: flex;
  gap: 12px;
  background: rgba(15, 17, 23, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.history-card:hover {
  border-color: var(--accent-primary);
  background: rgba(30, 36, 46, 0.7);
}

.history-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.history-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.history-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-author {
  font-size: 11px;
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .brand-text h1 {
    font-size: 24px;
  }
  .input-group {
    flex-direction: column;
  }
  .btn-submit {
    padding: 14px 0;
    min-width: 100%;
  }
  .result-card {
    grid-template-columns: 1fr;
  }
  .player-wrapper {
    max-height: 380px;
  }
}
