/* freeviddown - Redesigned Lightweight Stylesheet v2.0 */

/* ============================================
   CSS Variables & Theme
   ============================================ */
:root {
   --primary: #7c6aef;
   --primary-color: #7c6aef;
   --primary-rgb: 124, 106, 239;
   --secondary-color: #f43f5e;
   --primary-hover: #6c5ce7;
   --primary-glow: rgba(124, 106, 239, 0.3);
   --success: #10b981;
   --warning: #f59e0b;
   --error: #ef4444;
   --gradient-primary: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
   --gradient-surface: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
   --space-xs: 0.25rem;
   --space-sm: 0.5rem;
   --space-md: 1rem;
   --space-lg: 1.5rem;
   --space-xl: 2rem;
   --space-2xl: 3rem;
   --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
   --font-size-xs: 0.75rem;
   --font-size-sm: 0.875rem;
   --font-size-md: 1rem;
   --font-size-lg: 1.25rem;
   --font-size-xl: 1.5rem;
   --font-size-2xl: 2rem;
   --font-size-3xl: 2.5rem;
   --radius-sm: 0.375rem;
   --radius-md: 0.5rem;
   --radius-lg: 0.75rem;
   --radius-xl: 1rem;
   --radius-full: 9999px;
   --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
   --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
   --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
   --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
   --transition-fast: 150ms ease;
   --transition-base: 200ms ease;
   --transition-slow: 300ms ease;
   --container-max: 1200px;
   --hub-bg: rgba(15, 15, 26, 0.95);
   --hub-border: rgba(255, 255, 255, 0.08);
   --hub-blur: 24px;
   --hub-accent: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
   --hub-item-bg: rgba(255, 255, 255, 0.025);
   --hub-item-border: rgba(255, 255, 255, 0.05);
   --hub-item-hover-bg: rgba(255, 255, 255, 0.05);
   --hub-item-hover-border: rgba(255, 255, 255, 0.1);
   --progress-glow: 0 0 18px rgba(99, 102, 241, 0.45);
   --progress-complete-glow: 0 0 18px rgba(52, 199, 89, 0.45);
   --progress-error-glow: 0 0 18px rgba(255, 59, 48, 0.45);
}

/* Dark Theme */
.theme-dark {
   --bg-primary: #0a0a0f;
   --bg-secondary: #14141f;
   --bg-tertiary: #1a1a28;
   --bg-card: #1a1a28;
   --bg-glass: rgba(20, 20, 31, 0.95);
   --text-primary: #f0f0f5;
   --text-secondary: #8888a0;
   --text-muted: #5a5a72;
   --border-color: rgba(255, 255, 255, 0.06);
   --border-light: rgba(255, 255, 255, 0.03);
   --gradient-bg: #0a0a0f;
   --gradient-card: rgba(124, 106, 239, 0.03);
}

/* Light Theme */
.theme-light {
   --bg-primary: #fafbfc;
   --bg-secondary: #ffffff;
   --bg-tertiary: #f5f6f8;
   --bg-card: #ffffff;
   --bg-glass: rgba(255, 255, 255, 0.95);
   --text-primary: #111827;
   --text-secondary: #6b7280;
   --text-muted: #9ca3af;
   --border-color: rgba(0, 0, 0, 0.08);
   --border-light: rgba(0, 0, 0, 0.04);
   --gradient-bg: #fafbfc;
   --gradient-card: rgba(124, 106, 239, 0.02);
   --hub-bg: rgba(255, 255, 255, 0.95);
   --hub-border: rgba(0, 0, 0, 0.08);
   --hub-item-bg: rgba(0, 0, 0, 0.02);
   --hub-item-border: rgba(0, 0, 0, 0.06);
   --hub-item-hover-bg: rgba(0, 0, 0, 0.04);
   --hub-item-hover-border: rgba(0, 0, 0, 0.1);
}

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

html {
   scroll-behavior: smooth;
}

body {
   font-family: var(--font-family);
   font-size: var(--font-size-md);
   line-height: 1.6;
   color: var(--text-primary);
   background: var(--bg-primary);
   min-height: 100vh;
   -webkit-font-smoothing: antialiased;
}

[dir="rtl"] {
   direction: rtl;
   text-align: right;
}

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

a:hover {
   color: var(--primary-hover);
}

img {
   max-width: 100%;
   height: auto;
}

/* ============================================
   Utilities
   ============================================ */
.container {
   width: 100%;
   max-width: var(--container-max);
   margin: 0 auto;
   padding: 0 var(--space-lg);
}

.hidden {
   display: none !important;
}

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

.text-muted {
   color: var(--text-muted);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: var(--space-sm);
   padding: var(--space-sm) var(--space-lg);
   font-family: inherit;
   font-size: var(--font-size-sm);
   font-weight: 500;
   line-height: 1.5;
   border: none;
   border-radius: var(--radius-md);
   cursor: pointer;
   transition: all var(--transition-fast);
   white-space: nowrap;
   text-decoration: none;
}

.btn:disabled {
   opacity: 0.6;
   cursor: not-allowed;
}

.btn-primary {
   background: var(--primary);
   color: white;
}

.btn-primary:hover:not(:disabled) {
   background: var(--primary-hover);
   transform: translateY(-1px);
}

.btn-ghost {
   background: transparent;
   color: var(--text-secondary);
}

.btn-ghost:hover {
   color: var(--text-primary);
   background: var(--bg-tertiary);
}

.btn-download {
   padding: var(--space-md) var(--space-xl);
   font-size: var(--font-size-md);
   border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.btn-block {
   width: 100%;
}

.btn-link {
   background: none;
   border: none;
   color: var(--primary);
   cursor: pointer;
   font-size: var(--font-size-sm);
}

.btn-link:hover {
   text-decoration: underline;
}

.btn-icon {
   padding: 0.5rem;
   background: transparent;
   border: none;
   cursor: pointer;
   font-size: 1.1rem;
   display: inline-flex;
   align-items: center;
   justify-content: center;
}

.btn-secondary {
   background: var(--bg-tertiary);
   color: var(--text-primary);
   border: 1px solid var(--border-color);
}

.btn-secondary:hover {
   background: var(--primary);
   color: white;
   border-color: var(--primary);
}

.btn-scan {
   background: var(--success);
   color: white;
}

.btn-scan:hover {
   filter: brightness(1.1);
}

.btn-playlist {
   background: #8b5cf6;
   color: white;
}

.btn-playlist:hover {
   filter: brightness(1.1);
}

.btn-glow {
   position: relative;
   overflow: hidden;
}

/* ============================================
   Inputs
   ============================================ */
.input {
   width: 100%;
   padding: var(--space-md) var(--space-lg);
   font-family: inherit;
   font-size: var(--font-size-md);
   color: var(--text-primary);
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-lg);
   outline: none;
   transition: border-color var(--transition-fast);
}

.input:focus {
   border-color: var(--primary);
   box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.input-group {
   display: flex;
   gap: 0;
   border-radius: var(--radius-lg);
   overflow: hidden;
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
}

.input-group .input {
   border-radius: 0;
   border: none;
   flex: 1;
}

.input-group .input:focus {
   z-index: 1;
   box-shadow: none;
}

.input-group .btn-download {
   border-radius: 0;
}

.paste-btn,
.clear-btn {
   padding: 0.75rem;
   font-size: 1.25rem;
   background: transparent;
   border: none;
   cursor: pointer;
   transition: all 0.2s;
   color: var(--text-muted);
}

.paste-btn:hover,
.clear-btn:hover {
   color: var(--primary);
}

/* ============================================
   Header — Simple, no blur
   ============================================ */
.header {
   position: sticky;
   top: 0;
   z-index: 100;
   padding: var(--space-sm) 0;
   background: var(--bg-primary);
   border-bottom: 1px solid var(--border-color);
}

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

.logo {
   display: flex;
   align-items: center;
   gap: var(--space-sm);
   font-size: var(--font-size-lg);
   font-weight: 700;
   color: var(--text-primary);
}

.logo-icon {
   font-size: 1.5em;
}

.nav {
   display: flex;
   align-items: center;
   gap: var(--space-sm);
}

.auth-buttons {
   display: flex;
   gap: var(--space-sm);
}

.theme-dark .icon-moon {
   display: none;
}

.theme-dark .icon-sun {
   display: inline;
}

.theme-light .icon-moon {
   display: inline;
}

.theme-light .icon-sun {
   display: none;
}

/* ============================================
   Hero Section — Clean, no background effects
   ============================================ */
.hero {
   position: relative;
   padding: var(--space-2xl) 0 var(--space-xl);
   text-align: center;
   overflow: hidden;
}

.hero .container {
   position: relative;
   z-index: 1;
}

.hero-bg-animation {
   display: none;
}

.hero-title {
   font-size: var(--font-size-3xl);
   font-weight: 700;
   margin-bottom: var(--space-sm);
}

.hero-title .letter {
   display: inline-block;
   transform-origin: center bottom;
}

.hero-subtitle {
   font-size: var(--font-size-lg);
   color: var(--text-secondary);
   margin-bottom: var(--space-xl);
}

.hero-subtitle .word {
   display: inline-block;
   margin-right: 0.3em;
}

.hero-title span {
   display: inline-block;
}

.gradient-text {
   color: var(--primary);
   -webkit-text-fill-color: var(--primary);
}

.animated-gradient {
   color: var(--primary);
   -webkit-text-fill-color: var(--primary);
}

.highlight-text {
   color: var(--primary);
}

/* ============================================
   Download Box — Clean card, no glass/glow
   ============================================ */
.download-box {
   max-width: 700px;
   margin: 0 auto;
   padding: var(--space-xl);
   background: var(--bg-card);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-xl);
   box-shadow: var(--shadow-md);
}

