/* Working on the page with the mouse and the keyboard: focus on elements, skip link, live readout, page
   navigation in the status bar, the floating context toolbar, the field picker and the layers list.
   (canvas.js, nav.js, ctxbar.js, contextmenu.js, layers.js) */

/* ---- skip link: visible only when it has the keyboard focus */
.skip-link { position: fixed; top: 6px; inset-inline-start: 8px; z-index: 2000; padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; transform: translateY(-160%); transition: transform .12s; }
.skip-link:focus, .skip-link:focus-visible { transform: none; outline: 2px solid #fff; outline-offset: -4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- an element with the keyboard focus (on top of the selection frame) */
.design-page .fd-el:focus { outline: none; }
.design-page .fd-el:focus-visible { outline: 2px solid var(--accent) !important; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(37, 99, 235, .22); }
.design-page .fd-el.is-design-hidden { visibility: hidden; pointer-events: none; }

/* ---- the live position / size readout next to the selection */
.fd-readout { position: absolute; z-index: 60; pointer-events: none; padding: 2px 7px; border-radius: 5px; background: #1c2433; color: #fff; font-size: 11px; line-height: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 2px 8px rgba(20, 30, 50, .25); }
.statusbar bdi { font-variant-numeric: tabular-nums; }

/* ---- "‹ page 1 of 2 ›" */
.status-pages { display: inline-flex; align-items: center; gap: 2px; }
.status-nav { border: 1px solid transparent; background: none; min-width: 24px; height: 24px; border-radius: 5px; font-size: 15px; line-height: 1; color: var(--text); cursor: pointer; }
.status-nav:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
.status-nav:disabled { opacity: .35; cursor: default; }

/* ---- floating context toolbar */
.fd-ctxbar { position: fixed; z-index: 45; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(20, 30, 50, .16); }
.fd-ctxbar[hidden], .fd-dragging .fd-ctxbar { display: none; }
.fd-ctxbar-b { min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap; }
.fd-ctxbar-b:hover { background: var(--accent-soft); }
.fd-ctxbar-b.danger { color: var(--danger); }
.fd-ctxbar-b[aria-disabled="true"] { opacity: .38; cursor: default; background: none; }
.fd-ctxbar-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line); }

/* ---- searchable list of the data fields */
.fd-picker { position: fixed; z-index: 1001; width: 340px; max-width: calc(100vw - 8px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20, 30, 50, .18); padding: 6px; }
.fd-picker-q { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.fd-picker-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 280px; overflow-y: auto; }
.fd-picker-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; min-height: 28px; }
.fd-picker-opt:hover { background: var(--panel-2); }
.fd-picker-opt.on { background: var(--accent-soft); outline: 1px solid var(--accent); outline-offset: -1px; }
.fd-picker-opt.bound .fd-picker-name::after { content: ' ✓'; color: var(--ok); }
.fd-picker-kind { width: 14px; color: var(--muted); text-align: center; flex: none; }
.fd-picker-name { font-weight: 600; }
.fd-picker-path { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.fd-picker-sample { color: var(--muted); font-size: 11px; background: var(--panel-2); border-radius: 4px; padding: 0 5px; flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-picker-empty { padding: 10px; color: var(--muted); }
.fd-picker-hint { margin: 6px 4px 0; color: var(--muted); font-size: 11px; }

/* ---- layers */
.layers { display: flex; flex-direction: column; min-height: 0; }
.layers-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.layers-q { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.layers-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.layers-list { list-style: none; margin: 0; padding: 0 6px; overflow-y: auto; }
.layer { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 6px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.layer:hover { background: var(--panel-2); }
.layer.on { background: var(--accent-soft); border-color: rgba(37, 99, 235, .35); }
.layer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.layer.is-hidden .layer-name, .layer.is-hidden .layer-icon { opacity: .45; }
.layer.dragging { opacity: .5; }
.layer.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.layer.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.layer-icon { width: 22px; flex: none; text-align: center; color: var(--muted); font-size: 12px; }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-group { color: var(--muted); font-size: 11px; }
.layer-btn { border: 1px solid transparent; background: none; width: 26px; height: 26px; border-radius: 5px; font-size: 12px; opacity: .55; cursor: pointer; flex: none; }
.layer:hover .layer-btn, .layer.on .layer-btn, .layer-btn[aria-pressed="true"] { opacity: 1; }
.layer-btn:hover { background: var(--panel); border-color: var(--line); }
.layers-rename { flex: 1; min-width: 0; padding: 3px 6px; border: 1px solid var(--accent); border-radius: 5px; font: inherit; }
.layers-empty { padding: 14px 10px; color: var(--muted); }

/* the rail icon of the "Layers" tab (registered with registerPanel of panels.js): three stacked sheets */
.ic-layers { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5z'/%3E%3Cpath d='m3 12.5 9 5 9-5'/%3E%3Cpath d='m3 17 9 5 9-5'/%3E%3C/svg%3E"); }

/* ---- an element outside the printed area: off the page, too close to its edge, or across the template's margins
   (core/shared/pdf-check.js placement, canvas.js markPlacement) */
.design-page .fd-el.is-outside { outline: 1.5px dashed #dc2626; outline-offset: -1px; box-shadow: inset 0 0 0 999px rgba(220, 38, 38, .08); }
.design-page .fd-el.is-outside-margins { outline-color: #d97706; box-shadow: inset 0 0 0 999px rgba(217, 119, 6, .07); }
.fd-offpage { position: absolute; bottom: 100%; margin-bottom: 4px; inset-inline-end: 0; z-index: 5; padding: 1px 10px; border: 1px solid #fca5a5; border-radius: 999px; background: #fef2f2; color: #b91c1c; font-size: 12px; font-weight: 600; line-height: 18px; cursor: pointer; white-space: nowrap; }
.fd-offpage:hover { background: #fee2e2; }
