:root, [data-theme="midnight"] {
    --bg-dark: #0f111a;
    --bg-surface: #191c29;
    --bg-sidebar: rgba(15, 17, 26, 0.85);
    --bg-topbar: rgba(15, 17, 26, 0.9);
    --bg-card: rgba(25, 28, 41, 0.65);
    --bg-card-hover: rgba(35, 39, 56, 0.85);
    --text-main: #f8f9fa;
    --text-muted: #94a3b8;
    --input-bg: rgba(0, 0, 0, 0.25);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --glow-1: rgba(99, 102, 241, 0.15);
    --glow-2: rgba(236, 72, 153, 0.1);
    --glass-blur: blur(12px);
    --radius: 12px;
}

/* ========================================================
   LIGHT & PASTEL THEMES
   ======================================================== */
[data-theme="light-clean"] {
    --bg-dark: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.92);
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --input-bg: #f8fafc;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(0, 0, 0, 0.09);
    --glow-1: rgba(79, 70, 229, 0.08);
    --glow-2: rgba(236, 72, 153, 0.05);
}

[data-theme="light-latte"] {
    --bg-dark: #fbf8f3;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.92);
    --bg-card: #ffffff;
    --bg-card-hover: #f7f0e6;
    --text-main: #292524;
    --text-muted: #78716c;
    --input-bg: #fbf8f3;
    --primary: #d97706;
    --primary-hover: #b45309;
    --accent: #ea580c;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(120, 80, 40, 0.12);
    --glow-1: rgba(217, 119, 6, 0.08);
    --glow-2: rgba(234, 88, 12, 0.05);
}

[data-theme="light-sakura"] {
    --bg-dark: #fff5f8;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.92);
    --bg-card: #ffffff;
    --bg-card-hover: #fce7f3;
    --text-main: #4a044e;
    --text-muted: #86198f;
    --input-bg: #fff5f8;
    --primary: #db2777;
    --primary-hover: #be185d;
    --accent: #9333ea;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(219, 39, 119, 0.14);
    --glow-1: rgba(219, 39, 119, 0.08);
    --glow-2: rgba(147, 51, 234, 0.05);
}

[data-theme="light-mint"] {
    --bg-dark: #f0fdf4;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.92);
    --bg-card: #ffffff;
    --bg-card-hover: #dcfce7;
    --text-main: #064e3b;
    --text-muted: #047857;
    --input-bg: #f0fdf4;
    --primary: #059669;
    --primary-hover: #047857;
    --accent: #0d9488;
    --success: #059669;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(5, 150, 105, 0.14);
    --glow-1: rgba(5, 150, 105, 0.08);
    --glow-2: rgba(13, 148, 136, 0.05);
}

[data-theme="light-breeze"] {
    --bg-dark: #f0f9ff;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.92);
    --bg-card: #ffffff;
    --bg-card-hover: #e0f2fe;
    --text-main: #0c4a6e;
    --text-muted: #0369a1;
    --input-bg: #f0f9ff;
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --accent: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(2, 132, 199, 0.14);
    --glow-1: rgba(2, 132, 199, 0.08);
    --glow-2: rgba(99, 102, 241, 0.05);
}

/* ========================================================
   DARK & NEON THEMES
   ======================================================== */
[data-theme="sunset"] {
    --bg-dark: #170b1c;
    --bg-surface: #271230;
    --bg-sidebar: rgba(23, 11, 28, 0.85);
    --bg-topbar: rgba(23, 11, 28, 0.9);
    --bg-card: rgba(39, 18, 48, 0.65);
    --bg-card-hover: rgba(56, 26, 68, 0.85);
    --text-main: #fff1f2;
    --text-muted: #fda4af;
    --input-bg: rgba(0, 0, 0, 0.25);
    --primary: #f43f5e;
    --primary-hover: #e11d48;
    --accent: #fb923c;
    --border: rgba(244, 63, 94, 0.18);
    --glow-1: rgba(244, 63, 94, 0.2);
    --glow-2: rgba(251, 146, 60, 0.14);
}

[data-theme="dark-mocha"] {
    --bg-dark: #15100c;
    --bg-surface: #251c16;
    --bg-sidebar: rgba(21, 16, 12, 0.85);
    --bg-topbar: rgba(21, 16, 12, 0.9);
    --bg-card: rgba(37, 28, 22, 0.65);
    --bg-card-hover: rgba(52, 40, 31, 0.85);
    --text-main: #fef3c7;
    --text-muted: #d6bb98;
    --input-bg: rgba(0, 0, 0, 0.25);
    --primary: #d97706;
    --primary-hover: #b45309;
    --accent: #f59e0b;
    --border: rgba(217, 119, 6, 0.18);
    --glow-1: rgba(217, 119, 6, 0.2);
    --glow-2: rgba(245, 158, 11, 0.14);
}

