/* ==========================================================================
   SMARTBOX DEMO

   A working miniature of the SmartBox key programming app: the dashboard, the
   make / model / year walk, the immobiliser grid and the guided PI steps.

   Written rather than ported, but not invented. SmartBox is a Flutter app
   (C:\laragon\www\smartbox_flutter), so there is no markup or stylesheet to
   lift. Everything visible here is taken from its source instead:

     lib/core/constants/colors.dart          the palette, brand #2e536f
     lib/core/constants/static_data.dart     the six dashboard cards
     assets/translations/en-US.json          every label, word for word
     lib/features/home/screens/home.dart     the dashboard layout
     lib/shared/widgets/cards_grid.dart      three columns, circle icon on top
     lib/features/programming/**             the six-step programming wizard
     assets/icons/*.png                      the icons, copied unchanged

   It is drawn as a landscape tablet because main.dart locks the app to
   landscapeLeft and landscapeRight: this is bench software on a tablet, not a
   phone app. Vehicles, immobilisers, serial numbers and logs are dummy data.

   Everything is namespaced .sbx-* and scoped under .sbx-demo.
   ========================================================================== */

.sbx-demo {
  /* CustomColor.primaryColor and friends, straight out of colors.dart. */
  --sbx-brand: #2e536f;
  --sbx-info: #1b74e4;
  --sbx-gold: #fdbc1f;
  --sbx-success: #25a029;
  --sbx-danger: #ff1100;
  --sbx-scaffold: #fafafa;
  --sbx-surface: #ffffff;
  --sbx-ink: #222121;
  --sbx-muted: #635f5f;
  --sbx-line: #f0ecec;
  --sbx-soft: #edf4fc;
  --sbx-softer: #d4e5f9;

  position: absolute;
  inset: 0;
  display: grid;
  /* Copy on the left, tablet on the right. The tablet column takes whatever
     is left over so the device is as large as the frame allows. */
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  /* Cap the row so a tall device clamps to the frame instead of overflowing it. */
  grid-template-rows: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: clamp(28px, 3.4vw, 54px);
  padding: 24px clamp(26px, 4vw, 60px);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(85% 70% at 50% 0%, #1b2a36, #0c1218 72%);
  text-align: left;
  overflow: hidden;
}
.sbx-demo *,
.sbx-demo *::before,
.sbx-demo *::after { box-sizing: border-box; }
.sbx-demo,
.sbx-demo :where(button) { cursor: default; font: inherit; color: inherit; }
.sbx-demo :where(button) { background: none; border: 0; padding: 0; text-align: left; }
.sbx-demo [data-sbx] { cursor: pointer; }

/* ---------------- the panel beside the tablet ---------------- */
.sbx-side { max-width: 300px; justify-self: start; }
.sbx-side__mark {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}
.sbx-side__mark img { width: 34px; height: 34px; }
.sbx-side__lede {
  margin: 12px 0 22px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #9db0c0;
}
.sbx-side__list { display: grid; gap: 14px; }
.sbx-side__item { display: flex; align-items: flex-start; gap: 11px; }
.sbx-side__item b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #eaf2f9;
  margin-bottom: 2px;
}
.sbx-side__item b + span {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: #8496a5;
}
.sbx-side__dot {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(110, 170, 220, 0.14);
}
.sbx-side__dot img { width: 17px; height: 17px; }

/* ---------------- the tablet ---------------- */
.sbx-tablet {
  /* Sized from the width, not the height: an aspect ratio resolved against a
     stretched grid row makes the track sizing circular and the device ends up
     taller than the room it has. */
  width: min(1000px, 100%);
  aspect-ratio: 16 / 10;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 11px 13px;
  border-radius: 22px;
  background: #0a0e12;
  box-shadow:
    0 0 0 1px #2b333d,
    0 40px 80px -34px rgba(0, 0, 0, 0.9);
  position: relative;
}
/* The front camera, so the black rectangle reads as a device. */
.sbx-tablet::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #2f3a45;
}
.sbx-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 11px;
  background: var(--sbx-scaffold);
  color: var(--sbx-ink);
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  position: relative;
}

/* ---------------- app bar ---------------- */
.sbx-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding: 9px 14px;
}
.sbx-bar__back {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--sbx-line);
  background: var(--sbx-surface);
  color: var(--sbx-brand);
}
.sbx-bar__back svg { width: 12px; height: 12px; }
.sbx-bar__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.sbx-bar__sub {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--sbx-muted);
}
.sbx-bar__right { margin-left: auto; display: flex; gap: 6px; }
.sbx-bar__btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--sbx-line);
  background: var(--sbx-surface);
}
.sbx-bar__btn img { width: 13px; height: 13px; }

.sbx-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0 18px 14px;
  display: flex;
  flex-direction: column;
}

