/* =====================================================================
   NEXA — Motion layer
   =====================================================================
   Loaded AFTER style.css so it layers on top without any existing rule
   being rewritten. Everything here is additive: remove this file and the
   app still works, just without the motion.

   The whole layer is disabled under prefers-reduced-motion. Motion that
   cannot be turned off is an accessibility failure, and on a till screen
   it is also a distraction during a rush.
   ===================================================================== */

:root {
  /* One easing family, four durations. The point of tokenising these is
     that every surface in the app then moves with the same personality --
     which is what separates a designed interface from a collection of
     independently animated parts. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);      /* entrances, expansions */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);   /* moves between states */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);/* press feedback, pops */

  --dur-instant: 70ms;   /* press feedback -- must feel like the finger caused it */
  --dur-fast: 110ms;     /* hovers, small state flips */
  --dur-base: 160ms;     /* entrances, panels */
  --dur-slow: 200ms;     /* view changes, large reveals -- a POS is a live till screen; a cashier switching tabs mid-sale should never feel like they're waiting on the software */
}

/* ---------------------------------------------------------------------
   1. View transition
   Each screen fades up as it becomes active, so navigation reads as
   movement between places rather than an instant content swap.
   --------------------------------------------------------------------- */
.view.active {
  animation: nx-view-in var(--dur-slow) var(--ease-out) both;
}
@keyframes nx-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   2. Staggered card entrance
   Cards arrive in sequence rather than all at once. The delay is capped
   at the 8th card: beyond that the wait becomes noticeable and the
   effect turns from polish into lag.
   --------------------------------------------------------------------- */
.view.active .card {
  animation: nx-card-in var(--dur-base) var(--ease-out) both;
}
.view.active .card:nth-child(1) { animation-delay: 15ms; }
.view.active .card:nth-child(2) { animation-delay: 30ms; }
.view.active .card:nth-child(3) { animation-delay: 45ms; }
.view.active .card:nth-child(4) { animation-delay: 60ms; }
.view.active .card:nth-child(n+5) { animation-delay: 75ms; }
@keyframes nx-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   3. Press feedback
   The single highest-impact micro-interaction: the control visibly
   yields under the finger. Uses :active so it tracks the real press,
   including touch, with no JS.
   --------------------------------------------------------------------- */
button, .nav-item, .prod-card, .choice-btn, .qty-btn {
  transition: transform var(--dur-instant) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}
button:active, .nav-item:active, .prod-card:active,
.choice-btn:active, .qty-btn:active {
  transform: scale(0.96);
}
.primary-btn:hover:not(:disabled) { transform: translateY(-1px); }

/* A disabled button must not appear pressable -- the feedback itself is
   the promise that something will happen. */
button:disabled { transform: none !important; opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   4. Product tiles
   --------------------------------------------------------------------- */
.prod-card { transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast); }
.prod-card:hover { transform: translateY(-2px); }
/* Fires when an item lands in the cart, confirming the tap registered
   even when the cart is scrolled out of sight. */
.nx-pop { animation: nx-pop var(--dur-base) var(--ease-spring); }
@keyframes nx-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---------------------------------------------------------------------
   5. Cart line entrance
   --------------------------------------------------------------------- */
.cart-line { animation: nx-slide-in var(--dur-base) var(--ease-out) both; }
@keyframes nx-slide-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   6. Skeleton loading
   Replaces "جارٍ التحميل..." with a shape that matches the content that
   is coming, so the layout does not jump when data lands.
   --------------------------------------------------------------------- */
.nx-skeleton {
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(247, 249, 250, 0.04) 0%,
    rgba(247, 249, 250, 0.10) 50%,
    rgba(247, 249, 250, 0.04) 100%);
  background-size: 200% 100%;
  animation: nx-shimmer 1.4s linear infinite;
}
/* Direction is reversed under RTL so the sweep travels with the reading
   direction instead of against it. */
[dir="rtl"] .nx-skeleton { animation-direction: reverse; }
@keyframes nx-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.nx-skeleton-row { height: 44px; margin-bottom: 8px; }
.nx-skeleton-line { height: 12px; margin-bottom: 10px; }
.nx-skeleton-line.short { width: 45%; }

/* ---------------------------------------------------------------------
   7. Stat figures
   --------------------------------------------------------------------- */
