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

:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-glow: rgba(255, 255, 255, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Animated gradient background */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c, #4facfe, #00f2fe);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glass card effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Input section */
.input-section {
    padding: 24px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.input-icon {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

#urlInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
}

#urlInput::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

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

.btn-primary.loading .btn-loader {
    display: block;
}

.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Preview section */
.preview-section {
    padding: 24px;
    animation: slideUp 0.4s ease;
}

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

.preview-content {
    display: flex;
    gap: 24px;
}

.thumbnail-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 200px;
    border-radius: 12px;
    overflow: hidden;
}

#thumbnail {
    width: 100%;
    height: auto;
    display: block;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-info h2 {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uploader {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.quality-section {
    margin-top: auto;
}

.quality-section label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.quality-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quality-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quality-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quality-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 16px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-download:hover {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

/* Progress section */
.progress-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    background-size: 200% 100%;
    animation: progressGradient 2s linear infinite;
    border-radius: 4px;
    transition: width 0.3s ease;
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Error message */
.error-message {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    animation: shake 0.4s ease;
}

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

.error-message svg {
    width: 24px;
    height: 24px;
    color: #ef4444;
    flex-shrink: 0;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 20px 24px;
    text-align: center;
}

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

.platforms {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.platform {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.platform svg {
    width: 24px;
    height: 24px;
}

/* Utility */
.hidden {
    display: none !important;
}

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

    .hero {
        padding: 30px 20px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .input-wrapper {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }

    .input-icon {
        display: none;
    }

    #urlInput {
        width: 100%;
        text-align: center;
    }

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

    .preview-content {
        flex-direction: column;
    }

    .thumbnail-wrapper {
        width: 100%;
    }
}