/* ---------------- dashboard head ---------------- */
.sbx-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 4px 18px 10px;
}
.sbx-head__logo { width: 34px; height: 34px; flex: none; }
.sbx-head__title { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.sbx-head__sub { display: block; font-size: 10.5px; color: var(--sbx-muted); }

/* the User Profile / Battery / Switch Connection strip */
.sbx-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: none;
  margin-bottom: 9px;
  border: 1px solid var(--sbx-line);
  border-radius: 9px;
  background: var(--sbx-surface);
  padding: 3px;
}
.sbx-strip__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 6px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sbx-brand);
  transition: background 0.15s ease;
}
.sbx-strip__btn + .sbx-strip__btn { border-left: 1px solid var(--sbx-line); }
.sbx-strip__btn img { width: 16px; height: 16px; }

/* the six dashboard cards, three across */
.sbx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 1;
  min-height: 0;
  border: 1px solid var(--sbx-line);
  border-radius: 9px;
  background: var(--sbx-surface);
  padding: 3px;
  overflow: hidden;
}
.sbx-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  text-align: center;
  transition: background 0.15s ease;
}
.sbx-card:nth-child(-n + 3) { border-bottom: 1px solid var(--sbx-line); }
.sbx-card:nth-child(3n + 2) { border-left: 1px solid var(--sbx-line); border-right: 1px solid var(--sbx-line); }
.sbx-card:hover { background: var(--sbx-soft); }
.sbx-card__icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sbx-surface);
  box-shadow: 0 8px 14px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--sbx-line);
}
.sbx-card__icon img { width: 24px; height: 24px; }
.sbx-card__name { font-size: 11.5px; font-weight: 700; color: var(--sbx-brand); }
.sbx-card__text { font-size: 10px; line-height: 1.4; color: var(--sbx-muted); }

/* the brand band along the bottom of the dashboard */
.sbx-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: none;
  align-items: center;
  background: var(--sbx-brand);
  color: #fff;
  padding: 9px 18px;
  font-size: 10.5px;
  text-align: center;
}
.sbx-band__alert {
  border: 1px solid #fff;
  border-radius: 7px;
  background: var(--sbx-danger);
  padding: 4px 6px;
}

/* ---------------- pick lists (make, model, year) ---------------- */
.sbx-search {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid var(--sbx-line);
  border-radius: 9px;
  background: var(--sbx-surface);
  color: #9a9494;
  font-size: 11px;
}
.sbx-search img { width: 14px; height: 14px; opacity: 0.55; }
.sbx-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 7px;
  flex: 1;
  min-height: 0;
  align-content: start;
  overflow: hidden;
}
.sbx-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--sbx-line);
  border-radius: 9px;
  background: var(--sbx-surface);
  font-size: 11.5px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sbx-pick:hover { border-color: var(--sbx-softer); background: var(--sbx-soft); }
.sbx-pick svg { width: 11px; height: 11px; flex: none; color: #b3adad; }
.sbx-picks--wide { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }

/* the note the step header carries above the list */
.sbx-note {
  flex: none;
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--sbx-soft);
  border: 1px solid var(--sbx-softer);
  font-size: 10.5px;
  line-height: 1.5;
  color: #40566c;
}
.sbx-note b { color: var(--sbx-brand); }

/* the Make: / Model: / Year: trail */
.sbx-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
  margin-bottom: 10px;
}
.sbx-crumb span {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--sbx-soft);
  border: 1px solid var(--sbx-softer);
  font-size: 10px;
  font-weight: 700;
  color: var(--sbx-brand);
}

/* ---------------- immobiliser grid ---------------- */
.sbx-toprow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-bottom: 10px;
}
.sbx-toprow__spacer { flex: 1; }
.sbx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--sbx-softer);
  background: var(--sbx-soft);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sbx-brand);
}
.sbx-chip svg { width: 10px; height: 10px; }

.sbx-immos {
  display: grid;
  /* Three across, which is what StaggeredGrid.count does in step4.dart for
     anything past two immobilisers. */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sbx-immo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 10px;
  border: 1px solid var(--sbx-line);
  border-radius: 9px;
  background: var(--sbx-surface);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.sbx-immo:hover { border-color: var(--sbx-softer); transform: translateY(-1px); }
/* the coloured ripple the real card carries behind its header */
.sbx-immo::before {
  content: "";
  position: absolute;
  top: -58px;
  left: 50%;
  transform: translateX(-50%);
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: var(--sbx-ripple, var(--sbx-gold));
  opacity: 0.16;
}
.sbx-immo__gear {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sbx-ripple, var(--sbx-gold));
  color: #fff;
  position: relative;
}
.sbx-immo__gear svg { width: 18px; height: 18px; }
.sbx-immo__name {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  position: relative;
}
.sbx-immo__online { font-size: 9.5px; color: var(--sbx-muted); position: relative; }
.sbx-immo__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  position: relative;
}
.sbx-immo__tags span {
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--sbx-soft);
  font-size: 9px;
  font-weight: 600;
  color: #40566c;
}
.sbx-immo__hint { font-size: 9.5px; color: var(--sbx-muted); position: relative; }

/* ---------------- guided PI steps ---------------- */
.sbx-run {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.sbx-prog { display: flex; align-items: center; gap: 9px; flex: none; margin-bottom: 12px; }
.sbx-prog__track {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--sbx-line);
  overflow: hidden;
}
.sbx-prog__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--sbx-brand);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.sbx-prog__n { font-size: 10px; font-weight: 700; color: var(--sbx-muted); }

