/* The import dialog (ui/imports/imports.js). Made of the page's own parts (.modal-overlay, .modal, .modal-title, label +
   input, .btn, .tag); colours only through the page's variables, so both themes follow. The picker is the sign-in
   sketch's (sketches/login, .lg-pk), renamed .imp-pk. */

/* the dialog sits near the top, so a step that is taller than the last one only grows downward */
#imp-modal{align-items:flex-start;padding-top:max(32px,10vh)}
#imp-modal .imp-dlg{max-width:560px;max-height:calc(100vh - max(32px,10vh) - 20px);overflow-y:auto}   /* the page's .modal otherwise: 28px padding, 20px under the title */
.imp-dlg .btn-primary{border:1px solid transparent}          /* lines up with the ghost button beside it */
.imp-dlg:focus,.imp:focus{outline:none}

/* the key */
.imp-key{font-family:var(--font-mono);font-size:13px}
input.imp-key.imp-bad{border-color:var(--red)}
input.imp-key.imp-bad:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--red) 15%,transparent)}
.imp-err{font-size:13px;line-height:1.45;color:var(--red);margin-top:8px;text-wrap:pretty}
.imp-err[hidden]{display:none}
.imp-err.imp-err-only{margin-top:0}

/* the footer: what the step does on the left, Cancel then the action on the right */
.imp-foot{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:20px}
.imp-foot .btn{flex-shrink:0}
.imp-foot-note{margin-right:auto;font-size:12.5px;line-height:1.4;color:var(--muted)}
.imp-sum{margin-right:auto;min-width:0;min-height:38px;display:flex;flex-direction:column;justify-content:center;gap:1px}
.imp-sum-1{font-size:13.5px;font-weight:500;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.imp-sum-1.imp-need{color:var(--red);font-weight:400}
.imp-sum-2{display:flex;min-width:0;font-size:12.5px;color:var(--muted);white-space:nowrap}
.imp-sum-2:empty{display:none}
.imp-sum-names{min-width:0;overflow:hidden;text-overflow:ellipsis}
.imp-sum-more{flex-shrink:0;margin-left:6px;color:var(--muted2)}
.imp-msg{font-size:14px;line-height:1.5;color:var(--text)}

/* the check and the import: one row per step, its state as a tag on the right */
.imp-steps{border-top:1px solid var(--border)}
.imp-step{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:8px 0;
  border-bottom:1px solid var(--border);font-size:14px}
.imp-step .tag{flex-shrink:0;font-variant-numeric:tabular-nums}
.imp-step-photos{border-bottom:none}
.imp-bar{height:6px;margin:2px 0 4px;border-radius:3px;background:rgba(255,255,255,.06);overflow:hidden}
.imp-bar-fill{height:100%;width:0;border-radius:3px;background:var(--accent);transition:width .35s cubic-bezier(.4,0,.2,1)}
html[data-theme="light"] .imp-bar{background:rgba(16,17,22,.07)}

/* done */
.imp-done{font-size:14px;line-height:1.5;color:var(--text)}
.imp-kind{margin-top:6px;font-size:13px;line-height:1.5;color:var(--muted);text-wrap:pretty}
.imp-hint{margin-top:8px;font-size:13px;line-height:1.5;color:var(--muted);text-wrap:pretty}
.imp-rows{margin-top:12px;border-top:1px solid var(--border)}
.imp-item{padding:10px 0;border-bottom:1px solid var(--border)}
.imp-row{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:14px}
.imp-row-t{min-width:0;overflow-wrap:anywhere}
.imp-row .tag{flex-shrink:0}
.imp-dim{color:var(--muted)}
.imp-sub{font-size:12.5px;line-height:1.5;color:var(--muted);margin-top:3px}

/* pick what to import: one list, a row per model that opens and closes, its presets under it. Every row has a fixed
   height (the script works the list's height out from them), so opening a model never moves the count or the footer:
   the list scrolls inside, and each model's row stays on top while its presets scroll under it */
.imp{--imp-pk-max:clamp(180px,calc(100vh - max(32px,10vh) - 300px),460px)}
.imp:has(.imp-pk-filter){--imp-pk-max:clamp(180px,calc(100vh - max(32px,10vh) - 344px),460px)}
.imp-pk-wrap{position:relative}
.imp-pk-wrap::after{content:'';position:absolute;left:0;right:0;bottom:1px;height:16px;pointer-events:none;opacity:0;transition:opacity .12s;
  background:linear-gradient(to bottom,transparent,var(--surface))}
.imp-pk-wrap.imp-pk-more::after{opacity:1}   /* more below: a cut row reads as "more", not as a mistake */
.imp-pk-filter{margin-bottom:8px}
.imp-pk-filter input{padding:8px 11px;font-size:13.5px}
.imp-pk-filter input::-webkit-search-cancel-button{cursor:pointer}
.imp-pk-head{display:flex;align-items:center;justify-content:space-between;gap:12px;height:36px}
label.imp-pk-all{display:flex;align-items:center;gap:10px;margin:0;height:100%;padding-left:10px;font-size:13.5px;font-weight:500;color:var(--text);cursor:pointer;user-select:none}
.imp-pk-count{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.imp-pk-list{position:relative;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
.imp-pk-model{position:sticky;top:0;z-index:1;display:flex;align-items:center;height:52px;padding-right:6px;background:var(--surface);
  border-bottom:1px solid var(--border);cursor:pointer;user-select:none;outline:none}
.imp-pk-grp + .imp-pk-grp .imp-pk-model{border-top:1px solid var(--border)}
.imp-pk-box{display:flex;align-items:center;justify-content:center;width:36px;height:100%;flex-shrink:0}   /* the model's checkbox: its own hit area */
.imp-pk-mt{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.imp-pk-name{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.imp-pk-meta{min-height:17px;font-size:12.5px;line-height:17px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.imp-pk-n{margin-left:10px;font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
/* the page's one disclosure marker: the studio's (ui/studio/editor.css .st-item-caret), same size, weight and turn */
.imp-pk-chev{flex-shrink:0;width:7px;height:7px;margin:0 5px 0 12px;border:solid var(--muted);border-width:0 1.5px 1.5px 0;
  transform:rotate(-45deg);transition:transform .15s ease}
.imp-pk-model[aria-expanded="true"] .imp-pk-chev{transform:rotate(45deg) translate(-2px,-2px)}
.imp-pk-items[hidden]{display:none}
.imp-pk-row{display:flex;align-items:center;gap:10px;height:36px;padding:0 6px 0 36px;font-size:14px;cursor:pointer;user-select:none;outline:none}
.imp-pk-row .imp-pk-pn{min-width:0;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.imp-pk-row .tag{flex-shrink:0;padding:1px 7px}
.imp-pk-row[aria-disabled="true"]{cursor:default;color:var(--muted)}
.imp-pk-row:hover:not([aria-disabled="true"]){background:rgba(255,255,255,.03)}
.imp-pk-model:hover{box-shadow:inset 0 0 0 999px rgba(255,255,255,.03)}   /* over its own solid background: it covers the rows */
.imp-pk-model:focus-visible,.imp-pk-row:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;border-radius:6px}
.imp-pk-div{display:flex;align-items:center;gap:10px;height:28px;padding:0 6px 0 36px;font-size:12px;color:var(--muted2)}
.imp-pk-div::after{content:'';flex:1;height:1px;background:var(--border)}
.imp-pk mark{background:color-mix(in srgb,var(--accent) 35%,transparent);color:var(--text);border-radius:3px}   /* names and app tags alike */
.imp-pk-none{padding:28px 12px;text-align:center;font-size:13px;color:var(--muted)}
.imp-pk input[type=checkbox]{width:13px;height:13px;flex-shrink:0;margin:0;padding:0;accent-color:var(--accent);cursor:pointer}
.imp-pk-list input[type=checkbox]{pointer-events:none}   /* the row is the click target, the box only shows its state */
/* the boxes follow the theme (the browser's own light box is a bright white square on dark) */
.imp-pk{color-scheme:dark}
html[data-theme="light"] .imp-pk{color-scheme:light}
html[data-theme="light"] .imp-pk-row:hover:not([aria-disabled="true"]){background:rgba(16,17,22,.035)}
html[data-theme="light"] .imp-pk-model:hover{box-shadow:inset 0 0 0 999px rgba(16,17,22,.035)}

@media(max-width:768px){
  #imp-modal{padding:12px}
  #imp-modal .imp-dlg{padding:20px 18px;max-height:calc(100vh - 24px)}
  .imp{--imp-pk-max:clamp(160px,calc(100vh - 290px),460px)}
  .imp:has(.imp-pk-filter){--imp-pk-max:clamp(160px,calc(100vh - 334px),460px)}
}
