/**
 * Pixel Gallery - Download Queue Styles (queue.css)
 * สไตล์สำหรับ Floating Download Queue Panel และตัวเลือกดาวน์โหลดแยกไฟล์ / ZIP
 */

/* ==========================================================================
   1. Split Button & Popover Menu ใน Cart Drawer Footer (Minimal Glass & Monochrome)
   ========================================================================== */
.pg-split-btn-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    border-radius: 9999px;
    border: none;
    background: #111827;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.16);
    z-index: 20;
    overflow: visible;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-split-btn-group:hover {
        background: #1f2937;
        box-shadow: 0 12px 28px rgba(17, 24, 39, 0.22);
    }
}

body.dark-mode .pg-split-btn-group,
html.dark-mode .pg-split-btn-group,
[data-theme="dark"] .pg-split-btn-group {
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-split-btn-group:hover,
    html.dark-mode .pg-split-btn-group:hover,
    [data-theme="dark"] .pg-split-btn-group:hover {
        background: #f4f4f5;
    }
}

.pg-split-main-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px 13px 22px;
    background: transparent;
    color: #ffffff;
    border: none;
    border-top-left-radius: 9999px;
    border-bottom-left-radius: 9999px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: opacity 0.15s ease;
    outline: none;
}

body.dark-mode .pg-split-main-btn,
html.dark-mode .pg-split-main-btn,
[data-theme="dark"] .pg-split-main-btn {
    color: #111827;
}

.pg-split-main-btn:active {
    opacity: 0.9;
}

.pg-split-main-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pg-split-main-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.pg-split-chevron-btn {
    width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: none;
    border-top-right-radius: 9999px;
    border-bottom-right-radius: 9999px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    outline: none;
    flex-shrink: 0;
    position: relative;
}

.pg-split-chevron-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 26%;
    bottom: 26%;
    width: 1px;
    background: rgba(255, 255, 255, 0.16);
}

@media (hover: hover) and (pointer: fine) {
    .pg-split-chevron-btn:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
    }
}

body.dark-mode .pg-split-chevron-btn,
html.dark-mode .pg-split-chevron-btn,
[data-theme="dark"] .pg-split-chevron-btn {
    color: rgba(17, 24, 39, 0.75);
}

body.dark-mode .pg-split-chevron-btn::before,
html.dark-mode .pg-split-chevron-btn::before,
[data-theme="dark"] .pg-split-chevron-btn::before {
    background: rgba(17, 24, 39, 0.14);
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-split-chevron-btn:hover,
    html.dark-mode .pg-split-chevron-btn:hover,
    [data-theme="dark"] .pg-split-chevron-btn:hover {
        background: rgba(17, 24, 39, 0.06);
        color: #111827;
    }
}

.pg-split-chevron-btn svg {
    width: 15px;
    height: 15px;
    stroke-width: 2;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-split-btn-group.menu-open .pg-split-chevron-btn svg {
    transform: rotate(180deg);
}

/* เมนูตัวเลือกรูปแบบการดาวน์โหลด (Minimal Borderless Glassmorphism) */
.pg-split-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.86) 100%);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: none;
    border-radius: 22px;
    padding: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14), 0 4px 14px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 50;
    animation: pgSplitMenuIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .pg-split-menu,
html.dark-mode .pg-split-menu,
[data-theme="dark"] .pg-split-menu {
    background: linear-gradient(145deg, rgba(39, 39, 42, 0.94) 0%, rgba(24, 24, 27, 0.96) 100%);
    border: none;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(0, 0, 0, 0.4);
}

@keyframes pgSplitMenuIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pg-split-btn-group.menu-open .pg-split-menu {
    display: flex;
}

.pg-split-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 16px;
    color: #111827;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

body.dark-mode .pg-split-menu-item,
html.dark-mode .pg-split-menu-item,
[data-theme="dark"] .pg-split-menu-item {
    color: #f4f4f5;
}

@media (hover: hover) and (pointer: fine) {
    .pg-split-menu-item:hover {
        background: rgba(0, 0, 0, 0.035);
    }
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-split-menu-item:hover,
    html.dark-mode .pg-split-menu-item:hover,
    [data-theme="dark"] .pg-split-menu-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}

