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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --error: #ef4444;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #1a1f3a 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo svg {
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.4));
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.search-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#videoUrl {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    outline: none;
    transition: all 0.3s;
}

#videoUrl:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    min-width: 150px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

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

.btn-primary.loading .btn-text {
    opacity: 0;
}

.btn-primary.loading .loader {
    opacity: 1;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.supported-platforms {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.platform-icons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.platform {
    background: var(--bg);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    animation: shake 0.5s;
}

.error-message:empty {
    display: none;
}

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

.video-info {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease;
}

.video-info.hidden {
    display: none;
}

.video-preview {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

#thumbnail {
    width: 320px;
    height: 180px;
    object-fit: cover;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.video-details {
    flex: 1;
    min-width: 250px;
}

#videoTitle {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.video-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.video-meta span::before {
    margin-right: 0.5rem;
}

#videoAuthor::before {
    content: "👤";
}

#videoDuration::before {
    content: "⏱️";
}

.download-options h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.format-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.format-option {
    background: var(--bg);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.format-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.format-quality {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.format-type {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.download-progress {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 0.75rem;
}

.download-progress.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-light);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 1rem;
    width: 0%;
    animation: progressAnim 2s ease-in-out infinite;
}

@keyframes progressAnim {
    0%, 100% { width: 0%; }
    50% { width: 100%; }
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.feature {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    animation: fadeInUp 0.6s ease both;
}

.feature:nth-child(1) { animation-delay: 0.3s; }
.feature:nth-child(2) { animation-delay: 0.4s; }
.feature:nth-child(3) { animation-delay: 0.5s; }
.feature:nth-child(4) { animation-delay: 0.6s; }

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.feature p {
    color: var(--text-muted);
}

footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

.disclaimer {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

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

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

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

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

    #thumbnail {
        width: 100%;
    }

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

    .format-list {
        grid-template-columns: 1fr;
    }
}