/* glass-effect, glow-effect: removed in redesign */
.download-form {
   margin-bottom: var(--space-lg);
}

/* Platforms */
.platforms {
   display: flex;
   justify-content: center;
   flex-wrap: wrap;
   gap: var(--space-sm);
   margin-top: var(--space-lg);
}

.platform-badge {
   display: inline-flex;
   align-items: center;
   gap: 4px;
   padding: 4px 10px;
   background: var(--bg-tertiary);
   border-radius: var(--radius-full);
   font-size: 0.8rem;
   color: var(--text-secondary);
   transition: color var(--transition-fast);
   cursor: default;
}

.platform-badge:hover {
   color: var(--text-primary);
}

.platform-icon {
   font-size: 1rem;
}

.platform-badge.universal {
   background: var(--primary);
   color: white;
   font-weight: 600;
}

/* Mode Toggle */
.mode-toggle {
   display: flex;
   gap: 0.5rem;
   margin-bottom: 1rem;
   padding: 0.25rem;
   background: var(--bg-tertiary);
   border-radius: var(--radius-lg);
   width: fit-content;
   margin-left: auto;
   margin-right: auto;
}

.mode-btn {
   padding: 0.5rem 1rem;
   font-size: 0.85rem;
   font-weight: 500;
   background: transparent;
   border: none;
   border-radius: var(--radius-md);
   cursor: pointer;
   color: var(--text-muted);
   transition: all 0.2s;
}

.mode-btn:hover {
   color: var(--text-primary);
}

.mode-btn.active {
   background: var(--primary);
   color: white;
}

.mode-btn .mode-icon {
   font-size: 1.1rem;
   margin-right: 4px;
}

.mode-btn .mode-text {
   font-weight: 500;
}

/* Live Stats Banner */
.live-stats-banner {
   display: none;
}

.stat-item {
   display: flex;
   align-items: center;
   gap: var(--space-sm);
   text-align: center;
}

.stat-icon {
   font-size: 1.5rem;
}

.stat-value {
   font-size: var(--font-size-lg);
   font-weight: 700;
   display: block;
}

.stat-label {
   font-size: var(--font-size-sm);
   color: var(--text-muted);
}

.stat-divider {
   width: 1px;
   height: 30px;
   background: var(--border-color);
}

/* ============================================
   Results
   ============================================ */
.results {
   padding: var(--space-xl) 0;
}

.result-card {
   max-width: 700px;
   margin: 0 auto;
   padding: var(--space-xl);
   background: var(--bg-card);
   border-radius: var(--radius-xl);
   border: 1px solid var(--border-color);
}

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

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

.video-info {
   display: flex;
   gap: var(--space-lg);
   margin-bottom: var(--space-lg);
}

.video-thumbnail {
   width: 160px;
   height: 90px;
   object-fit: cover;
   border-radius: var(--radius-md);
   background: var(--bg-tertiary);
}

.video-details {
   flex: 1;
}

.video-title {
   font-size: var(--font-size-lg);
   font-weight: 600;
   margin-bottom: var(--space-xs);
   line-height: 1.3;
}

.video-meta {
   color: var(--text-muted);
   font-size: var(--font-size-sm);
}

.quality-options {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
   gap: var(--space-md);
}

.quality-btn {
   display: flex;
   flex-direction: column;
   align-items: center;
   padding: var(--space-md);
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-md);
   cursor: pointer;
   transition: all var(--transition-fast);
}

.quality-btn:hover {
   border-color: var(--primary);
   background: rgba(124, 106, 239, 0.08);
}

.quality-label {
   font-weight: 600;
   color: var(--text-primary);
}

.quality-format {
   font-size: var(--font-size-xs);
   color: var(--text-muted);
}

.quality-size {
   font-size: var(--font-size-xs);
   color: var(--text-muted);
   margin-top: var(--space-xs);
}

.quality-2k {
   border: 2px solid #8b5cf6 !important;
   position: relative;
}

.quality-no-audio {
   font-size: 0.7rem;
   background: rgba(220, 53, 69, 0.15);
   color: #dc3545;
   padding: 2px 6px;
   border-radius: 4px;
   margin-left: auto;
   font-weight: 500;
}

.quality-ad-badge {
   position: absolute;
   top: -8px;
   right: -8px;
   background: var(--primary);
   color: white;
   font-size: 0.65rem;
   padding: 0.15rem 0.4rem;
   border-radius: var(--radius-full);
}

.error-message {
   padding: var(--space-md);
   background: rgba(239, 68, 68, 0.1);
   border: 1px solid rgba(239, 68, 68, 0.3);
   border-radius: var(--radius-md);
   color: var(--error);
   text-align: center;
}

/* ============================================
   Features — Clean grid
   ============================================ */
.section {
   padding: var(--space-2xl) 0;
}

.section-title {
   font-size: var(--font-size-2xl);
   font-weight: 700;
   margin-bottom: var(--space-xl);
}

.features {
   padding: var(--space-2xl) 0;
}

.features-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
   gap: var(--space-lg);
}

.feature-card {
   padding: var(--space-xl);
   background: var(--bg-card);
   border-radius: var(--radius-lg);
   border: 1px solid var(--border-light);
   text-align: center;
   transition: transform var(--transition-fast);
}

.feature-card:hover {
   transform: translateY(-3px);
}

.feature-icon {
   font-size: 2.5rem;
   margin-bottom: var(--space-md);
   display: block;
}

.feature-title {
   font-size: var(--font-size-md);
   font-weight: 600;
   margin-bottom: var(--space-sm);
}

.feature-desc {
   font-size: var(--font-size-sm);
   color: var(--text-secondary);
}

/* ============================================
   FAQ
   ============================================ */
.faq-grid {
   max-width: 800px;
   margin: 0 auto;
}

.faq-item {
   background: var(--bg-card);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-lg);
   margin-bottom: var(--space-md);
   overflow: hidden;
}

.faq-question {
   padding: var(--space-lg);
   font-weight: 600;
   cursor: pointer;
   list-style: none;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.faq-question::-webkit-details-marker {
   display: none;
}

.faq-question::after {
   content: '+';
   font-size: 1.5rem;
   color: var(--primary);
   transition: transform var(--transition-fast);
}

.faq-item[open] .faq-question::after {
   transform: rotate(45deg);
}

.faq-answer {
   padding: 0 var(--space-lg) var(--space-lg);
   color: var(--text-secondary);
   line-height: 1.7;
}

/* ============================================
   Comparison Table
   ============================================ */
.comparison {
   padding: var(--space-2xl) 0;
}

.comparison-table {
   max-width: 900px;
   margin: 0 auto;
   background: var(--bg-card);
   border-radius: var(--radius-xl);
   border: 1px solid var(--border-color);
   overflow: hidden;
}

.comparison-header {
   display: grid;
   grid-template-columns: 2fr 1fr 1fr;
   gap: var(--space-md);
   padding: var(--space-lg);
   background: var(--bg-tertiary);
   border-bottom: 2px solid var(--border-color);
   font-weight: 600;
   text-align: center;
}

.comparison-header>div:first-child {
   text-align: left;
}

[dir="rtl"] .comparison-header>div:first-child {
   text-align: right;
}

.comparison-row {
   display: grid;
   grid-template-columns: 2fr 1fr 1fr;
   gap: var(--space-md);
   padding: var(--space-lg);
   border-bottom: 1px solid var(--border-light);
   align-items: center;
   transition: background var(--transition-fast);
}

.comparison-row:last-child {
   border-bottom: none;
}

.comparison-row:hover {
   background: var(--bg-tertiary);
}

.comparison-feature {
   font-weight: 500;
   color: var(--text-primary);
}

.comparison-value {
   text-align: center;
   font-size: var(--font-size-sm);
}

.comparison-us {
   color: var(--success);
   font-weight: 600;
}

.comparison-others {
   color: var(--text-muted);
}

.check-mark {
   color: var(--success);
   font-size: 1.5rem;
}

.cross-mark {
   color: var(--error);
   font-size: 1.5rem;
   opacity: 0.6;
}

/* ============================================
   Modal
   ============================================ */
.modal {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   z-index: 1000;
   display: flex;
   align-items: center;
   justify-content: center;
   padding: var(--space-lg);
}

.modal-backdrop {
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: rgba(0, 0, 0, 0.6);
}

.modal-content {
   position: relative;
   width: 100%;
   max-width: 400px;
   padding: var(--space-xl);
   background: var(--bg-secondary);
   border-radius: var(--radius-xl);
   border: 1px solid var(--border-color);
   box-shadow: var(--shadow-xl);
   animation: modalIn 0.2s ease;
}

@keyframes modalIn {
   from {
      opacity: 0;
      transform: scale(0.95);
   }

   to {
      opacity: 1;
      transform: scale(1);
   }
}

.modal-close {
   position: absolute;
   top: var(--space-md);
   right: var(--space-md);
   background: none;
   border: none;
   font-size: var(--font-size-lg);
   color: var(--text-muted);
   cursor: pointer;
   padding: var(--space-xs);
}

.modal-header {
   margin-bottom: var(--space-lg);
}

.modal-title {
   font-size: var(--font-size-xl);
   font-weight: 600;
}

.form-group {
   margin-bottom: var(--space-md);
}

.form-group label {
   display: block;
   margin-bottom: var(--space-xs);
   font-size: var(--font-size-sm);
   font-weight: 500;
   color: var(--text-secondary);
}

.form-error {
   padding: var(--space-sm);
   margin-bottom: var(--space-md);
   background: rgba(239, 68, 68, 0.1);
   border-radius: var(--radius-sm);
   color: var(--error);
   font-size: var(--font-size-sm);
   text-align: center;
}

.auth-switch {
   margin-top: var(--space-lg);
   text-align: center;
   font-size: var(--font-size-sm);
   color: var(--text-muted);
}

.forgot-link {
   display: block;
   margin-top: var(--space-md);
   text-align: center;
}

/* ============================================
   Dropdown Menu
   ============================================ */
.dropdown-menu {
   position: absolute;
   top: calc(100% + 8px);
   right: 0;
   min-width: 180px;
   padding: var(--space-sm);
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-md);
   box-shadow: var(--shadow-lg);
   z-index: 100;
}