[data-theme="cyberpunk"] {
    --bg-dark: #0a0b12;
    --bg-surface: #151726;
    --bg-sidebar: rgba(10, 11, 18, 0.85);
    --bg-topbar: rgba(10, 11, 18, 0.9);
    --bg-card: rgba(21, 23, 38, 0.7);
    --bg-card-hover: rgba(30, 33, 54, 0.9);
    --text-main: #fef08a;
    --text-muted: #a5f3fc;
    --input-bg: rgba(0, 0, 0, 0.35);
    --primary: #eab308;
    --primary-hover: #ca8a04;
    --accent: #06b6d4;
    --border: rgba(234, 179, 8, 0.22);
    --glow-1: rgba(234, 179, 8, 0.22);
    --glow-2: rgba(6, 182, 212, 0.16);
}

[data-theme="nord"] {
    --bg-dark: #121820;
    --bg-surface: #1e2632;
    --bg-sidebar: rgba(18, 24, 32, 0.85);
    --bg-topbar: rgba(18, 24, 32, 0.9);
    --bg-card: rgba(30, 38, 50, 0.65);
    --bg-card-hover: rgba(42, 53, 70, 0.85);
    --text-main: #eceff4;
    --text-muted: #88c0d0;
    --input-bg: rgba(0, 0, 0, 0.25);
    --primary: #81a1c1;
    --primary-hover: #5e81ac;
    --accent: #88c0d0;
    --border: rgba(129, 161, 193, 0.18);
    --glow-1: rgba(129, 161, 193, 0.2);
    --glow-2: rgba(136, 192, 208, 0.14);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Ambient Glow */
.background-glow {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, var(--glow-1, rgba(99, 102, 241, 0.15)) 0%, rgba(15, 17, 26, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    transition: background 0.3s ease;
}
.background-glow::after {
    content: '';
    position: absolute;
    bottom: -50%;
    right: -80%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--glow-2, rgba(236, 72, 153, 0.1)) 0%, rgba(15, 17, 26, 0) 70%);
    border-radius: 50%;
    transition: background 0.3s ease;
}

/* Clean modern scrollbars app-wide */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

[data-theme^="light-"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme^="light-"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar, rgba(15, 17, 26, 0.8));
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: background 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    padding: 0 0.5rem;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px; /* in case rounded corners on img tag look nice */
}

.sidebar-logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
}

.menu-item svg {
    width: 20px;
    height: 20px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.sidebar-footer .menu-item {
    color: var(--error);
}

.sidebar-footer .menu-item:hover {
    background: rgba(239, 68, 68, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    overflow: hidden;
}

.sidebar-user span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 0;
    max-width: calc(100% - 260px);
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3rem;
    background: var(--bg-topbar, rgba(15, 17, 26, 0.9));
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: background 0.3s ease;
}

.channel-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-selector label {
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.custom-dropdown {
    position: relative;
    width: 250px;
    font-size: 0.9rem;
}

.custom-dropdown-trigger {
    background: var(--bg-surface, rgb(25, 28, 41));
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.custom-dropdown-trigger:hover {
    border-color: var(--primary);
}

.custom-dropdown-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.custom-dropdown-trigger span {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-dropdown-list,
.theme-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    background: var(--bg-surface, #191c29) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.35);
    z-index: 1100;
    max-height: 380px;
    overflow-y: auto;
    color: var(--text-main);
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
}

.custom-dropdown-list::-webkit-scrollbar,
.theme-dropdown-menu::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.custom-dropdown-list {
    left: 0;
    right: 0;
    max-height: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-main) !important;
    transition: background 0.2s ease;
}

.custom-dropdown-item:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.08)) !important;
    color: var(--text-main) !important;
}

.custom-dropdown-item img, .custom-dropdown-item .fallback-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-menu-header {
    padding: 8px 12px 4px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    user-select: none;
}

.theme-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.theme-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.84rem;
    color: var(--text-main) !important;
    transition: all 0.15s ease;
    user-select: none;
    margin-bottom: 2px;
}

.theme-menu-item:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.08)) !important;
    color: var(--text-main) !important;
}

