/* ---------- Admin motion ----------
   How the staff screens move (AdminLayout, the sign-in) on every device that opens
   them - the kiosks, an iPad, a phone, a computer. Loaded after app.css and
   kiosk-motion.css (App.razor), on every page but the public landing page.

   Staff open these pages dozens of times a shift, so the motion is short and never in
   the way: a page settles in under a fifth of a second, only the first few things on it
   are staggered (a few hundredths apart), and nothing waits on an animation to be tapped.
   (2026-11-09, the owner: "make everything instantaneously work" - and then "make the
   animation and motion work": the same motion, quicker - every entrance 0.12-0.24s.) Everything enters
   with fill "backwards" - it holds its first frame through its delay and then hands
   the element back to its own styles. A live update (a new order) doesn't replay a
   page; only what's new arrives. Windows close with motion too (js/admin-motion.js). */

/* ---------- A page arrives ---------- */
/* The page's own parts - not a window opened over it: windows sit in the page too, and
   caught here they first waited out the page's stagger (the dish window took half a
   second to come up). They have their own motion, below. */
.admin-content > :not(.modal-backdrop-custom, .editor-backdrop, .order-editor, .loading-row) { animation: admin-in .18s var(--ease-out) backwards; }
.admin-content > :nth-child(2):not(.modal-backdrop-custom, .editor-backdrop, .order-editor, .loading-row) { animation-delay: .02s; }
.admin-content > :nth-child(3):not(.modal-backdrop-custom, .editor-backdrop, .order-editor, .loading-row) { animation-delay: .03s; }
.admin-content > :nth-child(n + 4):not(.modal-backdrop-custom, .editor-backdrop, .order-editor, .loading-row) { animation-delay: .04s; }

/* "טוען..." only when loading really takes a moment: it waits a beat first, so a page
   that loads at once never flashes it. */
.admin-content .loading-row { animation: admin-in .2s var(--ease-out) .25s backwards; }

/* Going to another page (js/admin-nav.js): the page you're leaving stays as it is - no grey
   film over it (the owner's recording, 2026-11-09: "the shadow") - and when it takes a moment
   the gold line below runs along the top until the new one is there. */
html.admin-navigating .admin-busy-bar { opacity: 1; transition: opacity .12s ease .12s; }
/* The page you're leaving, held where it was until the next one is here (js/admin-nav.js) -
   under the phone's top bar, still: nothing in it moves or takes a tap. */
.admin-held { position: fixed; top: 0; bottom: 0; z-index: 10; overflow: hidden; pointer-events: none; background: var(--cream); }
.admin-held-page { position: absolute; top: 0; left: 0; margin: 0; }
.admin-held, .admin-held * { animation: none !important; transition: none !important; }

/* A tap waiting for the server (js/admin-busy.js): the button stays pressed in, and a thin
   gold line runs along the top of the screen the way the page reads - only when the answer
   takes more than a moment, gone the moment it comes. */