.dropdown-menu.hidden {
   opacity: 0;
   transform: translateY(-10px);
   pointer-events: none;
}

.dropdown-item {
   display: flex;
   align-items: center;
   gap: var(--space-sm);
   padding: var(--space-sm) var(--space-md);
   color: var(--text-primary);
   border-radius: var(--radius-sm);
   transition: background var(--transition-fast);
   cursor: pointer;
}

.dropdown-item:hover {
   background: var(--bg-tertiary);
}

.dropdown-item.active {
   background: rgba(124, 106, 239, 0.1);
   color: var(--primary);
}

.check-icon {
   color: var(--primary);
   font-size: 1rem;
   font-weight: bold;
}

.dropdown-divider {
   border: none;
   border-top: 1px solid var(--border-color);
   margin: var(--space-sm) 0;
}

.language-dropdown {
   min-width: 200px;
}

.language-dropdown .dropdown-item {
   font-size: var(--font-size-sm);
}

[dir="rtl"] .dropdown-menu {
   right: auto;
   left: 0;
}

.dropdown-menu.show {
   display: block;
   animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
   from {
      opacity: 0;
      transform: translateY(-10px);
   }

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

.user-menu {
   position: relative;
}

#userDropdown {
   position: absolute;
   top: 100%;
   right: 0;
   margin-top: var(--space-sm);
   z-index: 1000;
   min-width: 180px;
   background: var(--bg-card);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-md);
   box-shadow: var(--shadow-xl);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
   position: fixed;
   bottom: var(--space-xl);
   right: var(--space-xl);
   z-index: 9999;
   display: flex;
   flex-direction: column;
   gap: var(--space-sm);
   pointer-events: none;
}

.toast {
   pointer-events: auto;
}

.toast {
   display: flex;
   align-items: center;
   gap: var(--space-md);
   padding: var(--space-md) var(--space-lg);
   min-width: 300px;
   max-width: 400px;
   background: var(--bg-secondary);
   border-radius: var(--radius-lg);
   border: 1px solid var(--border-color);
   box-shadow: var(--shadow-lg);
   animation: toastIn 0.3s ease;
}

.toast.toast-out {
   animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
   from {
      opacity: 0;
      transform: translateX(100%);
   }

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

@keyframes toastOut {
   from {
      opacity: 1;
      transform: translateX(0);
   }

   to {
      opacity: 0;
      transform: translateX(100%);
   }
}

.toast-icon {
   font-size: 1.5rem;
}

.toast-content {
   flex: 1;
}

.toast-title {
   font-weight: 600;
   margin-bottom: 2px;
}

.toast-message {
   font-size: var(--font-size-sm);
   color: var(--text-secondary);
}

.toast-close {
   background: none;
   border: none;
   color: var(--text-muted);
   cursor: pointer;
   padding: var(--space-xs);
}

.toast-success {
   border-left: 4px solid var(--success);
}

.toast-error {
   border-left: 4px solid var(--error);
}

.toast-warning {
   border-left: 4px solid var(--warning);
}

.toast-info {
   border-left: 4px solid var(--primary);
}

/* ============================================
   Skeleton / Progress / Format Pills / Quality Badge
   ============================================ */
.skeleton {
   background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
   background-size: 200% 100%;
   animation: skeleton-shimmer 1.5s infinite;
   border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
   0% {
      background-position: 200% 0;
   }

   100% {
      background-position: -200% 0;
   }
}

.skeleton-text {
   height: 1em;
   margin-bottom: var(--space-sm);
}

.skeleton-text:last-child {
   width: 70%;
}

.skeleton-image {
   width: 160px;
   height: 90px;
}

.skeleton-button {
   height: 42px;
   width: 120px;
}

.progress-container {
   width: 100%;
   height: 8px;
   background: var(--bg-tertiary);
   border-radius: var(--radius-full);
   overflow: hidden;
   margin: var(--space-md) 0;
}

.progress-bar {
   height: 100%;
   background: linear-gradient(90deg, var(--primary), #8b5cf6);
   border-radius: var(--radius-full);
   transition: width 0.3s ease;
}

.progress-bar.animated {
   animation: progress-pulse 2s infinite;
}

@keyframes progress-pulse {

   0%,
   100% {
      opacity: 1;
   }

   50% {
      opacity: 0.7;
   }
}

.progress-info {
   display: flex;
   justify-content: space-between;
   margin-top: 0.5rem;
   font-size: 0.875rem;
   color: var(--text-muted);
}

.progress-percentage {
   font-weight: 600;
   color: var(--primary);
}

.progress-eta {
   color: var(--text-secondary);
}

.format-pills {
   display: flex;
   gap: var(--space-sm);
   margin-bottom: var(--space-lg);
   justify-content: center;
}

.format-pill {
   padding: var(--space-xs) var(--space-md);
   background: var(--bg-tertiary);
   border: 2px solid transparent;
   border-radius: var(--radius-full);
   color: var(--text-secondary);
   cursor: pointer;
   font-size: var(--font-size-sm);
   font-weight: 500;
   transition: all var(--transition-fast);
}

.format-pill:hover {
   border-color: var(--primary);
   color: var(--text-primary);
}

.format-pill.active {
   background: var(--primary);
   color: white;
   border-color: var(--primary);
}

.quality-badge {
   display: inline-flex;
   align-items: center;
   gap: 4px;
   padding: 2px 8px;
   border-radius: var(--radius-full);
   font-size: var(--font-size-xs);
   font-weight: 600;
}

.quality-badge-2k {
   background: linear-gradient(135deg, #8b5cf6, #d946ef);
   color: white;
}

.quality-badge-hd {
   background: linear-gradient(135deg, #10b981, #3b82f6);
   color: white;
}

.quality-badge-sd {
   background: var(--bg-tertiary);
   color: var(--text-muted);
}

.copy-btn {
   display: inline-flex;
   align-items: center;
   gap: var(--space-xs);
   padding: var(--space-xs) var(--space-sm);
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-sm);
   color: var(--text-secondary);
   cursor: pointer;
   font-size: var(--font-size-xs);
   transition: all var(--transition-fast);
}

.copy-btn:hover {
   background: var(--primary);
   color: white;
   border-color: var(--primary);
}

.copy-btn.copied {
   background: var(--success);
   border-color: var(--success);
   color: white;
}

/* ============================================
   History Panel
   ============================================ */
.history-panel {
   position: fixed;
   top: 0;
   right: 0;
   width: 400px;
   max-width: 100vw;
   height: 100vh;
   background: var(--bg-secondary);
   border-left: 1px solid var(--border-color);
   box-shadow: var(--shadow-xl);
   z-index: 10001;
   overflow-y: auto;
   flex-direction: column;
   display: none;
}

.history-panel.open {
   display: flex;
}

.history-panel-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 16px 20px;
   border-bottom: 1px solid var(--border-color);
   position: sticky;
   top: 0;
   background: var(--bg-secondary);
   z-index: 5;
}

.history-panel-header h3 {
   font-size: 1rem;
   font-weight: 700;
   margin: 0;
}

.history-close {
   width: 32px;
   height: 32px;
   border-radius: 50%;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   color: var(--text-primary);
   font-size: 1rem;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
}

.history-close:hover {
   background: #f43f5e;
   color: white;
}

.history-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background: rgba(0, 0, 0, 0.5);
   z-index: 10000;
   opacity: 0;
   visibility: hidden;
   transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-overlay.active {
   opacity: 1;
   visibility: visible;
}

/* Fix: Override inline absolute positioning on JS-generated close button */
#historyCloseBtn {
   position: sticky !important;
   top: 0 !important;
   right: 0 !important;
   align-self: flex-end;
   margin: 12px 16px;
   width: 36px;
   height: 36px;
   min-height: 36px;
   border-radius: 50%;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   color: var(--text-primary);
   font-size: 1rem;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   z-index: 10;
   flex-shrink: 0;
}

#historyCloseBtn:hover {
   background: #f43f5e;
   color: white;
}

.history-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: var(--space-lg);
   border-bottom: 1px solid var(--border-color);
   position: sticky;
   top: 0;
   background: var(--bg-secondary);
}

.history-header h3 {
   font-size: 1rem;
   font-weight: 700;
   margin: 0;
}

.history-title {
   font-size: var(--font-size-lg);
   font-weight: 600;
}

.history-list {
   padding: 0;
   display: flex;
   flex-direction: column;
}

.history-item {
   display: flex;
   gap: 16px;
   padding: 12px 20px;
   background: transparent;
   border-bottom: 1px solid var(--border-light);
   cursor: pointer;
   transition: background 0.2s;
   position: relative;
   align-items: center;
}

.history-item:last-child {
   border-bottom: none;
}

.history-item:hover {
   background: var(--bg-tertiary);
}

