/* =========================================
   Global Background Uploads Widget
   Floating bottom-right panel — survives navigation
   ========================================= */

.dm-jobs-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    pointer-events: none;
}

.dm-jobs-widget[hidden] {
    display: none;
}

.dm-jobs-widget-card {
    background: #161616;
    color: #f0f0f0;
    border: 1px solid var(--ls-border-medium);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 8px 24px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    min-width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.dm-jobs-widget-card.fade-out {
    animation: dmjw-fade-out 0.4s ease-in forwards;
}

@keyframes dmjw-fade-out {
    to { opacity: 0; transform: translateY(8px); }
}

.dm-jobs-widget-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.dm-jobs-widget-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: var(--ls-accent-bg);
    color: var(--ls-accent);
    border: 1px solid rgba(0, 188, 140, 0.3);
}

.dm-jobs-widget-card.status-failed .dm-jobs-widget-icon {
    background: rgba(231, 76, 60, 0.15);
    color: var(--ls-danger);
    border-color: rgba(231, 76, 60, 0.4);
}

.dm-jobs-widget-card.status-completed .dm-jobs-widget-icon {
    background: rgba(0, 188, 140, 0.2);
    color: var(--ls-accent);
    border-color: rgba(0, 188, 140, 0.5);
}

.dm-jobs-widget-title {
    flex: 1;
    min-width: 0;
}

.dm-jobs-widget-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-jobs-widget-meta {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 1px;
}

.dm-jobs-widget-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.dm-jobs-widget-close:hover {
    color: #fff;
}

.dm-jobs-widget-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    margin-bottom: 6px;
}

.dm-jobs-widget-pill {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dm-jobs-widget-card.status-pending .dm-jobs-widget-pill {
    background: rgba(149, 165, 166, 0.2);
    color: #bdc3c7;
}

.dm-jobs-widget-card.status-processing .dm-jobs-widget-pill {
    background: rgba(52, 152, 219, 0.2);
    color: #5dade2;
}

.dm-jobs-widget-card.status-completed .dm-jobs-widget-pill {
    background: rgba(0, 188, 140, 0.2);
    color: var(--ls-accent);
}

.dm-jobs-widget-card.status-failed .dm-jobs-widget-pill {
    background: rgba(231, 76, 60, 0.2);
    color: var(--ls-danger);
}

.dm-jobs-widget-card.status-processing .dm-jobs-widget-pill::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: dmjw-pulse 1s ease-in-out infinite;
}

@keyframes dmjw-pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

.dm-jobs-widget-progress {
    height: 4px;
    background: var(--ls-border-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.dm-jobs-widget-progress-bar {
    height: 100%;
    background: linear-gradient(90deg,
        var(--ls-accent) 0%,
        rgba(0, 188, 140, 0.5) 50%,
        var(--ls-accent) 100%);
    background-size: 200% 100%;
    animation: dmjw-progress-pulse 1.4s linear infinite;
    width: 100%;
}

.dm-jobs-widget-card.status-completed .dm-jobs-widget-progress-bar {
    animation: none;
    background: var(--ls-accent);
}

.dm-jobs-widget-card.status-failed .dm-jobs-widget-progress-bar {
    animation: none;
    background: var(--ls-danger);
}

@keyframes dmjw-progress-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dm-jobs-widget-detail {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 6px;
}

.dm-jobs-widget-error {
    font-size: 0.68rem;
    color: #f5c4be;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 4px;
    padding: 5px 8px;
    margin-top: 6px;
    word-wrap: break-word;
}

/* Toast notification (separate from widget cards) */
.dm-jobs-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #161616;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--ls-border-medium);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 8px 28px rgba(0, 0, 0, 0.6);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dm-jobs-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dm-jobs-toast i {
    font-size: 16px;
}

.dm-jobs-toast.success i { color: var(--ls-accent); }
.dm-jobs-toast.error i   { color: var(--ls-danger); }