.sbx-msg {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--sbx-line);
  border-radius: 11px;
  background: var(--sbx-surface);
  text-align: center;
}
.sbx-msg__text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.015em;
  max-width: 480px;
}
.sbx-msg__done {
  display: grid;
  gap: 7px;
  justify-items: center;
}
.sbx-msg__tick {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(37, 160, 41, 0.12);
  color: var(--sbx-success);
}
.sbx-msg__tick svg { width: 22px; height: 22px; }
.sbx-msg__sub { font-size: 11px; font-weight: 400; color: var(--sbx-muted); }
.sbx-msg__step { display: grid; gap: 11px; justify-items: center; max-width: 520px; }
.sbx-msg__badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sbx-soft);
}
.sbx-msg__badge img { width: 24px; height: 24px; }
/* The read-aloud control the app puts beside a step with no timer. */
.sbx-msg__speak {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--sbx-line);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sbx-brand);
}
.sbx-msg__speak svg { width: 13px; height: 13px; }
/* The countdown the app shows while a timed step runs. */
.sbx-msg__timer { display: grid; gap: 6px; justify-items: center; width: min(320px, 100%); font-size: 10.5px; color: var(--sbx-muted); }
.sbx-msg__bar { display: block; width: 100%; height: 5px; border-radius: 99px; background: var(--sbx-line); overflow: hidden; }
.sbx-msg__bar span { display: block; height: 100%; border-radius: 99px; background: var(--sbx-info); }

.sbx-acts { display: flex; gap: 8px; flex: none; }
.sbx-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 9px;
  background: var(--sbx-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: filter 0.15s ease;
}
.sbx-btn:hover { filter: brightness(1.1); }
.sbx-btn--ghost {
  background: var(--sbx-surface);
  border: 1px solid var(--sbx-line);
  color: var(--sbx-brand);
  flex: 0 0 auto;
  min-width: 108px;
}

/* ---------------- usage logs ---------------- */
.sbx-logs {
  display: grid;
  gap: 6px;
  align-content: start;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sbx-log {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--sbx-line);
  border-radius: 9px;
  background: var(--sbx-surface);
}
.sbx-log__avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--sbx-line);
}
.sbx-log__avatar img { width: 17px; height: 17px; }
.sbx-log__car { font-size: 11.5px; font-weight: 700; }
.sbx-log__immo { display: block; font-size: 10px; color: var(--sbx-muted); }
.sbx-log__spacer { flex: 1; }
.sbx-log__meta { text-align: right; font-size: 10px; color: var(--sbx-muted); }
.sbx-log__meta b { display: block; font-size: 11px; color: var(--sbx-ink); }
.sbx-log__flag {
  flex: none;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
}
.sbx-log__flag--ok { background: rgba(37, 160, 41, 0.12); color: var(--sbx-success); }
.sbx-log__flag--no { background: rgba(255, 17, 0, 0.1); color: var(--sbx-danger); }

/* ---------------- narrow ---------------- */
/* Below this the panel and the tablet start fighting for the same room, so the
   device keeps it and the copy drops. */
@media (max-width: 1180px) {
  .sbx-demo {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding: 20px;
  }
  .sbx-side { display: none; }
}
@media (max-width: 900px) {
  /* A landscape tablet at this width would be 200px tall and unreadable, so
     the device fills the frame instead and the grid drops to two columns. */
  .sbx-demo { padding: 12px; align-items: stretch; }
  .sbx-tablet { width: 100%; aspect-ratio: auto; padding: 8px; border-radius: 16px; }
  .sbx-screen { font-size: 10px; }
  .sbx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sbx-card:nth-child(-n + 3) { border-bottom: 0; }
  .sbx-card:nth-child(3n + 2) { border-left: 0; border-right: 0; }
  .sbx-card:nth-child(-n + 4) { border-bottom: 1px solid var(--sbx-line); }
  .sbx-card:nth-child(2n) { border-left: 1px solid var(--sbx-line); }
  .sbx-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sbx-strip__btn:nth-child(3) { display: none; }
  .sbx-band { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .sbx-band span:nth-child(2) { display: none; }
  .sbx-immos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sbx-body { padding: 0 12px 10px; }
  .sbx-head { padding: 4px 12px 8px; }
  .sbx-card { padding: 7px 8px; gap: 3px; }
  .sbx-card__icon { width: 30px; height: 30px; }
  .sbx-card__icon img { width: 18px; height: 18px; }
  .sbx-card__name { font-size: 10.5px; }
  .sbx-card__text { font-size: 9px; }
  .sbx-strip__btn { font-size: 10px; padding: 7px 4px; }
}

/* The mockup is absolutely positioned, so the laptop screen has nothing to
   size to. The pane is what holds it open. */
.kore-demo__pane[data-demo-pane="smartbox"] { min-height: 700px; }
@media (max-width: 900px) {
  .kore-demo__pane[data-demo-pane="smartbox"] { min-height: 580px; }
}
