/*
 * sattle.me point of sale, as a phone on the website.
 * Mirrors the app's mobile screens (new-app: src/app/(app)/pos/index.tsx and charge.tsx) and its
 * tokens (src/theme/tokens.ts, typography.ts): cream ground, ink text, orange primary fill, umber
 * accent text, settled green, Plus Jakarta Sans and JetBrains Mono. Demonstration only.
 */

.sm-device {
  --s: 0.8;
  --app-cream: #faf6ee;
  --app-white: #ffffff;
  --app-sand: #f2ece0;
  --app-ink: #0b1a33;
  --app-stone: #6e675e;
  --app-stone-light: #8a837a;
  --app-orange: #f7931a;
  --app-orange-pressed: #e08414;
  --app-umber: #8f5300;
  --app-ink05: rgba(11, 26, 51, 0.05);
  --app-ink10: rgba(11, 26, 51, 0.1);
  --app-ink14: rgba(11, 26, 51, 0.14);
  --app-open-fg: #8f5300;
  --app-open-bg: #fcebd5;
  --app-open-dot: #f7931a;
  --app-settled-fg: #1f6b45;
  --app-settled-bg: #dcede2;
  --app-settled-dot: #2e9c64;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  position: relative;
  width: calc(414px * var(--s));
  height: calc(866px * var(--s));
  flex: none;
}

.sm-device__body {
  position: absolute;
  inset: 0 auto auto 0;
  width: 414px;
  height: 866px;
  transform: scale(var(--s));
  transform-origin: top left;
  border-radius: 64px;
  background: linear-gradient(145deg, #3a3d44 0%, #17191d 38%, #24272d 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.14),
    inset 0 0 0 4px #0d0e10,
    0 2px 4px rgba(0, 0, 0, 0.16),
    0 28px 60px -12px rgba(0, 0, 0, 0.36),
    0 60px 120px -40px rgba(0, 0, 0, 0.28);
}

/* Side buttons. */
.sm-device__body::before,
.sm-device__body::after {
  content: "";
  position: absolute;
  width: 4px;
  border-radius: 2px;
  background: #2b2e34;
}
.sm-device__body::before {
  left: -3px;
  top: 178px;
  height: 64px;
  box-shadow: 0 86px 0 #2b2e34;
}
.sm-device__body::after {
  right: -3px;
  top: 232px;
  height: 104px;
}

.sm-screen {
  position: absolute;
  inset: 12px;
  border-radius: 52px;
  overflow: hidden;
  background: var(--app-cream);
  color: var(--app-ink);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

.sm-island {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 122px;
  height: 36px;
  margin-left: -61px;
  border-radius: 20px;
  background: #050505;
  z-index: 5;
}

.sm-status {
  position: relative;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 30px 0 44px;
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
  z-index: 4;
}
.sm-status__icons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.sm-status svg {
  display: block;
  fill: currentColor;
}

/* Header (PosFrame, mobile): 64 high, title centred, an action each side. */
.sm-header {
  height: 64px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding: 0 8px;
}
.sm-header__title {
  text-align: center;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-iconbtn {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--app-ink);
  cursor: pointer;
  transition:
    opacity 220ms var(--ease-out),
    background-color 140ms linear;
}
.sm-iconbtn:hover {
  background: var(--app-ink05);
}
.sm-iconbtn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}
.sm-iconbtn[hidden] {
  display: grid;
  visibility: hidden;
}

/* Views: amount, invoice, paid. Stacked, one shown. */
.sm-views {
  position: absolute;
  inset: 118px 0 0 0;
}
.sm-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 22px 34px;
  transition: opacity 220ms var(--ease-out);
}
.sm-view[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 160ms linear,
    visibility 0s linear 160ms;
}

/* Amount block. */
.sm-amount {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.sm-amount__line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
}
.sm-amount__figure {
  display: inline-flex;
  font-weight: 700;
  font-size: var(--amount-size, 76px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sm-amount__figure span {
  display: inline-block;
}
.sm-amount__figure .is-new {
  animation: sm-rise 260ms var(--ease-out) 90ms both;
}
.sm-amount__currency {
  font-weight: 600;
  font-size: 22px;
  color: var(--app-stone);
}
.sm-sats {
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  color: var(--app-stone);
  font-weight: 500;
}
.sm-sats b {
  font-weight: 700;
  color: var(--app-ink);
}
.sm-sats__figure {
  white-space: pre;
}
.sm-sats__unit {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13.5px;
}

.sm-note {
  align-self: center;
  margin: 10px 0 0;
  padding: 0 12px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--app-umber);
  font: 600 15px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  border-radius: 22px;
  cursor: default;
}

.sm-push {
  flex: 1;
}

/* Keypad: four rows of three keys, 72 high, radius 24, sand while pressed. */
.sm-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.sm-key {
  height: 72px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--app-ink);
  font: 600 28px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 140ms linear;
  -webkit-tap-highlight-color: transparent;
}
.sm-key:hover {
  background: var(--app-ink05);
}
.sm-key:active,
.sm-key.is-pressed {
  background: var(--app-sand);
}
.sm-key svg {
  width: 24px;
  height: 22px;
  fill: var(--app-stone);
}

