/* Rob, GO Assistant's robot (22/11/2026): the launcher in the corner and GO Assistant's panel (web/rob.js).
   The same file in Employee Tools, Roster & Timesheets, Be Safe, Contracting Management and Project Pro Go
   (apps/employee-tools/tests/test_rob_copies.py). Colours are Go Engineering's own, written as plain hex:
   tools/dark_screen.py wraps them for the dark screen, so run it after changing one.
   Above the page (the rail of apps and PPE's cart are 40) and below the apps' own viewers and dialogs (50 and 60). */

/* his size and the room the page keeps for him (22/11/2026): one place, smaller on a phone; an app keeps a right-hand column clear with --rob-gutter */
:root { --rob-w: 92px; --rob-h: 115px; --rob-gap: 16px; }

/* ---- the robot: floats, blinks, eyes on the pointer, waves, talks; still for anyone who asks for reduced motion */
.rob-bot { display: block; overflow: visible; }
.rob-bot .rob-float { animation: rob-float 3.2s ease-in-out infinite; transform-box: view-box; }
@keyframes rob-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.rob-bot .rob-eyes { transition: transform .18s ease-out; transform-box: fill-box; transform-origin: center; }
.rob-bot .rob-lids { transform-box: fill-box; transform-origin: center; }
.rob-bot.is-blink .rob-lids { animation: rob-blink .16s ease-in-out 1; }
@keyframes rob-blink { 50% { transform: scaleY(.08); } }
.rob-bot .rob-glow { animation: rob-glow 2.4s ease-in-out infinite; }
@keyframes rob-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.rob-bot .rob-arm-r { transform-box: fill-box; transform-origin: 12% 50%; transition: transform .3s; }
.rob-bot .rob-arm-l { transform-box: fill-box; transform-origin: 88% 50%; transition: transform .3s; }
.rob-bot.is-wave .rob-arm-r { animation: rob-wave .9s ease-in-out 2; }
@keyframes rob-wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-38deg); } 60% { transform: rotate(-12deg); } }
.rob-bot .rob-ear { transform-box: fill-box; transform-origin: center; }
.rob-bot.is-wave .rob-ear { animation: rob-wiggle .45s ease-in-out 3; }
@keyframes rob-wiggle { 50% { transform: rotate(-12deg) translateY(-1px); } }
.rob-bot .rob-mouth { opacity: 0; transform-box: fill-box; transform-origin: center; }
.rob-bot.is-talk .rob-mouth { opacity: 1; animation: rob-talk .22s ease-in-out infinite alternate; }
@keyframes rob-talk { from { transform: scaleY(.3); } to { transform: scaleY(1); } }
.rob-bot.is-awake .rob-eye { transform: scale(1.12); transform-box: fill-box; transform-origin: center; }
.rob-bot.is-think .rob-eyes { animation: rob-think 1s ease-in-out infinite; }
@keyframes rob-think { 0%, 100% { transform: translate(-2px, -2px); } 50% { transform: translate(2px, -2px); } }

/* ---- now and then a trick (rob.js): a flip (up, over backwards and down), a twirl, a little dance; the wave is above.
   Each keyframe lists the same transforms in the same order, so the turn is drawn as a turn. */
