/**
 * YT2Dude - Complete UI Structure Redesign
 * Spatial Bento Design System
 * Version 2.0
 */

/* =====================================================
   FONTS — loaded via <link preload> in HTML for performance
   ===================================================== */

/* =====================================================
   CSS VARIABLES - SPATIAL DARK THEME
   ===================================================== */
:root {
    /* Backgrounds - Spatial Dark */
    --bg-void: #05050A;
    --bg-primary: #0A0A12;
    --bg-elevated: #12121C;
    --bg-surface: #18182A;
    --bg-glass: rgba(18, 18, 28, 0.75);
    --bg-glass-hover: rgba(24, 24, 42, 0.85);

    /* Accent - Cyan/Teal Gradient */
    --accent-primary: #00E5CC;
    --accent-secondary: #6366F1;
    --accent-tertiary: #A855F7;
    --accent-gradient: linear-gradient(135deg, #00E5CC 0%, #6366F1 50%, #A855F7 100%);
    --accent-gradient-subtle: linear-gradient(135deg, rgba(0, 229, 204, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);

    /* Text */
    --text-primary: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --text-dim: #52525B;

    /* Semantic */
    --success: #22C55E;
    --success-soft: rgba(34, 197, 94, 0.15);
    --warning: #F59E0B;
    --warning-soft: rgba(245, 158, 11, 0.15);
    --error: #EF4444;
    --error-soft: rgba(239, 68, 68, 0.15);

    /* Glass & Borders */
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-hover: rgba(255, 255, 255, 0.12);
    --glass-border-active: rgba(0, 229, 204, 0.4);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(0, 229, 204, 0.15);
    --shadow-glow-strong: 0 0 60px rgba(0, 229, 204, 0.25);

    /* Typography */
    --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-index */
    --z-base: 1;
    --z-elevated: 10;
    --z-overlay: 100;
    --z-modal: 1000;
    --z-toast: 1100;
}

/* Light Mode Variables */
.light {
    --bg-void: #F8FAFC;
    --bg-primary: #FFFFFF;
    --bg-elevated: #F1F5F9;
    --bg-surface: #E2E8F0;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-hover: rgba(248, 250, 252, 0.95);

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-dim: #94A3B8;

    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-hover: rgba(0, 0, 0, 0.12);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(0, 229, 204, 0.2);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-void);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input {
    font-family: inherit;
    border: none;
    background: none;
    outline: none;
}

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

.hidden {
    display: none !important;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* =====================================================
   FIXED HEADER (always visible)
   ===================================================== */
:root {
    --header-height: 60px;
}

.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-overlay);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    pointer-events: none;
}

.fixed-header>* {
    pointer-events: auto;
}

/* Fixed Logo (Left Side) */
.fixed-logo {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    transition: transform 0.2s ease;
}

/* Animated background for logo area */
.fixed-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    z-index: -2;
}

/* Animated glow ring behind logo */
.fixed-logo::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(from 0deg,
            rgba(0, 229, 204, 0.6),
            rgba(99, 102, 241, 0.6),
            rgba(168, 85, 247, 0.4),
            rgba(0, 229, 204, 0.6));
    border-radius: var(--radius-lg);
    z-index: -3;
    opacity: 0.6;
    animation: logoGlow 4s linear infinite;
    filter: blur(4px);
}

@keyframes logoGlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.fixed-logo:hover {
    transform: scale(1.02);
}

.fixed-logo:hover::after {
    opacity: 1;
    filter: blur(6px);
}

.fixed-logo-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(0, 229, 204, 0.4));
    transition: filter 0.2s ease;
}

.fixed-logo:hover .fixed-logo-icon {
    filter: drop-shadow(0 0 20px rgba(0, 229, 204, 0.6));
}

.fixed-logo-text {
    height: 22px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0, 229, 204, 0.5));
}

/* Light mode: invert text logo for visibility */
.light .fixed-logo-text {
    filter: invert(1) drop-shadow(0 0 8px rgba(0, 0, 0, 0.2));
}