.history-thumb {
   width: 96px;
   height: 54px;
   aspect-ratio: 16/9;
   object-fit: cover;
   border-radius: 10px;
   background: var(--bg-tertiary);
   flex-shrink: 0;
}

.history-info {
   flex: 1;
   min-width: 0;
}

.history-item-title {
   font-size: 0.85rem;
   font-weight: 600;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
   margin-bottom: 4px;
   color: var(--text-primary);
}

.history-meta {
   font-size: 0.72rem;
   color: var(--text-muted);
   display: flex;
   align-items: center;
   gap: 6px;
}

.history-platform-icon {
   width: 14px;
   height: 14px;
   opacity: 0.6;
}

.history-actions {
   display: flex;
   gap: 8px;
   opacity: 0;
   transition: opacity 0.2s;
}

.history-item:hover .history-actions {
   opacity: 1;
}

.history-action-btn {
   background: var(--bg-tertiary);
   border: none;
   color: var(--text-muted);
   width: 28px;
   height: 28px;
   border-radius: 8px;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   font-size: 0.8rem;
}

.history-action-btn:hover {
   color: var(--text-primary);
}

.history-action-btn.delete:hover {
   background: rgba(255, 59, 48, 0.2);
   color: #ff3b30;
}

.history-search {
   padding: 16px 20px;
   border-bottom: 1px solid var(--border-color);
}

.history-search-input {
   width: 100%;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: 12px;
   padding: 8px 12px;
   color: var(--text-primary);
   font-size: 0.85rem;
   outline: none;
}

.history-search-input:focus {
   border-color: var(--primary);
}

.history-empty {
   text-align: center;
   padding: 60px 20px;
   color: var(--text-muted);
}

.history-empty-icon {
   font-size: 2.5rem;
   margin-bottom: 16px;
   display: block;
   opacity: 0.3;
}

/* ============================================
   FAB
   ============================================ */
.fab {
   position: fixed;
   bottom: var(--space-xl);
   left: var(--space-xl);
   width: 48px;
   height: 48px;
   border-radius: 50%;
   background: var(--primary);
   color: white;
   border: none;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1.25rem;
   transition: all var(--transition-fast);
   z-index: 99;
   box-shadow: var(--shadow-md);
}

.fab:hover {
   transform: scale(1.1);
}

.pulse {
   animation: pulse 2s infinite;
}

@keyframes pulse {

   0%,
   100% {
      opacity: 1;
   }

   50% {
      opacity: 0.7;
   }
}

/* ============================================
   Scan Results
   ============================================ */
.scan-results {
   margin-top: 2rem;
}

.scan-results-header {
   display: flex;
   flex-direction: column;
   gap: 0.5rem;
   margin-bottom: 1.25rem;
}

.scan-results-title {
   display: flex;
   align-items: center;
   gap: 0.5rem;
   flex-wrap: wrap;
}

.scan-results-count {
   font-size: 1.25rem;
   font-weight: 600;
}

.scan-page-title {
   font-size: 0.9rem;
   color: var(--text-secondary);
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
   max-width: 100%;
}

.scan-media-summary {
   padding: 0.6rem 1rem;
   background: var(--bg-tertiary);
   border-radius: var(--radius-md);
   margin-bottom: 1rem;
   font-size: 0.875rem;
   color: var(--text-secondary);
   border: 1px solid var(--border-color);
}

.scan-video-list {
   display: flex;
   flex-direction: column;
   gap: 0.75rem;
}

.scan-video-card {
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-lg);
   padding: 0;
   overflow: hidden;
   transition: border-color 0.2s;
}

.scan-video-card:hover {
   border-color: var(--primary);
}

.scan-video-card.scan-video-drm {
   opacity: 0.6;
   border-color: rgba(239, 68, 68, 0.3);
}

.scan-video-info {
   display: flex;
   gap: 0;
   align-items: stretch;
}

.scan-video-thumb {
   position: relative;
   width: 160px;
   min-width: 160px;
   aspect-ratio: 16/9;
   overflow: hidden;
   background: var(--bg-primary);
   flex-shrink: 0;
}

.scan-video-thumb img {
   width: 100%;
   height: 100%;
   object-fit: cover;
   display: block;
}

.scan-video-thumb-placeholder {
   display: flex;
   align-items: center;
   justify-content: center;
   background: var(--bg-tertiary);
}

.scan-video-thumb-placeholder>span {
   font-size: 2rem;
   opacity: 0.5;
}

.scan-video-thumb-small {
   width: 80px;
   min-width: 80px;
}

.scan-video-thumb-small.scan-video-thumb-placeholder>span {
   font-size: 1.5rem;
}

.scan-video-thumb-overlay {
   position: absolute;
   bottom: 4px;
   right: 4px;
}

.scan-video-thumb-badge {
   display: inline-block;
   padding: 2px 7px;
   border-radius: var(--radius-sm);
   font-size: 0.65rem;
   font-weight: 700;
   text-transform: uppercase;
   letter-spacing: 0.03em;
}

.scan-video-thumb-badge.quality-badge-hd {
   background: rgba(99, 102, 241, 0.85);
   color: #fff;
}

.scan-video-thumb-badge.quality-badge-2k {
   background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(5, 150, 105, 0.9));
   color: #fff;
}

.scan-video-thumb-badge.quality-badge-sd {
   background: rgba(255, 255, 255, 0.15);
   color: var(--text-secondary);
}

.scan-video-details {
   flex: 1;
   padding: 0.75rem 1rem;
   display: flex;
   flex-direction: column;
   justify-content: center;
   gap: 0.35rem;
   min-width: 0;
}

.scan-video-title {
   font-size: 0.95rem;
   font-weight: 600;
   margin: 0;
   display: -webkit-box;
   -webkit-line-clamp: 2;
   -webkit-box-orient: vertical;
   overflow: hidden;
   color: var(--text-primary);
}

.scan-video-meta {
   display: flex;
   flex-wrap: wrap;
   align-items: center;
   gap: 0.4rem;
   font-size: 0.75rem;
}

.scan-video-source {
   display: inline-block;
   padding: 1px 6px;
   background: rgba(99, 102, 241, 0.15);
   color: var(--primary);
   border-radius: var(--radius-sm);
   font-size: 0.65rem;
   font-weight: 600;
   text-transform: uppercase;
}

.scan-video-format-tag {
   display: inline-block;
   padding: 1px 6px;
   background: rgba(168, 85, 247, 0.12);
   color: #a855f7;
   border-radius: var(--radius-sm);
   font-size: 0.65rem;
   font-weight: 600;
}

.scan-video-size,
.scan-video-duration {
   color: var(--text-muted);
   font-size: 0.75rem;
}

.scan-video-drm-notice {
   padding: 0.35rem 0.5rem;
   background: rgba(239, 68, 68, 0.1);
   border-radius: var(--radius-sm);
   color: #ef4444;
   font-size: 0.75rem;
   font-weight: 500;
}

.scan-video-actions {
   display: flex;
   flex-wrap: wrap;
   gap: 0.4rem;
   padding: 0.5rem 0.75rem;
   border-top: 1px solid var(--border-color);
   background: rgba(0, 0, 0, 0.05);
}

.scan-video-actions .quality-btn {
   flex: 1;
   min-width: 0;
   justify-content: center;
}

.scan-video-card-mini {
   padding: 0;
}

.scan-video-card-mini .scan-video-title {
   font-size: 0.85rem;
}

.scan-section-divider {
   margin-top: 1.5rem;
   padding-bottom: 0.5rem;
   border-bottom: 1px solid var(--border-color);
   margin-bottom: 0.75rem;
}

.scan-section-divider h4 {
   margin: 0;
   font-size: 0.9rem;
   color: var(--text-secondary);
   font-weight: 600;
}

.theme-light .scan-video-card {
   background: rgba(255, 255, 255, 0.9);
}

.theme-light .scan-video-actions {
   background: rgba(0, 0, 0, 0.03);
}

.theme-light .scan-video-thumb-placeholder {
   background: var(--bg-tertiary);
}

.theme-light .scan-video-thumb-badge.quality-badge-sd {
   background: rgba(0, 0, 0, 0.08);
}

.video-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
   gap: 1rem;
}

.video-item {
   background: var(--bg-tertiary);
   border-radius: var(--radius-md);
   padding: 1rem;
   transition: all 0.2s;
   border: 1px solid var(--border-color);
}

.video-item:hover {
   border-color: var(--primary);
}

.video-item-title {
   font-weight: 500;
   margin-bottom: 0.5rem;
   display: -webkit-box;
   -webkit-line-clamp: 2;
   -webkit-box-orient: vertical;
   overflow: hidden;
}

.video-item-meta {
   font-size: 0.75rem;
   color: var(--text-muted);
   margin-bottom: 0.75rem;
}

.video-item-platform {
   display: inline-block;
   padding: 0.25rem 0.5rem;
   background: var(--primary);
   color: white;
   border-radius: var(--radius-sm);
   font-size: 0.7rem;
   font-weight: 500;
}

.video-item-btn {
   width: 100%;
   margin-top: 0.5rem;
}

/* Playlist */
.playlist-controls {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 1rem;
   background: var(--bg-tertiary);
   border-radius: var(--radius-md) var(--radius-md) 0 0;
   border-bottom: 1px solid var(--border-color);
   margin-bottom: 1rem;
}

.selection-count {
   font-weight: 500;
}

.playlist-actions {
   display: flex;
   gap: 0.5rem;
}

