/* ============================================
   GLOBAL JOBS TRACKER — Scandinavian Minimalist
   Floating panel with dramatic shadow-border
   ============================================ */

.jobs-tracker {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-height: 80vh;
    z-index: 9998;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(180, 190, 210, 0.35);
    border-top: 2px solid rgba(180, 130, 150, 0.35);
    box-shadow:
        0 20px 60px -12px rgba(60, 40, 50, 0.18),
        0 8px 24px -6px rgba(60, 40, 50, 0.10),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.jobs-tracker.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.jobs-tracker.hiding {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
}

/* ── Header ── */

.jobs-tracker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(180, 190, 210, 0.2);
    transition: background 0.2s;
}

.jobs-tracker-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.jobs-tracker-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.jobs-tracker-icon {
    width: 18px;
    height: 18px;
    color: #8C5670;
    flex-shrink: 0;
    animation: jtIconPulse 2s ease-in-out infinite;
}

@keyframes jtIconPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.jobs-tracker-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2D2B3A;
    letter-spacing: 0.02em;
}

.jobs-tracker-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #C4687A, #8C5670);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(140, 86, 112, 0.3);
}

.jobs-tracker-toggle {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.jobs-tracker-toggle:hover {
    color: #4B5563;
}

.jobs-tracker.collapsed .jobs-tracker-toggle {
    transform: rotate(180deg);
}

/* ── Body (collapsible) ── */

.jobs-tracker-body {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.25s ease;
    padding: 0;
}

.jobs-tracker.collapsed .jobs-tracker-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.jobs-tracker-body::-webkit-scrollbar {
    width: 4px;
}

.jobs-tracker-body::-webkit-scrollbar-track {
    background: transparent;
}

.jobs-tracker-body::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 2px;
}

/* ── Empty state ── */

.jobs-tracker-empty {
    padding: 20px 16px;
    text-align: center;
    font-size: 0.75rem;
    color: #9CA3AF;
}

/* ── Job item ── */

