/* Tutorials: the spotlight, the popover, the recorder and the Training page.
   public/js/tutorials.js has the reasoning.

   Stacking: an ordinary modal is 100, the Reword editor 150, toasts 200. A
   tutorial has to sit over dialogs (steps open them) and under toasts:
     160 dark panels   161 ring   164 recorder outline   165 recorder panel
     168 popover       169 welcome card */

/* A step's kept screen (2 Dec 2026): a frozen copy of the page under the dark
   panels, 157, with a shield over it, 158, so nothing in it can be pressed. */
#tut-root .tut-snap {
  position: fixed; left: 0; top: 0; z-index: 157; border: 0; margin: 0; padding: 0;
  transform-origin: 0 0; background: var(--bg, #fff); pointer-events: none;
}
#tut-root .tut-snap-shield { position: fixed; inset: 0; z-index: 158; background: transparent; }
.tut-rec-screen { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

#tut-root .tut-dim {
  position: fixed; z-index: 160; background: rgba(15, 23, 42, .62);
  /* Swallows clicks. On a "click" step the hole between the four panels is
     what lets the real click through. */
}
#tut-root .tut-ring {
  position: fixed; z-index: 161; box-sizing: border-box; border-radius: 8px;
  border: 2px solid var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .35);
  display: none; pointer-events: none;
}
#tut-root .tut-pop {
  position: fixed; z-index: 168; box-sizing: border-box; display: none;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(15, 23, 42, .35);
  max-height: calc(100vh - 24px); overflow: auto;
}
.tut-pop-body { padding: 14px 16px 6px; }
.tut-pop-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--navy); }
.tut-pop-text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.tut-pop-note { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #92400e; }
.tut-pop-foot { display: flex; align-items: center; gap: 8px; padding: 8px 16px 10px; }
.tut-pop-foot .spacer { flex: 1; }
.tut-pop-count { font-size: 12px; color: var(--muted); }
.tut-pop-hint { font-size: 12.5px; font-weight: 700; color: var(--blue); }
.tut-pop-skip { padding: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
/* Touch: the two links are the way out of a stuck step, so give them a finger-sized row. */
@media (max-width: 860px) { .tut-pop-skip .tut-link { min-height: 36px; font-size: 13px; } }
.tut-link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; }

#tut-welcome {
  position: fixed; inset: 0; z-index: 169; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .5); padding: 16px;
}
.tut-welcome-card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 12px; padding: 16px 16px 10px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .35);
}
.tut-welcome-card .tut-pop-foot { padding: 12px 0 0; }

