/* CSS Reset & Variables */
:root {
    --primary: #fe2c55;
    --primary-dark: #e91e4d;
    --secondary: #25f4ee;
    --gradient: linear-gradient(135deg, #fe2c55 0%, #25f4ee 100%);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Dark theme (default) */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #8a8b91;
    --shadow: 0 10px 40px rgba(254, 44, 85, 0.2);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.1);
    --blob-opacity: 0.3;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: rgba(0, 0, 0, 0.05);
    --border-color: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.2);
    --text-primary: #161823;
    --text-secondary: #6c757d;
    --shadow: 0 10px 40px rgba(254, 44, 85, 0.15);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --blob-opacity: 0.15;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-animation::before,
.bg-animation::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: var(--blob-opacity);
    animation: float 20s ease-in-out infinite;
    transition: opacity 0.4s ease;
}

.bg-animation::before {
    background: var(--primary);
    top: -200px;
    left: -200px;
}

.bg-animation::after {
    background: var(--secondary);
    bottom: -200px;
    right: -200px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, 50px) scale(1.1); }
    66% { transform: translate(-50px, 100px) scale(0.9); }
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow);
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lang-switch {
    display: flex;
    gap: 8px;
}

.lang-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}

.lang-btn:hover,
.lang-btn.active {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
}

/* Theme Toggle */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--primary);
    transform: rotate(15deg);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: var(--transition);
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: translateY(20px) rotate(-90deg);
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: translateY(-20px) rotate(90deg);
}

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

.hero h1 {
    font-size: clamp(32px, 6vw, 48px);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
}

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

.hero p {
    font-size: 18px;
    color: var(--gray);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Download Box */
.download-box {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    margin: 40px 0;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

[data-theme="light"] .download-box {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.input-group input {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition);
    outline: none;
}

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

.input-group input:focus {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.btn-download {
    padding: 16px 32px;
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

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

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

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

.btn-download svg {
    width: 20px;
    height: 20px;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

.btn-download.loading .spinner {
    display: block;
}

.btn-download.loading .btn-text {
    display: none;
}

/* Paste Button */
.paste-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.paste-btn {
    background: var(--bg-input);
    border: none;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.paste-btn:hover {
    background: rgba(254, 44, 85, 0.15);
}

[data-theme="light"] .paste-btn {
    background: rgba(254, 44, 85, 0.1);
}

/* Result Section */
.result {
    display: none;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease;
}

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

.result.show {
    display: block;
}

.video-preview {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.video-thumbnail {
    width: 180px;
    height: 320px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

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

.video-info {
    flex: 1;
}

.video-info h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-author {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.video-author svg {
    width: 16px;
    height: 16px;
}

.download-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.download-option:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

[data-theme="light"] .download-option {
    background: var(--bg-tertiary);
}

[data-theme="light"] .download-option:hover {
    background: #e0e4e8;
}

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

.option-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-icon svg {
    width: 20px;
    height: 20px;
}

.option-details h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.option-details span {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-option {
    padding: 10px 20px;
    background: rgba(254, 44, 85, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Features Section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 60px 0;
}

.feature {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.feature:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

[data-theme="light"] .feature {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .feature:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
}

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

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

/* How to Use Section */
.how-to {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    margin: 40px 0;
    transition: var(--transition);
}

[data-theme="light"] .how-to {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.how-to h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 32px;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

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

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

/* FAQ Section */
.faq {
    margin: 60px 0;
}

.faq h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 32px;
}

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

[data-theme="light"] .faq-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.faq-question:hover {
    background: var(--bg-card-hover);
}

[data-theme="light"] .faq-question:hover {
    background: rgba(0, 0, 0, 0.03);
}

.faq-question svg {
    width: 20px;
    height: 20px;
    transition: var(--transition);
}

.faq-item.active .faq-question svg {
    transform: rotate(180deg);
}

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

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

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

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

footer p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

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

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

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-primary);
}

.social-links a:hover {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
}

.social-links svg {
    width: 20px;
    height: 20px;
}

/* Error Message */
.error-message {
    background: rgba(254, 44, 85, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
    display: none;
    font-size: 14px;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .hero {
        padding: 40px 0 24px;
    }

    .download-box {
        padding: 24px 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-download {
        justify-content: center;
    }

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

    .video-thumbnail {
        width: 140px;
        height: 250px;
    }

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

    .how-to {
        padding: 24px;
    }

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

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

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}