.theme-menu-item.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.system-stats {
    display: flex;
    gap: 15px;
}

.stat-badge {
    background: var(--bg-card, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 2rem 3rem;
    flex-grow: 1;
}

/* SPA Sections */
.spa-section {
    display: none;
}
.spa-section.active {
    display: block;
}

/* Music Gallery */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.folder-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 1rem 3rem 1rem; /* Extra padding at bottom for absolute text */
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}
.folder-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: var(--primary);
}
.folder-card .folder-icon-main {
    width: 40px;
    height: 40px;
    color: var(--primary);
    margin-bottom: 10px;
}
.folder-card h4 {
    font-size: 0.9rem;
    margin-bottom: 5px;
    word-break: break-all;
}
.folder-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    position: absolute;
    bottom: 1.25rem;
    left: 0;
    right: 0;
    margin: 0;
}
.folder-card.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}
.upload-zone svg {
    color: var(--primary);
    margin-bottom: 1rem;
}
.upload-zone h3 {
    margin-bottom: 0.5rem;
}

/* Channel List */
.channel-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.channel-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

.channel-card-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.channel-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.channel-card-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.channel-card-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.channel-card-status {
    font-size: 0.8rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header h1 span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1.2rem;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

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

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Stats */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 135px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    height: 24px;
}

.stat-card-header h3 {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

.stat-card-body {
    display: flex;
    align-items: baseline;
    min-height: 38px;
    height: auto;
    margin: 4px 0;
    overflow: hidden;
}

.stat-card .stat-value {
    font-size: clamp(1.2rem, 1.4vw, 1.65rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.stat-card .stat-value .stat-unit {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.85;
}

.stat-card .stat-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: auto;
}

/* Job List */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--success);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
}

.dot.pulse {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

.progress-bar.animated {
    animation: progressStripes 2s linear infinite;
}

/* Lock height to prevent Layout Shift during SSE updates which cancels momentum scroll */
.job-progress-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
    min-height: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes progressStripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.job-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    padding-left: 45px;
    width: 100%;
}

.job-list::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.job-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.job-item::before {
    content: '';
    position: absolute;
    top: 24px;
    left: -39px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 3px solid var(--primary);
    z-index: 1;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
}

.job-item:hover::before {
    background: var(--primary);
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
}

.job-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(5px);
    border-color: rgba(99, 102, 241, 0.4);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.job-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.job-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-PENDING { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.status-PROCESSING { background: rgba(99, 102, 241, 0.1); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.2); }
.status-UPLOADING { background: rgba(236, 72, 153, 0.1); color: var(--accent); border: 1px solid rgba(236, 72, 153, 0.2); }
.status-COMPLETED { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-FAILED { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }

.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar.animated::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.job-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    isolation: isolate;
}

/* Secondary & Nested modals NEVER use blur to prevent 100% GPU spikes */
#bulk-edit-modal,
#bulk-media-order-modal,
#bulk-audio-modal,
#comments-modal-overlay,
#channel-modal-overlay,
#job-details-modal-overlay,
#confirm-modal-overlay,
#prompt-modal-overlay {
    background: rgba(0, 0, 0, 0.88) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 2000 !important;
    isolation: isolate;
}

#confirm-modal-overlay,
#prompt-modal-overlay {
    z-index: 99999 !important;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0s linear;
}

.modal {
    background: var(--bg-card);
    width: 90%;
    max-width: 800px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    transform: translate3d(0, 15px, 0) scale(0.98);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: flat;
}

.modal-overlay.active .modal {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    contain: paint;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.modal-body::-webkit-scrollbar {
    display: none;
}

.bulk-list-item {
    contain: layout paint;
    transform: translateZ(0);
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

input[type="text"], input[type="number"], input[type="password"], input[type="email"], textarea, select {
    width: 100%;
    background: var(--input-bg, rgba(0, 0, 0, 0.2));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="email"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.divider {
    margin: 2rem 0 1rem 0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 10px;
}

/* Drop Zone */
.drop-zone {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-main);
}

.drop-zone span {
    pointer-events: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 999999;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.folder-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.folder-card:hover .folder-actions {
    opacity: 1;
}
.folder-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.folder-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.folder-action-btn.delete:hover {
    background: var(--error);
    border-color: var(--error);
}

.music-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: background 0.2s;
}
.music-file-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.music-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.music-file-info svg {
    color: var(--primary);
}
.music-file-size {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.stat-badge-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    min-width: 110px;
}
.stat-badge-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}
.mini-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}
.mini-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.stat-badge.has-fill {
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: 1px solid var(--border);
    background: transparent;
}
.stat-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: rgba(99, 102, 241, 0.2);
    z-index: -1;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.tags-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 42px;
    align-items: center;
}
.tags-input-container input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    min-width: 150px;
}
.tag-badge {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tag-badge .remove-tag {
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
}
.tag-badge .remove-tag:hover {
    color: var(--error);
}

/* Music Selection Tree */
.music-folder-group {
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.music-folder-header {
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    user-select: none;
}
.music-folder-header:hover {
    background: rgba(0,0,0,0.3);
}
.music-folder-body {
    padding: 8px 12px;
    display: none;
    background: rgba(0,0,0,0.05);
}
.music-folder-body.open {
    display: block;
}
.music-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
}
.music-file-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.music-file-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
}

