/* Motion (October 2026 redesign), matching Shift-Wall's motion.css: every moving part in one place. Loaded after
   redesign.css. Only opacity and movement are animated (smooth on older kiosk tablets, no blur); entrances ease out
   fast and settle softly; small confirmations get a little spring. The individual translate/scale properties are
   used so animations never fight an element's own transform. Switched off for people who ask for reduced motion. */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.45, .64, 1);
  --ease-in: cubic-bezier(.5, 0, .75, 0);
}

@keyframes mo-fade { from { opacity: 0; } }
@keyframes mo-fade-out { to { opacity: 0; } }
@keyframes mo-rise { from { opacity: 0; translate: 0 12px; } }
@keyframes mo-drop { from { opacity: 0; translate: 0 -10px; } }
@keyframes mo-from-left { from { opacity: 0; translate: -18px 0; } }
@keyframes mo-card { from { opacity: 0; translate: 0 14px; scale: .97; } }
@keyframes mo-pop { from { opacity: 0; scale: .5; } }
@keyframes mo-bump { 0% { scale: 1; } 40% { scale: 1.25; } 100% { scale: 1; } }
@keyframes mo-modal-in { from { opacity: 0; translate: 0 18px; scale: .96; } }
@keyframes mo-modal-out { to { opacity: 0; translate: 0 10px; scale: .97; } }
@keyframes mo-ring { from { box-shadow: 0 0 0 0 var(--tone-edge, var(--primary)); } to { box-shadow: 0 0 0 16px transparent; } }
@keyframes mo-wash { from { translate: -100% 0; opacity: 1; } to { translate: 100% 0; opacity: 1; } }
@keyframes mo-big-pop { 0% { opacity: 0; scale: .4; } 60% { opacity: 1; scale: 1.08; } 100% { scale: 1; } }
@keyframes mo-wave { from { opacity: .5; scale: 1; } to { opacity: 0; scale: 1.9; } }
@keyframes mo-draw { to { stroke-dashoffset: 0; } }
@keyframes mo-breathe { 50% { opacity: .45; } }
@keyframes mo-focus { from { outline-offset: 7px; outline-color: transparent; } }
@keyframes mo-reveal { from { clip-path: circle(0 at var(--mo-x, 50%) var(--mo-y, 0%)); } to { clip-path: circle(var(--mo-r, 150vmax) at var(--mo-x, 50%) var(--mo-y, 0%)); } }

/* Opening: the header settles from above, the bar of counters follows. Switching kiosk/admin fades the view in. */
.app-header { animation: mo-drop .5s var(--ease-out) backwards; }
.kiosk-subbar { animation: mo-fade .5s ease-out .1s backwards; }
#view-kiosk, #view-admin { animation: mo-fade .35s ease-out; }

/* Kiosk name cards: they arrive one by one (first load, filter or search), lift under a finger, press in. */
#employee-grid.is-entering .employee-card { animation: mo-card .55s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 35ms + var(--entered, 0ms)); }
.employee-card { transition: transform .3s var(--ease-out), border-color .2s ease, box-shadow .3s var(--ease-out); }
@media (hover: hover) { .employee-card:hover { transform: translateY(-3px); box-shadow: 0 18px 32px -20px rgb(18 32 51 / 50%); } }
.employee-card:active { transform: scale(.985); transition-duration: .08s; }
.employee-card .avatar { transition: scale .35s var(--ease-spring); }
@media (hover: hover) { .employee-card:hover .avatar { scale: 1.06; } }
/* Someone just signed in or out: their colour washes over the card, a ring leaves the initials, the status updates. */
.employee-card.just-changed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in oklch, var(--tone-edge, var(--primary)) 18%, transparent) 50%, transparent 80%);
  opacity: 0;
  animation: mo-wash 1.2s var(--ease-out) calc(.1s + var(--changed, 0ms));
  pointer-events: none;
}
.employee-card.just-changed .avatar { animation: mo-ring .7s var(--ease-out) var(--changed, 0ms) 2; }
.employee-card.just-changed .card-status-row > * { animation: mo-from-left .5s var(--ease-out) calc(.15s + var(--changed, 0ms)) backwards; }
.employee-card.just-changed .card-action-btn { animation: mo-fade .5s ease-out calc(.25s + var(--changed, 0ms)) backwards; }
/* Working right now: the green dot breathes slowly. */
.status-tag.in .indicator-dot, .stat-pill.in .indicator-dot { animation: mo-breathe 2.6s ease-in-out infinite; }
/* A counter that changes gives a small bounce. */
.stat-pill .is-bumped { display: inline-block; animation: mo-bump .45s var(--ease-spring); }
.filter-btn { transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease; }

