:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    --card-bg: rgba(15, 23, 42, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

.app-container {
    width: 100%;
    max-width: 1280px;
    padding: 24px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 24px;
    height: 100%;
    align-items: stretch;
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
        padding-bottom: 40px;
    }

    body {
        align-items: flex-start;
    }

    .app-container {
        height: auto;
    }
}

/* Glassmorphic card design */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Player section styles */
.player-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.player-card {
    flex: 0 0 auto;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 20px;
}

.related-card {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.player-card::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.player-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Next Song Marquee */
.next-song-marquee {
    margin-top: 12px;
    font-size: 0.72rem;
    color: var(--accent-color);
    width: 240px;
    overflow: hidden;
    box-sizing: border-box;
    white-space: nowrap;
    position: relative;
    height: 18px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    display: flex;
    align-items: center;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee-anim 10s linear infinite;
}

@keyframes marquee-anim {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

.badge {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    color: white;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    letter-spacing: 1.5px;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

/* CD style rotating disk */
.cd-container {
    margin: 16px 0;
    position: relative;
    z-index: 1;
}

.cd-disk {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #09090b;
    border: 8px solid #18181b;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    animation: spin 20s linear infinite;
    animation-play-state: paused;
    /* Play/Pause animation */
    transition: transform 0.5s ease;
}

.cd-disk::after {
    content: '';
    position: absolute;
    width: 96%;
    height: 96%;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.cd-disk img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #27272a;
}

.cd-center {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--background);
    z-index: 10;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8), 0 0 0 5px #18181b;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.song-meta {
    width: 100%;
    z-index: 1;
}

.song-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.song-status {
    font-size: 0.85rem;
    color: var(--accent-color);
    min-height: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.song-status:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.3);
    text-decoration: underline;
}

/* Scrubber / Progress */
.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    z-index: 1;
}

.time-stamp {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 35px;
}

.scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

.scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    transition: transform 0.1s ease;
}

.scrubber::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    width: 100%;
    margin-bottom: 15px;
    z-index: 1;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.btn-icon.active {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.btn-play-pause {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    color: white;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    font-size: 1.25rem;
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.35);
}

.btn-play-pause:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
    color: white;
}

/* Volume styling */
.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 140px;
    z-index: 1;
}

.volume-container i {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.volume-scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

.volume-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
}

/* Sidebar panel */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.search-card {
    flex: 0 0 auto;
}

.playlist-card {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.card-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.color-yt {
    color: #ff0000;
}

/* Search bar styling */
.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.search-input-group input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    outline: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.search-input-group input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

/* Library Filter Input */
.library-filter-group {
    position: relative;
    margin-bottom: 12px;
}

.library-filter-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 32px 8px 12px;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: all 0.2s ease;
}

.library-filter-group input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

.library-filter-group .filter-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.75rem;
    pointer-events: none;
}

/* Playlist Header & Inline Album Bar */
.playlist-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.header-left-group h3 {
    white-space: nowrap;
    margin: 0;
    font-size: 0.95rem;
}

.album-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.album-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 180px;
    font-weight: 500;
}

.album-select:hover,
.album-select:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

.album-select option {
    background: #18181b;
    color: #f4f4f5;
    padding: 8px;
}

.album-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.album-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.album-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.btn-create-album {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-color);
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-create-album:hover {
    background: var(--accent-color);
    color: white;
}

.btn-manage-album {
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #60a5fa;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* Batch Album Songs Manager Modal */
.batch-album-song-list {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-right: 4px;
}

.batch-song-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.batch-song-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.batch-song-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    color: white;
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

/* Search results list */
.results-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.related-card .results-list {
    flex: 1;
    max-height: none;
}

/* Library playlist list */
.playlist-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px 10px;
    font-size: 0.85rem;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

/* Items styling */
.item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.item-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.item-card.playing {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.25);
}

.thumb-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

.thumb-wrapper .item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    color: #ffffff;
    font-size: 0.95rem;
    pointer-events: none;
}

.thumb-wrapper:hover .thumb-overlay {
    opacity: 1;
}

.thumb-wrapper:hover .item-thumb {
    transform: scale(1.08);
    filter: brightness(0.9);
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: text;
    cursor: text;
}

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

.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.rendering {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-badge.playing {
    background: rgba(37, 99, 235, 0.25);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.4);
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

.btn-action {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

.btn-action.download-btn:hover {
    color: var(--accent-color);
}

.btn-action.delete-btn:hover {
    color: var(--danger-color);
}

/* Library Tabs */
.library-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 2px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Related card styling */
.related-card {
    flex: 0 0 auto;
    max-height: 250px;
}

#related-list {
    max-height: 180px;
    overflow-y: auto;
}

/* Modal overlay styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    max-width: 420px;
    width: 90%;
    text-align: center;
    padding: 32px;
    border-radius: 20px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-icon {
    font-size: 2.8rem;
    color: #f59e0b;
    margin-bottom: 16px;
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.modal-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Offline Toggle Switch Styling */
.offline-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-secondary);
    user-select: none;
}

.offline-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.offline-switch .slider {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    transition: 0.3s;
}

.offline-switch .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.offline-switch input:checked + .slider {
    background-color: #10b981;
}

.offline-switch input:checked + .slider:before {
    transform: translateX(14px);
}

.offline-switch input:disabled + .slider {
    opacity: 0.7;
    cursor: not-allowed;
}

.offline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 500;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}