/* Fixed Controls (Right Side) */
.fixed-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.fixed-controls .language-selector {
    position: relative;
}

.fixed-controls .language-btn,
.fixed-controls .theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fixed-controls .theme-toggle {
    padding: var(--space-2);
    width: 38px;
    height: 38px;
}

.fixed-controls .language-btn:hover,
.fixed-controls .theme-toggle:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.fixed-controls .chevron-icon {
    transition: transform 0.2s ease;
}

.fixed-controls .language-selector.open .chevron-icon {
    transform: rotate(180deg);
}

/* Language Dropdown */
.fixed-controls .language-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 160px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-lg);
}

.fixed-controls .language-selector.open .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fixed-controls .lang-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.fixed-controls .lang-option:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.fixed-controls .lang-option.active {
    background: var(--accent-gradient-subtle);
    color: var(--accent-primary);
}

.fixed-controls .lang-flag {
    font-size: 1rem;
}

/* Theme Toggle Icons */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .sun-icon {
    display: none;
}

.dark .moon-icon {
    display: block;
}

.light .sun-icon {
    display: block;
}

.light .moon-icon {
    display: none;
}

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

    .fixed-header,
    .fixed-logo,
    .fixed-controls * {
        transition: none;
    }
}

/* =====================================================
   HERO SECTION
   ===================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(80px + var(--space-8)) 0 var(--space-16);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 140%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(0, 229, 204, 0.08) 0%, rgba(99, 102, 241, 0.04) 40%, transparent 70%);
    filter: blur(60px);
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

.hero-content {
    position: relative;
    z-index: var(--z-base);
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

/* Hero Logo */
.hero-logo {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-8);
}

.hero-logo-img {
    width: clamp(180px, 35vw, 280px);
    height: auto;
    filter: drop-shadow(0 0 50px rgba(0, 229, 204, 0.5)) drop-shadow(0 0 100px rgba(99, 102, 241, 0.4));
    animation: logoFloat 6s ease-in-out infinite, logoGlow 3s ease-in-out infinite alternate;
    transition: transform var(--transition-normal);
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.hero-logo:hover .hero-logo-img {
    transform: scale(1.08) rotate(3deg);
    filter: drop-shadow(0 0 70px rgba(0, 229, 204, 0.7)) drop-shadow(0 0 120px rgba(99, 102, 241, 0.6));
}

/* Rotating Ring Effect */
.logo-ring {
    position: absolute;
    width: clamp(220px, 42vw, 340px);
    height: clamp(220px, 42vw, 340px);
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, var(--accent-primary), transparent, var(--accent-secondary), transparent);
    animation: ringRotate 8s linear infinite;
    opacity: 0.4;
    z-index: 1;
    filter: blur(8px);
}

.hero-logo:hover .logo-ring {
    opacity: 0.7;
    animation-duration: 4s;
}

@keyframes ringRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

@keyframes logoGlow {
    0% {
        filter: drop-shadow(0 0 50px rgba(0, 229, 204, 0.5)) drop-shadow(0 0 100px rgba(99, 102, 241, 0.4));
    }

    100% {
        filter: drop-shadow(0 0 80px rgba(0, 229, 204, 0.7)) drop-shadow(0 0 130px rgba(99, 102, 241, 0.6));
    }
}

/* Hero Tagline */
.hero-tagline {
    font-family: var(--font-display);
    font-size: clamp(1.125rem, 3vw, 1.5rem);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-10);
    letter-spacing: 0.02em;
}

/* =====================================================
   SEARCH CARD (Floating Input)
   ===================================================== */
.search-card {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-2);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: all var(--transition-normal);
    margin-bottom: var(--space-6);
}

.search-card:hover,
.search-card:focus-within {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.search-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
}

.search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    height: 52px;
    font-size: 1rem;
    color: var(--text-primary);
    background: transparent;
}

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

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

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

.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 52px;
    padding: 0 var(--space-6);
    background: var(--accent-gradient);
    color: #0A0A12;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
    min-width: 120px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-strong);
}

.submit-btn:active {
    transform: translateY(0);
}

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