.pg-split-menu-item.active {
    background: rgba(0, 0, 0, 0.055);
    color: #111827;
}

body.dark-mode .pg-split-menu-item.active,
html.dark-mode .pg-split-menu-item.active,
[data-theme="dark"] .pg-split-menu-item.active {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.pg-menu-item-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.pg-menu-item-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.pg-menu-item-text strong {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: inherit;
}

.pg-menu-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.07);
    color: #374151;
    line-height: 1.3;
}

body.dark-mode .pg-menu-badge,
html.dark-mode .pg-menu-badge,
[data-theme="dark"] .pg-menu-badge {
    background: rgba(255, 255, 255, 0.12);
    color: #e4e4e7;
}

.pg-menu-item-text span:not(.pg-menu-badge) {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.35;
}

body.dark-mode .pg-menu-item-text span:not(.pg-menu-badge),
html.dark-mode .pg-menu-item-text span:not(.pg-menu-badge),
[data-theme="dark"] .pg-menu-item-text span:not(.pg-menu-badge) {
    color: #a1a1aa;
}

.pg-menu-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #111827;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

body.dark-mode .pg-menu-check,
html.dark-mode .pg-menu-check,
[data-theme="dark"] .pg-menu-check {
    background: #ffffff;
    color: #111827;
}

.pg-menu-check svg {
    width: 13px;
    height: 13px;
}

.pg-split-menu-item.active .pg-menu-check {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   2. Floating Download Queue Panel (Minimal Borderless Glassmorphism)
   ========================================================================== */
.pg-queue-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 370px;
    max-width: calc(100vw - 32px);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), 0 4px 14px rgba(0, 0, 0, 0.04);
    color: #0f172a;
    font-family: var(--pf-font, var(--font-sans, 'Plus Jakarta Sans', 'Kanit', -apple-system, BlinkMacSystemFont, sans-serif));
    z-index: 10001;
    overflow: hidden;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.pg-queue-panel *,
.pg-queue-panel button,
.pg-queue-panel input {
    font-family: inherit;
}

body.dark-mode .pg-queue-panel,
html.dark-mode .pg-queue-panel,
[data-theme="dark"] .pg-queue-panel {
    background: rgba(24, 24, 27, 0.88);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.3);
    color: #f4f4f5;
}

.pg-queue-panel.show {
    transform: translateY(0);
    opacity: 1;
}

/* ส่วนหัวของ Queue (ไร้เส้นคั่น ไร้กรอบ) */
.pg-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 10px;
    background: transparent;
    border: none;
}

.pg-queue-title-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.pg-queue-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    flex-shrink: 0;
    animation: pgDotPulse 1.5s infinite;
}

.pg-queue-pulse-dot.is-paused {
    background: #f59e0b;
    animation: none;
}

.pg-queue-pulse-dot.is-completed {
    background: #10b981;
    animation: none;
}

.pg-queue-pulse-dot.is-cancelled {
    background: #ef4444;
    animation: none;
}

@keyframes pgDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.82); }
}

.pg-queue-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .pg-queue-title,
html.dark-mode .pg-queue-title,
[data-theme="dark"] .pg-queue-title {
    color: #f4f4f5;
}

.pg-queue-counter-tag {
    font-size: 0.73rem;
    padding: 2px 9px;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 9999px;
    color: #4b5563;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

body.dark-mode .pg-queue-counter-tag,
html.dark-mode .pg-queue-counter-tag,
[data-theme="dark"] .pg-queue-counter-tag {
    background: rgba(255, 255, 255, 0.1);
    color: #d4d4d8;
}

.pg-queue-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pg-queue-action-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .pg-queue-action-btn:hover {
        background: rgba(0, 0, 0, 0.06);
        color: #111827;
    }
}

body.dark-mode .pg-queue-action-btn,
html.dark-mode .pg-queue-action-btn,
[data-theme="dark"] .pg-queue-action-btn {
    color: #a1a1aa;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-queue-action-btn:hover,
    html.dark-mode .pg-queue-action-btn:hover,
    [data-theme="dark"] .pg-queue-action-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
}

