:root {
    --bg-color: #0c111c;
    --card-bg: rgba(30, 41, 59, 0.4);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #3b82f6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Background Effects */
.background-gradients {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.gradient-blob {
    position: absolute;
    filter: blur(100px);
    opacity: 0.15;
    border-radius: 50%;
}

.form-blob {
    top: -10%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.result-blob {
    bottom: -10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Hero */
.hero {
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.4s ease, border-color 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Platform Toggle */
.platform-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.toggle-btn {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.toggle-btn.active {
    background: rgba(139, 92, 246, 0.15);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.toggle-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Form */
.input-group {
    display: flex;
    gap: 1rem;
    position: relative;
}

input[type="url"] {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 1.125rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    min-width: 140px;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary);
}

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

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.1);
}

.success-btn {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    background: var(--success);
    color: white;
    text-align: center;
    text-decoration: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.success-btn:hover {
    background: #059669;
}

/* Result Card */
.result-container {
    opacity: 0;
    transform: translateY(20px);
}

.result-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.video-info {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.thumbnail-wrapper {
    flex: 0 0 40%;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.thumbnail-wrapper img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    aspect-ratio: 16/9;
}

.details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.details h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.duration {
    color: var(--text-muted);
    font-weight: 500;
}

.download-controls {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.styled-select {
    width: 100%;
    appearance: none;
    background: rgba(0, 0, 0, 0.2) url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 1rem center;
    background-size: 1em;
    border: 1px solid var(--card-border);
    color: white;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
}

.styled-select:focus {
    border-color: var(--secondary);
}

.styled-select option {
    background: var(--bg-color);
    color: white;
}

/* Progress Section */
.progress-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    animation: fadeIn 0.4s ease;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

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

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

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

/* Spinners */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
}

.toast {
    position: relative;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    color: white;
    font-weight: 500;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.success {
    border-left-color: var(--success);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

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

    .primary-btn {
        width: 100%;
        padding: 1.2rem;
    }

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

    .thumbnail-wrapper {
        width: 100%;
    }

    .container {
        padding: 2rem 1rem;
    }

    .toast-container {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }
}