.nx-count { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   8. Focus
   Visible, and only for keyboard users -- a persistent ring on every
   mouse click would read as a rendering fault.
   --------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------------
   9. Modals
   --------------------------------------------------------------------- */
.modal-overlay:not([hidden]) { animation: nx-fade var(--dur-fast) var(--ease-out) both; }
.modal-overlay:not([hidden]) .modal-box { animation: nx-modal-in var(--dur-base) var(--ease-spring) both; }
@keyframes nx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nx-modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   10. Row entrance for lists and tables
   --------------------------------------------------------------------- */
.nx-rows > * { animation: nx-row-in var(--dur-base) var(--ease-out) both; }
.nx-rows > *:nth-child(1) { animation-delay: 8ms; }
.nx-rows > *:nth-child(2) { animation-delay: 16ms; }
.nx-rows > *:nth-child(3) { animation-delay: 24ms; }
.nx-rows > *:nth-child(4) { animation-delay: 32ms; }
.nx-rows > *:nth-child(n+5) { animation-delay: 40ms; }
@keyframes nx-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   11. Success pulse -- confirms a save without stealing focus
   --------------------------------------------------------------------- */
.nx-success { animation: nx-success var(--dur-slow) var(--ease-out); }
@keyframes nx-success {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

/* ---------------------------------------------------------------------
   12. Reduced motion
   Everything above collapses to an instant state change. Opacity-only
   fades are kept at 1ms rather than removed so elements never get stuck
   at opacity 0 if an animation is what reveals them.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .view.active,
  .view.active .card,
  .cart-line,
  .nx-rows > *,
  .modal-overlay:not([hidden]),
  .modal-overlay:not([hidden]) .modal-box,
  .nx-pop,
  .nx-success {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
  .nx-skeleton { animation: none; }
  button, .nav-item, .prod-card, .choice-btn, .qty-btn { transition: none; }
  button:active, .nav-item:active, .prod-card:active,
  .choice-btn:active, .qty-btn:active, .primary-btn:hover { transform: none; }
}


/* =====================================================================
   Product showcase — animated demo on the sign-in page
   =====================================================================
   Four scenes that cycle on their own, drawn from DOM + CSS rather than
   a video: sharp at any size, weightless, theme-aware, and incapable of
   going out of date the way a screen recording does.

   Every colour here is derived from a theme token. The previous version
   hardcoded a white receipt, which vanished against the light theme's
   cream page -- the exact failure visible in the screenshot.
   ===================================================================== */
.showcase { margin-top: 30px; max-width: 520px; }

.showcase-frame {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 18px 50px color-mix(in srgb, var(--shadow) 60%, transparent);
}

.showcase-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.showcase-bar .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 20%, transparent);
}
.showcase-label {
  margin-inline-start: auto;
  font-size: 0.72rem; letter-spacing: 0.06em;
  color: var(--ink-dim);
}

/* Sidebar + stage, mirroring the real app's shell so the demo reads as
   the product rather than as decoration. */
.showcase-body { display: flex; height: 250px; }
.sc-nav {
  flex: 0 0 46px;
  display: flex; flex-direction: column; gap: 9px;
  padding: 14px 10px;
  border-inline-end: 1px solid var(--line);
}
.sc-nav-item {
  height: 9px; border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 13%, transparent);
}
.sc-nav-item.is-on { background: var(--copper); }

.showcase-stage { position: relative; flex: 1; }

.scene {
  position: absolute; inset: 0;
  padding: 14px;
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out),
    visibility 0s linear var(--dur-base);
}
.scene.is-active {
  opacity: 1; visibility: visible; transform: none;
  transition-delay: 0s;
}

/* ---- Scene 1 · point of sale ---- */
.scene-pos { display: flex; gap: 10px; }
.s-grid {
  flex: 1.25;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
  align-content: start;
}
.s-tile {
  height: 50px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem; color: var(--ink-dim);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--line);
}
/* Tiles light up in sequence, as if being tapped. */
.is-active .s-tile:nth-child(2),
.is-active .s-tile:nth-child(5),
.is-active .s-tile:nth-child(3) { animation: nx-tile-tap 4s var(--ease-out) infinite; }
.is-active .s-tile:nth-child(5) { animation-delay: 0.6s; }
.is-active .s-tile:nth-child(3) { animation-delay: 1.2s; }
@keyframes nx-tile-tap {
  0%, 7%   { background: color-mix(in srgb, var(--copper) 28%, transparent);
             border-color: var(--copper); color: var(--ink); transform: scale(0.96); }
  22%,100% { background: color-mix(in srgb, var(--ink) 6%, transparent);
             border-color: var(--line); color: var(--ink-dim); transform: none; }
}

