
/* ═══════════════════════════════════════════════════════════════════════════
   DevFix — app-heartbeat.css
   Estilos exclusivos do módulo Heartbeat Monitor (prefixo hb-)
   Não compartilha classes com nenhum outro módulo.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Painel raiz ─────────────────────────────────────────────────────────── */
.hb-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Cabeçalho ───────────────────────────────────────────────────────────── */
.hb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hb-header-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.hb-header-icon {
  flex-shrink: 0;
  margin-top: 4px;
  color: #e53e3e;
}

.hb-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hb-beta-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #e53e3e, #fc8181);
  color: #F5F5F7;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}

.hb-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Botão Novo Job ──────────────────────────────────────────────────────── */
.hb-btn-new {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.hb-btn-new:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.hb-btn-new:active {
  transform: translateY(0);
}

/* ── Aviso de login ──────────────────────────────────────────────────────── */
.hb-login-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(229, 62, 62, 0.08);
  border: 1px solid rgba(229, 62, 62, 0.25);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.hb-link {
  color: #e53e3e;
  text-decoration: none;
  font-weight: 600;
}

.hb-link:hover {
  text-decoration: underline;
}

/* ── Formulário ──────────────────────────────────────────────────────────── */
.hb-form-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.hb-form-card {
  display: flex;
  flex-direction: column;
}

.hb-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.hb-form-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.hb-form-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.hb-form-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.hb-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 540px) {
  .hb-field-row {
    grid-template-columns: 1fr;
  }
}

.hb-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.hb-optional {
  font-weight: 400;
  opacity: 0.65;
}

.hb-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.hb-input::placeholder {
  color: var(--text-muted);
}

.hb-input:hover {
  border-color: rgba(15, 16, 32, 0.12);
}

[data-theme="dark"] .hb-input:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.hb-input:focus {
  outline: none;
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

.hb-field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.hb-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.hb-btn-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
}

.hb-btn-cancel:hover {
  background: var(--bg-hover);
}

/* Primário alinhado ao resto do DevFix (mesmo padrão que .hb-btn-new) */
.hb-btn-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.hb-btn-save:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.hb-btn-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Toast de feedback ───────────────────────────────────────────────────── */
.hb-toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: hbFadeIn 0.2s ease;
}

.hb-toast-ok {
  background: rgba(56, 161, 105, 0.12);
  border: 1px solid rgba(56, 161, 105, 0.3);
  color: #68d391;
}

.hb-toast-err {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid rgba(229, 62, 62, 0.3);
  color: #fc8181;
}

@keyframes hbFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Estados (loading / vazio) ───────────────────────────────────────────── */
.hb-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.hb-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: #e53e3e;
  border-radius: 50%;
  animation: hbSpin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes hbSpin {
  to {
    transform: rotate(360deg);
  }
}

.hb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 0;
  color: var(--text-muted);
  text-align: center;
}

.hb-empty p {
  margin: 0;
  font-size: 0.9rem;
}

/* ── Lista de jobs ───────────────────────────────────────────────────────── */
#hbJobsList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hb-job-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: start;
  transition: border-color 0.15s;
}

.hb-job-card:hover {
  border-color: rgba(229, 62, 62, 0.3);
}

/* Indicador de status lateral */
.hb-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.hb-status-dot.hb-s-up {
  background: #38a169;
  box-shadow: 0 0 6px rgba(56, 161, 105, 0.5);
}

.hb-status-dot.hb-s-late {
  background: #d69e2e;
  box-shadow: 0 0 6px rgba(214, 158, 46, 0.5);
  animation: hbPulse 1.5s ease-in-out infinite;
}

.hb-status-dot.hb-s-down {
  background: #e53e3e;
  box-shadow: 0 0 6px rgba(229, 62, 62, 0.5);
  animation: hbPulse 0.9s ease-in-out infinite;
}

.hb-status-dot.hb-s-new {
  background: #4a5568;
}

@keyframes hbPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.hb-job-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hb-job-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hb-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}

.hb-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 20px;
  padding: 3px 10px;
  text-transform: uppercase;
}

.hb-status-pill.hb-s-up {
  background: rgba(56, 161, 105, 0.12);
  color: #68d391;
  border: 1px solid rgba(56, 161, 105, 0.25);
}


.hb-status-pill.hb-s-late {
  background: rgba(214, 158, 46, 0.12);
  color: #f6e05e;
  border: 1px solid rgba(214, 158, 46, 0.25);
}

.hb-status-pill.hb-s-down {
  background: rgba(229, 62, 62, 0.12);
  color: #fc8181;
  border: 1px solid rgba(229, 62, 62, 0.25);
}

.hb-status-pill.hb-s-new {
  background: rgba(74, 85, 104, 0.15);
  color: #a0aec0;
  border: 1px solid rgba(74, 85, 104, 0.3);
}

/* URL de ping */
.hb-ping-url-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: #0a0b0f;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 7px 12px;
}

.hb-ping-url {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  color: #63b3ed;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hb-copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.hb-copy-btn:hover {
  color: var(--text-primary);
}

/* Ações do card */
.hb-job-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.hb-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.hb-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.hb-action-btn.hb-action-del:hover {
  background: rgba(229, 62, 62, 0.1);
  color: #fc8181;
  border-color: rgba(229, 62, 62, 0.3);
}

/* ── Modal de Histórico ──────────────────────────────────────────────────── */
.hb-history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: hbFadeIn 0.2s ease;
}

.hb-history-modal {
  background: var(--bg-surface, #1a1b23);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hb-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.hb-history-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}

.hb-history-close:hover {
  color: var(--text-primary);
}

.hb-history-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Timeline de pings */
.hb-ping-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hb-ping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.84rem;
}

.hb-ping-item:last-child {
  border-bottom: none;
}

.hb-ping-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38a169;
  flex-shrink: 0;
}

.hb-ping-time {
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
}

.hb-ping-ago {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-left: auto;
}

/* Barra visual de atividade (grade de quadrados) */
.hb-activity-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 16px;
}

.hb-activity-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.hb-activity-cell.hb-ac-hit {
  background: #38a169;
}

.hb-activity-cell.hb-ac-miss {
  background: rgba(229, 62, 62, 0.35);
}

.hb-history-stat {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.hb-hstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  flex: 1;
  min-width: 100px;
}

.hb-hstat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hb-hstat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Instrução de uso */
.hb-usage-box {
  background: #0a0b0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 4px;
}

.hb-usage-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  font-weight: 600;
}

.hb-usage-cmd {
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  color: #63b3ed;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  padding: 6px 10px;
  display: block;
  margin-bottom: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

.hb-usage-cmd:last-child {
  margin-bottom: 0;
}

/* Responsivo */
@media (max-width: 600px) {
  .hb-job-card {
    grid-template-columns: auto 1fr;
  }

  .hb-job-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
}
