:root {
    --bg-primary: #0a0a0f;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

.blob {
    position: absolute;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: float 10s infinite alternate ease-in-out;
}
.blob-1 { width: 400px; height: 400px; background: rgba(59, 130, 246, 0.3); top: -100px; left: -100px; border-radius: 50%; }
.blob-2 { width: 300px; height: 300px; background: rgba(139, 92, 246, 0.3); bottom: -50px; right: -50px; border-radius: 50%; animation-delay: -5s; }
.blob-3 { width: 250px; height: 250px; background: rgba(16, 185, 129, 0.2); top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; animation-delay: -2s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 30px) scale(1.1); }
}

.container {
    width: 100%;
    max-width: 700px;
    padding: 2rem;
    z-index: 1;
}

header { text-align: center; margin-bottom: 2.5rem; }
.logo {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--glass-bg), rgba(255,255,255,0.05));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex; justify-content: center; align-items: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.icon-logo { color: var(--accent); width: 32px; height: 32px; }
h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -1px; margin-bottom: 0.5rem; }
h1 span { background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
header p { color: var(--text-secondary); font-size: 1rem; max-width: 450px; margin: 0 auto; line-height: 1.5; }

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

.input-group {
    position: relative; display: flex; align-items: center;
    background: rgba(0, 0, 0, 0.2); border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 0.5rem; transition: all 0.3s ease;
}
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.icon-input { color: var(--text-secondary); margin-left: 1rem; width: 20px; height: 20px; }
input[type="url"] { flex: 1; background: transparent; border: none; color: var(--text-primary); padding: 1rem; font-size: 1rem; outline: none; }
input[type="url"]::placeholder { color: var(--text-secondary); }

button { cursor: pointer; }
button[type="submit"] {
    background: var(--accent); color: white; border: none; border-radius: 12px;
    padding: 0.8rem 1.5rem; font-size: 1rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.5rem; transition: all 0.3s ease;
}
button[type="submit"]:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
button[type="submit"]:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.spinner {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%; border-top-color: white; animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
    display: none; align-items: center; gap: 0.5rem; color: var(--danger);
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1rem; border-radius: 12px; margin-top: 1.5rem; font-size: 0.9rem;
}

.result-box { display: none; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--glass-border); animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.result-content { display: flex; gap: 1.5rem; margin-bottom: 2rem; }
#videoThumb { width: 160px; height: 90px; border-radius: 12px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,0.3); border: 1px solid var(--glass-border); }
.video-info { flex: 1; }
#videoTitle { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.channel { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.8rem; }
.badges { display: flex; gap: 0.8rem; }
.badge { display: flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; padding: 0.3rem 0.6rem; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text-secondary); }
.badge.quality { color: var(--success); background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); }
.badge i { width: 12px; height: 12px; }

.res-selection { margin-bottom: 1rem; text-align: left; }
.res-selection label { display: block; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.res-dropdown {
    width: 100%; padding: 0.8rem; background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border); color: #fff;
    border-radius: 12px; font-size: 1rem; outline: none;
    font-family: 'Inter', sans-serif;
}
.res-dropdown:focus { border-color: var(--accent); }

.download-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.8rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white; text-decoration: none; padding: 1rem 2rem;
    border: none;
    border-radius: 14px; font-weight: 600; font-size: 1.1rem; width: 100%;
    transition: all 0.3s ease; box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}
.download-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(59, 130, 246, 0.4); }

.success-btn { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3); }
.success-btn:hover { box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4); }

.download-note { color: var(--text-secondary); font-size: 0.8rem; margin-top: 1rem; text-align: center;}

.download-progress { text-align: center; margin-top: 1.5rem; }
.progress-bar-container {
    width: 100%; height: 8px; background: rgba(255,255,255,0.1);
    border-radius: 4px; overflow: hidden; margin-bottom: 0.5rem;
    position: relative;
}
.progress-bar {
    height: 100%; width: 0%; background: var(--success);
    border-radius: 4px; transition: width 0.3s ease;
}
.progress-stats { font-size: 0.9rem; font-weight: 600; color: var(--success); margin-bottom: 0.3rem; }
#progressText { font-size: 0.8rem; color: var(--text-secondary); }

footer { text-align: center; margin-top: 3rem; color: var(--text-secondary); font-size: 0.85rem; }

@media (max-width: 600px) {
    .glass-card { padding: 1.5rem; }
    .input-group { flex-direction: column; background: transparent; border: none; padding: 0; }
    .input-group:focus-within { box-shadow: none; }
    input[type="url"] { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
    .icon-input { display: none; }
    button[type="submit"] { width: 100%; justify-content: center; padding: 1rem; }
    .result-content { flex-direction: column; align-items: center; text-align: center; }
    #videoThumb { width: 100%; height: auto; max-width: 250px; }
    .badges { justify-content: center; }
}