.admin-shell [data-waiting] { opacity: .7; transform: scale(.97); cursor: progress; transition: opacity .12s ease, transform .12s var(--ease-out); }
/* A small icon button barely shows dimming: it lights up the way it does under the mouse. */
.admin-shell .icon-btn[data-waiting] { opacity: 1; background-color: var(--cream-deep); color: var(--chocolate); }
.admin-shell .icon-btn.icon-btn-danger[data-waiting] { background-color: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.admin-busy-bar { position: fixed; top: 0; inset-inline: 0; z-index: 2000; height: 3px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .12s ease; }
html.admin-busy .admin-busy-bar { opacity: 1; }
.admin-busy-bar::before {
    content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 35%;
    border-radius: 0 0 3px 3px; background: var(--gold);
    animation: admin-busy .9s cubic-bezier(.65, 0, .35, 1) infinite;
}
@keyframes admin-busy {
    from { transform: translateX(calc(100% * var(--dir, 1))); }
    to { transform: translateX(calc(-300% * var(--dir, 1))); }
}
/* Reduced motion: the line is just there. */
html[data-motion="reduced"] .admin-busy-bar::before { animation: none; width: 100%; opacity: .7; }
@media (prefers-reduced-motion: reduce) { .admin-busy-bar::before { animation: none; width: 100%; opacity: .7; } }

/* The numbers at the top of a report or the dashboard: one after another, each icon
   popping as its card lands. */
.stat-cards > .stat-card { animation: admin-card-in .22s var(--ease-out) backwards; }
.stat-cards > .stat-card:nth-child(2) { animation-delay: .02s; }
.stat-cards > .stat-card:nth-child(3) { animation-delay: .04s; }
.stat-cards > .stat-card:nth-child(4) { animation-delay: .06s; }
.stat-cards > .stat-card:nth-child(n + 5) { animation-delay: .08s; }
.stat-card .stat-icon { animation: admin-icon-pop .28s cubic-bezier(.34, 1.56, .64, 1) .05s backwards; }
.stat-card { transition: transform .2s var(--ease-out), box-shadow .2s ease; }
@media (hover: hover) {
    html.mouse-on .stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -14px rgba(74, 58, 26, .35); }
}

/* Settings: section after section. */
.settings-section { animation: admin-in .2s var(--ease-out) backwards; }
.settings-section:nth-of-type(2) { animation-delay: .02s; }
.settings-section:nth-of-type(3) { animation-delay: .04s; }
.settings-section:nth-of-type(n + 4) { animation-delay: .05s; }

/* Tables: the first rows fade in when the page opens; a row that appears later (a
   new order on the board) fades in on its own - fading only: the orders board pins
   its action column, and a moving row would carry it along. (Rows marked as moved or new keep
   their own highlight - those rules are more specific.) */
table.admin-table tbody tr { animation: admin-row-in .18s var(--ease-out) backwards; }
table.admin-table tbody tr:nth-child(2) { animation-delay: .01s; }
table.admin-table tbody tr:nth-child(3) { animation-delay: .02s; }
table.admin-table tbody tr:nth-child(4) { animation-delay: .03s; }
table.admin-table tbody tr:nth-child(5) { animation-delay: .04s; }
table.admin-table tbody tr:nth-child(6) { animation-delay: .045s; }
table.admin-table tbody tr:nth-child(n + 7) { animation-delay: .05s; }
/* The orders page's long list: only what's on screen fades in. Each fading card is a
   layer of its own on an iPhone, and a whole page of them at once was more than its
   browser would hold (2026-11-08). Its rows never move up into these (none are taken
   out), so none starts a fade late. */
table.orders-list tbody tr:nth-child(n + 13) { animation: none; }

/* A message (saved, an error) slides down into place rather than appearing. */
.admin-content .alert { animation: admin-alert-in .18s var(--ease-out) backwards; }

/* "בטוח?" under a row or a card (cancel an order, delete a dish or a category) opens out
   of the row it belongs to. */
.admin-content :is(.cancel-panel, .inline-confirm) { animation: admin-drop-in .16s var(--ease-out) backwards; transform-origin: top; }

/* ---------- Windows ---------- */
/* A window over the page (the menu's dish, add-on and new-dish windows): the page dims
   quickly and the window comes up into place. No blur behind it here - the blur costs
   the iPad and the kiosk a heavy redraw on every frame, for a look nobody would miss. */
.admin-content .modal-backdrop-custom { animation: backdrop-in .12s ease-out; backdrop-filter: none; }
.admin-content .modal-sheet { animation: admin-window-in .18s var(--ease-out); }
/* A phone: up from the bottom of the screen, like the phone's own sheets. */
@media (max-width: 639px) {
    .admin-content .modal-sheet { animation: admin-sheet-up .24s var(--ease-drawer); }
}

/* The order change window ("שינוי"). */
.editor-backdrop { animation: backdrop-in .12s ease-out; }
.order-editor { animation: admin-window-in .18s var(--ease-out); }
/* Inside it, moving between the order, the dishes to add and a dish's choices: what
   opens glides in. A dish added or changed arrives in the list on its own. */
