/* ── Jobs Monitor — Sidebar Button + Popup Panel ──────────────────────────── */

/* Sidebar Jobs entry */
#jm-sidebar-entry {
  margin: 10px 0;
}

/* sidebar link — inherits .sidebar a styles; just adds gap for the badge */
#jm-sidebar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  max-width: 100%;
  white-space: nowrap;
}

#jm-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #4a90e2;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  line-height: 1.4;
  margin-left: 2px;
}

#jm-sidebar-badge.jm-badge-running {
  background: #f59e0b;
  color: #1e293b;
}

#jm-sidebar-badge.jm-badge-empty {
  display: none;
}

/* ── Popup panel ───────────────────────────────────────────────────────────── */
#jm-panel {
  display: none;
  position: fixed;
  top: 80px;
  left: calc(var(--sidebar-width-desktop, 180px) + 5px);
  width: 320px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.18);
  border-left: 3px solid #4a90e2;
  z-index: 9999;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  overflow-y: auto;
  border-radius: 8px;
}

#jm-panel.jm-panel-open {
  display: flex;
  flex-direction: column;
}

#jm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f7f9fc;
  border-radius: 0 8px 0 0;
  flex-shrink: 0;
}

#jm-panel-header .jm-panel-title {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}

#jm-panel-analysis {
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  margin-top: 1px;
}

#jm-panel-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

#jm-panel-close:hover {
  color: #374151;
}

#jm-panel-body {
  flex: 1;
  padding: 8px 0;
}

.jm-empty-msg {
  padding: 20px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

/* Job rows */
.jm-job-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.12s;
}

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

.jm-job-row:hover {
  background: #f7f9fc;
}

.jm-job-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  color: #6b7280;
}

.jm-job-name {
  flex: 1;
  color: #374151;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

/* Status badges — mirror downstream.ejs .module-state */
.jm-status {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid #d1d5db;
  color: #374151;
  background: #f9fafb;
  white-space: nowrap;
  flex-shrink: 0;
}

.jm-status-running {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.jm-status-pending, .jm-status-submitted {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #6b7280;
}

.jm-status-completed {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.jm-status-failed, .jm-status-timeout, .jm-status-out_of_memory, .jm-status-node_fail {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.jm-status-cancelled {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #6b7280;
}

.jm-elapsed {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}

.jm-cancel-btn {
  background: none;
  border: 1px solid #e5e7eb;
  color: #9ca3af;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 7px;
  font-size: 11px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.jm-cancel-btn:hover {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fef2f2;
}

/* ── Toast Notifications ───────────────────────────────────────────────────── */
#jm-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.jm-toast {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  pointer-events: all;
  cursor: pointer;
  animation: jm-slide-in 0.2s ease forwards;
  max-width: 300px;
  border-left: 4px solid #d1d5db;
  transition: opacity 0.3s;
}

.jm-toast-success {
  border-left-color: #86efac;
  background: #ecfdf5;
  color: #166534;
}

.jm-toast-error {
  border-left-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

@keyframes jm-slide-in {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