.rob-hit .rob-bot { transform-origin: 50% 55%; --rob-up: calc(var(--rob-h) * -.62); }
.rob-bot.is-flip { animation: rob-flip 1.8s linear 1; }
@keyframes rob-flip {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1, 1); animation-timing-function: ease-out; }
  12%  { transform: translate(0, 6px) rotate(0deg) scale(1.06, .88); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  34%  { transform: translate(-14px, var(--rob-up)) rotate(0deg) scale(.96, 1.04); animation-timing-function: cubic-bezier(.45, .05, .55, .95); }
  74%  { transform: translate(-14px, var(--rob-up)) rotate(-360deg) scale(1, 1); animation-timing-function: cubic-bezier(.5, 0, .75, .3); }
  90%  { transform: translate(0, 4px) rotate(-360deg) scale(1.06, .9); animation-timing-function: ease-out; }
  100% { transform: translate(0, 0) rotate(-360deg) scale(1, 1); }
}
.rob-bot.is-flip .rob-ear { animation: rob-wiggle .4s ease-in-out 3; }
.rob-bot.is-twirl { animation: rob-twirl 1.3s ease-in-out 1; }
@keyframes rob-twirl {
  0%   { transform: translateY(0) scale(1, 1); }
  25%  { transform: translateY(-10px) scale(.08, 1); }
  50%  { transform: translateY(-14px) scale(-1, 1); }
  75%  { transform: translateY(-10px) scale(-.08, 1); }
  100% { transform: translateY(0) scale(1, 1); }
}
.rob-bot.is-twirl .rob-arm-r { transform: rotate(-28deg); }
.rob-bot.is-twirl .rob-arm-l { transform: rotate(28deg); }
.rob-bot.is-dance { animation: rob-dance 1.8s ease-in-out 1; }
@keyframes rob-dance {
  0%, 30%, 60%, 90%, 100% { transform: translateY(0) rotate(0deg); }
  15%, 75% { transform: translateY(-8px) rotate(-8deg); }
  45% { transform: translateY(-8px) rotate(8deg); }
}
.rob-bot.is-dance .rob-arm-r { animation: rob-wave .45s ease-in-out 4; }
.rob-bot.is-dance .rob-arm-l { animation: rob-arm-up .45s ease-in-out 4; }
@keyframes rob-arm-up { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(38deg); } 60% { transform: rotate(12deg); } }
.rob-bot.is-dance .rob-ear { animation: rob-wiggle .45s ease-in-out 4; }

/* ---- the launcher: the full robot, bottom right */
.rob { position: fixed; right: max(var(--rob-gap), env(safe-area-inset-right, 0px)); bottom: max(var(--rob-gap), env(safe-area-inset-bottom, 0px)); z-index: 45;
  display: grid; justify-items: end; transition: right .32s cubic-bezier(.2, .8, .2, 1); }
.rob-hit { display: block; margin: 0; padding: 0; min-width: 0; min-height: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none;
  cursor: pointer; line-height: 0; -webkit-tap-highlight-color: transparent; }
