/**
 * bb-workflow.css v1.0.0 — Thanh quy trình BBKT → BBKK (KMS).
 * Nạp SAU css/bb.css và css/kms-enterprise.css. Dùng biến --ke-* của KMS; có sẵn bản tối ([data-theme="dark"]) và bản điện thoại.
 */

#bbWfBar {
  --wf-card: var(--ke-card, #fff);
  --wf-soft: var(--ke-soft, #f8fafc);
  --wf-line: var(--ke-line, #e2e8f0);
  --wf-ink: var(--ke-ink, #0f172a);
  --wf-ink2: var(--ke-ink2, #334155);
  --wf-muted: var(--ke-muted, #64748b);
  --wf-brand: var(--ke-red, #dc2626);
  --wf-brand-d: var(--ke-red-d, #b91c1c);
  --wf-brand-soft: var(--ke-red-soft, #fef2f2);
  --wf-ok: #15803d;
  --wf-ok-soft: #f0fdf4;
}

.bbwf-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "steps ctx cta";
  align-items: center;
  gap: 12px 18px;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--wf-card);
  border: 1px solid var(--wf-line);
  border-radius: 14px;
  box-shadow: var(--ke-shadow, 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px -6px rgba(15, 23, 42, .08));
  color: var(--wf-ink);
}
.bbwf-bar.dms-hidden { display: none !important; }
.bbwf-bar *, .bbwf-bar *::before, .bbwf-bar *::after { box-sizing: border-box; }
.bbwf-bar svg { flex: none; display: block; }

/* ---------- 2 bước ---------- */
.bbwf-steps { grid-area: steps; display: flex; align-items: center; gap: 6px; min-width: 0; }
.bbwf-arrow { display: inline-flex; color: var(--wf-muted); }
.bbwf-step {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 7px; border-radius: 999px;
  border: 1px solid var(--wf-line); background: var(--wf-soft); color: var(--wf-ink2);
  font: inherit; text-align: left; cursor: pointer; line-height: 1.15;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.bbwf-step:hover { border-color: var(--wf-brand); color: var(--wf-brand-d); }
.bbwf-step:focus-visible, .bbwf-btn:focus-visible, .bbwf-link:focus-visible { outline: 2px solid var(--wf-brand); outline-offset: 2px; }
.bbwf-step i {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--wf-line); color: var(--wf-ink2); font: 700 .78rem/1 inherit; font-style: normal;
}
.bbwf-step span { display: flex; flex-direction: column; min-width: 0; }
.bbwf-step b { font-size: .82rem; font-weight: 700; white-space: nowrap; }
.bbwf-step small { font-size: .68rem; color: var(--wf-muted); letter-spacing: .04em; }
.bbwf-step.is-active { background: var(--wf-brand-soft); border-color: var(--wf-brand); color: var(--wf-brand-d); box-shadow: 0 0 0 3px rgba(220, 38, 38, .10); }
.bbwf-step.is-active i { background: var(--wf-brand); color: #fff; }
.bbwf-step.is-active small { color: var(--wf-brand-d); }
.bbwf-step.is-done { background: var(--wf-ok-soft); border-color: rgba(21, 128, 61, .35); color: var(--wf-ok); }
.bbwf-step.is-done i { background: var(--wf-ok); color: #fff; }
.bbwf-step.is-done small { color: var(--wf-ok); }

/* ---------- Cửa hàng đang làm việc ---------- */
.bbwf-ctx { grid-area: ctx; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .82rem; color: var(--wf-ink2); }
.bbwf-pin { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--wf-brand-soft); color: var(--wf-brand-d); flex: none; }
.bbwf-ctx-t { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.bbwf-ctx-t b { color: var(--wf-ink); font-weight: 700; }
.bbwf-ctx-t em { font-style: normal; color: var(--wf-muted); margin-left: 4px; white-space: nowrap; }
.bbwf-ctx-a { display: inline-flex; gap: 4px; flex: none; margin-left: auto; }
.bbwf-ctx.is-empty { color: var(--wf-muted); }
.bbwf-ctx.is-empty .bbwf-ctx-t { font-size: .78rem; }
.bbwf-link {
  border: 0; background: none; padding: 4px 8px; border-radius: 8px; font: 600 .76rem/1.2 inherit; color: var(--wf-brand-d);
  cursor: pointer; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: transparent;
}
.bbwf-link:hover { background: var(--wf-brand-soft); text-decoration-color: currentColor; }

/* ---------- Nút hành động ---------- */
.bbwf-cta { grid-area: cta; display: flex; justify-content: flex-end; min-width: 0; }
.bbwf-cta:empty { display: none; }
.bbwf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--wf-line); background: var(--wf-card); color: var(--wf-ink2);
  font: 700 .84rem/1.2 inherit; cursor: pointer; white-space: nowrap; transition: transform .12s, box-shadow .12s, border-color .12s, color .12s;
}
.bbwf-btn:hover { border-color: var(--wf-brand); color: var(--wf-brand-d); }
.bbwf-btn.primary {
  background: linear-gradient(135deg, var(--wf-brand-d), var(--wf-brand)); border-color: transparent; color: #fff;
  box-shadow: 0 6px 14px -4px rgba(185, 28, 28, .45);
}
.bbwf-btn.primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 18px -4px rgba(185, 28, 28, .5); }

/* Nhóm nút ở chân bước "Tổng hợp" của BBKT */
.bbwf-foot-btns { display: inline-flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---------- Liên kết hệ thống trong menu bên KMS (thẻ <a> dùng chung giao diện .nd-nav) ---------- */
a.nd-nav.nd-nav-link { text-decoration: none; display: flex; align-items: center; }
a.nd-nav.nd-nav-link:hover { text-decoration: none; }

/* ---------- Giao diện tối ---------- */
html[data-theme="dark"] #bbWfBar {
  --wf-card: #111a2e; --wf-soft: #0f1729; --wf-line: #1e293b; --wf-ink: #e2e8f0; --wf-ink2: #cbd5e1; --wf-muted: #94a3b8;
  --wf-brand: #f87171; --wf-brand-d: #fca5a5; --wf-brand-soft: rgba(248, 113, 113, .12); --wf-ok: #4ade80; --wf-ok-soft: rgba(74, 222, 128, .10);
}
html[data-theme="dark"] .bbwf-step.is-active { box-shadow: 0 0 0 3px rgba(248, 113, 113, .16); }
html[data-theme="dark"] .bbwf-btn.primary { background: linear-gradient(135deg, #b91c1c, #dc2626); color: #fff; }

/* ---------- Máy tính bảng / điện thoại ---------- */
/* Dưới ~1650px một hàng 3 cột bị chật (chữ "Cửa hàng đang làm việc: …" bị bẻ 3 dòng) -> tách thành 2 hàng: [các bước | nút] rồi [cửa hàng] */
@media (max-width: 1650px) {
  .bbwf-bar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "steps cta" "ctx ctx"; }
}
@media (max-width: 640px) {
  .bbwf-bar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "steps" "ctx" "cta"; padding: 10px; border-radius: 12px; }
  .bbwf-steps { width: 100%; }
  .bbwf-step { flex: 1 1 0; min-width: 0; }
  .bbwf-step b { white-space: normal; font-size: .78rem; }
  .bbwf-ctx { flex-wrap: wrap; }
  .bbwf-ctx-t { flex: 1 1 0; }   /* chữ nằm cạnh biểu tượng ghim, không rớt xuống dòng dưới */
  .bbwf-ctx-a { margin-left: 0; width: 100%; padding-left: 36px; }
  .bbwf-cta { justify-content: stretch; }
  .bbwf-btn { width: 100%; white-space: normal; text-align: center; min-height: 44px; }
  .bbwf-foot-btns { width: 100%; }
  .bbwf-foot-btns .nd-btn { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .bbwf-step, .bbwf-btn { transition: none; }
  .bbwf-btn.primary:hover { transform: none; }
}
