/* KPR Careers — the right rail and the Assistant (assistant.js). Same shape
   as KPR Finance's: a slim rail of KPR app shortcuts down the right edge on a
   computer, the Assistant's button in it, and a chat panel docked beside it.
   On phones (or with the rail tucked away) the button sits in the corner. */

:root { --rail-w: 0px; }
.cr-rail, .cr-rail-show { display: none; }

@media screen and (min-width: 861px) {
  :root { --rail-w: 56px; }
  html.rail-off { --rail-w: 0px; }
  /* "html body" outranks kpr-core's own body padding, which loads later. */
  html body { padding-right: calc(var(--rail-w) + env(safe-area-inset-right, 0px)); }
  .kpr-hdr { margin-right: calc(-1 * var(--rail-w)); }   /* the header still spans the full width */
  .cr-rail {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    position: fixed; top: var(--kpr-hdr-h, 60px); right: 0; bottom: 0; z-index: 45;
    width: var(--rail-w); padding: 14px 0 10px; box-sizing: border-box;
    background: var(--card); border-left: 1px solid var(--border);
  }
  html.rail-off .cr-rail { display: none; }
  html.rail-off .cr-rail-show { display: inline-flex; }
}
.cr-rail-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; text-decoration: none; color: var(--fg-2);
  border: 0; background: none; padding: 0; cursor: pointer;
}
.cr-rail-link svg { width: 22px; height: 22px; }
.cr-rail-sep { width: 24px; height: 1px; background: var(--border); margin: 6px 0; }
.cr-rail-hide, .cr-rail-show {
  align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.cr-rail-hide { display: inline-flex; margin-top: auto; }
.cr-rail-hide svg, .cr-rail-show svg { width: 18px; height: 18px; }
.cr-rail-show {
  position: fixed; right: 36px; bottom: 92px; z-index: 45;
  background: var(--card); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
@media (hover: hover) and (pointer: fine) {
  .cr-rail-link:hover, .cr-rail-hide:hover, .cr-rail-show:hover { background: var(--card-2); color: var(--fg); }
}
.cr-rail-link:focus-visible, .cr-rail-hide:focus-visible, .cr-rail-show:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* The Assistant's button: the corner on phones / with the rail hidden ... */
/* Same as KPR Finance's (voice.css): the accent colour, darker while the
   panel is open, red with a breathing ring while listening. */
.cr-ai-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 1150;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35), 0 2px 4px rgba(0, 0, 0, 0.12);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  touch-action: manipulation;
}
.cr-ai-fab.on { background: var(--kpr-accent2, color-mix(in srgb, var(--accent) 80%, black)); }
.cr-ai-fab.live { background: #c4433a; animation: cr-ai-ring 1.4s ease-out infinite; }
@keyframes cr-ai-ring {
  0%   { box-shadow: 0 0 0 0 rgba(196, 67, 58, .45), 0 6px 18px rgba(0, 0, 0, .18); }
  100% { box-shadow: 0 0 0 16px rgba(196, 67, 58, 0), 0 6px 18px rgba(0, 0, 0, .18); }
}
.cr-ai-fab svg { width: 24px; height: 24px; }
.cr-ai-fab:active { transform: scale(.94); }
.cr-ai-fab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .cr-ai-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(79, 70, 229, 0.4), 0 2px 4px rgba(0, 0, 0, 0.12); } }
/* ... and in the rail on a computer, above the chevron, at the icons' size. */
@media screen and (min-width: 861px) {
  html:not(.rail-off) .cr-ai-fab { right: 8px; bottom: 52px; width: 40px; height: 40px; box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3); z-index: 46; }
  html:not(.rail-off) .cr-ai-fab svg { width: 20px; height: 20px; }
  html:not(.rail-off) .cr-ai-fab.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
}
@media screen and (max-width: 860px) { .cr-ai-fab.on { display: none; } }

