/* =========================================================================
   Image converter. Sits on workspace.css (the charcoal .ws-app shell) and
   lays the page out as settings | preview | image list.

   The settings rail uses one pattern throughout: a small caps label above
   each control, controls full width, and choices as equal-width button
   grids, so every row lines up with the one above it.
   ========================================================================= */

.ws-grid.ic-grid { grid-template-columns: 300px minmax(0, 1fr) 340px; }
.ic-grid [hidden] { display: none !important; }

/* ----- settings rail ----------------------------------------------------- */
.ic-side .ic-field { margin: 0 0 14px; }
.ic-side .ic-field:last-child { margin-bottom: 0; }
.ic-lbl {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0 0 7px; font: 600 11px var(--mono); letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.5);
}
.ic-seg { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 5px; }
.ic-seg button {
  min-width: 0; padding: 8px 4px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius-btn);
  background: var(--ch-ctrl); color: rgba(255,255,255,.82);
  font: 600 11.5px var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color var(--t-state), color var(--t-state), background-color var(--t-state);
}
.ic-seg button:hover { border-color: var(--gold); color: var(--gold); }
.ic-seg button.on { background: var(--gold); border-color: var(--gold); color: var(--ch-shell); }

.ic-inrow { display: flex; align-items: center; gap: 8px; }
.ic-inrow input[type=range] { flex: 1; min-width: 0; accent-color: var(--gold); }
.ic-side .ic-num { width: 88px; }
.ic-side .ic-num.sm { width: 64px; text-align: right; }
.ic-side .ic-inrow .ic-num:not(.sm) { flex: 1; min-width: 0; }
.ic-text {
  width: 100%; padding: 8px 10px; font: 400 12.5px var(--body);
  background: var(--ch-bg); color: var(--text);
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-btn);
}
.ic-text:focus, .ic-side .ic-num:focus { outline: none; border-color: var(--gold); }
.ic-text::placeholder { color: rgba(255,255,255,.35); }
.ic-check {
  display: flex; align-items: center; gap: 9px; margin: 0 0 8px; cursor: pointer;
  font: 500 12.5px var(--body); color: rgba(255,255,255,.8);
}
.ic-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--gold); }
.ic-side .ic-hint { margin: 0; font: 400 12.5px/1.55 var(--body); color: rgba(255,255,255,.5); }
.ic-side h2 { margin-top: 18px; }
.ic-side > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Add images: one target to click or drop on, with the rarer ways under it. */
.ic-dz {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 16px 10px; cursor: pointer; text-align: center;
  border: 1.5px dashed rgba(255,255,255,.18); border-radius: 8px; background: rgba(255,255,255,.02);
  transition: border-color var(--t-state), background-color var(--t-state);
}
.ic-dz:hover, .ic-dz:focus-visible, body.ic-dragging .ic-dz { border-color: var(--gold); background: var(--gold-soft); outline: none; }
.ic-dz b { font: 700 13px var(--body); color: var(--gold); }
.ic-dz span { font: 400 12px var(--body); color: rgba(255,255,255,.5); }
.ic-links { display: flex; justify-content: center; gap: 16px; margin: 9px 0 0; }
.ic-link { background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--gold); font: 500 12px var(--body); }
.ic-link:hover { color: var(--gold-hi); }