/* Pop-ups: they rise and settle and their contents follow a beat later; closing, a copy sinks away (see app.js). */
.modal-backdrop { animation: mo-fade .3s ease-out; backdrop-filter: none; }
.modal-backdrop .modal-content { animation: mo-modal-in .45s var(--ease-out); }
.modal-backdrop .modal-body > *, .modal-backdrop .modal-footer { animation: mo-rise .5s var(--ease-out) backwards; }
.modal-backdrop .modal-body > :nth-child(1) { animation-delay: .05s; }
.modal-backdrop .modal-body > :nth-child(2) { animation-delay: .09s; }
.modal-backdrop .modal-body > :nth-child(3) { animation-delay: .13s; }
.modal-backdrop .modal-body > :nth-child(n + 4), .modal-backdrop .modal-footer { animation-delay: .17s; }
.modal-backdrop.is-closing { animation: mo-fade-out .22s ease-in forwards; pointer-events: none; }
.modal-backdrop.is-closing .modal-content { animation: mo-modal-out .22s var(--ease-in) forwards; }
.modal-backdrop.is-closing .modal-body > *, .modal-backdrop.is-closing .modal-footer,
.modal-backdrop.is-closing .feedback-screen > *, .modal-backdrop.is-closing .feedback-icon-wrap::after { animation: none; }
#modal-avatar { animation: mo-pop .5s var(--ease-spring) .1s backwards; }

/* PIN: each dot pops in, the keys press in. */
.pin-digit { transition: border-color .2s ease, background-color .2s ease; }
.pin-digit.filled { animation: mo-pop .32s var(--ease-spring); }
.keypad-key:active { scale: .93; transition-duration: .06s; }

/* Signed in or out: the icon springs up with a ripple, the tick draws itself, then the words follow. */
.feedback-screen > * { animation: mo-rise .5s var(--ease-out) backwards; }
.feedback-screen > :nth-child(2) { animation-delay: .22s; }
.feedback-screen > :nth-child(3) { animation-delay: .28s; }
.feedback-screen > :nth-child(4) { animation-delay: .34s; }
.feedback-screen > :nth-child(n + 5) { animation-delay: .4s; }
.feedback-screen .feedback-icon-wrap { position: relative; isolation: isolate; animation: mo-big-pop .6s var(--ease-out); }
.feedback-icon-wrap::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: currentColor; opacity: 0; animation: mo-wave .9s var(--ease-out) .2s; pointer-events: none; }
.feedback-icon-wrap.in path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: mo-draw .45s ease-out .3s forwards; }
.feedback-icon-wrap.out svg { animation: mo-from-left .5s var(--ease-out) .25s backwards; }