/* หลอด Progress Bar แบบแคปซูลมินิมอล */
.pg-queue-progress-bar-wrap {
    height: 4px;
    margin: 2px 20px 4px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

body.dark-mode .pg-queue-progress-bar-wrap,
html.dark-mode .pg-queue-progress-bar-wrap,
[data-theme="dark"] .pg-queue-progress-bar-wrap {
    background: rgba(255, 255, 255, 0.08);
}

.pg-queue-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 9999px;
    background: #0f172a;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .pg-queue-progress-bar,
html.dark-mode .pg-queue-progress-bar,
[data-theme="dark"] .pg-queue-progress-bar {
    background: #f8fafc;
}

/* รายการที่กำลังโหลด (Active Item Spotlight ไร้กรอบ) */
.pg-queue-body {
    padding: 10px 20px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pg-queue-current-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.035);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 16px;
    padding: 10px 12px;
}

.pg-queue-current-item.is-ios-save-mode {
    padding: 14px;
}

body.dark-mode .pg-queue-current-item,
html.dark-mode .pg-queue-current-item,
[data-theme="dark"] .pg-queue-current-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.07);
}

/* กล่องบันทึกรูปลงแอปรูปภาพบน iOS / iPadOS ดีไซน์มินิมอลเข้ากับธีมหลัก */
.pg-ios-save-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.pg-ios-save-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #0f172a;
    line-height: 1.4;
}

.pg-ios-save-status-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.14);
    color: #059669;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pg-ios-save-status-icon svg {
    width: 11px;
    height: 11px;
}

body.dark-mode .pg-ios-save-status,
html.dark-mode .pg-ios-save-status,
[data-theme="dark"] .pg-ios-save-status {
    color: #f4f4f5;
}

body.dark-mode .pg-ios-save-status-icon,
html.dark-mode .pg-ios-save-status-icon,
[data-theme="dark"] .pg-ios-save-status-icon {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
}

.pg-ios-save-btn {
    width: 100%;
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: 9999px;
    background: #0f172a;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
    transition: background 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-ios-save-btn:hover {
        background: #1e293b;
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
    }
}

.pg-ios-save-btn:active {
    transform: scale(0.98);
}

.pg-ios-save-btn .pg-ios-save-spin {
    display: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    animation: pgQueueSpin 0.75s linear infinite;
    flex-shrink: 0;
}

.pg-ios-save-btn.is-loading {
    opacity: 0.82;
    pointer-events: none;
}

.pg-ios-save-btn.is-loading .pg-ios-save-icon {
    display: none;
}

.pg-ios-save-btn.is-loading .pg-ios-save-spin {
    display: inline-block;
}

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

.pg-ios-save-hint.is-warn {
    color: #b45309;
    font-weight: 500;
}

body.dark-mode .pg-ios-save-hint.is-warn,
html.dark-mode .pg-ios-save-hint.is-warn,
[data-theme="dark"] .pg-ios-save-hint.is-warn {
    color: #fbbf24;
}

body.dark-mode .pg-ios-save-btn,
html.dark-mode .pg-ios-save-btn,
[data-theme="dark"] .pg-ios-save-btn {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-ios-save-btn:hover,
    html.dark-mode .pg-ios-save-btn:hover,
    [data-theme="dark"] .pg-ios-save-btn:hover {
        background: #e2e8f0;
    }
}

.pg-ios-save-hint {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 400;
    color: #64748b;
    line-height: 1.45;
}

body.dark-mode .pg-ios-save-hint,
html.dark-mode .pg-ios-save-hint,
[data-theme="dark"] .pg-ios-save-hint {
    color: #94a3b8;
}

.pg-queue-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    flex-shrink: 0;
}

body.dark-mode .pg-queue-item-thumb,
html.dark-mode .pg-queue-item-thumb,
[data-theme="dark"] .pg-queue-item-thumb {
    background: rgba(255, 255, 255, 0.08);
}

.pg-queue-item-info {
    flex: 1;
    min-width: 0;
}

.pg-queue-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

body.dark-mode .pg-queue-item-name,
html.dark-mode .pg-queue-item-name,
[data-theme="dark"] .pg-queue-item-name {
    color: #f4f4f5;
}

