:root {
    --primary: #3b82f6;
    /* Azul moderno mais suave */
    --primary-hover: #2563eb;
    --bg-main: #f8fafc;
    /* Fundo claro e limpo */
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    /* Texto escuro ardósia */
    --text-dim: #64748b;
    --accent-bg: #f1f5f9;
}

/* Dark Mode Automático */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0f172a;
        --card-bg: #1e293b;
        --border: #334155;
        --text-main: #f1f5f9;
        --text-dim: #94a3b8;
        --accent-bg: #334155;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    transition: background-color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 480px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

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

header p {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 400;
    margin-bottom: 35px;
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.selector-container {
    text-align: left;
}

.selector-container label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.type-selectors {
    display: flex;
    background: var(--accent-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
}

.type-btn {
    flex: 1;
    background: transparent;
    padding: 9px;
    font-size: 0.85rem;
    border-radius: 9px;
    color: var(--text-dim);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-btn.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#format-select {
    width: 100%;
    background: var(--accent-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.input-group {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 6px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    padding: 14px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
}

button#download-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

button#download-btn:hover {
    background: var(--primary-hover);
}

.status-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    margin-top: 15px;
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

#video-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
}

.video-details h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-details p {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.progress-container {
    width: 100%;
}

.progress-bar {
    height: 4px;
    background: var(--accent-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.error-msg {
    color: var(--error);
    margin-top: 20px;
    font-size: 0.9rem;
    background: rgba(255, 77, 77, 0.1);
    padding: 10px;
    border-radius: 8px;
}

.hidden {
    display: none;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

footer {
    margin-top: 50px;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Responsividade */
@media (max-width: 480px) {
    header h1 {
        font-size: 2.2rem;
    }

    .input-group {
        flex-direction: column;
        padding: 10px;
    }

    button {
        width: 100%;
    }
}