/* ---- Recorder ---- */
#tut-hover {
  position: fixed; z-index: 164; pointer-events: none; display: none; box-sizing: border-box;
  border: 2px solid #d97706; background: rgba(217, 119, 6, .08); border-radius: 4px;
}
#tut-rec {
  position: fixed; z-index: 165; top: 12px; right: 12px; width: 340px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px); overflow: auto; box-sizing: border-box;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .3); padding: 12px; font-size: 13px;
}
.tut-rec-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; cursor: move; user-select: none; touch-action: none; }
.tut-rec-grip { color: var(--muted, #94a3b8); }
@media (max-width: 600px) { .tut-rec-head { cursor: default; } }
.tut-rec-help { background: #fffbeb; color: #92400e; border-radius: 8px; padding: 7px 9px; font-size: 12px; margin-bottom: 8px; }
.tut-rec-list { list-style: none; margin: 0 0 8px; padding: 0; }
.tut-rec-list li { display: flex; align-items: center; gap: 6px; padding: 5px 4px; border-bottom: 1px solid var(--border); cursor: grab; }
.tut-rec-list li.sel { background: #eff6ff; }
.tut-rec-n { width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tut-rec-t { flex: 1; min-width: 0; cursor: pointer; overflow: hidden; }
.tut-rec-t .small { display: block; }
.tut-rec-btns { display: flex; flex: none; }
.tut-rec-btns .icon-btn { padding: 2px 5px; }
.tut-rec-empty { cursor: default !important; border: 0 !important; }
.tut-rec-form { border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.tut-rec-form input[type="text"], .tut-rec-form textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.tut-rec-kind { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.tut-rec-formfoot, .tut-rec-foot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ---- Resources > Training ---- */
a.chip { text-decoration: none; display: inline-block; }
.tut-chips { margin: 0 0 12px; }
.tut-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; flex-wrap: wrap; }
.tut-row-main { flex: 1; min-width: 220px; }
.tut-row-main .pill { margin-left: 6px; }
.tut-row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.tut-who { margin-top: 18px; }
.tut-who-scroll { overflow-x: auto; }
.tut-d-roles { display: flex; gap: 14px; }
.tut-d-roles label { font-weight: 400; color: var(--text); display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 600px) {
  #tut-rec { top: auto; bottom: 8px; right: 8px; left: 8px; width: auto; max-height: 55vh; }
}

/* Search, folders and order (29 Oct 2026). */
.tut-search { width: 100%; max-width: 420px; margin: 0 0 12px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; }
.tut-folder { margin-bottom: 12px; }
.tut-folder-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; padding: 6px 2px; }
.tut-folder-acts { display: inline-flex; gap: 4px; margin-left: auto; }
.tut-folder-empty { padding: 4px 2px 8px; }
.tut-row .tut-order { display: flex; flex-direction: column; gap: 2px; margin-right: 8px; }
.tut-row .tut-order .icon-btn[disabled] { opacity: .3; }

/* Screenshots on a step (Pete, 30 Oct 2026). The card widens when it holds one. */
.tut-pop-pics { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.tut-pop-pics figure { margin: 0; }
.tut-pop-pics img { display: block; max-width: 100%; max-height: 46vh; margin: 0 auto; border: 1px solid var(--border); border-radius: 6px; cursor: zoom-in; }
.tut-pop-pics figcaption { margin-top: 3px; font-size: 12px; color: var(--muted); text-align: center; }
#tut-root .tut-zoom {
  position: fixed; inset: 0; z-index: 169; background: rgba(15, 23, 42, .88);
  display: flex; align-items: center; justify-content: center; padding: 60px 12px 12px;
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: zoom-out;
}
#tut-root .tut-zoom img {
  max-width: 100%; max-height: 100%; border-radius: 6px; background: #fff;
  transform-origin: 50% 50%; will-change: transform; touch-action: none; -webkit-user-drag: none; cursor: zoom-in;
}
#tut-root .tut-zoom.is-zoomed img { cursor: grab; }
#tut-root .tut-zoom img.tut-zoom-anim { transition: transform .15s ease-out; }
/* Zoom buttons (Pete, 1 Nov 2026), top right. 44px so a thumb can hit them. */
#tut-root .tut-zoom-bar {
  position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 6px; cursor: default;
}
#tut-root .tut-zoom-btn {
  min-width: 44px; height: 44px; padding: 0 10px; box-sizing: border-box; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(15, 23, 42, .75); color: #fff;
  font: 600 20px/1 system-ui, sans-serif; cursor: pointer;
}
#tut-root .tut-zoom-btn:disabled { opacity: .4; cursor: default; }
#tut-root .tut-zoom-btn:hover:not(:disabled) { background: rgba(51, 65, 85, .95); }
#tut-root .tut-zoom-reset { font-size: 14px; min-width: 60px; }
#tut-root .tut-zoom-close { font-size: 26px; }
@media (max-width: 860px) {
  #tut-root .tut-zoom { padding: 64px 0 0; }
  #tut-root .tut-zoom-btn { min-width: 48px; height: 48px; }
}
.tut-rec-pics { display: flex; flex-direction: column; gap: 6px; }
.tut-rec-pic { display: flex; align-items: center; gap: 6px; }
.tut-rec-pic img { width: 56px; height: 40px; object-fit: cover; border: 1px solid var(--border); border-radius: 4px; flex: none; }
.tut-rec-pic input[type="text"] { flex: 1; min-width: 0; }
