/* ========================================================
   RITMADA YOUTUBE DOWNLOADER — STYLESHEET
   Modern Dark-Mode Glassmorphism Design
   ======================================================== */

:root {
  --bg-main: #0a0c10;
  --bg-card: rgba(18, 22, 32, 0.75);
  --bg-card-hover: rgba(26, 31, 46, 0.85);
  --bg-input: #121620;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);
  
  --accent-primary: #6366f1;
  --accent-secondary: #a855f7;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Background ambient glows */
.bg-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  top: -100px;
  left: 20%;
  background: radial-gradient(circle, #6366f1, transparent 70%);
}

.bg-glow-2 {
  top: 300px;
  right: 15%;
  background: radial-gradient(circle, #ec4899, transparent 70%);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* Navbar */
.navbar {
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 12, 16, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-name span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 50px 0 30px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Search Card */
.search-card {
  max-width: 800px;
  margin: 0 auto;
}

.search-form {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  padding: 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: var(--transition);
}

.search-form:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 10px 40px var(--accent-glow);
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 14px 0;
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
}

.btn-ghost {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-clear {
  padding: 6px 10px;
  font-size: 0.9rem;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-gradient);
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* Quick Samples */
.quick-samples {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.sample-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.sample-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

/* Error Alert */
.error-alert {
  max-width: 800px;
  margin: 20px auto;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fca5a5;
  font-size: 0.95rem;
}

.error-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-size: 1.1rem;
}

/* Video Results Card */
.result-section {
  max-width: 1000px;
  margin: 30px auto;
  animation: fadeIn 0.4s ease-out;
}

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

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.video-preview {
  display: flex;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.015);
}

.thumbnail-wrapper {
  position: relative;
  width: 320px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: #000;
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.video-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.video-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item svg {
  color: var(--accent-primary);
}

.video-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tabs */
.format-tabs-wrapper {
  padding: 20px 24px;
}

.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Format Table */
.table-container {
  overflow-x: auto;
}

.format-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.format-table th {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.format-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.format-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.badge-4k {
  background: linear-gradient(135deg, #e11d48, #be185d);
  color: #fff;
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.4);
}

.badge-2k {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
}

.badge-fhd {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.badge-hd {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-sd {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.badge-mp3 {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.format-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.size-tag {
  color: var(--text-dim);
  font-size: 0.88rem;
}

.text-right {
  text-align: right;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-download:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Features Section */
.features-section {
  padding: 60px 0 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

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

.feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 14px;
}

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

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

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #181d2c;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.toast-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast-content h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.toast-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .search-form {
    flex-direction: column;
  }
  
  .btn-primary {
    padding: 14px;
  }

  .video-preview {
    flex-direction: column;
  }

  .thumbnail-wrapper {
    width: 100%;
  }

  .meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
