:root {
    --bg-dark: #07090e;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(28, 36, 56, 0.85);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(0, 242, 254, 0.5);
    
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --accent-glow: rgba(0, 242, 254, 0.35);
    --accent-neon: #00f2fe;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --danger: #ff4757;
    --success: #2ed573;

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;

    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 40px 20px;
}

/* Background Blurs */
.bg-blur {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: 0;
    pointer-events: none;
}
.blur-1 {
    width: 450px;
    height: 450px;
    background: rgba(0, 242, 254, 0.15);
    top: -100px;
    left: -100px;
}
.blur-2 {
    width: 500px;
    height: 500px;
    background: rgba(79, 172, 254, 0.12);
    bottom: -150px;
    right: -100px;
}
.blur-3 {
    width: 350px;
    height: 350px;
    background: rgba(138, 43, 226, 0.1);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.app-container {
    width: 100%;
    max-width: 920px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #07090e;
    box-shadow: 0 0 20px var(--accent-glow);
}

.logo-icon svg {
    width: 26px;
    height: 26px;
}

.logo-text h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.logo-text h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .tag {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-reset-nav {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-reset-nav svg {
    width: 16px;
    height: 16px;
}

.btn-reset-nav:hover {
    background: rgba(0, 242, 254, 0.15);
    border-color: rgba(0, 242, 254, 0.4);
    color: var(--accent-neon);
}

.header-badges {
    display: flex;
    gap: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
}

.badge-neon {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--accent-neon);
}

.badge-neon .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-neon);
    box-shadow: 0 0 8px var(--accent-neon);
}

/* Main Container & Cards */
.config-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-card, .controls-card, .media-card, .playlist-card, .progress-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.search-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(10, 13, 20, 0.8);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 6px 6px 6px 16px;
    gap: 12px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 15px var(--accent-glow);
}

.input-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-main);
}

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

.btn-paste {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-paste svg {
    width: 15px;
    height: 15px;
}

.btn-paste:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #07090e;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.input-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding-left: 4px;
}

/* Controls Card */
.controls-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.segmented-control {
    display: flex;
    background: rgba(10, 13, 20, 0.6);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
}

.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.segment-btn svg {
    width: 16px;
    height: 16px;
}

.segment-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    appearance: none;
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    font-family: var(--font-main);
}

.select-wrapper select:focus {
    border-color: var(--border-focus);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 10px;
    color: var(--text-muted);
}

/* Error Banner */
.error-banner {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.4);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
}

/* Single Media Card */
.media-card {
    display: flex;
    gap: 20px;
    align-items: center;
}

.media-preview {
    position: relative;
    width: 220px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--font-mono);
}

.media-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.type-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-neon);
    background: rgba(0, 242, 254, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    width: fit-content;
}

.playlist-tag {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.media-header h2 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-download {
    background: var(--primary-gradient);
    color: #07090e;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.2s ease;
    width: fit-content;
}

.btn-download svg {
    width: 18px;
    height: 18px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

/* Playlist Card */
.playlist-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-info h2 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
}

.count-badge {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.playlist-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-card);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-neon);
    cursor: pointer;
}

.playlist-search input {
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 6px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: rgba(10, 13, 20, 0.4);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.playlist-item-thumb {
    width: 70px;
    aspect-ratio: 16/9;
    border-radius: 6px;
    object-fit: cover;
}

.playlist-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.playlist-item-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.playlist-item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ------------------------------------------------------------- */
/* ULTRA VISUAL DOWNLOADING UI (progress-card)                   */
/* ------------------------------------------------------------- */
.progress-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.4s ease-out;
}

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

/* Active Media Banner */
.visual-media-banner {
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 16px;
}

.banner-preview {
    position: relative;
    width: 180px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.banner-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-aura {
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent-neon);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 15px var(--accent-glow);
    animation: auraPulse 2s infinite alternate;
}

@keyframes auraPulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.banner-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.banner-top-badges {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quality-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.live-status-pill {
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid rgba(0, 242, 254, 0.4);
    color: var(--accent-neon);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.banner-info h2 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.current-file-subtext {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 480px;
}

/* Real-Time Per-Song Queue Visualizer */
.queue-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-card);
    padding-top: 18px;
}

.queue-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
}

/* Individual Song Queue Row */
.queue-item-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(10, 13, 20, 0.4);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    transition: all 0.25 ease;
    position: relative;
}

.queue-item-row.active {
    background: rgba(0, 242, 254, 0.06);
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

.queue-item-row.completed {
    background: rgba(46, 213, 115, 0.05);
    border-color: rgba(46, 213, 115, 0.2);
}

.queue-thumb {
    width: 64px;
    aspect-ratio: 16/9;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.queue-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.queue-song-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Individual Progress Bar Track & Fill */
.queue-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.queue-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.3s ease;
}

.queue-bar-fill.completed {
    background: var(--success);
    box-shadow: 0 0 10px rgba(46, 213, 115, 0.4);
}

.queue-right-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.queue-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    font-family: var(--font-mono);
}

.queue-status-pending {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.queue-status-downloading {
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-neon);
    border: 1px solid rgba(0, 242, 254, 0.3);
    animation: pulsePill 1.5s infinite alternate;
}

@keyframes pulsePill {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

.queue-status-completed {
    background: rgba(46, 213, 115, 0.15);
    color: var(--success);
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.btn-queue-dl {
    background: var(--success);
    color: #07090e;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 10px rgba(46, 213, 115, 0.3);
    transition: all 0.2s ease;
}

.btn-queue-dl:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.5);
}

/* Results Section */
.download-results {
    background: rgba(46, 213, 115, 0.1);
    border: 1px solid rgba(46, 213, 115, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.download-results h4 {
    font-size: 18px;
    font-weight: 800;
}

.complete-subtext {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-start-new {
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.1);
}

/* Scrollbars */
.playlist-list::-webkit-scrollbar, .queue-list::-webkit-scrollbar {
    width: 6px;
}
.playlist-list::-webkit-scrollbar-track, .queue-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.playlist-list::-webkit-scrollbar-thumb, .queue-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.hidden {
    display: none !important;
}

.footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}