.rob-hit:focus { outline: none; }
.rob-hit:focus-visible { outline: 2px solid #53A127; outline-offset: 2px; }
.rob-hit .rob-bot { width: var(--rob-w); height: var(--rob-h); filter: drop-shadow(0 6px 10px rgba(21, 22, 58, .25)); }
/* the dark screen: the white robot keeps a soft light halo */
[data-teams-theme="dark"] .rob-hit .rob-bot { filter: drop-shadow(0 0 5px rgba(240, 244, 248, .35)) drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }

/* what the person still has to do: the count on Rob (amber: something to do now; grey: only things for soon) */
.rob-hit { position: relative; }
.rob-badge { position: absolute; top: 2px; right: 0; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 11px;
  background: #B45309; color: #FFFFFF; border: 2px solid var(--bd-ffffff, #FFFFFF); box-shadow: 0 2px 6px rgba(21, 22, 58, .25); pointer-events: none;
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.rob-badge.rob-badge-soon { background: var(--bg-627182, #627182); }

.rob-bubble { position: absolute; right: calc(var(--rob-w) + 8px); bottom: calc(var(--rob-h) * .54); width: max-content; max-width: min(260px, calc(100vw - var(--rob-w) - 40px)); box-sizing: border-box;
  padding: 10px 14px; border-radius: 14px; background: var(--bg-ffffff, #FFFFFF); color: var(--fg-25265e, #25265E); border: 1px solid var(--bd-e2e8f0, #E2E8F0); box-shadow: 0 8px 24px rgba(21, 22, 58, .18);
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; font-weight: 500; line-height: 1.35; text-align: left;
  white-space: normal; pointer-events: none; }
.rob-bubble[hidden] { display: none; }

/* lifted over the page's own corner: PPE's cart button (Employee Tools) and the course's footer bar (Be Safe) */
body:has(.cart-fab) .rob { bottom: max(84px, env(safe-area-inset-bottom, 0px)); }
body:has(#footnav:not(.hidden)) .rob { bottom: 86px; }
/* room at the end of the page, so its last lines and buttons can be scrolled clear of him */
body:has(> #rob) { padding-bottom: calc(var(--rob-h) + 2 * var(--rob-gap)); --rob-gutter: calc(var(--rob-w) + 2 * var(--rob-gap)); }

/* ---- GO Assistant's panel (not in Project Pro Go, where Rob opens a new window) */
.rob-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 44; box-sizing: border-box;
  display: flex; flex-direction: column; background: var(--bg-ffffff, #FFFFFF); color: var(--fg-2c3e50, #2C3E50); border-left: 1px solid var(--bd-e2e8f0, #E2E8F0); box-shadow: -12px 0 30px rgba(21, 22, 58, .18);
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.45;
  transform: translateX(104%); visibility: hidden; transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s; }
.rob-panel.rob-open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.rob-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--bd-e2e8f0, #E2E8F0); }
.rob-head .rob-face { flex: none; display: block; line-height: 0; }
.rob-head .rob-bot { width: 34px; height: 26px; }
.rob-title { min-width: 0; }
.rob-title b { display: block; color: var(--fg-25265e, #25265E); font-size: 14px; font-weight: 600; line-height: 1.3; }
.rob-title small { display: block; color: var(--fg-627182, #627182); font-size: 12px; line-height: 1.3; }
.rob-head button { margin: 0; font: inherit; font-size: 13px; border: 1px solid var(--bd-e2e8f0, #E2E8F0); background: transparent; color: var(--fg-2c3e50, #2C3E50); border-radius: 8px;
  padding: 4px 10px; cursor: pointer; box-shadow: none; }
.rob-head button:hover { border-color: #6DB82F; }
.rob-head button:focus-visible { outline: 2px solid #53A127; outline-offset: 2px; }
.rob-head button:disabled { opacity: .6; cursor: progress; }
.rob-head .rob-close { margin-left: auto; }
.rob-body { flex: 1; min-height: 0; display: flex; }
.rob-body iframe { flex: 1; display: block; width: 100%; height: 100%; border: 0; background: var(--bg-ffffff, #FFFFFF); }

/* while the panel is open, Rob stands just left of it (pressing him again closes it) */
.rob.rob-beside { right: calc(min(420px, 100vw) + 12px); }

/* ---- phones: the same robot, smaller; the panel takes the whole screen */
@media (max-width: 599.98px) {
  :root { --rob-w: 48px; --rob-h: 60px; }
  .rob-badge { top: -2px; right: -4px; }
  .rob-bubble { right: 0; bottom: calc(var(--rob-h) + 8px); max-width: calc(100vw - 32px); }
  .rob-panel { width: 100%; border-left: 0; }
  .rob.rob-beside { display: none; }
  body:has(.cart-fab) .rob { bottom: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  .rob-bot .rob-float, .rob-bot .rob-glow, .rob-bot.is-blink .rob-lids, .rob-bot.is-talk .rob-mouth, .rob-bot.is-think .rob-eyes,
  .rob-bot.is-wave .rob-arm-r, .rob-bot.is-wave .rob-ear, .rob-bot.is-flip, .rob-bot.is-flip .rob-ear, .rob-bot.is-twirl,
  .rob-bot.is-dance, .rob-bot.is-dance .rob-arm-r, .rob-bot.is-dance .rob-arm-l, .rob-bot.is-dance .rob-ear { animation: none; }
  .rob-bot .rob-eyes, .rob, .rob-panel, .rob-panel.rob-open { transition: none; }
}

@media print {
  .rob, .rob-panel { display: none !important; }
  body:has(> #rob) { padding-bottom: 0; }
}