.pg-queue-item-status {
    font-size: 0.75rem;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

body.dark-mode .pg-queue-item-status,
html.dark-mode .pg-queue-item-status,
[data-theme="dark"] .pg-queue-item-status {
    color: #60a5fa;
}

.pg-queue-item-status.is-completed {
    color: #059669;
}

body.dark-mode .pg-queue-item-status.is-completed,
html.dark-mode .pg-queue-item-status.is-completed,
[data-theme="dark"] .pg-queue-item-status.is-completed {
    color: #34d399;
}

.pg-queue-item-status.is-cancelled {
    color: #dc2626;
}

body.dark-mode .pg-queue-item-status.is-cancelled,
html.dark-mode .pg-queue-item-status.is-cancelled,
[data-theme="dark"] .pg-queue-item-status.is-cancelled {
    color: #f87171;
}

.pg-queue-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(37, 99, 235, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: pgSpin 0.75s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

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

/* รายการคิวทั้งหมด (Scrollable List แบบคลีน ไม่ตีกรอบซ้อน) */
.pg-queue-list {
    max-height: 168px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0;
}

.pg-queue-list::-webkit-scrollbar {
    width: 4px;
}

.pg-queue-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.14);
    border-radius: 9999px;
}

body.dark-mode .pg-queue-list::-webkit-scrollbar-thumb,
html.dark-mode .pg-queue-list::-webkit-scrollbar-thumb,
[data-theme="dark"] .pg-queue-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

.pg-queue-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #4b5563;
    padding: 6px 8px;
    border-radius: 10px;
    background: transparent;
    border: none;
    transition: background 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-queue-row:hover {
        background: rgba(0, 0, 0, 0.03);
    }
}

body.dark-mode .pg-queue-row,
html.dark-mode .pg-queue-row,
[data-theme="dark"] .pg-queue-row {
    color: #a1a1aa;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-queue-row:hover,
    html.dark-mode .pg-queue-row:hover,
    [data-theme="dark"] .pg-queue-row:hover {
        background: rgba(255, 255, 255, 0.04);
    }
}

.pg-queue-row-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.pg-queue-row-badge {
    font-size: 0.73rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pg-queue-row.done .pg-queue-row-badge {
    color: #059669;
}

body.dark-mode .pg-queue-row.done .pg-queue-row-badge,
html.dark-mode .pg-queue-row.done .pg-queue-row-badge,
[data-theme="dark"] .pg-queue-row.done .pg-queue-row-badge {
    color: #34d399;
}

.pg-queue-row.downloading .pg-queue-row-badge {
    color: #2563eb;
}

body.dark-mode .pg-queue-row.downloading .pg-queue-row-badge,
html.dark-mode .pg-queue-row.downloading .pg-queue-row-badge,
[data-theme="dark"] .pg-queue-row.downloading .pg-queue-row-badge {
    color: #60a5fa;
}

.pg-queue-row.failed .pg-queue-row-badge {
    color: #dc2626;
}

body.dark-mode .pg-queue-row.failed .pg-queue-row-badge,
html.dark-mode .pg-queue-row.failed .pg-queue-row-badge,
[data-theme="dark"] .pg-queue-row.failed .pg-queue-row-badge {
    color: #f87171;
}

.pg-queue-row.waiting .pg-queue-row-badge {
    color: #9ca3af;
}

body.dark-mode .pg-queue-row.waiting .pg-queue-row-badge,
html.dark-mode .pg-queue-row.waiting .pg-queue-row-badge,
[data-theme="dark"] .pg-queue-row.waiting .pg-queue-row-badge {
    color: #71717a;
}

/* ส่วนท้ายและการควบคุม (ไร้เส้นคั่น ไร้กรอบ) */
.pg-queue-footer {
    padding: 8px 20px 18px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pg-queue-auto-remove-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.75rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-queue-auto-remove-label:hover {
        color: #111827;
    }
}

body.dark-mode .pg-queue-auto-remove-label,
html.dark-mode .pg-queue-auto-remove-label,
[data-theme="dark"] .pg-queue-auto-remove-label {
    color: #a1a1aa;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-queue-auto-remove-label:hover,
    html.dark-mode .pg-queue-auto-remove-label:hover,
    [data-theme="dark"] .pg-queue-auto-remove-label:hover {
        color: #f4f4f5;
    }
}

.pg-queue-auto-remove-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    accent-color: #111827;
    cursor: pointer;
    margin: 0;
}