.order-editor-body > * { animation: admin-swap-in .16s var(--ease-out) backwards; }
.order-editor-body > :nth-child(2) { animation-delay: .015s; }
.order-editor-body > :nth-child(n + 3) { animation-delay: .03s; }
.order-editor-body > .loading-row { animation: admin-in .2s var(--ease-out) .25s backwards; }
.editor-lines > .editor-line { animation: admin-line-in .18s var(--ease-out) backwards; }
.editor-chip, .editor-product, .editor-stepper button, .editor-edit, .editor-remove, .editor-close {
    transition: transform .14s var(--ease-out), background-color .15s ease, border-color .15s ease, color .15s ease;
}
.editor-chip:active, .editor-product:active:not(:disabled) { transform: scale(.97); }
.editor-stepper button:active:not(:disabled), .editor-edit:active, .editor-remove:active, .editor-close:active { transform: scale(.9); }

/* ---------- Navigation ---------- */
/* The page you're on: its icon gives a small turn as it lights up. */
.admin-nav a { transition: background-color .15s ease, color .15s ease, transform .14s var(--ease-out); }
.admin-nav a:active { transform: scale(.97); }
.admin-nav a .icon { transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .15s ease; }
.admin-nav a.active .icon { animation: admin-nav-icon .42s cubic-bezier(.34, 1.56, .64, 1); }
@media (hover: hover) {
    html.mouse-on .admin-nav a:hover .icon { transform: translateX(calc(-3px * var(--dir, 1))); }
}

/* The side menu (a computer, the kiosk, an iPad across): the light behind the page you're
   on glides to the page you open, the moment you tap it. js/admin-nav.js places and shows
   it (and takes the lit link's own light off); without the script the link lights up by
   itself, as before. */
.admin-nav-pill { display: none; }
@media (min-width: 761px) {
    .admin-nav-links { position: relative; }
    .admin-nav-links a { position: relative; z-index: 1; }
    .admin-nav-pill {
        display: block; position: absolute; top: 0; inset-inline: 0; z-index: 0; height: 0;
        border-radius: var(--radius-sm); background: rgba(255, 255, 255, .14);
        box-shadow: inset 3px 0 0 var(--gold);
        pointer-events: none; opacity: 0;
        transition: transform .3s cubic-bezier(.65, 0, .35, 1), height .3s cubic-bezier(.65, 0, .35, 1), opacity .15s ease;
    }
    html[dir="rtl"] .admin-nav-pill { box-shadow: inset -3px 0 0 var(--gold); }
}

/* The phone's and the iPad's page menu: it rolls down, and its links fall into place one
   after another. Slower and softer than it was (owner, 2026-11-20: "a bit slower and
   smoother" - .18s with a curve that did nearly all of it in the first frames read as a
   snap): .45s on an even curve, so it reads as rolling down, the links 30ms apart. */
@media (max-width: 760px) {
    html.admin-nav-open .admin-nav-panel { animation: admin-nav-drop .45s cubic-bezier(.25, .46, .45, .94); transform-origin: top; }
    html.admin-nav-open .admin-nav-panel :is(.admin-nav-links, .admin-nav-foot) > * { animation: admin-in .36s cubic-bezier(.22, .61, .36, 1) backwards; }
    html.admin-nav-open .admin-nav-panel .admin-nav-links > :nth-child(1) { animation-delay: .04s; }
    html.admin-nav-open .admin-nav-panel .admin-nav-links > :nth-child(2) { animation-delay: .07s; }
    html.admin-nav-open .admin-nav-panel .admin-nav-links > :nth-child(3) { animation-delay: .1s; }
    html.admin-nav-open .admin-nav-panel .admin-nav-links > :nth-child(4) { animation-delay: .13s; }
    html.admin-nav-open .admin-nav-panel .admin-nav-links > :nth-child(5) { animation-delay: .16s; }
    html.admin-nav-open .admin-nav-panel .admin-nav-links > :nth-child(n + 6) { animation-delay: .19s; }
    html.admin-nav-open .admin-nav-panel .admin-nav-foot > * { animation-delay: .22s; }
    html.admin-nav-open .admin-nav-backdrop { animation: backdrop-in .3s ease-out; }
}