/* Buttons: pill, 64 high, the one primary fill per screen. */
.sm-button {
  position: relative;
  width: 100%;
  height: 64px;
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--app-orange);
  box-shadow: inset 0 0 0 1px rgba(143, 83, 0, 0.35);
  color: #fff;
  font: 700 17px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 0 rgba(143, 83, 0, 0.55);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition:
    background-color 140ms linear,
    transform 140ms var(--ease-out);
}
.sm-button:hover {
  background: var(--app-orange-pressed);
}
.sm-button:active {
  transform: scale(0.985);
}
.sm-button:disabled {
  background: var(--app-sand);
  box-shadow: none;
  color: var(--app-stone);
  text-shadow: none;
  cursor: not-allowed;
}
.sm-button__caption {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.sm-button__figure {
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}
.sm-button__ring {
  position: absolute;
  right: 22px;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
}
.sm-button__ring circle {
  fill: none;
  stroke-width: 2.5;
}
.sm-button__ring .track {
  stroke: rgba(255, 255, 255, 0.35);
}
.sm-button__ring .arc {
  stroke: #fff;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Invoice (02 Attente de paiement). */
.sm-invoice {
  align-items: center;
  gap: 16px;
  padding-top: 6px;
}
.sm-invoice .sm-amount {
  --amount-size: 52px;
}
.sm-plate {
  position: relative;
  box-sizing: border-box;
  width: 248px;
  height: 248px;
  padding: 15px;
  border: 1px solid var(--app-ink10);
  border-radius: 22px;
  background: var(--app-white);
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.2);
}
.sm-plate svg {
  display: block;
  width: 216px;
  height: 216px;
  transition: filter 300ms var(--ease-out), opacity 300ms var(--ease-out);
}
.sm-plate.is-creating svg {
  filter: blur(8px);
  opacity: 0.4;
}
.sm-invite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.sm-invite__scan {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--app-stone);
}
.sm-invite__nets {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
}
.sm-invite__nets span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sm-invite__nets em {
  font-style: normal;
  font-weight: 500;
  color: var(--app-stone);
}
.sm-invite__nets svg {
  width: 17px;
  height: 17px;
}
/* As BoltCardReader.tsx: a 32 px mark, 11 px apart, label at type.label (13.5), 44 px high. */
.sm-invite__card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--app-stone);
}
.sm-invite__card svg {
  flex: none;
  width: 32px;
  height: 32px;
}
.sm-countdown {
  width: 100%;
  display: grid;
  gap: 9px;
}
.sm-countdown__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--app-stone);
}
.sm-countdown__row b {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--app-ink);
}
.sm-countdown__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--app-sand);
  overflow: hidden;
}
.sm-countdown__bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--app-orange);
  transform-origin: left center;
  transition: transform 1s linear;
}
.sm-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--app-ink);
}
.sm-waiting i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--app-orange);
  animation: sm-pulse 1600ms ease-in-out infinite;
}

/* Paid (03 Paiement détecté). */
.sm-paid {
  align-items: center;
  text-align: center;
  padding-top: 70px;
}
.sm-disc {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--app-settled-bg);
  display: grid;
  place-items: center;
}
.sm-disc svg {
  width: 38px;
  height: 38px;
  fill: var(--app-settled-fg);
}
.sm-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  padding: 0 13px;
  height: 30px;
  border-radius: 999px;
  background: var(--app-settled-bg);
  color: var(--app-settled-fg);
  font-size: 13.5px;
  font-weight: 700;
}
.sm-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--app-settled-dot);
}
.sm-paid .sm-amount {
  --amount-size: 52px;
  margin-top: 24px;
}
.sm-detail {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--app-stone);
}
.sm-paid .sm-button {
  margin-top: 0;
}
.sm-view.is-arriving > * {
  animation: sm-rise 300ms var(--ease-out) both;
}
.sm-view.is-arriving > :nth-child(1) {
  animation: sm-disc 460ms var(--ease-out) 240ms both;
}
.sm-view.is-arriving > :nth-child(2) {
  animation-delay: 500ms;
}
.sm-view.is-arriving > :nth-child(3) {
  animation-delay: 535ms;
}
.sm-view.is-arriving > :nth-child(4) {
  animation-delay: 570ms;
}
.sm-view.is-arriving > :nth-child(6) {
  animation-delay: 605ms;
}

.sm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sm-screen :focus-visible {
  outline: 3px solid var(--app-orange);
  outline-offset: 2px;
}

@keyframes sm-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes sm-disc {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes sm-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sm-amount__figure .is-new,
  .sm-view.is-arriving > * {
    animation-name: sm-fade;
  }
  .sm-waiting i {
    animation: none;
  }
}
@keyframes sm-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