.s-cart {
  flex: 1;
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px; border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
.s-head { font-size: 0.7rem; color: var(--ink-dim); }
.s-line {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.68rem; color: var(--ink);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.s-line i { font-style: normal; opacity: 0.85; }
.is-active .s-line { animation: nx-row-in var(--dur-base) var(--ease-out) both; }
.is-active .s-line:nth-child(3) { animation-delay: 0.6s; }
.is-active .s-line:nth-child(4) { animation-delay: 1.2s; }
.s-total {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.76rem; padding-top: 8px;
}
.s-amount { color: var(--copper); font-variant-numeric: tabular-nums; font-size: 0.92rem; }

/* ---- Scene 2 · printing ---- */
.scene-print { display: flex; flex-direction: column; align-items: center; }
.s-printer {
  width: 172px; height: 30px;
  border-radius: 7px 7px 3px 3px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  border: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px;
}
.s-slot {
  width: 130px; height: 4px; border-radius: 2px;
  background: color-mix(in srgb, var(--bg) 85%, #000);
}
/* Paper is always lighter than the surrounding surface, in BOTH themes:
   mixing toward white keeps it readable on a cream page instead of
   disappearing into it. */
.s-receipt {
  width: 146px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--panel) 30%, #ffffff);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 5px 5px;
}
.is-active .s-receipt { animation: nx-print 3.6s var(--ease-out) infinite; }
@keyframes nx-print {
  0%      { clip-path: inset(0 0 100% 0); }
  55%,90% { clip-path: inset(0 0 0 0); }
  100%    { clip-path: inset(0 0 100% 0); }
}
.r-title {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.24em;
  text-align: center; color: #1a1a1a;
}
.r-line { height: 5px; border-radius: 3px; background: #c4cace; }
.r-line.w60 { width: 60%; margin: 0 auto; }
.r-rule { height: 1px; background: #d6dbdf; }
.r-row { display: flex; justify-content: space-between; gap: 8px; }
.r-row i { height: 5px; width: 58%; border-radius: 3px; background: #c4cace; }
.r-row b { height: 5px; width: 24%; border-radius: 3px; background: #c4cace; }
.r-total {
  text-align: center; font-size: 0.72rem; font-weight: 800;
  color: #111; font-variant-numeric: tabular-nums;
}

/* ---- Scene 3 · reports ---- */
.scene-chart { display: flex; flex-direction: column; gap: 10px; }
.s-kpi { display: flex; flex-direction: column; gap: 1px; }
.k-val {
  font-size: 1.5rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.k-cap { font-size: 0.68rem; color: var(--ink-dim); }
.k-delta { font-size: 0.68rem; color: var(--ok); margin-top: 2px; }

.s-bars { display: flex; align-items: flex-end; gap: 7px; flex: 1; min-height: 0; }
.s-bars span {
  flex: 1; height: var(--h);
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--copper), color-mix(in srgb, var(--copper) 30%, transparent));
  transform-origin: bottom;
}
/* Bars grow from the baseline in sequence -- the detail that makes a
   chart feel alive rather than drawn. */
.is-active .s-bars span { animation: nx-bar-grow var(--dur-slow) var(--ease-out) both; }
.is-active .s-bars span:nth-child(1) { animation-delay: 0.05s; }
.is-active .s-bars span:nth-child(2) { animation-delay: 0.11s; }
.is-active .s-bars span:nth-child(3) { animation-delay: 0.17s; }
.is-active .s-bars span:nth-child(4) { animation-delay: 0.23s; }
.is-active .s-bars span:nth-child(5) { animation-delay: 0.29s; }
.is-active .s-bars span:nth-child(6) { animation-delay: 0.35s; }
.is-active .s-bars span:nth-child(7) { animation-delay: 0.41s; }
@keyframes nx-bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---- Scene 4 · verticals ---- */
.scene-verticals {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-content: center; justify-content: center;
}
.v-chip {
  padding: 9px 14px; border-radius: 99px;
  border: 1px solid var(--line); font-size: 0.8rem;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.is-active .v-chip { animation: nx-chip-in var(--dur-base) var(--ease-spring) both; }
.is-active .v-chip:nth-child(1) { animation-delay: 0.05s; }
.is-active .v-chip:nth-child(2) { animation-delay: 0.12s; }
.is-active .v-chip:nth-child(3) { animation-delay: 0.19s; }
.is-active .v-chip:nth-child(4) { animation-delay: 0.26s; }
.is-active .v-chip:nth-child(5) { animation-delay: 0.33s; }
.is-active .v-chip:nth-child(6) { animation-delay: 0.40s; }
@keyframes nx-chip-in {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to   { opacity: 1; transform: none; }
}

.showcase-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.s-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  transition: width var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.s-dot.is-on { width: 22px; border-radius: 99px; background: var(--copper); }

@media (max-width: 760px) {
  .showcase { max-width: 100%; }
  .showcase-body { height: 215px; }
}

/* Scene 4 · business types — a real settings list, not emoji chips */
.scene-verticals { display: flex; flex-direction: column; gap: 5px; }
.v-head {
  font-size: 0.68rem; letter-spacing: 0.1em;
  color: var(--ink-dim); margin-bottom: 3px;
}
.v-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 7px;
  font-size: 0.74rem; color: var(--ink);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.v-row.is-on {
  border-color: var(--copper);
  background: color-mix(in srgb, var(--copper) 14%, transparent);
}
.v-row i {
  font-style: normal; font-size: 0.64rem;
  color: var(--copper); letter-spacing: 0.06em;
}
.v-note {
  margin-top: auto; font-size: 0.64rem;
  color: var(--ink-dim); line-height: 1.5;
}
.is-active .v-row { animation: nx-row-in var(--dur-base) var(--ease-out) both; }
.is-active .v-row:nth-child(2) { animation-delay: 0.05s; }
.is-active .v-row:nth-child(3) { animation-delay: 0.11s; }
.is-active .v-row:nth-child(4) { animation-delay: 0.17s; }
.is-active .v-row:nth-child(5) { animation-delay: 0.23s; }
.is-active .v-row:nth-child(6) { animation-delay: 0.29s; }