.btn-arrow {
    transition: transform var(--transition-fast);
}

.submit-btn:hover .btn-arrow {
    transform: translateX(4px);
}

/* =====================================================
   ERROR TOAST
   ===================================================== */
.error-toast {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--error-soft);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-full);
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: var(--space-6);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

/* =====================================================
   TRUST INDICATORS
   ===================================================== */
.trust-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.trust-divider {
    opacity: 0.4;
}

/* =====================================================
   RESULTS SECTION
   ===================================================== */
.results {
    padding: var(--space-6) 0 var(--space-12);
    padding-top: calc(var(--navbar-height) + var(--space-4));
    animation: slideUp 0.4s ease-out;
}

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

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

/* =====================================================
   VIDEO PREVIEW CARD
   ===================================================== */
.video-preview-card {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-6);
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-10);
}

.thumbnail-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duration-badge {
    position: absolute;
    bottom: var(--space-2);
    right: var(--space-2);
    padding: var(--space-1) var(--space-2);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
}

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

.video-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* =====================================================
   FORMAT SELECTION CARD - Unified Container
   ===================================================== */
.format-selection-card {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.format-selection-card:hover {
    border-color: var(--glass-border-hover);
}

/* Light mode specific styling */
:root:not(.dark) .format-selection-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.1), 0 8px 32px -12px rgba(0, 0, 0, 0.08);
}

/* NEW VIDEO ACTION - Standalone Centered Button */
.new-video-action {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: var(--space-4);
    margin-bottom: var(--space-6);
}

.new-video-action .new-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.new-video-action .new-video-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.new-video-action .new-video-btn svg {
    transition: transform 0.3s ease;
}

.new-video-action .new-video-btn:hover svg {
    transform: rotate(-45deg);
}

/* Light mode specific for new-video-btn */
:root:not(.dark) .new-video-action .new-video-btn {
    background: rgba(241, 245, 249, 0.9);
    border-color: rgba(148, 163, 184, 0.4);
    color: #475569;
}

:root:not(.dark) .new-video-action .new-video-btn:hover {
    background: white;
    border-color: var(--accent);
    color: #1e293b;
}

/* =====================================================
   SECTION HEADER
   ===================================================== */
.section-header {
    margin-bottom: var(--space-6);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-1);
}

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

/* =====================================================
   FORMAT BENTO GRID
   ===================================================== */
.format-bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.format-card {
    position: relative;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
}

.format-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.format-card.selected {
    border-color: var(--accent-primary);
    background: var(--accent-gradient-subtle);
    box-shadow: var(--shadow-glow);
}

.format-card.selected::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    z-index: -1;
    opacity: 0.3;
}

.format-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: var(--bg-surface);
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.format-card.video .format-badge {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-secondary);
}

.format-card.audio .format-badge {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-tertiary);
}

.format-quality {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
    line-height: 1.2;
}

.format-info {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.format-info span {
    display: flex;
    align-items: center;
}

.format-check {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--accent-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition-bounce);
}

.format-card.selected .format-check {
    opacity: 1;
    transform: scale(1);
}

/* =====================================================
   COMPACT PROGRESS HUB
   ===================================================== */
.download-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding-top: var(--space-4);
    /* No background, border or box styling - just centered content */
}

/* Main Download Button (Compact) */
.download-btn-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: auto;
    min-height: 38px;
    padding: var(--space-2) var(--space-4);
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    color: #0A0A12;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.download-btn-compact::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.download-btn-compact:hover:not(:disabled)::before {
    transform: translateX(100%);
}

.download-btn-compact:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.download-btn-compact:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-surface);
    color: var(--text-muted);
}

/* Progress Hub (Processing State) */
.progress-hub {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.progress-status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Animated Spinner */
.spinner-container {
    flex-shrink: 0;
}

.spinner {
    animation: spin 1s linear infinite;
}

.spinner-track {
    stroke: var(--glass-border);
}

.spinner-progress {
    stroke: var(--accent-primary);
    stroke-dasharray: 31.4 31.4;
    stroke-dashoffset: 20;
    transform-origin: center;
}

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

.progress-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Shimmer Progress Bar */
.progress-bar-shimmer {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill-shimmer {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    position: relative;
    transition: width 0.3s ease;
}

.progress-fill-shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.4) 50%,
            transparent 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(200%);
    }
}