.playlist-item {
   display: flex;
   align-items: center;
   gap: 1rem;
   padding: 0.75rem;
   background: var(--bg-secondary);
   border-radius: var(--radius-sm);
   margin-bottom: 0.5rem;
   transition: all 0.2s;
   cursor: pointer;
}

.playlist-item:hover {
   background: var(--bg-tertiary);
}

.playlist-item.selected {
   border: 1px solid var(--primary);
   background: rgba(124, 106, 239, 0.1);
}

.checkbox-wrapper {
   display: flex;
   align-items: center;
}

.custom-checkbox {
   width: 20px;
   height: 20px;
   border: 2px solid var(--text-muted);
   border-radius: 4px;
   display: flex;
   align-items: center;
   justify-content: center;
   transition: all 0.2s;
}

.playlist-item.selected .custom-checkbox {
   background: var(--primary);
   border-color: var(--primary);
   color: white;
}

.playlist-item-info {
   flex: 1;
   overflow: hidden;
}

.playlist-item-title {
   font-size: 0.9rem;
   font-weight: 500;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.playlist-item-meta {
   font-size: 0.75rem;
   color: var(--text-muted);
}

/* Queue Limits */
.queue-limits {
   display: flex;
   gap: 1rem;
   padding: 0.75rem;
   background: var(--bg-tertiary);
   border-radius: var(--radius-md);
   font-size: 0.875rem;
   margin-bottom: 1rem;
}

.queue-limit-item {
   display: flex;
   align-items: center;
   gap: 0.5rem;
   color: var(--text-secondary);
}

.queue-limit-value {
   font-weight: 600;
   color: var(--text-primary);
}

/* Quick Stats */
.quick-stats {
   display: flex;
   justify-content: center;
   gap: 2rem;
   margin-top: 2rem;
   padding-top: 1.5rem;
   border-top: 1px solid var(--border-color);
}

/* Error Card */
.error-card {
   text-align: center;
   padding: 2rem;
}

.error-icon {
   font-size: 3rem;
   margin-bottom: 1rem;
}

.error-title {
   font-size: 1.5rem;
   margin-bottom: 0.5rem;
}

.retry-section {
   margin-bottom: 1.5rem;
}

.retry-info {
   font-size: 0.875rem;
   color: var(--text-secondary);
   margin-bottom: 0.75rem;
}

.alternatives-section {
   background: var(--bg-tertiary);
   border-radius: var(--radius-md);
   padding: 1rem;
   margin-bottom: 1rem;
}

.alternatives-title {
   font-weight: 600;
   margin-bottom: 0.5rem;
}

.alternatives-list {
   list-style: none;
   padding: 0;
   margin: 0;
}

.alternatives-list li {
   padding: 0.25rem 0;
}

.alternatives-list a {
   color: var(--primary);
}

.help-section {
   font-size: 0.875rem;
   color: var(--text-muted);
}

/* Video Preview Modal */
.video-preview-modal {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: rgba(0, 0, 0, 0.9);
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 10000;
}

.video-preview-content {
   background: var(--bg-secondary);
   border-radius: var(--radius-xl);
   max-width: 800px;
   width: 90%;
   max-height: 90vh;
   overflow: hidden;
}

.video-preview-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 1rem;
   border-bottom: 1px solid var(--border-color);
}

.video-preview-header h3 {
   margin: 0;
   font-size: 1rem;
}

.video-preview-close {
   background: none;
   border: none;
   color: var(--text-primary);
   font-size: 1.5rem;
   cursor: pointer;
}

.video-preview-frame {
   position: relative;
   padding-bottom: 56.25%;
   background: #000;
}

.video-preview-frame iframe {
   position: absolute;
   width: 100%;
   height: 100%;
}

.video-preview-actions {
   padding: 1rem;
   display: flex;
   gap: 0.5rem;
   flex-wrap: wrap;
}

/* Progress Overlay */
.progress-overlay {
   position: fixed;
   bottom: 2rem;
   right: 2rem;
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-lg);
   padding: 1rem;
   min-width: 280px;
   box-shadow: var(--shadow-lg);
   z-index: 1000;
}

.progress-overlay-title {
   font-weight: 600;
   margin-bottom: 0.5rem;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.progress-overlay-close {
   background: none;
   border: none;
   color: var(--text-muted);
   cursor: pointer;
   font-size: 1.25rem;
}

/* Tools Grid */
.tools-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
   gap: 1.5rem;
   margin-top: 2rem;
}

.tool-link {
   display: flex;
   align-items: center;
   gap: 1.25rem;
   padding: 1.5rem;
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-lg);
   text-decoration: none;
   transition: all 0.2s;
}

.tool-link:hover {
   border-color: var(--primary);
   background: var(--bg-tertiary);
}

.tool-icon {
   font-size: 2rem;
   width: 60px;
   height: 60px;
   display: flex;
   align-items: center;
   justify-content: center;
   background: rgba(124, 106, 239, 0.05);
   border-radius: var(--radius-md);
}

.tool-text h4 {
   color: var(--text-primary);
   margin: 0 0 0.25rem 0;
   font-size: 1.1rem;
}

.tool-text p {
   color: var(--text-secondary);
   font-size: 0.9rem;
   line-height: 1.4;
   margin: 0;
}

[loading="lazy"] {
   opacity: 0.95;
   transition: opacity 0.5s ease-in;
}

/* ============================================
   Download Hub (Progress Container)
   ============================================ */
.download-progress-container {
   position: fixed;
   bottom: 24px;
   right: 24px;
   z-index: 10000;
   max-width: 420px;
   width: calc(100% - 48px);
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: 24px;
   box-shadow: var(--shadow-xl);
   overflow: hidden;
   transition: all 0.35s ease;
   transform-origin: bottom right;
}

.download-progress-container.minimized {
   transform: translateY(calc(100% - 58px)) scale(0.96);
   opacity: 0.92;
}

.download-hub-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 16px 20px;
   background: var(--bg-tertiary);
   border-bottom: 1px solid var(--border-color);
   cursor: pointer;
   position: relative;
}

.download-hub-header::before {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   height: 3px;
   background: var(--gradient-primary);
   border-radius: 24px 24px 0 0;
   opacity: 0.85;
}

.download-hub-title {
   font-size: 0.95rem;
   font-weight: 700;
   color: var(--text-primary);
   display: flex;
   align-items: center;
   gap: 10px;
}

.download-hub-actions {
   display: flex;
   gap: 6px;
}

.hub-action-btn {
   background: var(--bg-tertiary);
   border: 1px solid transparent;
   color: var(--text-muted);
   cursor: pointer;
   font-size: 0.85rem;
   width: 34px;
   height: 34px;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 12px;
   transition: all 0.2s;
}

.hub-action-btn:hover {
   background: var(--primary);
   color: white;
}

