/**
 * Media Downloader — Design System & Stylesheet
 * Strictly Black, White, and Red Theme
 */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Strictly Black, White, and Red Palette - Dark Default */
  --bg-body: #000000;
  --bg-surface: #0c0c0c;
  --bg-surface-elevated: #161616;
  --bg-surface-hover: #222222;
  --bg-input: #080808;
  
  --border-subtle: #242424;
  --border-focus: #e50914;
  --border-card: rgba(255, 255, 255, 0.1);

  --text-primary: #ffffff;
  --text-secondary: #d4d4d4;
  --text-tertiary: #808080;
  --text-inverse: #000000;

  --accent-primary: #e50914;
  --accent-hover: #dc2626;
  --accent-light: rgba(229, 9, 20, 0.16);
  --accent-gradient: linear-gradient(135deg, #e50914 0%, #b91c1c 100%);
  
  --success: #e50914;
  --success-bg: rgba(229, 9, 20, 0.16);
  --warning: #ffffff;
  --warning-bg: #1c1c1c;
  --danger: #e50914;
  --danger-bg: rgba(229, 9, 20, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 25px rgba(229, 9, 20, 0.28);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-body: #ffffff;
  --bg-surface: #f7f7f7;
  --bg-surface-elevated: #eeeeee;
  --bg-surface-hover: #e2e2e2;
  --bg-input: #ffffff;
  
  --border-subtle: #d6d6d6;
  --border-focus: #e50914;
  --border-card: rgba(0, 0, 0, 0.08);

  --text-primary: #000000;
  --text-secondary: #333333;
  --text-tertiary: #666666;
  --text-inverse: #ffffff;

  --accent-light: rgba(229, 9, 20, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.15);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-hover);
}

/* Container */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 12, 12, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-normal), border-color var(--transition-normal);
}
[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.9);
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.brand-logo img, .brand-logo svg {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-link {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
}

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

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

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

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--accent-light);
  border: 1px solid rgba(229, 9, 20, 0.4);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

/* Downloader Form Card */
.downloader-box {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px 8px 6px 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-group:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.25);
}

.input-icon {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1.05rem;
  padding: 10px 4px;
  font-family: inherit;
}
.url-input::placeholder {
  color: var(--text-tertiary);
}

.btn-paste, .btn-clear {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-paste:hover, .btn-clear:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition-fast), opacity var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.4);
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.55);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Supported Badges Bar */
.supported-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.platform-pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Alert Notification */
.alert-box {
  display: none;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: left;
}
.alert-box.active {
  display: flex;
}
.alert-danger {
  background: var(--danger-bg);
  border: 1px solid rgba(229, 9, 20, 0.4);
  color: #ffffff;
}
.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
}
.alert-success {
  background: var(--accent-light);
  border: 1px solid rgba(229, 9, 20, 0.4);
  color: #ffffff;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Media Result Section */
.result-section {
  display: none;
  margin-top: 36px;
  text-align: left;
}
.result-section.active {
  display: block;
}

.media-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .media-card {
    grid-template-columns: 1fr;
  }
}

.media-thumb-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000000;
  border: 1px solid var(--border-subtle);
}
.media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.media-info {
  display: flex;
  flex-direction: column;
}
.media-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}
.media-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.media-uploader {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Tabs: Video / Audio */
.tab-controls {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition-fast);
}
.tab-btn:hover {
  color: var(--text-primary);
}
.tab-btn.active {
  color: var(--accent-primary);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-primary);
}

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

/* Format Grid */
.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.format-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition-fast);
}
.format-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.format-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.format-res {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.format-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent-primary);
}
.format-pill.badge-rec {
  background: var(--accent-primary);
  color: #ffffff;
}

.format-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-download-format {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-download-format:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

/* Job Processing Status Card */
.job-modal {
  display: none;
  margin-top: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.job-modal.active {
  display: block;
}

.job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.job-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.job-status-badge {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}
.badge-queued { background: #262626; color: #ffffff; }
.badge-processing { background: var(--accent-primary); color: #ffffff; }
.badge-completed { background: var(--accent-primary); color: #ffffff; }
.badge-failed { background: var(--accent-light); color: var(--accent-primary); border: 1px solid var(--accent-primary); }

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.job-details-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-complete-download {
  display: none;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.45);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.btn-complete-download.active {
  display: inline-flex;
}
.btn-complete-download:hover {
  background: var(--accent-hover);
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Feature & Steps Section */
.features-section {
  padding: 70px 0;
}
.section-heading {
  text-align: center;
  margin-bottom: 48px;
}
.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: left;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.step-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 20px;
}
.step-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.step-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* FAQ Accordion */
.faq-section {
  padding: 40px 0 80px;
}
.faq-wrap {
  max-width: 820px;
  margin: 0 auto;
}
.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}
.faq-item.open {
  border-color: var(--accent-primary);
}
.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  padding: 20px 24px;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.faq-chevron {
  color: var(--accent-primary);
  transition: transform var(--transition-fast);
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}
.faq-answer {
  display: none;
  padding: 0 24px 20px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}
.faq-item.open .faq-answer {
  display: block;
}

/* Legal Pages */
.legal-content {
  max-width: 820px;
  margin: 40px auto 80px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px;
}
.legal-content h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.legal-content .updated-date {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-bottom: 30px;
  display: block;
}
.legal-content h2 {
  font-size: 1.35rem;
  margin: 28px 0 12px;
}
.legal-content p, .legal-content li {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 1rem;
  line-height: 1.7;
}
.legal-content ul {
  padding-left: 24px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  animation: slideIn 0.25s ease forwards;
}
.toast.toast-error { border-left: 4px solid var(--accent-primary); }
.toast.toast-success { border-left: 4px solid var(--text-primary); }
.toast.toast-info { border-left: 4px solid var(--accent-primary); }

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

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 48px 0 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 36px;
}
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 380px;
  margin-top: 12px;
  line-height: 1.6;
}
.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.footer-links {
  list-style: none;
}
.footer-links li {
  margin-bottom: 10px;
}
.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-links a:hover {
  color: var(--accent-primary);
}
.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}
@media (max-width: 640px) {
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