body.dark-mode .pg-queue-auto-remove-label input[type="checkbox"],
html.dark-mode .pg-queue-auto-remove-label input[type="checkbox"],
[data-theme="dark"] .pg-queue-auto-remove-label input[type="checkbox"] {
    accent-color: #3b82f6;
}

.pg-queue-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pg-queue-ctrl-btn {
    padding: 7px 15px;
    border-radius: 9999px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
    outline: none;
    line-height: 1.2;
}

.pg-queue-ctrl-btn:active {
    transform: scale(0.96);
}

.pg-queue-ctrl-pause {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
}

@media (hover: hover) and (pointer: fine) {
    .pg-queue-ctrl-pause:hover {
        background: rgba(0, 0, 0, 0.1);
    }
}

body.dark-mode .pg-queue-ctrl-pause,
html.dark-mode .pg-queue-ctrl-pause,
[data-theme="dark"] .pg-queue-ctrl-pause {
    background: rgba(255, 255, 255, 0.1);
    color: #f4f4f5;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-queue-ctrl-pause:hover,
    html.dark-mode .pg-queue-ctrl-pause:hover,
    [data-theme="dark"] .pg-queue-ctrl-pause:hover {
        background: rgba(255, 255, 255, 0.16);
    }
}

/* ปุ่มยกเลิกขณะกำลังดาวน์โหลด (ไร้กรอบ) */
.pg-queue-ctrl-cancel {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: none;
}

@media (hover: hover) and (pointer: fine) {
    .pg-queue-ctrl-cancel:hover {
        background: rgba(239, 68, 68, 0.16);
    }
}

body.dark-mode .pg-queue-ctrl-cancel,
html.dark-mode .pg-queue-ctrl-cancel,
[data-theme="dark"] .pg-queue-ctrl-cancel {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
    border: none;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-queue-ctrl-cancel:hover,
    html.dark-mode .pg-queue-ctrl-cancel:hover,
    [data-theme="dark"] .pg-queue-ctrl-cancel:hover {
        background: rgba(239, 68, 68, 0.24);
    }
}

/* ปุ่ม "เสร็จสิ้น" เมื่อโหลดครบแล้ว (UX ชัดเจน กดปิดได้ทันที) */
.pg-queue-ctrl-cancel.is-done-close {
    background: #111827;
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
    .pg-queue-ctrl-cancel.is-done-close:hover {
        background: #1f2937;
    }
}

body.dark-mode .pg-queue-ctrl-cancel.is-done-close,
html.dark-mode .pg-queue-ctrl-cancel.is-done-close,
[data-theme="dark"] .pg-queue-ctrl-cancel.is-done-close {
    background: #ffffff;
    color: #111827;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-queue-ctrl-cancel.is-done-close:hover,
    html.dark-mode .pg-queue-ctrl-cancel.is-done-close:hover,
    [data-theme="dark"] .pg-queue-ctrl-cancel.is-done-close:hover {
        background: #e4e4e7;
    }
}

/* สถานะย่อลง (Minimized Floating Pill) */
.pg-queue-panel.minimized {
    width: 270px;
    border-radius: 9999px;
}

.pg-queue-panel.minimized .pg-queue-header {
    padding: 10px 14px;
}

.pg-queue-panel.minimized .pg-queue-progress-bar-wrap,
.pg-queue-panel.minimized .pg-queue-body,
.pg-queue-panel.minimized .pg-queue-footer {
    display: none;
}

@media (max-width: 600px) {
    .pg-queue-panel {
        bottom: 14px;
        right: 14px;
        left: 14px;
        width: auto;
        border-radius: 22px;
    }
    .pg-queue-panel.minimized {
        left: auto;
        width: 250px;
        border-radius: 9999px;
    }
}
