/* Yordamchi — the job page's assistant (assistant.js) in the booth design: docked on the right from 1200 px (the page
   makes room), a drawer over the page from 901 px, a bottom sheet behind a round button on phones. Colours and fonts
   are style.css's variables. */
:root { --yd-w: 384px; }

/* ---------------------------------------------------------------- the collapsed tab / the phone's button */
.yd-tab { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 55; display: flex;
  flex-direction: column; align-items: center; gap: 10px; padding: 16px 9px; border: 1px solid var(--rule-2);
  border-right: none; border-radius: var(--r-lg) 0 0 var(--r-lg); background: var(--booth); color: var(--paper);
  cursor: pointer; box-shadow: -8px 0 30px rgba(0,0,0,.35); }
.yd-tab:hover { background: var(--booth-2); border-color: var(--dim); }
.yd-tab .yd-tab-t { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 10.5px/1 var(--f-mono);
  letter-spacing: .16em; text-transform: uppercase; }
#yd.open .yd-tab { display: none; }
.yd-lamp { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px rgba(255,180,58,.7);
  flex: none; }

/* ---------------------------------------------------------------- the panel */
.yd-panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--yd-w); max-width: 100vw; z-index: 60;
  display: flex; flex-direction: column; background: var(--booth); border-left: 1px solid var(--rule);
  box-shadow: -18px 0 50px rgba(0,0,0,.45); transform: translateX(100%); visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s; }
#yd.open .yd-panel { transform: none; visibility: visible; transition: transform .22s ease; }
.yd-scrim { position: fixed; inset: 0; z-index: 58; background: rgba(8,7,6,.55); }
.yd-scrim[hidden] { display: none; }
body.yd-docked main, body.yd-docked .holdbar { margin-right: var(--yd-w); }
body.yd-docked .yd-panel { box-shadow: none; }

.yd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--rule); }
.yd-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.yd-title b { display: block; font: 600 15px/1.2 var(--f-display); letter-spacing: .01em; }
.yd-title span:not(.yd-lamp) { display: block; font: 500 10px/1.4 var(--f-mono); letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint); }
.yd-x { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--r);
  background: none; color: var(--dim); cursor: pointer; flex: none; }
.yd-x:hover { border-color: var(--rule-2); color: var(--paper); }
.yd-note { margin: 10px 14px 0; padding: 9px 12px; border: 1px solid var(--rule-2); border-radius: var(--r);
  font-size: 13px; line-height: 1.45; color: var(--dim); background: var(--ink); }
.yd-note.warn { border-color: var(--amber); color: var(--paper); }
.yd-note[hidden] { display: none; }

/* ---------------------------------------------------------------- messages */
.yd-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 14px 8px; display: flex;
  flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.yd-hello { padding: 4px 4px 8px; }
.yd-hello p { margin: 12px 0 0; color: var(--dim); font-size: 14px; line-height: 1.6; }
.yd-msg { display: flex; flex-direction: column; gap: 6px; max-width: 92%; min-width: 0; }
.yd-msg.me { align-self: flex-end; align-items: flex-end; }
.yd-msg.ai { align-self: flex-start; }
.yd-b { padding: 10px 13px; border-radius: 12px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap;
  overflow-wrap: anywhere; }
.yd-msg.me .yd-b { background: var(--paper); color: var(--ink); border-bottom-right-radius: 3px; }
.yd-msg.ai .yd-b { background: var(--booth-2); border: 1px solid var(--rule); border-bottom-left-radius: 3px; }
.yd-msg.err .yd-b { border-color: var(--err); color: #ffd9d4; }
.yd-msg.typing .yd-b { color: var(--amber); font: 500 12.5px/1.4 var(--f-mono); display: flex; align-items: center; gap: 10px; }
.yd-dots { display: inline-flex; gap: 4px; }
.yd-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: yd-dot 1.1s infinite ease-in-out; }
.yd-dots i:nth-child(2) { animation-delay: .15s; }
.yd-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes yd-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.yd-ref { display: inline; padding: 0 3px; margin: 0 -1px; border: none; border-radius: 3px; background: rgba(255,180,58,.14);
  color: var(--amber); font: 600 .95em/1.3 var(--f-mono); cursor: pointer; }
.yd-ref:hover { background: rgba(255,180,58,.28); }

/* applied changes: compact cards under the answer */
.yd-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; width: 100%; }
.yd-card { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--rule);
  border-left: 2px solid var(--amber); border-radius: var(--r); background: var(--ink); font: 500 12px/1.35 var(--f-mono);
  color: #e3d9c8; min-width: 0; }
.yd-card span:not(.led) { min-width: 0; overflow-wrap: anywhere; flex: 1; }
.yd-card svg.i { width: 15px; height: 15px; color: var(--amber); }
.yd-card.regen { border-left-color: var(--rec); }
.yd-card.regen svg.i { color: var(--rec); }
.yd-card.pending { border-left-color: var(--ok); }
.yd-card.pending svg.i { color: var(--ok); }
.yd-card.lesson svg.i, .yd-card.note svg.i { color: var(--ok); }

/* ---------------------------------------------------------------- suggestions + the input */
.yd-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 0; }
.yd-chips:empty { display: none; }
.yd-chips .chip { padding: 6px 11px; font-size: 12.5px; max-width: 100%; white-space: normal; text-align: left; line-height: 1.3; }
.yd-box { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 14px; }
.yd-box textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; resize: none; padding: 11px 12px;
  font-size: 14.5px; line-height: 1.45; overflow-y: hidden; }
.yd-box textarea:disabled { opacity: .5; }
.yd-send { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: var(--r);
  border: 1px solid var(--rec); background: var(--rec); color: var(--rec-ink); cursor: pointer; }
.yd-send:hover { filter: brightness(1.08); }
.yd-send:disabled { opacity: .4; cursor: default; filter: none; }
.yd-send svg.i { stroke-width: 2; }

/* ---------------------------------------------------------------- phones: a round button and a bottom sheet */
@media (max-width: 900px) {
  .yd-tab { top: auto; right: 14px; bottom: calc(132px + env(safe-area-inset-bottom)); transform: none; width: 54px;
    height: 54px; padding: 0; border-radius: 50%; border: 1px solid var(--amber); justify-content: center;
    background: var(--booth-2); box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 0 4px rgba(255,180,58,.12); }
  .yd-tab .yd-tab-t, .yd-tab .yd-lamp { display: none; }
  .yd-tab svg.i { width: 24px; height: 24px; color: var(--amber); }
  .yd-panel { top: auto; left: 0; width: 100%; height: min(86vh, 720px); height: min(86dvh, 720px);
    border-left: none; border-top: 1px solid var(--rule-2); border-radius: 14px 14px 0 0; transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom); }
  .yd-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 38px; height: 4px; margin-left: -19px;
    border-radius: 2px; background: var(--rule-2); }
  .yd-head { position: relative; padding-top: 18px; }
  .yd-panel { z-index: 70; }
  .yd-scrim { z-index: 65; }
  .yd-box textarea { font-size: 16px; }          /* no zoom-in on focus (iOS) */
}
@media (prefers-reduced-motion: reduce) {
  .yd-panel, #yd.open .yd-panel { transition: none; }
  .yd-dots i { animation: none; opacity: .7; }
}
