:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary: #8b5cf6;
    --secondary: #ec4899;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.background-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    top: 0;
    left: 0;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    border-radius: 50%;
    animation: float 10s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
    }

    100% {
        transform: translateY(50px) scale(1.1);
    }
}

.container {
    width: 90%;
    max-width: 650px;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

header h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 800;
}

header h1 span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: #cbd5e1;
    margin-bottom: 2rem;
    font-weight: 300;
}

section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* INPUT FORMS */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

input[type="url"] {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

button {
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.4);
}

button:active {
    transform: translateY(0);
}

/* Secondary Button */
.secondary-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    margin-top: 10px;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.hidden {
    display: none !important;
}

/* PLAYLIST SELECTION STEP ==================== */
.playlist-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.playlist-info h2 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
}

.playlist-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 500;
}

.quality-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

select {
    background: transparent;
    color: white;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
}

select option {
    background: #1e293b;
    color: white;
}

.list-controls {
    text-align: left;
    margin-bottom: 10px;
    padding-left: 10px;
}

/* TRACKS LIST */
.tracks-container {
    flex: 1;
    overflow-y: auto;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
    padding-right: 5px;
    max-height: 250px;
}

.tracks-container::-webkit-scrollbar {
    width: 6px;
}

.tracks-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

.tracks-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

.track-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
    gap: 15px;
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.track-title {
    flex: 1;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-duration {
    font-size: 0.8rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 8px;
    border-radius: 5px;
}

/* CHECKBOX CUSTOM */
.custom-checkbox {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
    gap: 10px;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.custom-checkbox:hover input~.checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    display: none;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.custom-checkbox input:checked~.checkmark:after {
    display: block;
}


/* DOWNLOAD STEP */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.error-msg {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.log-area {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    text-align: left;
    height: 150px;
    overflow-y: auto;
    color: #a7f3d0;
    border: 1px solid var(--glass-border);
}

.loader {
    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;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* NOVIDADES DA V2 (MODO AUDIO/VÍDEO, HISTÓRICO, ETC) */
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: space-between;
    align-items: center;
}

.mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--glass-border);
}

.mode-btn {
    width: auto;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-color);
    font-size: 0.9rem;
    box-shadow: none;
    border-radius: 8px;
    font-weight: 500;
}

.mode-btn:hover {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: bold;
}

.extra-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.custom-checkbox {
    font-size: 0.85rem;
}

.custom-checkbox .checkmark {
    width: 16px;
    height: 16px;
}

.track-actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.track-actions-bar button {
    width: auto;
    padding: 6px 12px;
    font-size: 0.8rem;
    margin: 0;
}

.selected-count {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-left: auto;
}

.track-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    cursor: pointer;
}

.track-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.track-number {
    font-size: 0.8rem;
    color: #94a3b8;
    width: 20px;
    text-align: center;
}

.track-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    gap: 10px;
}

.download-bar {
    display: flex;
    gap: 15px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #cbd5e1;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.btn-primary {
    background: var(--primary);
}

.download-history {
    margin-top: 30px;
    text-align: left;
}

.download-history h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 8px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.history-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.history-reuse {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    border: none;
    flex-shrink: 0;
}

.history-reuse:hover {
    background: var(--primary);
    transform: rotate(180deg);
}

.history-empty {
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
}

.btn-player-link {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 50px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.btn-player-link:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(236, 72, 153, 0.4));
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
    color: white;
}