/* Success Hub - Enhanced Aesthetic Design */
.success-hub {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-xl);
    animation: successFadeIn 0.4s ease;
}

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

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

.success-celebration {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.success-icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--success) 0%, #06b6d4 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.15);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

.success-check {
    color: #ffffff;
    animation: checkDraw 0.5s ease 0.3s forwards;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
}

@keyframes checkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.success-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.success-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: -0.01em;
}

.success-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Action Buttons (Inline Compact) - Smaller Size */
.download-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding-top: var(--space-2);
    margin-top: var(--space-2);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    white-space: nowrap;
    min-height: 32px;
    cursor: pointer;
}

.action-btn.primary {
    background: var(--accent-gradient);
    color: #0A0A12;
    box-shadow: var(--shadow-sm);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.action-separator {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
}

/* New Video Button - Theme-aware styling */
.new-video-btn,
#downloadAnotherBtn {
    background: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-md) !important;
    padding: 8px 16px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.new-video-btn:hover,
#downloadAnotherBtn:hover {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2s;
    }

    .progress-fill-shimmer::after {
        animation: none;
    }

    .success-icon {
        animation: none;
    }

    .success-icon svg path {
        animation: none;
        stroke-dashoffset: 0;
    }
}

/* =====================================================
   FEATURES SECTION
   ===================================================== */
.features {
    padding: var(--space-16) 0;
    background: var(--bg-primary);
}

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

.feature-card {
    padding: var(--space-6);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    text-align: center;
    transition: all var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--accent-gradient-subtle);
    border-radius: var(--radius-lg);
    color: var(--accent-primary);
    margin-bottom: var(--space-4);
}

.feature-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.feature-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    padding: var(--space-8) 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--glass-border);
}

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

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--space-2);
}