/* Jump links (the menu's categories, the settings' parts) and the information pages' tabs. */
.page-jump a, .pages-tab { transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .14s var(--ease-out); }
.page-jump a:active, .pages-tab:active { transform: scale(.96); }
.admin-quick-btn { transition: background-color .15s ease, border-color .15s ease, transform .14s var(--ease-out); }
.admin-quick-btn:active { transform: scale(.98); }

/* ---------- Swiping back (js/admin-swipe-back.js) ----------
   The round arrow that follows a sideways swipe in from the side it comes from, growing
   as it comes; it fills gold once letting go would go back, and slides on out when it
   does. Its place is set by the script on every move (--swipe-x, --swipe-p), so it has
   no transition while the finger is on it - only on the way in, out and back. */
.swipe-back {
    position: fixed;
    top: 50%;
    z-index: 1200;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface);
    color: var(--chocolate);
    box-shadow: 0 10px 26px -10px rgba(74, 58, 26, .5), 0 0 0 1px rgba(74, 58, 26, .08);
    pointer-events: none;
    opacity: 0;
    transform: translateX(var(--swipe-x, 0)) scale(calc(.7 + .3 * var(--swipe-p, 0)));
    transition: opacity .2s ease, transform .3s var(--ease-out), background-color .15s ease, color .15s ease;
}
.swipe-back[data-side="left"] { left: 0; }
.swipe-back[data-side="right"] { right: 0; }
.swipe-back[data-side="right"] svg { transform: scaleX(-1); }
.swipe-back[data-active] { opacity: calc(.35 + .65 * var(--swipe-p, 0)); transition: background-color .15s ease, color .15s ease; }
.swipe-back[data-armed] { background: var(--gold); color: var(--surface); }
.swipe-back[data-armed] svg { animation: swipe-back-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
.swipe-back[data-side="right"][data-armed] svg { animation-name: swipe-back-pop-mirrored; }
/* Going back: on across, the way the finger went. */
.swipe-back[data-gone] { opacity: 0; background: var(--gold); color: var(--surface); }
.swipe-back[data-gone][data-side="left"] { transform: translateX(48px) scale(1); }
.swipe-back[data-gone][data-side="right"] { transform: translateX(-48px) scale(1); }
@keyframes swipe-back-pop { 50% { transform: scale(1.3); } }
@keyframes swipe-back-pop-mirrored { from { transform: scaleX(-1); } 50% { transform: scale(-1.3, 1.3); } to { transform: scaleX(-1); } }

/* ---------- Controls ---------- */
/* Switches snap across with a little give. */
.addon-toggle-track::after { transition: transform .32s cubic-bezier(.34, 1.56, .64, 1); }
.icon-btn { transition: transform .14s var(--ease-out), background-color .15s ease; }
.icon-btn:active { transform: scale(.92); }

/* ---------- Staff sign-in ---------- */
/* The card rises (app.css), then the logo, the title, the accounts and the form, in turn. */
.login-card > * { animation: admin-in .36s var(--ease-out) backwards; }
.login-card > .login-logo { animation: admin-logo-in .55s cubic-bezier(.34, 1.56, .64, 1) .05s backwards; }
.login-card > :nth-child(2) { animation-delay: .08s; }
.login-card > :nth-child(3) { animation-delay: .12s; }
.login-card > :nth-child(4) { animation-delay: .16s; }
.login-card > :nth-child(n + 5) { animation-delay: .2s; }
.login-account { transition: transform .14s var(--ease-out), border-color .15s ease, background-color .15s ease; }
.login-account:active { transform: scale(.98); }
.login-form .field input { transition: border-color .15s ease, box-shadow .2s ease; }
.login-form .field input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }

/* ---------- Finishing motion (js/admin-flair.js, 2026-11-10) ---------- */
/* A number card's value rolls up into place - as the page opens, and again when it
   changes (a new order, a refund). */
.stat-card .stat-value { animation: admin-roll .4s var(--ease-out) .08s backwards; }
.stat-card .stat-value[data-roll] { animation: admin-roll .38s var(--ease-out); }

/* Scrolled past the page's title: a slim bar with it, over the page; a tap goes back up. */
.admin-title-bar {
    position: fixed; top: 0; z-index: 40;
    padding: 11px 36px;
    font-weight: 700; font-size: 1rem; color: var(--ink);
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 18px -14px rgba(74, 58, 26, .5);
    cursor: pointer;
    transform: translateY(-100%); opacity: 0; pointer-events: none;
    transition: transform .28s var(--ease-out), opacity .2s ease;
}
.admin-title-bar[data-shown] { transform: none; opacity: 1; pointer-events: auto; }

/* A row of tabs: one light behind the chosen tab, gliding to the next. */
[role="tablist"][data-pill] { position: relative; isolation: isolate; }
[role="tablist"][data-pill]::before {
    content: ""; position: absolute; z-index: -1; top: 0; left: 0;
    width: var(--pill-w); height: var(--pill-h);
    transform: translate(var(--pill-x), var(--pill-y));
    border-radius: 999px; background: var(--accent);
}
[role="tablist"][data-pill="glide"]::before { transition: transform .34s var(--ease-out), width .34s var(--ease-out), height .34s var(--ease-out); }
[role="tablist"][data-pill] .pages-tab { background: transparent; transition: color .2s ease; }
[role="tablist"][data-pill] .pages-tab.active { background: transparent; border-color: transparent; }

/* "Saved": a check draws itself at the message's start. */
.admin-content .alert-success { position: relative; padding-inline-start: 46px; }
.admin-content .alert-success::before {
    content: ""; position: absolute; inset-inline-start: 14px; top: 12px;
    width: 20px; height: 20px; border-radius: 50%; background: var(--success);
    animation: admin-icon-pop .32s cubic-bezier(.34, 1.56, .64, 1) .05s backwards;
}
.admin-content .alert-success::after {
    content: ""; position: absolute; inset-inline-start: 21px; top: 15px;
    width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: admin-check-draw .26s var(--ease-out) .22s backwards;
}

/* ---------- Keyframes ---------- */
@keyframes admin-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes admin-card-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes admin-icon-pop { from { opacity: 0; transform: scale(.4); } }
@keyframes admin-row-in { from { opacity: 0; } }
@keyframes admin-alert-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes admin-drop-in { from { opacity: 0; transform: translateY(-4px) scaleY(.96); } }
@keyframes admin-nav-icon {
    0% { transform: scale(1) rotate(0); }
    45% { transform: scale(1.25) rotate(-8deg); }
    100% { transform: scale(1) rotate(0); }
}
@keyframes admin-nav-drop { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes admin-window-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes admin-sheet-up { from { opacity: 0; transform: translateY(56px); } 30% { opacity: 1; } }
@keyframes admin-swap-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes admin-line-in { from { opacity: 0; transform: scale(.98); } }
@keyframes admin-logo-in { from { opacity: 0; transform: scale(.7); } }
@keyframes admin-roll { from { opacity: 0; transform: translateY(.45em); filter: blur(3px); } }
@keyframes admin-check-draw { from { clip-path: inset(100% 0 0 0); } }

/* ---------- Reduced motion ---------- */
/* app.css already cuts every animation and transition to nothing; the delays go too, so
   nothing is held invisible. */
@media (prefers-reduced-motion: reduce) {
    :is(.admin-shell, .login-card) *, .admin-shell { animation-delay: 0s !important; }
}
html[data-motion="reduced"] :is(.admin-shell, .login-card) *, html[data-motion="reduced"] .admin-shell { animation-delay: 0s !important; }