/* Explorer Grid for Folders */
.music-explorer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.music-folder-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
    position: relative;
}
.music-folder-card:hover {
    border-color: var(--primary);
    background: rgba(255,255,255,0.05);
}
.music-folder-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    z-index: 5;
}
.music-folder-card.expanded {
    grid-column: 1 / -1;
    cursor: default;
    background: rgba(0,0,0,0.2);
    align-items: flex-start;
}
.music-folder-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}
.music-folder-title {
    font-weight: 500;
    font-size: 0.95rem;
    word-break: break-all;
}
.music-folder-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.music-folder-card.expanded .music-folder-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 12px;
    padding-right: 36px;
}
.music-folder-card.expanded .music-folder-icon {
    font-size: 1.5rem;
    margin-bottom: 0;
}
.music-folder-card.expanded .music-folder-title {
    text-align: left;
    flex: 1;
}

/* Explorer Grid for Files */
.music-files-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    width: 100%;
}
.music-folder-card.expanded .music-files-grid {
    display: grid;
}
.music-file-card {
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}
.music-file-card:hover {
    background: rgba(255,255,255,0.05);
}
.music-file-icon {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--text-muted);
}
.music-file-name {
    font-size: 0.8rem;
    word-break: break-all;
    line-height: 1.2;
    margin-bottom: 4px;
}
.music-file-size {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.music-file-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Folder Highlight for Fully Selected */
.music-folder-card.fully-selected {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
}

/* Job Mode Tabs */
.job-mode-tabs .btn-tab {
    transition: all 0.2s ease-in-out;
}
.job-mode-tabs .btn-tab:not(.active):hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text-main) !important;
}

/* Audio Order Modes & Drag-and-Drop Sortable */
.audio-order-radio-card:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.06)) !important;
}

.manual-order-item:hover {
    border-color: var(--primary) !important;
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.08)) !important;
}

.manual-order-item:active {
    cursor: grabbing !important;
}

.manual-order-item .btn-reorder-up:hover,
.manual-order-item .btn-reorder-down:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

/* Floating Upload Speed Bubble */
.floating-upload-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999 !important;
    background: rgba(15, 18, 30, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(99, 102, 241, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(99, 102, 241, 0.25);
    border-radius: 14px;
    padding: 14px 18px;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(120px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    user-select: none;
}

.floating-upload-bubble.visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.floating-upload-bubble.completed {
    border-color: rgba(16, 185, 129, 0.65);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(16, 185, 129, 0.3);
}

.floating-upload-bubble.error {
    border-color: rgba(239, 68, 68, 0.65);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(239, 68, 68, 0.3);
}

.st-bubble-icon {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.floating-upload-bubble.completed .st-bubble-icon {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.floating-upload-bubble.error .st-bubble-icon {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.st-bubble-content {
    flex: 1;
    min-width: 0;
}

.st-bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.st-bubble-filename {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.st-bubble-speed {
    font-size: 0.82rem;
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.floating-upload-bubble.completed .st-bubble-speed {
    color: #10b981;
}

.floating-upload-bubble.error .st-bubble-speed {
    color: #ef4444;
}

.st-bubble-progress-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    height: 6px;
    width: 100%;
    overflow: hidden;
    margin-bottom: 4px;
}

.st-bubble-progress-fill {
    background: linear-gradient(90deg, #38bdf8, #6366f1);
    height: 100%;
    width: 0%;
    transition: width 0.15s ease-out;
    border-radius: 4px;
}

.floating-upload-bubble.completed .st-bubble-progress-fill {
    background: #10b981;
}

.floating-upload-bubble.error .st-bubble-progress-fill {
    background: #ef4444;
}

.st-bubble-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
}
