/* Popup motion/UX standard - SweetAlert2 dialogs + Bootstrap modals, app-wide.
   Loaded by partials/head.blade.php and layouts/auth.blade.php. Pure CSS: every
   existing Swal.fire(...) / modal gets it with no per-page code.
   SweetAlert2 injects its own CSS at runtime (after this file), so rules here use
   !important / higher specificity on purpose. Standard: docs/DESIGN.md. */

:root { --pm-ease: cubic-bezier(.22, 1, .36, 1); --pm-spring: cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- SweetAlert2 ---------- */
body .swal2-container { transition: background-color .3s ease; z-index: 2100 !important; }   /* above the fixed header (1090) AND every Bootstrap modal (2000, head.blade.php): at Swal's default 1060 the header drew over the top of every popup and cut off the badge */
body .swal2-container:not(.swal2-toast-shown) { padding-top: 2.2rem; }                       /* room for the overhanging icon badge when a tall popup nearly fills the screen */
body .swal2-container.swal2-backdrop-show,
body .swal2-container.swal2-noanimation {
  background: rgba(17, 25, 54, .45) !important;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}

/* Compact: size to the content. Swal's default is 32em wide with ~2.5em above the
   icon and 1.25em+ between rows. A Swal `width:` option (inline style) still wins. */
/* "Result card" design: white card, soft brand-tint corner, big bold title, grey text,
   and the status icon as a round badge overlapping the top-right corner. */
body .swal2-popup:not(.swal2-toast) {
  --pm-badge: linear-gradient(135deg, var(--bs-primary, #2196f3), var(--bs-secondary, #673ab7));
  --pm-badge-glow: rgba(var(--bs-secondary-rgb, 103, 58, 183), .55);
  width: 22em; max-width: 92vw;
  border-radius: 20px;
  padding: 1.7rem 1.25rem 1.2rem;
  background:
    radial-gradient(circle at 0% 100%, rgba(var(--bs-primary-rgb, 33, 150, 243), .13) 0 5.5em, transparent calc(5.5em + 1px)),
    radial-gradient(circle at 100% 100%, rgba(var(--bs-secondary-rgb, 103, 58, 183), .08) 0 4em, transparent calc(4em + 1px)),
    #fff;
  box-shadow: 0 25px 70px -15px rgba(17, 25, 54, .45);
}
/* popup has no icon-type class: :has() reads the visible icon (inline display:flex) */
body .swal2-popup:not(.swal2-toast):has(.swal2-icon.swal2-warning[style*="flex"]) { --pm-badge: linear-gradient(135deg, #f5a524, #e58a00); --pm-badge-glow: rgba(229, 138, 0, .55); }
body .swal2-popup:not(.swal2-toast):has(.swal2-icon.swal2-error[style*="flex"])   { --pm-badge: linear-gradient(135deg, #f0555a, #dc2626); --pm-badge-glow: rgba(220, 38, 38, .5); }

/* the icon becomes the badge */
body .swal2-popup:not(.swal2-toast) .swal2-icon {
  position: absolute; top: -1.4em; right: -1.2em; margin: 0; zoom: .78;
  background: var(--pm-badge); border: .35em solid #fff; color: #fff;
  box-shadow: 0 10px 24px -6px var(--pm-badge-glow);
}
/* recolour SweetAlert's native glyphs to white; drop its ring + white "mask" pieces */
body .swal2-popup .swal2-icon .swal2-success-ring,
body .swal2-popup .swal2-icon [class^=swal2-success-circular-line],
body .swal2-popup .swal2-icon .swal2-success-fix { display: none !important; }
body .swal2-popup .swal2-icon.swal2-success [class^=swal2-success-line],
body .swal2-popup .swal2-icon.swal2-error [class^=swal2-x-mark-line] { background-color: #fff !important; }
body .swal2-popup .swal2-icon .swal2-icon-content { color: #fff; }
body .swal2-popup .swal2-title { font-size: 1.5em; font-weight: 800; color: #2b3040; padding: .15em .4em 0; margin: 0; }
body .swal2-popup .swal2-html-container { font-size: .95em; color: #6b7280; margin: .45em .8em .1em; padding: 0; line-height: 1.5; }
body .swal2-popup .swal2-actions { margin: 1.1em auto 0; row-gap: .55rem; }   /* buttons that wrap onto two lines keep a gap */
body .swal2-popup .swal2-styled { margin: 0 .3em; padding: .5em 1.6em; font-size: .95em; }
body .swal2-popup.swal2-toast { width: auto; max-width: 92vw; padding: .75rem 1rem; }
/* in: slight overshoot "spring"; out: quick fade-down */
body .swal2-popup.swal2-show:not(.swal2-noanimation) { animation: pm-in .3s var(--pm-ease) both !important; }   /* snappy: .3 s (was .6 s) */
body .swal2-popup.swal2-hide:not(.swal2-noanimation) { animation: pm-out .15s ease-in both !important; }
@keyframes pm-in  { 0% { opacity: 0; transform: translateY(14px) scale(.93); } 60% { opacity: 1; transform: scale(1.015); } 100% { opacity: 1; transform: none; } }
@keyframes pm-out { to   { opacity: 0; transform: translateY(8px) scale(.96); } }

/* content cascades in just after the shell */
body .swal2-show .swal2-title,
body .swal2-show .swal2-html-container,
body .swal2-show .swal2-actions { animation: pm-rise .3s var(--pm-ease) both; }
body .swal2-show .swal2-title          { animation-delay: .05s; font-weight: 700; }
body .swal2-show .swal2-html-container { animation-delay: .08s; }
body .swal2-show .swal2-actions        { animation-delay: .11s; }
@keyframes pm-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* buttons: theme colour, lift on hover, press on click */
body .swal2-styled { border-radius: 10px; font-weight: 600; transition: transform .2s var(--pm-ease), box-shadow .25s, filter .2s; }
body .swal2-styled.swal2-confirm { background: var(--pm-badge, var(--bs-secondary, #673ab7)) !important; box-shadow: 0 8px 18px -8px var(--pm-badge-glow, rgba(103, 58, 183, .7)); }
body .swal2-styled.swal2-cancel  { background: #eef0f4 !important; color: #4b5563 !important; }
body .swal2-styled:hover  { transform: translateY(-2px); filter: brightness(1.06); }
body .swal2-styled:active { transform: scale(.97); }
body .swal2-styled:focus  { box-shadow: 0 0 0 .22rem rgba(var(--bs-secondary-rgb, 103, 58, 183), .25) !important; }

/* badge: springs in with a twist after the card lands, then a soft ripple loops */
body .swal2-show:not(.swal2-toast) .swal2-icon { animation: pm-badge .35s var(--pm-ease) .08s both, pm-ripple 2.4s ease-out 1s infinite; }
@keyframes pm-badge  { from { transform: scale(0) rotate(-45deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pm-ripple { 0% { box-shadow: 0 10px 24px -6px var(--pm-badge-glow), 0 0 0 0 var(--pm-badge-glow); } 70%, 100% { box-shadow: 0 10px 24px -6px var(--pm-badge-glow), 0 0 0 .9em transparent; } }

/* toasts (Swal toast mode): glide in from the side instead of popping */
body .swal2-popup.swal2-toast.swal2-show:not(.swal2-noanimation) { animation: pm-toast-in .4s var(--pm-ease) both !important; padding: .75rem 1rem; }
@keyframes pm-toast-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ---------- Swal content kit: lead pill + numbered steps + textarea (reopen-payroll popup; reuse, never re-declare per page) ----------
   <div class="pm-lead"><i class="ti ti-lock"></i> text</div>
   <ol class="pm-steps"><li style="--i:0"><span class="pm-ic"><i class="ti ti-x"></i></span><div><b>Title</b><small>hint</small></div></li>...</ol>
   Swal opts: width '30em', input 'textarea', inputLabel '...'. Dark tokens: dark-mode.css. */
body .swal2-popup .pm-lead { display: inline-flex; align-items: center; gap: .45em; margin: .3em 0 0; padding: .35em .85em; border-radius: 999px; font-size: .85em; font-weight: 600; color: #8a5a00; background: rgba(245, 165, 36, .16); }
body .swal2-popup .pm-steps { list-style: none; margin: 1em .4em 0; padding: 0; text-align: left; }
body .swal2-popup .pm-steps li { position: relative; display: flex; gap: .8em; align-items: flex-start; padding: .5em .4em; }
body .swal2-popup .pm-steps li:not(:last-child)::before { content: ""; position: absolute; left: calc(.4em + 1.1em - 1px); top: calc(.5em + 2.2em); height: calc(100% - 2.2em); width: 2px; border-radius: 2px; background: rgba(var(--bs-primary-rgb, 33, 150, 243), .22); }
body .swal2-popup .pm-ic { flex: 0 0 2.2em; height: 2.2em; display: grid; place-items: center; border-radius: 50%; font-size: 1.05em; color: var(--bs-primary, #2196f3); background: rgba(var(--bs-primary-rgb, 33, 150, 243), .14); box-shadow: 0 0 0 .22em var(--pm-card, #fff); position: relative; }
body .swal2-popup .pm-steps b { display: block; font-size: .95em; font-weight: 700; color: #2b3040; line-height: 1.3; }
body .swal2-popup .pm-steps small { display: block; font-size: .85em; color: #6b7280; line-height: 1.4; margin-top: .1em; }
body .swal2-show .pm-lead, body .swal2-show .pm-steps li { animation: pm-rise .3s var(--pm-ease) backwards; animation-delay: calc(.1s + var(--i, 0) * .06s); }
body .swal2-popup .swal2-input-label { display: block; margin: 1em .5em .35em; text-align: left; font-size: .8em; font-weight: 700; letter-spacing: .02em; color: #4b5563; }
body .swal2-popup .swal2-textarea { width: calc(100% - 1em); margin: 0 .5em; min-height: 6.5em; padding: .7em .85em; font-size: .92em; line-height: 1.45; border: 1.5px solid #d5d9e2; border-radius: 12px; background: #f8f9fc; color: #2b3040; resize: vertical; box-shadow: none; transition: border-color .2s, box-shadow .2s, background-color .2s; }
body .swal2-popup .swal2-textarea:focus { border-color: var(--bs-primary, #2196f3); background: #fff; box-shadow: 0 0 0 .22rem rgba(var(--bs-primary-rgb, 33, 150, 243), .18); }
body .swal2-popup .swal2-validation-message { margin: .7em .5em 0; border-radius: 10px; font-size: .85em; color: #b42318; background: rgba(220, 38, 38, .1); }
body .swal2-popup .swal2-styled > i { margin-right: .4em; vertical-align: -.1em; }

/* ---------- Bootstrap modals ---------- */
.modal.fade { transition: opacity .15s ease; }
.modal.fade .modal-dialog { transform: translateY(14px) scale(.94); transition: transform .28s var(--pm-ease); }   /* snappy ease-out, no long spring tail (was .55 s spring) */
.modal.show .modal-dialog { transform: none; }
.modal.modal-static .modal-dialog { transform: scale(1.02); }       /* keep Bootstrap's "bounce" for static backdrops */
.modal-content { border-radius: 16px; border: 0; box-shadow: 0 25px 70px -15px rgba(17, 25, 54, .4); }
.modal-backdrop.show { opacity: .45; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-backdrop.fade { transition: opacity .18s ease; }

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  body .swal2-popup, body .swal2-show .swal2-title, body .swal2-show .swal2-html-container,
  body .swal2-show .swal2-actions, body .swal2-show .swal2-icon, body .swal2-show .pm-lead, body .swal2-show .pm-steps li { animation: none !important; }
  body .swal2-popup .swal2-textarea { transition: none !important; }
  .modal.fade .modal-dialog, .modal.fade, .modal-backdrop.fade, body .swal2-styled { transition: none !important; transform: none !important; }
}

/* ---------- Pending sticker (admin dashboard) ----------
   Floating "needs approval" sticker, fixed bottom-right, stays until the pending total is 0.
   Click = summary panel (each row opens that tile's drill-down modal). Chime is synthesised in the
   dashboard script (WebAudio, no asset). transform/opacity only; tokens mirror .pm-drill (warning tone). */
.pend-sticker {
  --ps-a: #ffbe5c; --ps-b: #f5a524; --ps-glow: rgba(245, 165, 36, .55); --ps-ink: #b86e00;
  --ps-bg: #fff; --ps-text: #2b3040; --ps-muted: #6b7280; --ps-row: #f5f7fc; --ps-row-hover: #edf1fb; --ps-line: #e8ecf5;
  position: fixed; right: 1.2rem; top: 50%; margin-top: -49px; z-index: 1045;   /* vertically centred on the right edge (49px = half the 98px fab); clear of the tour button at the bottom */
    /* above the fixed header, below modals/backdrop (1050+) */
}
.pend-fab { position: relative; display: block; width: 84px; height: 98px; padding: 0; border: 0; background: none; cursor: pointer; animation: ps-in .9s cubic-bezier(.34, 1.45, .64, 1) .1s both, pm-bob 3.4s ease-in-out 1.1s infinite; }
.pend-fab:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb, 33, 150, 243), .5); outline-offset: 4px; border-radius: 24px; }
.pend-in { position: absolute; inset: 0; transition: transform .3s var(--pm-ease); }
@media (hover: hover) { .pend-fab:hover .pend-in { transform: scale(1.07) rotate(-3deg); } }
.pend-fab:active .pend-in { transform: scale(.95); }
.pend-tile {
  position: absolute; left: 10px; top: 8px; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 1.9rem; color: #fff;
  background: linear-gradient(145deg, var(--ps-a), var(--ps-b)); box-shadow: 0 14px 26px -8px var(--ps-glow), inset 0 -5px 0 rgba(0, 0, 0, .08);
  animation: ps-wiggle 7s ease-in-out 3s infinite;
}
.pend-tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--ps-b); opacity: 0; animation: ps-ping 2.4s ease-out 1.2s infinite; }
.pend-tile::before { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--ps-a); opacity: 0; animation: ps-ping 2.4s ease-out 2.4s infinite; }   /* second ring half a cycle behind the first = a steady sonar pulse that asks for a look */
.pend-bell {
  position: absolute; left: 28px; top: -11px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .95rem;
  background: var(--ps-bg); color: var(--ps-b); box-shadow: 0 6px 14px -4px var(--ps-glow); transform-origin: 50% 10%; animation: pm-ring 3.2s ease-in-out 1.2s infinite;
}
.pend-total {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); min-width: 2.3em; padding: .12em .65em; border-radius: 999px; text-align: center;
  font-size: .78rem; font-weight: 800; line-height: 1.3; color: #fff; background: linear-gradient(135deg, #ff7b7f, #dc2626); border: 2px solid var(--ps-bg); box-shadow: 0 6px 12px -4px rgba(220, 38, 38, .6);
  animation: ps-beat 2.6s ease-in-out 1.6s infinite;   /* double heartbeat on the number, then rest: the count is what needs attention */
}
.pend-spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ps-a); animation: pm-twinkle 2.4s ease-in-out infinite; }
.pend-spark.a { left: 0; top: 52px; } .pend-spark.b { right: 2px; top: 76px; width: 5px; height: 5px; animation-delay: 1s; }

.pend-panel {
  position: absolute; right: calc(100% + .8rem); top: 50%; width: 340px; max-width: calc(100vw - 2rem); max-height: calc(100vh - 16rem); padding: .9rem; border-radius: 20px;
  display: flex; flex-direction: column;   /* opens to the LEFT of the sticker (free page space), never under the header */
  background: var(--ps-bg); color: var(--ps-text); box-shadow: 0 25px 60px -15px rgba(17, 25, 54, .5), 0 0 0 1px var(--ps-line);
  transform-origin: 100% calc(50% - var(--ps-dy, 0px)); opacity: 0; visibility: hidden; transform: translateY(calc(-50% + var(--ps-dy, 0px))) translateX(22px) scale(.86);   /* centred on the sticker; --ps-dy (pending-sticker.js) slides it back inside the viewport, the tail stays on the sticker */
  transition: opacity .22s ease, transform .45s var(--pm-spring), visibility 0s linear .45s;
}
.pend-sticker[hidden] { display: none; }
/* leave: anticipate (tiny pull back), then glide off to the right edge; enter is ps-in below */
.pend-sticker { transition: opacity .45s ease-in, transform .5s cubic-bezier(.6, -.28, .74, .05); }
.pend-sticker.is-leaving { opacity: 0; transform: translateX(170px) rotate(10deg) scale(.9); pointer-events: none; }
/* dragged (pending-sticker.js): grab cursor, no touch scroll, no hover scale while moving; .flip = sticker on the left half, panel opens to its right */
.pend-fab { cursor: grab; touch-action: none; user-select: none; }
.pend-sticker.is-dragging .pend-fab { cursor: grabbing; }
.pend-sticker.is-dragging .pend-in { transform: scale(1.05); }
.pend-sticker.flip .pend-panel { right: auto; left: calc(100% + .8rem); transform-origin: 0 calc(50% - var(--ps-dy, 0px)); transform: translateY(calc(-50% + var(--ps-dy, 0px))) translateX(-22px) scale(.86); }
.pend-sticker.flip .pend-panel::after { right: auto; left: -7px; border-radius: 0 0 0 3px; box-shadow: -1px 1px 0 var(--ps-line); }
/* tail pointing at the sticker */
.pend-panel::after { content: ""; position: absolute; right: -7px; top: calc(50% - var(--ps-dy, 0px)); margin-top: -7px; width: 14px; height: 14px; background: var(--ps-bg); transform: rotate(45deg); border-radius: 0 3px 0 0; box-shadow: 1px -1px 0 var(--ps-line); }
.pend-rows { overflow-y: auto; min-height: 0; margin: 0 -.3rem; padding: 0 .3rem; scrollbar-width: thin; scrollbar-color: var(--ps-line) transparent; }
.pend-sticker.is-open .pend-panel, .pend-sticker.flip.is-open .pend-panel { opacity: 1; visibility: visible; transform: translateY(calc(-50% + var(--ps-dy, 0px))); transition-delay: 0s; }
.pend-sticker.is-open .pend-tile { box-shadow: 0 0 0 6px var(--ps-glow), 0 14px 26px -8px var(--ps-glow), inset 0 -5px 0 rgba(0, 0, 0, .08); }   /* halo shows which sticker the panel belongs to */
.pend-tile { transition: box-shadow .35s ease; }
.pend-sticker.is-open .pend-panel-head { animation: pm-rise .4s var(--pm-ease) both; }
.pend-panel-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; padding: 0 .2rem; }
.pend-panel-head strong { flex: 1; font-size: .98rem; font-weight: 800; color: var(--ps-ink); }
.pend-panel-head small { display: block; font-weight: 500; color: var(--ps-muted); font-size: .74rem; }
.pend-mute { width: 30px; height: 30px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--ps-row); color: var(--ps-muted); transition: transform .2s var(--pm-ease), background-color .2s; }
.pend-mute:hover { background: var(--ps-row-hover); color: var(--ps-text); transform: scale(1.08); }
.pend-row {
  display: flex; align-items: center; gap: .7rem; width: 100%; margin-bottom: .4rem; padding: .5rem .65rem; border: 0; border-radius: 13px; text-align: left;
  background: var(--ps-row); color: var(--ps-text); text-decoration: none; transition: transform .25s var(--pm-ease), background-color .2s;
}
.pend-row:last-child { margin-bottom: 0; }
.pend-row:hover { background: var(--ps-row-hover); color: var(--ps-text); transform: translateX(3px); }
.pend-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 1rem; }
.pend-label { flex: 1; min-width: 0; font-size: .84rem; font-weight: 600; }
.pend-num { min-width: 2em; padding: .1em .6em; border-radius: 999px; text-align: center; font-size: .78rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--ps-a), var(--ps-b)); }
.pend-row > .ti-chevron-right { color: var(--ps-muted); font-size: .8rem; transition: transform .25s var(--pm-ease); }
.pend-row:hover > .ti-chevron-right { transform: translateX(3px); }
.pend-sticker.is-open .pend-row { animation: pm-rise .4s var(--pm-ease) both; }
.pend-sticker.is-open .pend-row:nth-of-type(2) { animation-delay: .06s; } .pend-sticker.is-open .pend-row:nth-of-type(3) { animation-delay: .12s; }
.pend-sticker.is-open .pend-row:nth-of-type(4) { animation-delay: .18s; } .pend-sticker.is-open .pend-row:nth-of-type(n+5) { animation-delay: .24s; }

@keyframes ps-in     { from { transform: translateX(170px) rotate(14deg) scale(.9); opacity: 0; } 35% { opacity: 1; } to { transform: none; opacity: 1; } }   /* slides in from the right edge with a springy overshoot */
@keyframes ps-beat   { 0%, 40%, 100% { transform: translateX(-50%) scale(1); } 10% { transform: translateX(-50%) scale(1.22); } 20% { transform: translateX(-50%) scale(1.02); } 30% { transform: translateX(-50%) scale(1.14); } }
@keyframes ps-ping   { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.55); opacity: 0; } }
@keyframes ps-wiggle { 0%, 12%, 100% { transform: rotate(0); } 2% { transform: rotate(-9deg); } 4% { transform: rotate(8deg); } 6% { transform: rotate(-6deg); } 8% { transform: rotate(4deg); } 10% { transform: rotate(-2deg); } }
@media (max-width: 575.98px) {
  .pend-sticker { right: .6rem; }
  /* phones: no room beside the sticker, so open above it */
  .pend-panel { width: 300px; right: 0; top: auto; bottom: calc(100% + .5rem); max-height: calc(50vh - 6rem); transform: translateY(12px) scale(.94); transform-origin: 100% 100%; }
  .pend-sticker.is-open .pend-panel, .pend-sticker.flip.is-open .pend-panel { transform: none; }
  .pend-sticker.flip .pend-panel { left: 0; right: auto; transform: translateY(12px) scale(.94); transform-origin: 0 100%; }
  .pend-panel::after, .pend-sticker.flip .pend-panel::after { display: none; }
}
@media print { .pend-sticker { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .pend-fab, .pend-tile, .pend-tile::before, .pend-tile::after, .pend-total, .pend-bell, .pend-spark, .pend-sticker.is-open .pend-row, .pend-sticker.is-open .pend-panel-head { animation: none !important; }
  .pend-sticker, .pend-in, .pend-tile, .pend-panel, .pend-row, .pend-mute, .pend-row > .ti-chevron-right { transition: none !important; }
}

/* Phones / touch: no backdrop blur. Blurring the whole page behind a popup is re-rasterised every frame while the dialog animates and scrolls
   (the attendance grid behind a punch modal dropped to a few fps). A slightly darker plain scrim looks the same and costs nothing. (2026-11-18) */
@media (max-width: 767.98px), (hover: none) {
  .modal-backdrop.show { -webkit-backdrop-filter: none; backdrop-filter: none; opacity: .55; }
  body .swal2-container.swal2-backdrop-show, body .swal2-container.swal2-noanimation { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(17, 25, 54, .6) !important; }
}