.download-hub-list {
   max-height: 400px;
   overflow-y: auto;
   padding: 12px;
   display: flex;
   flex-direction: column;
   gap: 10px;
   scrollbar-width: thin;
   scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.download-hub-list::-webkit-scrollbar {
   width: 4px;
}

.download-hub-list::-webkit-scrollbar-thumb {
   background: rgba(255, 255, 255, 0.1);
   border-radius: 10px;
}

.download-progress-item {
   padding: 16px;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: 16px;
   position: relative;
   animation: hubItemIn 0.3s ease;
   transition: all 0.2s;
}

.download-progress-item:hover {
   border-color: var(--primary);
}

@keyframes hubItemIn {
   from {
      transform: translateY(10px);
      opacity: 0;
   }

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

.download-progress-info {
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
   margin-bottom: 12px;
   gap: 12px;
}

.download-progress-details {
   flex: 1;
   min-width: 0;
}

.download-progress-title {
   font-size: 0.85rem;
   font-weight: 600;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
   margin-bottom: 4px;
   color: var(--text-primary);
}

.download-progress-meta {
   display: flex;
   align-items: center;
   gap: 8px;
   font-size: 0.72rem;
   color: var(--text-muted);
   flex-wrap: wrap;
}

.download-progress-quality {
   color: var(--primary);
   font-weight: 800;
   text-transform: uppercase;
   background: rgba(124, 106, 239, 0.12);
   padding: 2px 8px;
   border-radius: 6px;
   font-size: 0.68rem;
}

.download-progress-status {
   position: relative;
   width: 100%;
}

.download-progress-text {
   display: block;
   font-size: 0.75rem;
   color: var(--text-muted);
   margin-bottom: 8px;
   font-weight: 500;
}

.download-progress-bar-container {
   height: 6px;
   background: var(--bg-primary);
   border-radius: 10px;
   overflow: hidden;
}

.download-progress-bar {
   height: 100%;
   background: var(--gradient-primary);
   border-radius: 10px;
   transition: width 0.4s ease;
}

.download-progress-cancel {
   background: rgba(255, 59, 48, 0.1);
   border: none;
   color: #ff3b30;
   width: 28px;
   height: 28px;
   min-width: 28px;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   font-size: 0.72rem;
   transition: all 0.2s;
   flex-shrink: 0;
}

.download-progress-cancel:hover {
   background: #ff3b30;
   color: white;
}

.download-progress-stats {
   display: flex;
   justify-content: space-between;
   margin-top: 8px;
   font-size: 0.7rem;
   color: var(--text-muted);
   font-family: monospace;
}

.download-progress-item.complete {
   border-color: rgba(52, 199, 89, 0.2);
   background: rgba(52, 199, 89, 0.03);
}

.download-progress-item.complete .download-progress-bar {
   background: linear-gradient(90deg, #34c759, #b1ea4d);
}

.download-progress-item.complete .download-progress-text {
   color: #34c759;
}

.download-progress-item.error {
   border-color: rgba(255, 59, 48, 0.2);
   background: rgba(255, 59, 48, 0.03);
}

.download-progress-item.error .download-progress-bar {
   background: linear-gradient(90deg, #ff3b30, #ff9500);
}

.download-progress-item.error .download-progress-text {
   color: #ff3b30;
}

/* ============================================
   Ad Zones (ALL PRESERVED)
   ============================================ */
.ad-zone {
   display: none;
   margin: 20px auto;
   text-align: center;
   max-width: 100%;
   overflow: hidden;
   min-height: 0;
   padding: var(--space-md);
}

.ad-zone:empty {
   display: none !important;
}

.ad-zone:not(:empty):not(.ad-zone-mobile-bottom):not(.ad-zone-fixed-bottom):not(.ad-zone-sidebar):not(.ad-zone-sidebar-left):not(.ad-zone-overlay):not(.ad-zone-interstitial) {
   display: block;
   min-height: 90px;
}

#ad-zone-header {
   margin-bottom: 0;
   padding-top: 1rem;
}

#ad-zone-footer {
   margin-top: 2rem;
   padding-bottom: 1rem;
   border-top: 1px solid var(--border-color);
}

#ad-zone-before-download {
   margin: 1.5rem auto;
}

.ad-zone-fixed-bottom {
   position: fixed;
   bottom: 0;
   left: 0;
   right: 0;
   z-index: 1000;
   background: var(--bg-secondary);
   border-top: 1px solid var(--border-color);
   padding: 0.75rem 1rem;
   text-align: center;
   box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
   display: none;
}

.ad-zone-fixed-bottom .ad-close {
   position: absolute;
   top: -12px;
   right: 1rem;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: 50%;
   width: 24px;
   height: 24px;
   cursor: pointer;
   font-size: 12px;
}

.ad-zone-fixed-bottom .ad-content {
   display: flex;
   justify-content: center;
   align-items: center;
   min-height: 50px;
}

.ad-zone-sidebar,
.ad-zone-sidebar-left {
   position: fixed;
   top: 50%;
   transform: translateY(-50%);
   z-index: 9999;
   max-width: 160px;
   display: none;
   margin: 0 !important;
}

.ad-zone-sidebar {
   right: 10px !important;
   left: auto !important;
}

.ad-zone-sidebar-left {
   left: 10px !important;
   right: auto !important;
}

.sidebar-ad-close {
   position: absolute;
   top: -25px;
   right: 0;
   width: 24px;
   height: 24px;
   background: rgba(0, 0, 0, 0.5);
   color: #fff;
   border: none;
   border-radius: 50%;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 14px;
   z-index: 10000;
}

.sidebar-ad-close:hover {
   background: #ef4444;
}

.ad-zone-sidebar-left .sidebar-ad-close {
   left: 0;
   right: auto;
}

.ad-zone-overlay {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   z-index: 10000;
   background: rgba(0, 0, 0, 0.85);
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 2rem;
}

.ad-zone-overlay .ad-content {
   position: relative;
   background: var(--bg-secondary);
   border-radius: var(--radius-xl);
   padding: 2rem;
   max-width: 600px;
   width: 100%;
}

.ad-zone-overlay .ad-close {
   position: absolute;
   top: 1rem;
   right: 1rem;
   background: var(--bg-tertiary);
   border: none;
   border-radius: 50%;
   width: 32px;
   height: 32px;
   cursor: pointer;
}

.ad-zone-interstitial {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   z-index: 10001;
   background: var(--bg-primary);
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   padding: 2rem;
}

.ad-zone-interstitial .ad-timer {
   font-size: 3rem;
   font-weight: 700;
   color: var(--primary);
   margin-bottom: 1rem;
}

.ad-zone-interstitial .ad-skip {
   margin-top: 1.5rem;
   padding: 0.75rem 2rem;
   background: var(--primary);
   color: white;
   border: none;
   border-radius: var(--radius-full);
   cursor: pointer;
   opacity: 0.5;
   pointer-events: none;
}

.ad-zone-interstitial .ad-skip.active {
   opacity: 1;
   pointer-events: auto;
}

.ad-zone-inline {
   margin: 1.5rem auto;
   padding: 1rem;
   border: 1px dashed var(--border-color);
   border-radius: var(--radius-lg);
   text-align: center;
}

.ad-zone-mobile-bottom {
   position: fixed;
   bottom: 0;
   left: 0;
   right: 0;
   z-index: 999;
   background: var(--bg-secondary);
   border-top: 1px solid var(--border-color);
   padding: 0.5rem 1rem;
   text-align: center;
   display: none;
}

.ad-zone-mobile-bottom .ad-close {
   position: absolute;
   top: -12px;
   right: 1rem;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: 50%;
   width: 24px;
   height: 24px;
   cursor: pointer;
   font-size: 12px;
   color: var(--text-muted);
}

.ad-timer {
   font-size: 2rem;
   font-weight: bold;
   color: var(--primary);
   margin-bottom: 20px;
   background: rgba(255, 255, 255, 0.1);
   width: 60px;
   height: 60px;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   border: 3px solid var(--primary);
}

.ad-skip {
   margin-top: 20px;
   padding: 12px 40px;
   background: var(--bg-tertiary);
   border: 1px solid var(--border-color);
   border-radius: 30px;
   color: var(--text-muted);
   cursor: not-allowed;
   transition: all 0.3s ease;
   font-size: 14px;
   font-weight: 500;
}

.ad-skip.active {
   background: var(--primary);
   color: white;
   cursor: pointer;
   border-color: var(--primary);
}

.ad-close {
   position: absolute;
   top: 5px;
   right: 10px;
   background: rgba(0, 0, 0, 0.1);
   border: none;
   border-radius: 50%;
   width: 24px;
   height: 24px;
   cursor: pointer;
   font-size: 14px;
   display: flex;
   align-items: center;
   justify-content: center;
   color: var(--text-muted);
}

.ad-close:hover {
   background: #ef4444;
   color: white;
}

.ad-skeleton {
   height: 100px;
   background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
   background-size: 200% 100%;
   animation: skeleton-shimmer 1.5s infinite;
   border-radius: var(--radius-md);
}

.ad-placeholder {
   color: var(--text-muted);
}

/* Interstitial Modal */
.interstitial-modal {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   z-index: 20000;
   background: rgba(10, 11, 15, 0.85);
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 20px;
   animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
   from {
      opacity: 0;
   }

   to {
      opacity: 1;
   }
}

.interstitial-content {
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: 20px;
   width: 100%;
   max-width: 550px;
   padding: 32px;
   text-align: center;
   box-shadow: var(--shadow-xl);
}

.interstitial-header h3 {
   font-size: 1.5rem;
   font-weight: 700;
   margin-bottom: 8px;
   color: var(--primary);
}

.interstitial-header p {
   color: var(--text-muted);
   font-size: 1rem;
   margin-bottom: 24px;
}

.interstitial-ad {
   background: var(--bg-tertiary);
   border: 1px dashed var(--border-color);
   border-radius: 16px;
   min-height: 250px;
   display: flex;
   align-items: center;
   justify-content: center;
   margin-bottom: 24px;
   overflow: hidden;
}

.interstitial-footer {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 16px;
}

.interstitial-timer {
   font-size: 1.25rem;
   font-weight: 600;
   color: var(--text-muted);
   background: var(--bg-tertiary);
   padding: 8px 16px;
   border-radius: 12px;
}

.interstitial-timer span {
   color: var(--primary);
   font-family: monospace;
}

.interstitial-skip {
   width: 100%;
   padding: 16px;
   font-size: 1.1rem;
   font-weight: 700;
   border-radius: 16px;
}

.interstitial-skip.hidden {
   display: none;
}

/* ============================================
   Footer & SEO Content
   ============================================ */
.custom-footer-section {
   padding: var(--space-lg) 0;
   text-align: center;
}

.custom-footer-section h1,
.custom-footer-section h2,
.custom-footer-section h3 {
   font-weight: 400;
   color: var(--text-secondary);
   margin-bottom: var(--space-sm);
}

.custom-footer-section h1 {
   font-size: var(--font-size-xl);
}

.custom-footer-section h2 {
   font-size: var(--font-size-lg);
}

.custom-footer-section h3 {
   font-size: var(--font-size-md);
}

.custom-footer-section p {
   color: var(--text-muted);
   font-size: var(--font-size-sm);
   max-width: 600px;
   margin: 0 auto;
   opacity: 0.8;
}

.custom-footer-section a {
   color: var(--primary);
   text-decoration: none;
   border-bottom: 1px dotted var(--primary);
}

.custom-footer-section a:hover {
   color: var(--primary-hover);
   border-bottom-style: solid;
}

.custom-footer-section::before {
   content: '';
   display: block;
   width: 60px;
   height: 1px;
   background: linear-gradient(90deg, transparent, var(--border-color), transparent);
   margin: 0 auto var(--space-md);
}

.footer {
   padding: var(--space-xl) 0;
   border-top: 1px solid var(--border-light);
}

.footer-content {
   display: flex;
   justify-content: space-between;
   align-items: center;
   flex-wrap: wrap;
   gap: var(--space-md);
}

.copyright {
   color: var(--text-muted);
   font-size: var(--font-size-sm);
}

.footer-links {
   display: flex;
   gap: var(--space-lg);
}

.footer-links a {
   color: var(--text-muted);
   font-size: var(--font-size-sm);
}

.footer-links a:hover {
   color: var(--text-primary);
}

.section-subtitle {
   color: var(--text-secondary);
   margin-bottom: var(--space-xl);
}

/* ============================================
   Sites Browser
   ============================================ */
.sites-browser {
   background: var(--bg-secondary);
   padding: var(--space-2xl) 0;
}

.sites-search-box {
   max-width: 500px;
   margin: 0 auto var(--space-xl);
}

.sites-search-input {
   width: 100%;
   text-align: center;
   font-size: var(--font-size-lg);
   padding: var(--space-md) var(--space-lg);
}

.sites-categories-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
   gap: var(--space-md);
   margin-bottom: var(--space-xl);
}

