/* ==========================================================================
   GLPI Control Center - workflow.css
   --------------------------------------------------------------------------
   Estilos do Workflow Wizard.
   Separado do search.css para manutenção independente.
   ========================================================================== */

/* ── Modal Overlay ──────────────────────────────────────────────────────── */
.workflow-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.workflow-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */
.workflow-dialog {
  position: relative;
  z-index: 1;
  width: min(580px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2e3347);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wfSlideUp 0.22s ease;
}

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

/* ── Header ─────────────────────────────────────────────────────────────── */
.workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border, #2e3347);
}

.workflow-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workflow-header-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent, #4f7ef7), var(--accent2, #6c5ce7));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.workflow-header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #e8eaf6);
}

.workflow-header-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text2, #9299b8);
}

.workflow-close-btn {
  background: none;
  border: 1px solid var(--border, #2e3347);
  color: var(--text2, #9299b8);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.workflow-close-btn:hover {
  color: var(--text, #e8eaf6);
  border-color: rgba(255, 255, 255, 0.18);
}

/* ── Progress Bar ───────────────────────────────────────────────────────── */
.workflow-progress {
  display: flex;
  align-items: center;
  padding: 20px 28px;
  gap: 0;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  flex-shrink: 0;
}

.workflow-step.completed {
  cursor: pointer;
}

.workflow-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2, #222535);
  border: 2px solid var(--border, #2e3347);
  color: var(--text3, #5a6080);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.workflow-step.active .workflow-step-circle {
  background: var(--accent, #4f7ef7);
  border-color: var(--accent, #4f7ef7);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(79, 126, 247, 0.2);
}

.workflow-step.completed .workflow-step-circle {
  background: var(--green, #00c896);
  border-color: var(--green, #00c896);
  color: #fff;
}

.workflow-step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text3, #5a6080);
  white-space: nowrap;
}

.workflow-step.active .workflow-step-label {
  color: var(--accent, #4f7ef7);
  font-weight: 600;
}

.workflow-step.completed .workflow-step-label {
  color: var(--green, #00c896);
}

.workflow-step-connector {
  flex: 1;
  height: 2px;
  background: var(--border, #2e3347);
  margin: 0 8px;
  min-width: 16px;
  border-radius: 1px;
}

/* ── Content ────────────────────────────────────────────────────────────── */
.workflow-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.workflow-step-body {
  animation: wfFadeIn 0.18s ease;
}

@keyframes wfFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.workflow-step-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #e8eaf6);
}

.workflow-step-subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text2, #9299b8);
  line-height: 1.5;
}

/* ── Step 1: Info Card ──────────────────────────────────────────────────── */
.wf-info-card {
  background: var(--surface2, #222535);
  border: 1px solid var(--border, #2e3347);
  border-radius: 12px;
  padding: 4px 0;
}

.wf-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.wf-info-row:last-child {
  border-bottom: none;
}

.wf-info-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3, #5a6080);
}

.wf-info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #e8eaf6);
}

.wf-info-value.mono {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}

/* Status badges no step 1 */
.wf-status-ativo {
  background: rgba(0, 200, 150, 0.16);
  color: var(--green, #00c896);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.wf-status-manutencao {
  background: rgba(255, 193, 7, 0.16);
  color: var(--yellow, #ffc107);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.wf-status-emprestado {
  background: rgba(255, 85, 85, 0.14);
  color: #ff8080;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Step 2: Assistência Cards ──────────────────────────────────────────── */
.wf-assistencia-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.wf-assistencia-card {
  background: var(--surface2, #222535);
  border: 2px solid var(--border, #2e3347);
  border-radius: 12px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.wf-assistencia-card:hover {
  border-color: var(--accent, #4f7ef7);
  background: rgba(79, 126, 247, 0.06);
}

.wf-assistencia-card.selected {
  border-color: var(--accent, #4f7ef7);
  background: rgba(79, 126, 247, 0.12);
  box-shadow: 0 0 0 3px rgba(79, 126, 247, 0.15);
}

.wf-assistencia-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #e8eaf6);
}

.wf-assistencia-card.selected .wf-assistencia-label {
  color: var(--accent, #4f7ef7);
}

/* ── Step 3: Formulário ─────────────────────────────────────────────────── */
.wf-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wf-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #e8eaf6);
}

.wf-required {
  color: var(--red, #ff5555);
}

.wf-select,
.wf-input,
.wf-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg, #0f1117);
  border: 1.5px solid var(--border, #2e3347);
  border-radius: 8px;
  color: var(--text, #e8eaf6);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.wf-select:focus,
.wf-input:focus,
.wf-textarea:focus {
  border-color: var(--accent, #4f7ef7);
  box-shadow: 0 0 0 3px rgba(79, 126, 247, 0.12);
}

.wf-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239299b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.wf-select option {
  background: var(--surface, #1a1d27);
}

.wf-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Toggle (Sim/Não) */
.wf-toggle-group {
  display: flex;
  gap: 8px;
}

.wf-toggle {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border, #2e3347);
  background: transparent;
  color: var(--text2, #9299b8);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.wf-toggle:hover {
  border-color: var(--accent, #4f7ef7);
  color: var(--text, #e8eaf6);
}

.wf-toggle.active {
  background: var(--accent, #4f7ef7);
  border-color: var(--accent, #4f7ef7);
  color: #fff;
}

/* ── Step 4: Fluxo da Assistência ──────────────────────────────────────── */
.wf-flow-card {
  background: var(--surface2, #222535);
  border: 1px solid var(--border, #2e3347);
  border-left: 4px solid var(--accent, #4f7ef7);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.wf-flow-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wf-flow-icon {
  font-size: 20px;
}

.wf-flow-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #e8eaf6);
}

.wf-flow-type {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3, #5a6080);
  background: var(--surface3, #2a2e42);
  padding: 3px 8px;
  border-radius: 4px;
}

/* ── Ações ─────────────────────────────────────────────────────────────── */
.wf-actions-section,
.wf-instructions-section {
  margin-bottom: 20px;
}

.wf-section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2, #9299b8);
}

.wf-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wf-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface2, #222535);
  border: 1.5px solid var(--border, #2e3347);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}

.wf-action-card:hover {
  border-color: var(--accent, #4f7ef7);
  background: rgba(79, 126, 247, 0.06);
}

.wf-action-card.executed {
  border-color: var(--green, #00c896);
  background: rgba(0, 200, 150, 0.06);
  opacity: 0.7;
  cursor: default;
}

.wf-action-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.wf-action-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wf-action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e8eaf6);
}

.wf-action-desc {
  font-size: 12px;
  color: var(--text2, #9299b8);
  line-height: 1.4;
}

.wf-action-arrow {
  font-size: 18px;
  color: var(--text3, #5a6080);
  flex-shrink: 0;
}

.wf-action-badge {
  color: var(--green, #00c896);
  font-size: 16px;
  flex-shrink: 0;
}

.wf-actions-executed {
  text-align: center;
  margin-bottom: 16px;
}

.wf-actions-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--green, #00c896);
  background: rgba(0, 200, 150, 0.12);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ── Instruções ────────────────────────────────────────────────────────── */
.wf-instructions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wf-instruction-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.wf-instruction-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface3, #2a2e42);
  color: var(--text2, #9299b8);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wf-instruction-text {
  font-size: 13px;
  color: var(--text, #e8eaf6);
  line-height: 1.5;
  padding-top: 2px;
}

/* ── Step 5: Resumo ─────────────────────────────────────────────────────── */
.wf-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wf-summary-section {
  background: var(--surface2, #222535);
  border: 1px solid var(--border, #2e3347);
  border-radius: 12px;
  padding: 16px;
}

.wf-summary-heading {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent, #4f7ef7);
}

.wf-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.wf-summary-row:last-child {
  border-bottom: none;
}

.wf-summary-row span:first-child {
  color: var(--text2, #9299b8);
}

.wf-summary-row span:last-child {
  color: var(--text, #e8eaf6);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
}

.wf-summary-row .mono {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.wf-summary-text {
  margin: 0;
  font-size: 13px;
  color: var(--text, #e8eaf6);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.workflow-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--border, #2e3347);
  gap: 12px;
}

.workflow-btn-primary,
.workflow-btn-secondary {
  padding: 10px 24px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.workflow-btn-primary {
  background: linear-gradient(135deg, var(--accent, #4f7ef7), var(--accent2, #6c5ce7));
  color: #fff;
}

.workflow-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.workflow-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.workflow-btn-secondary {
  background: transparent;
  border: 1px solid var(--border, #2e3347);
  color: var(--text2, #9299b8);
}

.workflow-btn-secondary:hover {
  color: var(--text, #e8eaf6);
  border-color: rgba(255, 255, 255, 0.18);
}

/* ── Feedback ───────────────────────────────────────────────────────────── */
.workflow-feedback {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.4;
}

.workflow-feedback.error {
  background: rgba(255, 85, 85, 0.12);
  color: #ff9c9c;
  border: 1px solid rgba(255, 85, 85, 0.2);
}

.workflow-feedback.success {
  background: rgba(0, 200, 150, 0.12);
  color: #7ae8c6;
  border: 1px solid rgba(0, 200, 150, 0.2);
}

/* ── Sending State ──────────────────────────────────────────────────────── */
.workflow-sending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 16px;
}

.workflow-sending p {
  color: var(--text2, #9299b8);
  font-size: 14px;
}

.wf-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border, #2e3347);
  border-top-color: var(--accent, #4f7ef7);
  border-radius: 50%;
  animation: wfSpin 0.8s linear infinite;
}

@keyframes wfSpin {
  to { transform: rotate(360deg); }
}

/* ── Done State ─────────────────────────────────────────────────────────── */
.workflow-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  text-align: center;
}

.wf-done-icon {
  width: 64px;
  height: 64px;
  background: rgba(0, 200, 150, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--green, #00c896);
}

/* ── Responsividade ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .workflow-modal {
    padding: 12px;
  }

  .workflow-dialog {
    max-height: calc(100vh - 24px);
  }

  .workflow-progress {
    padding: 16px 16px;
  }

  .workflow-step-label {
    display: none;
  }

  .workflow-content {
    padding: 0 16px 16px;
  }

  .workflow-header {
    padding: 16px;
  }

  .workflow-footer {
    padding: 12px 16px;
    flex-direction: column;
  }

  .workflow-btn-primary,
  .workflow-btn-secondary {
    width: 100%;
    text-align: center;
  }

  .wf-assistencia-grid {
    grid-template-columns: 1fr;
  }

  .wf-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ── Integration Engine (Sprint 3) ─────────────────────────────────────── */
.wf-integration-engine {
  margin-bottom: 16px;
}

.wf-engine-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 200, 150, 0.08);
  border: 1px solid rgba(0, 200, 150, 0.2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green, #00c896);
}

.wf-engine-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text3, #5a6080);
  flex-shrink: 0;
}

.wf-engine-dot.active {
  background: var(--green, #00c896);
  box-shadow: 0 0 6px rgba(0, 200, 150, 0.4);
  animation: wfPulse 2s ease-in-out infinite;
}

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

.wf-engine-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface2, #222535);
  border: 1px solid var(--border, #2e3347);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text2, #9299b8);
}

.wf-engine-summary {
  border-left: 3px solid var(--accent, #4f7ef7);
}

.wf-event-log {
  margin-top: 12px;
  padding: 10px;
  background: var(--surface2, #222535);
  border: 1px solid var(--border, #2e3347);
  border-radius: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text3, #5a6080);
  max-height: 80px;
  overflow-y: auto;
}