/* Buttons: a small lift on hover and a press; the main buttons catch the light. */
.btn, .card-action-btn { transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .3s var(--ease-out), transform .3s var(--ease-out); }
@media (hover: hover) {
  .btn:hover:not(:disabled) { transform: translateY(-1px); }
  .btn-primary:hover:not(:disabled), #modal-confirm-btn:hover { box-shadow: 0 10px 22px -12px rgb(31 95 181 / 70%); }
}
.btn:active:not(:disabled), .card-action-btn:active { transform: scale(.97); transition-duration: .08s; }
.btn-primary, #modal-confirm-btn, .card-action-btn.in-btn { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::after, #modal-confirm-btn::after, .card-action-btn.in-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 26%) 50%, transparent 70%);
  translate: -110% 0;
  pointer-events: none;
}
@media (hover: hover) {
  .btn-primary:hover:not(:disabled)::after, #modal-confirm-btn:hover::after, .employee-card:hover .card-action-btn.in-btn::after { translate: 110% 0; transition: translate .75s var(--ease-out); }
}
:focus-visible { animation: mo-focus .3s var(--ease-out); }

/* Admin: the menu slides in once; each section rises when opened and its rows arrive in order (see admin.js). */
@media (min-width: 1025px) { .admin-sidebar { animation: mo-from-left .6s var(--ease-out) backwards; } }
.admin-sidebar .nav-item svg { transition: translate .35s var(--ease-spring); }
@media (hover: hover) { .admin-sidebar .nav-item:hover svg { translate: 2px 0; } }
.admin-section { animation: mo-rise .45s var(--ease-out); }
.admin-section > * { animation: mo-rise .5s var(--ease-out) backwards; }
.admin-section > :nth-child(2) { animation-delay: .05s; }
.admin-section > :nth-child(3) { animation-delay: .1s; }
.admin-section > :nth-child(n + 4) { animation-delay: .15s; }
.admin-section.is-entering tbody tr, .admin-section.is-entering .stat-card { animation: mo-rise .45s var(--ease-out) backwards; }
.admin-section.is-entering :is(tbody tr, .stat-card):nth-child(2) { animation-delay: .04s; }
.admin-section.is-entering :is(tbody tr, .stat-card):nth-child(3) { animation-delay: .08s; }
.admin-section.is-entering :is(tbody tr, .stat-card):nth-child(4) { animation-delay: .12s; }
.admin-section.is-entering :is(tbody tr, .stat-card):nth-child(n + 5) { animation-delay: .16s; }
.admin-main .stat-card { transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out); }
@media (hover: hover) { .admin-main .stat-card:hover { transform: translateY(-2px); } }
.sidebar-count { animation: mo-pop .45s var(--ease-spring) .3s backwards; }

/* Light and dark: the new look spreads out from where you tapped (js/theme.js starts it). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: mo-reveal .65s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Feedback for admin actions (js/admin/feedback.js), as in Shift-Wall: a tick or a shake on the pressed button and a
   short message at the bottom of the screen instead of a browser alert box. */
@keyframes fb-tick { 0% { opacity: 0; scale: .85; } 14% { opacity: 1; scale: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fb-shake { 0%, 100% { translate: 0 0; } 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
:where([data-feedback]) { position: relative; }
.fb-tick {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
  background: var(--success); color: #ffffff; pointer-events: none;
  animation: fb-tick 1.1s var(--ease-out) forwards;
}
.fb-tick svg { animation: mo-pop .45s var(--ease-spring) .05s backwards; }
[data-feedback="failed"] { animation: fb-shake .45s ease; box-shadow: 0 0 0 2px var(--danger); }
.admin-toast {
  position: fixed; z-index: 1000; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  translate: -50% 0; width: max-content; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 14px; background: var(--navy); color: #ffffff;
  box-shadow: 0 12px 32px -12px rgb(18 32 51 / 55%); font-size: 14px; line-height: 1.4;
  animation: mo-rise .45s var(--ease-spring);
}
.admin-toast.is-error { background: var(--danger); }
.admin-toast[hidden] { display: none; }
/* Above the phone and tablet tab bar. */
@media (max-width: 1366px) { body.admin-view .admin-toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }
/* Wide screens: centred under the page, beside the side menu. */
@media (min-width: 1367px) { body.admin-view .admin-toast { left: calc(50% + 146px); } }