.site-category-card {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: var(--space-sm);
   padding: var(--space-lg);
   background: var(--bg-card);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-lg);
   cursor: pointer;
   transition: all var(--transition-fast);
   text-align: center;
}

.site-category-card:hover {
   border-color: var(--primary);
}

.category-icon {
   font-size: 2.5rem;
}

.category-name {
   font-weight: 600;
   color: var(--text-primary);
}

.category-count {
   font-size: var(--font-size-sm);
   color: var(--primary);
   background: rgba(124, 106, 239, 0.1);
   padding: 2px 10px;
   border-radius: var(--radius-full);
}

.sites-note {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: var(--space-sm);
   padding: var(--space-md);
   background: rgba(124, 106, 239, 0.05);
   border-radius: var(--radius-lg);
   color: var(--text-secondary);
}

.note-icon {
   font-size: 1.5rem;
}

/* ============================================
   Theme Customizer (preserved for JS compatibility)
   ============================================ */
.theme-customizer {
   padding: var(--space-2xl) 0;
}

.theme-options {
   display: flex;
   justify-content: center;
   flex-wrap: wrap;
   gap: var(--space-lg);
}

.theme-option {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: var(--space-sm);
   padding: var(--space-md);
   cursor: pointer;
   border-radius: var(--radius-lg);
   border: 2px solid transparent;
   transition: all var(--transition-fast);
}

.theme-option:hover {
   background: var(--bg-tertiary);
}

.theme-option.active {
   border-color: var(--primary);
   background: var(--bg-tertiary);
}

.theme-preview {
   width: 50px;
   height: 50px;
   border-radius: 50%;
   background: var(--theme-color, var(--primary));
   transition: transform var(--transition-fast);
}

.theme-option:hover .theme-preview {
   transform: scale(1.15);
}

.theme-option.active .theme-preview {
   box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--primary);
   transform: scale(1.1);
}

.theme-name {
   font-size: var(--font-size-sm);
   color: var(--text-secondary);
   font-weight: 500;
}