.jt-job {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(180, 190, 210, 0.15);
    position: relative;
    animation: jtJobIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.jt-job:last-child {
    border-bottom: none;
}

@keyframes jtJobIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.jt-job.removing {
    animation: jtJobOut 0.3s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes jtJobOut {
    from { opacity: 1; transform: translateX(0); max-height: 200px; }
    to   { opacity: 0; transform: translateX(20px); max-height: 0; padding: 0 16px; margin: 0; border: 0; }
}

/* Type accent — left border color */
.jt-job[data-type="enrichment"] { border-left: 3px solid #5B8FA8; }
.jt-job[data-type="evaluation"] { border-left: 3px solid #8C6DB5; }
.jt-job[data-type="search"]     { border-left: 3px solid #C4687A; }

/* Completed state */
.jt-job.completed { border-left-color: #5AA882; }

/* ── Cancel button ── */

.jt-cancel-btn {
    background: rgba(196, 104, 122, 0.08);
    border: 1px solid rgba(196, 104, 122, 0.2);
    color: #C4687A;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s, opacity 0.2s;
    margin-left: 2px;
}

.jt-cancel-btn:hover {
    background: rgba(196, 104, 122, 0.16);
    border-color: rgba(196, 104, 122, 0.35);
    transform: scale(1.15);
}

.jt-cancel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ── Dismiss button ── */

.jt-dismiss-btn {
    background: rgba(90, 168, 130, 0.08);
    border: 1px solid rgba(90, 168, 130, 0.2);
    color: #5AA882;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    margin-left: 2px;
}

.jt-dismiss-btn:hover {
    background: rgba(90, 168, 130, 0.18);
    transform: scale(1.15);
}

/* ── Job header row ── */

.jt-job-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.jt-job-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jt-job-icon svg {
    width: 14px;
    height: 14px;
}

.jt-job[data-type="enrichment"] .jt-job-icon { color: #5B8FA8; }
.jt-job[data-type="evaluation"] .jt-job-icon { color: #8C6DB5; }
.jt-job[data-type="search"]     .jt-job-icon { color: #C4687A; }
.jt-job.completed .jt-job-icon                { color: #5AA882; }

.jt-job-label {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
    color: #2D2B3A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.jt-job-pct {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    min-width: 38px;
    text-align: right;
}

.jt-job[data-type="enrichment"] .jt-job-pct { color: #5B8FA8; }
.jt-job[data-type="evaluation"] .jt-job-pct { color: #8C6DB5; }
.jt-job[data-type="search"]     .jt-job-pct { color: #C4687A; }
.jt-job.completed .jt-job-pct               { color: #5AA882; }

/* ── Progress bar ── */

.jt-job-track {
    position: relative;
    height: 6px;
    background: rgba(45, 43, 58, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.jt-job-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Type-colored fills with subtle shimmer */
.jt-job[data-type="enrichment"] .jt-job-fill {
    background: linear-gradient(90deg, #4A7F96 0%, #5B8FA8 40%, #7BAFC4 60%, #5B8FA8 100%);
    background-size: 300% 100%;
    animation: jtBarShimmer 3s linear infinite;
}

.jt-job[data-type="evaluation"] .jt-job-fill {
    background: linear-gradient(90deg, #7353A0 0%, #8C6DB5 40%, #A68CCC 60%, #8C6DB5 100%);
    background-size: 300% 100%;
    animation: jtBarShimmer 3s linear infinite;
}

.jt-job[data-type="search"] .jt-job-fill {
    background: linear-gradient(90deg, #A8505F 0%, #C4687A 40%, #D88A98 60%, #C4687A 100%);
    background-size: 300% 100%;
    animation: jtBarShimmer 3s linear infinite;
}

.jt-job.completed .jt-job-fill {
    background: linear-gradient(90deg, #5AA882, #7BC4A0) !important;
    background-size: 100% 100% !important;
    animation: none !important;
}

@keyframes jtBarShimmer {
    0%   { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

/* ── Status text ── */

.jt-job-status {
    font-size: 0.7rem;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.jt-job.completed .jt-job-status {
    color: #5AA882;
}

/* ── Discovery tags ── */

.jt-job-discoveries {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.jt-disc {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 0.62rem;
    font-weight: 500;
    border-radius: 5px;
    background: rgba(45, 43, 58, 0.03);
    border: 1px solid rgba(45, 43, 58, 0.08);
    color: #B0B5BF;
    letter-spacing: 0.01em;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.jt-disc-icon {
    font-size: 0.55rem;
    opacity: 0.4;
    transition: opacity 0.3s;
}

/* Pending state */
.jt-disc.pending {
    animation: jtDiscPending 2.5s ease-in-out infinite;
}

@keyframes jtDiscPending {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 0.8; }
}

/* Found state */
.jt-disc.found {
    background: rgba(90, 168, 130, 0.08);
    border-color: rgba(90, 168, 130, 0.25);
    color: #5AA882;
    box-shadow: 0 0 8px rgba(90, 168, 130, 0.1);
    animation: jtDiscFound 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes jtDiscFound {
    0%   { transform: scale(0.7); opacity: 0.4; }
    35%  { transform: scale(1.12); }
    65%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}

.jt-disc.found .jt-disc-icon {
    opacity: 1;
}

/* Not found state */
.jt-disc.not-found {
    color: #D1D5DB;
    border-color: rgba(45, 43, 58, 0.04);
    opacity: 0.45;
}

.jt-disc.not-found .jt-disc-icon {
    opacity: 0.2;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .jobs-tracker {
        width: 320px;
    }

    .jt-job-label {
        font-size: 0.72rem;
    }

    .jt-job-pct {
        font-size: 0.85rem;
    }

    .jt-disc {
        font-size: 0.58rem;
    }
}

@media (max-width: 480px) {
    .jobs-tracker {
        width: calc(100% - 24px);
        right: 12px;
        bottom: 12px;
    }

    .jobs-tracker-title {
        font-size: 0.72rem;
    }

    .jt-job {
        padding: 10px 12px;
    }
}
