/* CSS Variables */
:root {
    --primary: #ff0000;
    --primary-dark: #cc0000;
    --secondary: #282828;
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-light: #272727;
    --text: #ffffff;
    --text-secondary: #aaaaaa;
    --border: #333333;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* Light Theme */
[data-theme="light"] {
    --bg: #f9f9f9;
    --surface: #ffffff;
    --surface-light: #f0f0f0;
    --text: #0f0f0f;
    --text-secondary: #606060;
    --border: #e0e0e0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
}

.logo-icon {
    font-size: 28px;
}

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

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

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

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--surface-light);
    transform: scale(1.1);
}

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

.hero-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Download Box */
.download-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 700px;
    margin: 0 auto 40px;
    box-shadow: var(--shadow-lg);
}

.input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.url-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

.url-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

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

.paste-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

.paste-btn:hover {
    color: var(--text);
    transform: translateY(-50%) scale(1.1);
}

.options-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.format-select {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.format-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.format-buttons {
    display: flex;
    gap: 8px;
}

.format-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.format-icon {
    font-size: 16px;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

.download-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}

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

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--surface-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Video Preview */
.video-preview {
    max-width: 700px;
    margin: 0 auto;
}

.preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.thumbnail-wrapper {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

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

.video-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-info {
    padding: 24px;
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-author {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.quality-select {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.quality-select label {
    color: var(--text-secondary);
    font-size: 14px;
}

.quality-dropdown {
    padding: 10px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

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

.btn-primary {
    flex: 1;
    padding: 14px 24px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    padding: 14px 24px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Features Section */
.features {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 50px;
}

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

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.feature-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

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

/* How It Works */
.how-it-works {
    padding: 80px 0;
    background: var(--surface);
    border-radius: var(--radius);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
    min-width: 200px;
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.step-content p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.step-arrow {
    font-size: 24px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* FAQ Section */
.faq {
    padding: 80px 0;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 20px 24px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--surface-light);
}

.faq-icon {
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
    color: var(--primary);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 200px;
}

.faq-answer p {
    padding: 0 24px 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 60px 0 30px;
    margin-top: 60px;
}

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

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-text {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

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

.footer-copyright {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
    }

    .nav {
        gap: 20px;
    }

    .hero {
        padding: 40px 0;
    }

    .download-box {
        padding: 20px;
    }

    .options-row {
        flex-direction: column;
    }

    .format-select {
        width: 100%;
        justify-content: center;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }

    .steps {
        flex-direction: column;
    }

    .step-arrow {
        transform: rotate(90deg);
    }

    .download-actions {
        flex-direction: column;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title,
.hero-subtitle,
.download-box {
    animation: fadeIn 0.6s ease forwards;
}

.hero-subtitle {
    animation-delay: 0.1s;
}

.download-box {
    animation-delay: 0.2s;
}