.theme-purple {
   --primary: #6366f1;
   --primary-hover: #4f46e5;
   --primary-glow: rgba(99, 102, 241, 0.4);
   --gradient-primary: linear-gradient(135deg, #6366f1, #a855f7);
}

.theme-rose {
   --primary: #f43f5e;
   --primary-hover: #e11d48;
   --primary-glow: rgba(244, 63, 94, 0.4);
   --gradient-primary: linear-gradient(135deg, #f43f5e, #ec4899);
}

.theme-emerald {
   --primary: #10b981;
   --primary-hover: #059669;
   --primary-glow: rgba(16, 185, 129, 0.4);
   --gradient-primary: linear-gradient(135deg, #10b981, #06b6d4);
}

.theme-amber {
   --primary: #f59e0b;
   --primary-hover: #d97706;
   --primary-glow: rgba(245, 158, 11, 0.4);
   --gradient-primary: linear-gradient(135deg, #f59e0b, #ef4444);
}

.theme-cyan {
   --primary: #06b6d4;
   --primary-hover: #0891b2;
   --primary-glow: rgba(6, 182, 212, 0.4);
   --gradient-primary: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.theme-pink {
   --primary: #ec4899;
   --primary-hover: #db2777;
   --primary-glow: rgba(236, 72, 153, 0.4);
   --gradient-primary: linear-gradient(135deg, #ec4899, #f43f5e);
}

/* DRM & Quality Selector */
.drm-warning {
   display: flex;
   align-items: center;
   gap: var(--space-md);
   padding: var(--space-md);
   background: rgba(239, 68, 68, 0.1);
   border: 1px solid rgba(239, 68, 68, 0.3);
   border-radius: var(--radius-md);
   margin-bottom: var(--space-md);
}

.drm-icon {
   font-size: 2rem;
}

.drm-text strong {
   color: var(--error);
   display: block;
   margin-bottom: var(--space-xs);
}

.drm-text p {
   color: var(--text-secondary);
   font-size: var(--font-size-sm);
   margin: 0;
}

.quality-selector {
   display: flex;
   align-items: center;
   gap: var(--space-md);
   margin-bottom: var(--space-md);
   padding: var(--space-sm) var(--space-md);
   background: var(--bg-tertiary);
   border-radius: var(--radius-md);
}

.quality-selector label {
   color: var(--text-secondary);
   font-size: var(--font-size-sm);
   font-weight: 500;
   white-space: nowrap;
}

.quality-dropdown {
   flex: 1;
   padding: var(--space-sm) var(--space-md);
   background: var(--bg-secondary);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-md);
   color: var(--text-primary);
   font-size: var(--font-size-sm);
   cursor: pointer;
   outline: none;
}

.quality-dropdown:hover,
.quality-dropdown:focus {
   border-color: var(--primary);
}

.quality-dropdown option {
   background: var(--bg-secondary);
   color: var(--text-primary);
}

.quality-hq .quality-badge {
   background: rgba(58, 123, 213, 0.15);
   border: 1px solid rgba(58, 123, 213, 0.3);
   color: #4facfe;
}

/* Feedback Button */
.floating-feedback-btn {
   position: fixed;
   bottom: 200px;
   right: 20px;
   width: 50px;
   height: 50px;
   border-radius: 50%;
   background: var(--success);
   border: none;
   cursor: pointer;
   z-index: 1000;
   display: flex;
   align-items: center;
   justify-content: center;
   box-shadow: var(--shadow-md);
   transition: all 0.2s;
}

.floating-feedback-btn:hover {
   transform: scale(1.1);
}

.floating-feedback-btn .floating-btn-label {
   position: absolute;
   bottom: 60px;
   left: 50%;
   transform: translateX(-50%);
   background: var(--success);
   color: white;
   padding: 4px 10px;
   border-radius: 16px;
   font-size: 11px;
   font-weight: 600;
   white-space: nowrap;
   pointer-events: none;
}

.floating-feedback-btn .feedback-icon {
   font-size: 1.3rem;
   color: white;
}

.floating-feedback-btn .floating-btn-icon {
   font-size: 1.3rem;
   color: white;
}

/* Floating History Button */
.floating-history-btn {
   position: fixed;
   bottom: 100px;
   right: 20px;
   width: 50px;
   height: 50px;
   border-radius: 50%;
   background: var(--primary);
   border: none;
   cursor: pointer;
   z-index: 1000;
   display: flex;
   align-items: center;
   justify-content: center;
   box-shadow: var(--shadow-md);
   transition: all 0.2s;
}

.floating-history-btn:hover {
   transform: scale(1.1);
}

.floating-history-btn .floating-btn-label {
   position: absolute;
   bottom: 60px;
   left: 50%;
   transform: translateX(-50%);
   background: var(--primary);
   color: white;
   padding: 4px 10px;
   border-radius: 16px;
   font-size: 11px;
   font-weight: 600;
   white-space: nowrap;
   pointer-events: none;
}

.floating-history-btn .history-icon {
   font-size: 1.3rem;
}

.floating-history-btn .history-badge {
   position: absolute;
   top: -5px;
   right: -5px;
   background: #f43f5e;
   color: white;
   font-size: 11px;
   font-weight: bold;
   min-width: 20px;
   height: 20px;
   border-radius: 10px;
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 0 5px;
}

.floating-history-btn .history-badge:empty,
.floating-history-btn .history-badge[data-count="0"] {
   display: none;
}

/* Hidden animation classes (neutralized) */
.floating-shape,
.morphing-blob,
.particle-system,
.glow-orb,
.shooting-star,
.ambient-particle,
.confetti-piece,
.click-particle,
.ripple-effect,
.focus-particles,
.loading-overlay,
.loading-content,
.loading-logo,
.loading-text,
.loading-bar,
.loading-bar-fill,
.loading-curtain,
.quality-bot-active,
.geo-shape,
.site-marquee,
.kawaii-bot-wrapper {
   display: none !important;
}

/* ============================================
   Mobile Menu
   ============================================ */
.mobile-menu-btn {
   display: none;
   background: transparent;
   border: none;
   font-size: 1.5rem;
   color: var(--text-primary);
   cursor: pointer;
   padding: 0.5rem;
}

/* ============================================
   RTL
   ============================================ */
[dir="rtl"] .toast-container {
   left: var(--space-xl);
   right: auto;
}

[dir="rtl"] .history-panel {
   right: auto;
   left: -100vw;
   border-left: none;
   border-right: 1px solid var(--border-color);
}

[dir="rtl"] .history-panel.open {
   left: 0;
}

[dir="rtl"] .mobile-menu-btn {
   margin-right: 0;
   margin-left: 0.5rem;
}

[dir="rtl"] .download-progress-container {
   right: auto;
   left: 24px;
   transform-origin: bottom left;
}

[dir="rtl"] .download-hub-header {
   flex-direction: row-reverse;
}

[dir="rtl"] .download-hub-title {
   flex-direction: row-reverse;
}

[dir="rtl"] .download-hub-actions {
   flex-direction: row-reverse;
}

[dir="rtl"] .download-progress-info {
   flex-direction: row-reverse;
}

[dir="rtl"] .download-progress-details {
   text-align: right;
}

[dir="rtl"] .download-progress-meta {
   flex-direction: row-reverse;
}

[dir="rtl"] .download-progress-stats {
   flex-direction: row-reverse;
}

[dir="rtl"] .download-progress-bar {
   direction: rtl;
   transform-origin: right;
}

/* ============================================
   Responsive: Desktop (1200px+)
   ============================================ */
@media (min-width: 1200px) {
   .container {
      max-width: 1140px;
   }

   .hero-title {
      font-size: 3.5rem;
   }

   .download-box {
      max-width: 800px;
   }
}

/* ============================================
   Responsive: Tablet & Mobile (up to 1024px)
   ============================================ */
@media (max-width: 1024px) {
   .container {
      max-width: 960px;
   }

   .hero-title {
      font-size: var(--font-size-2xl);
   }

   .hero-subtitle {
      font-size: var(--font-size-md);
   }

   .features-grid {
      grid-template-columns: repeat(2, 1fr);
   }

   .faq-grid {
      max-width: 100%;
   }

   .toast-container {
      left: var(--space-md);
      right: var(--space-md);
      bottom: var(--space-lg);
   }

   .toast {
      min-width: auto;
      width: 100%;
   }

   .history-panel {
      width: 100%;
   }

   .mobile-menu-btn {
      display: block;
   }

   .header-content {
      gap: var(--space-sm);
   }

   .logo {
      flex: 1;
      font-size: var(--font-size-md);
   }

   .nav {
      position: fixed;
      top: 56px;
      left: 0;
      right: 0;
      background: var(--bg-secondary);
      padding: 1.5rem;
      flex-direction: column;
      gap: 1rem;
      border-bottom: 1px solid var(--border-color);
      transform: translateY(-120%);
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
      z-index: 99;
      box-shadow: var(--shadow-xl);
   }

   .nav.nav-open {
      transform: translateY(0);
      opacity: 1;
      visibility: visible;
   }

   .nav .btn,
   .nav .auth-buttons,
   .nav .user-menu {
      width: 100%;
   }

   .auth-buttons {
      flex-direction: column;
      gap: 0.5rem;
   }

   .auth-buttons .btn {
      width: 100%;
   }

   .nav.nav-open .auth-buttons {
      flex-direction: row;
      justify-content: center;
   }

   .auth-buttons,
   .user-menu {
      display: none;
      width: 100%;
      padding-top: var(--space-md);
      border-top: 1px solid var(--border-color);
      margin-top: var(--space-md);
   }

   .nav.nav-open .auth-buttons,
   .nav.nav-open .user-menu {
      display: flex;
      flex-direction: column;
   }

   #themeToggle,
   #langToggle {
      order: 1;
   }

   .hero {
      padding: var(--space-xl) 0;
   }

   .download-box {
      padding: var(--space-lg);
   }

   .input-group {
      flex-direction: column;
      border-radius: var(--radius-lg);
   }

   .input-group .input {
      border-radius: var(--radius-lg);
      border: 1px solid var(--border-color);
   }

   .btn-download {
      border-radius: var(--radius-lg);
      width: 100%;
      margin-top: var(--space-sm);
   }

   .video-info {
      flex-direction: column;
      align-items: center;
      text-align: center;
   }

   .video-thumbnail {
      width: 100%;
      max-width: 280px;
      height: auto;
      aspect-ratio: 16/9;
   }

   .quality-options {
      grid-template-columns: repeat(2, 1fr);
   }

   .features-grid {
      grid-template-columns: 1fr;
   }

   .feature-card {
      padding: var(--space-lg);
   }

   .footer-content {
      flex-direction: column;
      text-align: center;
   }

   .platforms {
      gap: var(--space-md);
   }

   .faq-question {
      padding: var(--space-md);
      font-size: var(--font-size-sm);
   }

   .faq-answer {
      padding: 0 var(--space-md) var(--space-md);
      font-size: var(--font-size-sm);
   }

   #userDropdown {
      position: fixed;
      top: auto;
      bottom: 0;
      left: 0;
      right: 0;
      border-radius: var(--radius-xl) var(--radius-xl) 0 0;
      animation: slideUpMobile 0.3s ease;
   }

   @keyframes slideUpMobile {
      from {
         transform: translateY(100%);
      }

      to {
         transform: translateY(0);
      }
   }

   .fab {
      width: 48px;
      height: 48px;
      font-size: 1.25rem;
      bottom: var(--space-lg);
      left: var(--space-lg);
   }

   .floating-feedback-btn {
      bottom: 140px;
      right: 15px;
      width: 46px;
      height: 46px;
   }

   .floating-feedback-btn .feedback-icon {
      font-size: 1.1rem;
   }

   .floating-history-btn {
      bottom: 80px;
      right: 15px;
      width: 46px;
      height: 46px;
   }

   .floating-history-btn .history-icon {
      font-size: 1.1rem;
   }

   .floating-history-btn .floating-btn-label,
   .floating-feedback-btn .floating-btn-label {
      display: none;
   }

   .section {
      padding: var(--space-xl) 0;
   }

   .section-title {
      font-size: var(--font-size-xl);
   }

   .comparison-header,
   .comparison-row {
      grid-template-columns: 1.5fr 1fr 1fr;
      gap: var(--space-sm);
      padding: var(--space-md);
      font-size: var(--font-size-sm);
   }

   .download-progress-container {
      max-width: 380px;
      bottom: 20px;
      right: 20px;
      width: calc(100% - 40px);
   }
}

/* ============================================
   Responsive: Small Mobile (up to 480px)
   ============================================ */
@media (max-width: 480px) {
   .container {
      padding: 0 var(--space-md);
   }

   .hero-title {
      font-size: var(--font-size-xl);
   }

   .download-box {
      padding: var(--space-md);
      border-radius: var(--radius-lg);
   }

   .platform-icon {
      font-size: 1.25rem;
   }

   .quality-options {
      grid-template-columns: 1fr;
   }

   .quality-btn {
      flex-direction: row;
      justify-content: space-between;
   }

   .modal-content {
      padding: var(--space-lg);
      margin: var(--space-sm);
      max-height: 90vh;
      overflow-y: auto;
   }

   .result-card {
      padding: var(--space-md);
   }

   .format-pills {
      flex-wrap: wrap;
   }

   .logo-text {
      font-size: var(--font-size-md);
   }

   .logo-icon {
      font-size: 1.25em;
   }

   .scan-video-info {
      flex-direction: column;
   }

   .scan-video-thumb {
      width: 100%;
      min-width: 100%;
   }

   .scan-video-thumb-small {
      width: 100%;
      min-width: 100%;
      aspect-ratio: 21/9;
   }

   .scan-video-details {
      padding: 0.6rem 0.75rem;
   }

   .scan-video-actions {
      padding: 0.5rem;
   }

   .sites-categories-grid {
      grid-template-columns: 1fr 1fr;
      gap: var(--space-sm);
   }

   .site-category-card {
      padding: var(--space-md);
   }

   .download-progress-container {
      right: 12px;
      left: 12px;
      bottom: 16px;
      max-width: none;
      width: auto;
      border-radius: 18px;
   }

   .download-progress-container.minimized {
      transform: translateY(calc(100% - 52px)) scale(0.98);
   }
}

/* ============================================
   Responsive: Extra Small (up to 400px) 
   ============================================ */
@media (max-width: 400px) {
   .download-progress-container {
      right: 8px;
      left: 8px;
      bottom: 12px;
      border-radius: 16px;
   }

   .download-hub-header {
      padding: 10px 12px;
   }

   .download-hub-title {
      font-size: 0.82rem;
   }

   .hub-action-btn {
      width: 28px;
      height: 28px;
      font-size: 0.72rem;
   }

   .download-hub-list {
      max-height: 260px;
      padding: 6px;
   }

   .download-progress-item {
      padding: 10px;
      border-radius: 10px;
   }
}

/* RTL responsive overrides */
@media (max-width: 768px) {
   [dir="rtl"] .download-progress-container {
      left: 20px;
      right: auto;
   }
}

@media (max-width: 576px) {
   [dir="rtl"] .download-progress-container {
      left: 12px;
      right: 12px;
   }
}

@media (max-width: 400px) {
   [dir="rtl"] .download-progress-container {
      left: 8px;
      right: 8px;
   }
}

/* Sidebar ads visibility */
@media (min-width: 768px) {

   .ad-zone-sidebar,
   .ad-zone-sidebar-left {
      display: block !important;
   }
}

@media (max-width: 767px) {

   .ad-zone-sidebar,
   .ad-zone-sidebar-left {
      display: none !important;
   }
}

@media (min-width: 769px) {
   .ad-zone-mobile-bottom {
      display: none !important;
   }
}

/* ============================================
   Print
   ============================================ */
@media print {

   .header,
   .footer,
   .fab,
   .toast-container,
   .history-panel,
   .modal,
   .ad-zone {
      display: none !important;
   }

   body {
      background: white;
      color: black;
   }

   .download-box {
      box-shadow: none;
      border: 1px solid #ccc;
   }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {

   *,
   *::before,
   *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
   }
}

/* Color scheme */
@media (prefers-color-scheme: dark) {
   :root {
      color-scheme: dark;
   }
}

@media (prefers-color-scheme: light) {
   :root {
      color-scheme: light;
   }
}

/* High Contrast */
@media (prefers-contrast: high) {
   body {
      color: #fff;
      background: #000;
   }
}

/* SEO Optimization */
.hero-title span {
   display: inline-block;
}