/* ----- preview ----------------------------------------------------------- */
.ws-stage.ic-stage { display: flex; flex-direction: column; padding: 0; place-items: initial; position: relative; overflow: hidden; }
.ic-pv-head {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
  padding: 10px 16px; background: rgba(16,17,20,.72); border-bottom: 1px solid var(--ch-line);
}
.ic-pv-name { flex: 1; min-width: 0; font: 600 13px var(--body); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-pv-head .ic-seg { --n: 2; width: 230px; }
.ic-pv-body { position: relative; flex: 1 1 auto; min-height: 0; }
.ic-pv-body canvas { position: absolute; inset: 0; display: block; }
.ic-pv-body canvas.grab { cursor: ew-resize; touch-action: none; }
.ic-ph {
  position: absolute; inset: 24px; display: grid; place-items: center; text-align: center;
  border: 1.5px dashed rgba(255,255,255,.16); border-radius: 12px; padding: 20px;
}
.ic-ph b { display: block; font: 600 15px var(--body); color: rgba(255,255,255,.85); margin-bottom: 6px; }
.ic-ph span { font: 400 13px/1.55 var(--body); color: rgba(255,255,255,.5); }
body.ic-dragging .ic-stage::after {
  content: "Drop to add images"; position: absolute; inset: 14px; z-index: 5;
  display: grid; place-items: center; border-radius: 12px;
  border: 2px dashed var(--gold); background: rgba(10,11,14,.72);
  font: 600 15px var(--body); color: var(--gold-hi);
}

.ic-pv-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 0 0 auto;
  padding: 11px 16px; background: var(--ch-panel); border-top: 1px solid var(--ch-line);
}
.ic-cap b { display: block; margin-bottom: 3px; font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.ic-cap:last-child b { color: var(--gold); }
.ic-cap span { font: 500 12.5px var(--mono); color: rgba(255,255,255,.85); }

.ic-meta { flex: 0 0 auto; max-height: 30%; overflow-y: auto; padding: 0 16px 12px; background: var(--ch-panel); }
.ic-meta-h { margin: 0 0 6px; font: 400 12.5px var(--body); color: rgba(255,255,255,.5); }
.ic-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
.ic-meta dt { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.45); padding-top: 2px; }
.ic-meta dd { margin: 0; font: 400 12.5px var(--body); color: rgba(255,255,255,.85); overflow-wrap: anywhere; }
.ic-meta dd.warn { color: #F2C14E; }

/* ----- image list -------------------------------------------------------- */
.ic-queue {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--ch-panel); border-left: 1px solid var(--ch-line);
}
.ic-q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 14px 10px; }
.ic-q-head h2 { margin: 0; font: 600 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.ic-q-head h2 span { margin-left: 6px; color: rgba(255,255,255,.45); }
.ic-q-dl { margin: 0 14px 10px; justify-content: center; }
.ic-queue .ic-q-dl { display: block; width: calc(100% - 28px); text-align: center; }
.ic-queue .ic-q-dl:disabled { opacity: .45; cursor: default; }
.ic-q-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.ic-q-ph { margin: 6px 4px; font: 400 12.5px/1.55 var(--body); color: rgba(255,255,255,.45); }
.ic-q-total { flex: 0 0 auto; margin: 0; padding: 10px 14px; border-top: 1px solid var(--ch-line); font: 500 11px var(--mono); color: rgba(255,255,255,.5); }
.ic-q-total:empty { display: none; }

.ic-q-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 8px; cursor: pointer;
  background: #17181C; border: 1px solid rgba(255,255,255,.08); border-radius: 7px;
  transition: border-color var(--t-state), background-color var(--t-state);
}
.ic-q-row:hover { border-color: rgba(255,255,255,.2); }
.ic-q-row.on { border-color: var(--gold); background: rgba(212,175,55,.08); }
.ic-q-row.bad { border-color: rgba(227,123,123,.45); }
.ic-q-th { width: 44px; height: 44px; border-radius: 5px; background: #26272D center / cover no-repeat; }
.ic-q-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ic-q-txt b { font: 600 12.5px var(--body); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-q-dim { font: 500 11px var(--mono); color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-q-size { font: 500 11px/1.45 var(--mono); color: rgba(255,255,255,.55); }
.ic-q-dim:empty { display: none; }
.ic-q-size i { font-style: normal; }
.ic-q-size i.down { color: #4CAF7D; }
.ic-q-size i.up { color: #F2C14E; }
.ic-q-row.busy .ic-q-size { color: var(--gold); }
.ic-q-row.bad .ic-q-size { color: #E37B7B; white-space: normal; font-family: var(--body); font-size: 12px; }
.ic-q-btn {
  width: 28px; height: 28px; padding: 0; cursor: pointer;
  background: none; border: 1px solid rgba(255,255,255,.12); border-radius: 5px;
  color: rgba(255,255,255,.7); font: 600 14px var(--body); line-height: 1;
}
.ic-q-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.ic-q-btn.x:hover { border-color: #E37B7B; color: #E37B7B; }
.ic-q-btn:disabled { opacity: .3; cursor: default; }

.ic-grid .tool-error { margin: 12px 16px 0; }

/* ----- phones ------------------------------------------------------------ */
@media (max-width: 900px) {
  /* The stacked panels outgrow the screen, so the page scrolls instead of
     a box inside it: settings, preview, then the list. */
  .ws-app:has(.ic-grid) { height: auto; min-height: 100vh; min-height: 100dvh; }
  .ws-app .ws-grid.ic-grid { flex: none; overflow: visible; }
  .ws-app .ws-grid.ic-grid .ws-stage.ic-stage { flex: 0 0 auto; height: 62vh; min-height: 360px; }
  .ic-queue { border-left: 0; border-top: 1px solid var(--ch-line); flex: 0 0 auto; }
  .ic-q-list { overflow: visible; }
  .ic-pv-head .ic-seg { width: 200px; }
  .ic-pv-foot { grid-template-columns: 1fr; gap: 8px; }
  .ic-meta { max-height: none; }
}