.footer-disclaimer {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-4);
    }

    .navbar-wrapper {
        padding: var(--space-2) var(--space-4);
    }

    .brand-name {
        font-size: 1.125rem;
    }

    .hero {
        min-height: auto;
        padding: calc(80px + var(--space-6)) 0 var(--space-8);
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .search-form {
        flex-direction: column;
        gap: var(--space-3);
    }

    .search-input-wrapper {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        background: var(--bg-surface);
        border-radius: var(--radius-lg);
    }

    .submit-btn {
        width: 100%;
        height: 48px;
    }

    .trust-indicators {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .video-preview-card {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .thumbnail-container {
        max-width: 100%;
    }

    .format-bento-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .format-card {
        padding: var(--space-4);
    }

    .format-quality {
        font-size: 1.25rem;
    }

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

@media (max-width: 480px) {
    .format-bento-grid {
        grid-template-columns: 1fr;
    }

    .search-card {
        padding: var(--space-3);
    }
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {

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

    html {
        scroll-behavior: auto;
    }
}

/* =====================================================
   FOCUS STATES (Accessibility)
   ===================================================== */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* =====================================================
   SCROLLBAR STYLING
   ===================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* =====================================================
   SELECTION
   ===================================================== */
::selection {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* =====================================================
   FAQ SECTION
   ===================================================== */
.faq-section {
    padding: var(--space-12) 0;
    background: var(--bg-primary);
}

.faq-section .section-title {
    text-align: center;
    margin-bottom: var(--space-2);
}

.faq-section .section-subtitle {
    text-align: center;
    margin-bottom: var(--space-8);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
    max-width: 1000px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-normal);
}

.faq-item:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.faq-question {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.faq-question::before {
    content: '?';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent-gradient);
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.faq-answer p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =====================================================
   SEO CONTENT SECTION
   ===================================================== */
.seo-content {
    padding: var(--space-12) 0;
    background: var(--bg-void);
}

.seo-content .section-title {
    text-align: center;
    margin-bottom: var(--space-8);
}

.seo-text-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
    max-width: 900px;
    margin: 0 auto;
}

.seo-text-item {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.seo-text-item h3 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: var(--space-4);
}

.seo-text-item p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.seo-text-item ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.seo-text-item li {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    padding-left: var(--space-5);
    position: relative;
}

.seo-text-item li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: 600;
}

.seo-text-item li strong {
    color: var(--text-primary);
}

/* Full-width SEO item (comparison table) */
.seo-text-item-full {
    grid-column: 1 / -1;
}

/* Ordered list steps */
.seo-steps {
    list-style: none;
    counter-reset: step-counter;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.seo-steps li {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    padding-left: calc(var(--space-5) + 8px);
    position: relative;
    counter-increment: step-counter;
}

.seo-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--bg-primary);
    background: var(--accent-primary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    top: 1px;
}

.seo-steps li strong {
    color: var(--text-primary);
}

/* Comparison Table */
.seo-comparison-table {
    overflow-x: auto;
    border-radius: var(--radius-md);
    margin-top: var(--space-3);
}

.seo-comparison-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.seo-comparison-table thead {
    background: var(--accent-primary);
}

.seo-comparison-table th {
    padding: var(--space-3) var(--space-4);
    color: white;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.seo-comparison-table td {
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.seo-comparison-table tbody tr:hover {
    background: var(--bg-secondary);
}

.seo-comparison-table tbody tr:last-child td {
    border-bottom: none;
}

/* =====================================================
   LANGUAGE SELECTOR
   ===================================================== */
.language-selector {
    position: relative;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.language-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--glass-border-hover);
    color: var(--text-primary);
}

.language-btn .globe-icon {
    opacity: 0.8;
}

.language-btn .chevron-icon {
    opacity: 0.6;
    transition: transform var(--transition-fast);
}

.language-selector.open .chevron-icon {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 160px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

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

.lang-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: start;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-option:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.lang-option.active {
    background: var(--accent-gradient-subtle);
    color: var(--accent-primary);
}

.lang-flag {
    font-size: 1.125rem;
    line-height: 1;
}

/* Scrollbar for language dropdown */
.language-dropdown::-webkit-scrollbar {
    width: 4px;
}

.language-dropdown::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: var(--radius-full);
}

/* =====================================================
   RTL SUPPORT (for Arabic and other RTL languages)
   ===================================================== */
html[dir="rtl"] body {
    text-align: right;
}

/* Use CSS logical properties for RTL support */
html[dir="rtl"] .language-dropdown {
    right: auto;
    left: 0;
}

html[dir="rtl"] .nav-right {
    flex-direction: row-reverse;
}

html[dir="rtl"] .search-input-wrapper {
    flex-direction: row-reverse;
}

html[dir="rtl"] .trust-item {
    flex-direction: row-reverse;
}

html[dir="rtl"] .feature-card {
    text-align: right;
}

html[dir="rtl"] .faq-question {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .footer-content {
    text-align: right;
}

html[dir="rtl"] .download-btn-content {
    flex-direction: row-reverse;
}

html[dir="rtl"] .new-download-btn {
    flex-direction: row-reverse;
}

html[dir="rtl"] .video-info h2 {
    text-align: right;
}

html[dir="rtl"] .video-meta {
    justify-content: flex-end;
}

html[dir="rtl"] .format-badge {
    margin-inline-start: 0;
    margin-inline-end: var(--space-2);
}

html[dir="rtl"] .seo-text-item li::before {
    left: auto;
    right: 0;
}

html[dir="rtl"] .seo-text-item li {
    padding-left: 0;
    padding-right: var(--space-5);
}

/* RTL animations adjustment */
html[dir="rtl"] .btn-arrow {
    transform: rotate(180deg);
}

html[dir="rtl"] .submit-btn:hover .btn-arrow {
    transform: rotate(180deg) translateX(-4px);
}

/* Mobile RTL adjustments */
@media (max-width: 768px) {
    html[dir="rtl"] .search-form {
        direction: rtl;
    }

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