:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --error: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100-screen;
    display: flex;
    justify-content: center;
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

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

.icon-logo {
    width: 40px;
    height: 40px;
    color: var(--primary);
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

h1 span {
    color: var(--primary);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    flex: 1;
}

.search-box {
    margin-bottom: 2rem;
    animation: fadeIn 1s ease-out;
}

.input-wrapper {
    position: relative;
    display: flex;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.input-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    padding: 0.75rem 0.75rem 0.75rem 2.75rem;
    font-size: 1rem;
}

input::placeholder {
    color: var(--text-muted);
}

.btn-primary,
.btn-success {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
    width: 100%;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-success:hover {
    background: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    text-align: center;
}

.video-preview {
    animation: fadeInUp 0.5s ease-out;
}

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.video-info {
    display: flex;
    gap: 1.5rem;
}

.thumbnail-wrapper {
    flex-shrink: 0;
    position: relative;
    width: 280px;
    border-radius: 1rem;
    overflow: hidden;
}

.thumbnail-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.25rem 0.5rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.details {
    flex: 1;
}

h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#v-author {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.format-selection {
    margin-top: 1rem;
}

.format-selection label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

select {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 0.75rem;
    outline: none;
    cursor: pointer;
}

select option {
    background: var(--bg-dark);
}

.error-msg {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
    padding: 1rem;
    border-radius: 1rem;
    margin-top: 1.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 450px;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
}

.progress-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin: 1.5rem 0 1rem;
    overflow: hidden;
}

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

.status-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

#statusText {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

.loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@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: 640px) {
    .video-info {
        flex-direction: column;
    }

    .thumbnail-wrapper {
        width: 100%;
    }

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

    input {
        padding-right: 0.75rem;
    }

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