/* The panel: docked on the right under the header, chat on top, composer at the bottom. */
.cr-ai {
  position: fixed; top: var(--kpr-hdr-h, 60px); right: var(--rail-w); bottom: 0; z-index: 1140;
  width: min(400px, calc(100vw - var(--rail-w) - 24px));
  display: flex; flex-direction: column;
  background: var(--card); color: var(--fg); font-family: var(--sans);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 36px -24px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateX(24px); pointer-events: none; visibility: hidden;
  transition: opacity .18s ease, transform .22s ease, visibility 0s linear .22s;
}
.cr-ai.open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
@media screen and (max-width: 860px) {
  .cr-ai { left: 0; right: 0; width: auto; border-left: 0; box-shadow: none; transform: translateY(16px); }
  .cr-ai.open { transform: none; }
}
.cr-ai-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.cr-ai-head b { font-family: var(--serif); font-size: 16px; font-weight: 500; flex: 1; }
.cr-ai-head b small { font: 600 10.5px var(--sans); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-left: 6px; }
.cr-ai-icon { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--fg-2); font-size: 15px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cr-ai-icon svg { width: 17px; height: 17px; }
.cr-ai-icon.on { color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .cr-ai-icon:hover { background: var(--card-2); } }
.cr-ai-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 8px; }
.cr-ai-hello { font-size: 14px; color: var(--fg-2); line-height: 1.5; margin: 0 0 10px; }
.cr-ai-try { font-size: 11.5px; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.cr-ai-examples { display: grid; gap: 6px; }
.cr-ai-examples button { text-align: left; border: 1px solid var(--border); background: var(--card-2); color: var(--fg); border-radius: 10px; padding: 8px 12px; font: 500 13px var(--sans); cursor: pointer; }
.cr-ai-examples button:hover { border-color: var(--accent); }
.cr-ai-chat { display: flex; flex-direction: column; gap: 8px; }
.cr-ai-msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.cr-ai-msg.new { animation: cr-ai-in .18s ease both; }
.cr-ai-msg.ai { align-self: flex-start; background: var(--card-2); color: var(--fg); border-bottom-left-radius: 4px; }
.cr-ai-msg.you { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.cr-ai-msg.note { align-self: stretch; max-width: none; font-size: 12.5px; color: var(--fg-2); background: transparent; border: 1px dashed var(--border-strong); }
.cr-ai-msg.wait { color: var(--muted); }
.cr-ai-msg.wait::after { content: "…"; animation: cr-ai-blink 1s steps(3) infinite; }
.cr-ai-go { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cr-ai-go button { border: 1px solid var(--accent); background: var(--card); color: var(--accent); border-radius: 999px; padding: 4px 12px; font: 600 12.5px var(--sans); cursor: pointer; }
.cr-ai-go button:hover { background: var(--accent); color: var(--accent-ink); }
@keyframes cr-ai-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes cr-ai-blink { 50% { opacity: .3; } }
.cr-ai-type { display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--card); }
.cr-ai-type input { flex: 1; height: 42px; border-radius: 21px; padding: 0 16px; font-size: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); outline: none; }
.cr-ai-type input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cr-ai-talk, .cr-ai-send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--fg-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cr-ai-talk svg, .cr-ai-send svg { width: 18px; height: 18px; }
.cr-ai-talk.live { background: #c4433a; border-color: #c4433a; color: #fff; }
.cr-ai-send { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cr-ai-send:disabled { opacity: .5; cursor: not-allowed; }
@media screen and (max-width: 860px) { .cr-ai-type input { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .cr-ai, .cr-ai-fab, .cr-ai-msg { transition: none; animation: none; } }
/* The toast in Job Match sits clear of the corner button on phones. */
@media screen and (max-width: 860px) { .jg-toast { bottom: 96px; } }
@media print { .cr-rail, .cr-rail-show, .cr-ai-fab, .cr-ai { display: none !important; } }
