/* ==========================================================================
   Design System & Universal Downloader Styling
   ========================================================================== */

:root {
  --bg-primary: #080c16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(18, 26, 47, 0.75);
  --bg-card-hover: rgba(26, 38, 68, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  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-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background Ambient Orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
  top: -150px;
  left: 20%;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  top: 30%;
  right: -100px;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  bottom: -100px;
  left: -50px;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 40px;
}

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

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.brand {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: linear-gradient(135deg, #818cf8, #38bdf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 36px;
}

/* Downloader Box */
.download-box-wrapper {
  max-width: 760px;
  margin: 0 auto 32px;
}

.download-box {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.download-box:focus-within {
  border-color: var(--border-glow);
  box-shadow: 0 20px 50px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.input-container {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.input-container:focus-within {
  border-color: #6366f1;
  background: rgba(15, 23, 42, 0.95);
}

.input-icon-wrapper {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 18px;
  transition: var(--transition);
}

.input-icon-wrapper.detected {
  color: #38bdf8;
  transform: scale(1.1);
}

#urlInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-main);
  padding: 10px 8px;
  font-family: inherit;
}

#urlInput::placeholder {
  color: var(--text-dim);
}

.action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #38bdf8;
}

.clear-btn {
  padding: 8px 10px;
  color: var(--text-dim);
}

.clear-btn:hover {
  color: var(--accent-rose);
}

.platform-override-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 16px;
  font-size: 13px;
}

.override-label {
  color: var(--text-dim);
}

.detected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.download-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
}

.download-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(99, 102, 241, 0.5);
  filter: brightness(1.08);
}

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

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

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

/* Result Area */
.result-area {
  max-width: 760px;
  margin: 0 auto 40px;
  text-align: left;
  animation: slideUp 0.3s ease;
}

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

.result-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.media-preview-container {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.media-thumb-box {
  width: 180px;
  min-width: 180px;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-color);
  position: relative;
}

.media-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-info {
  flex: 1;
}

.media-platform-tag {
  display: inline-block;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.media-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-meta-row {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Download Options Section */
.download-links-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.dl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.dl-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.3);
}

.dl-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dl-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.dl-badge.audio {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.dl-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

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

.dl-actions {
  display: flex;
  gap: 8px;
}

.btn-dl-now {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-dl-now:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-copy-link {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

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

/* Error Area */
.error-area {
  max-width: 760px;
  margin: 0 auto 32px;
}

.error-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
}

.error-icon {
  font-size: 24px;
  color: var(--accent-rose);
}

.error-content h3 {
  font-size: 15px;
  color: #fda4af;
  margin-bottom: 2px;
}

.error-content p {
  font-size: 13px;
  color: #fecdd3;
}

/* Supported Platforms */
.platforms-section {
  margin: 50px 0 40px;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-main);
}

.platforms-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 860px;
  margin: 0 auto;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
}

.platform-chip:hover, .platform-chip.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  transform: translateY(-2px);
}

.platform-chip i {
  font-size: 15px;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 40px;
  text-align: left;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-link {
  color: #38bdf8;
  text-decoration: none;
}

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

.toast {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease forwards;
}

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

@media (max-width: 640px) {
  .hero-title { font-size: 28px; }
  .media-preview-container { flex-direction: column; }
  .media-thumb-box { width: 100%; aspect-ratio: 16/9; }
  .download-box { padding: 16px; }
}
