/**
 * Floating Job Widget
 */
.bbai-job-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    border-radius: 14px;
    background: var(--bbai-bg, #fff);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18), 0 4px 14px rgba(15, 23, 42, 0.08);
    padding: 14px 16px;
    z-index: 999998;
    font-family: var(--bbai-font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.bbai-job-widget[hidden] {
    display: none;
}

/* Header */
.bbai-job-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.bbai-job-widget__status {
    font-size: 13px;
    font-weight: 800;
    color: var(--bbai-text, #1a1a1a);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bbai-job-widget__status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bbai-job-widget__pulse {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.42);
    flex: 0 0 auto;
}

.bbai-job-widget__close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--bbai-text-muted, #6b7280);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.bbai-job-widget__close:hover {
    background: var(--bbai-bg-secondary, #f3f4f6);
    color: var(--bbai-text, #1a1a1a);
}

.bbai-job-widget__close[hidden] {
    display: none;
}

/* Body */
.bbai-job-widget__body {
    margin-bottom: 10px;
}

.bbai-job-widget__counts {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.bbai-job-widget__progress-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--bbai-text, #1a1a1a);
}

.bbai-job-widget__eta {
    font-size: 11px;
    color: var(--bbai-text-muted, #6b7280);
}

/* Progress bar */
.bbai-job-widget__bar {
    height: 6px;
    background: var(--bbai-gray-200, #e5e7eb);
    border-radius: 3px;
    overflow: hidden;
}

.bbai-job-widget__bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    background: linear-gradient(90deg, #10b981, #2563eb);
}

/* State variants */
.bbai-job-widget--processing {
    animation: bbai-job-widget-attention 2.4s ease-in-out infinite;
}

.bbai-job-widget--processing .bbai-job-widget__pulse {
    animation: bbai-job-widget-pulse 1.35s ease-out infinite;
}

.bbai-job-widget--complete .bbai-job-widget__bar-fill {
    background: var(--bbai-success, #16a34a);
}

.bbai-job-widget--complete .bbai-job-widget__status {
    color: var(--bbai-success, #16a34a);
}

.bbai-job-widget--error .bbai-job-widget__bar-fill {
    background: var(--bbai-warning, #f59e0b);
}

.bbai-job-widget--error .bbai-job-widget__status {
    color: var(--bbai-warning, #f59e0b);
}

/* View button */
.bbai-job-widget__view {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    background: #059669;
    border: 1px solid #047857;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.bbai-job-widget__view:hover {
    background: #047857;
    border-color: #065f46;
    color: #ffffff;
}

.bbai-job-widget--complete .bbai-job-widget__view {
    background: #059669;
    border-color: #047857;
    color: #ffffff;
}

.bbai-job-widget--complete .bbai-job-widget__view:hover {
    background: #047857;
    border-color: #065f46;
    color: #ffffff;
}

@keyframes bbai-job-widget-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.42);
    }
    70% {
        box-shadow: 0 0 0 9px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes bbai-job-widget-attention {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bbai-job-widget--processing,
    .bbai-job-widget--processing .bbai-job-widget__pulse {
        animation: none;
    }
}
