/* ═══════════════════════════════════════════════════════════════════════════
   printers/anycubic/anycubic.css — Anycubic-specific styles.

   The live block reuses the shared .snap-* / .cre-fil-* classes; only the
   camera <img> needs brand rules (same recipe as bambulab.css).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Camera — FLV→JPEG frames via IPC ─────────────────────────────────────
   Frames are injected into <img data-acu-key="…"> as data: URLs.
   The image fills the .pp-cam-full 16:9 container absolutely. */
.acu-camera-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
  display: block;
  background: #000;
  object-fit: cover;
}

/* Hide the broken-image icon on the <img> until the first frame arrives. */
.pp-cam-loading .acu-camera-img {
  opacity: 0;
}

/* ── Cloud camera — Agora WebRTC <video> ──────────────────────────────────
   .acu-cam-agora is the shared .pp-cam-full banner (position:relative, 16:9),
   so it must KEEP that sizing — never override it. agora-cam.js inserts a
   <video srcObject> into each container (one per surface — side panel + cam
   wall, fed the same MediaStreamTrack); it just needs to fill the banner. */
.acu-cam-agora video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  background: #000;
}

/* ── Cloud provisioning — bridge-mode launch instructions ──────────────────
   Shown in the "Add a cloud printer" modal when the slicer isn't reachable. */
.acu-cloud-help {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(123, 97, 255, 0.06);
}
.acu-cloud-help p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.acu-cloud-help-cmd {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}
/* Offline cloud printers in the pick list are shown but not selectable. */
.snap-scan-card.is-disabled { opacity: 0.5; pointer-events: none; }
.snap-scan-card.is-busy     { opacity: 0.6; pointer-events: none; }

/* ── Instant control-button tooltip ───────────────────────────────────────
   Floating bubble for [data-acu-tip] elements. Rendered at <body> level and
   positioned with position:fixed so it escapes the .elg-jog-xy-circle
   overflow:hidden clip. Shows immediately on hover (no native title delay). */
.acu-tip-pop {
  position: fixed;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--dark-surface);
  color: var(--on-dark);
  border: 1px solid var(--ink-10);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  width: max-content;
  max-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.08s;
}
.acu-tip-pop.show { opacity: 1; }

/* ── Control jog pad — slicer "Axis Move" layout ──────────────────────────
   [home-all / disable-motors]  |  XY circle  |  Z pill (Z+ / home / Z−).
   Left column mirrors AnycubicSlicerNext: two stacked icon wells. */
.acu-jog-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;   /* home pinned top, disable pinned bottom */
  flex-shrink: 0;
  align-self: stretch;              /* full row height */
}
.acu-jog-side .cre-action-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: 50%;            /* round, like the slicer */
  background: var(--surface-2);
}
/* Same hover treatment as the homing buttons (.elg-jog-home-btn): primary
   fill, white icon. */
.acu-jog-side .cre-action-btn:hover { background: var(--primary); border-color: var(--primary); }
.acu-jog-side .cre-action-btn:hover .icon { background-color: var(--on-accent); }

/* Filament rows with more than one slot fill the full card width (like Elegoo);
   the 1/5 cap only applies to a lone external spool. */
.cre-fil-row--fill .snap-fil { max-width: none; }

/* Jog row — left-aligned and compact, like the Elegoo control card.
   Far-right column holds the light toggle (top) + jog step + speed below. */
.acu-ctrl .elg-jog-wrap {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  row-gap: 14px;
}
.acu-jog-extra {
  display: flex;
  flex-direction: column;
  align-items: flex-end;       /* light + selects pinned to the right */
  gap: 10px;
  flex-shrink: 0;
  align-self: stretch;
  justify-content: flex-start;
  margin-left: auto;           /* push this column to the right edge */
}
.acu-jog-extra .elg-ctrl-speed-row { flex-shrink: 0; }
.acu-jog-extra .elg-ctrl-speed-label { min-width: 38px; }       /* align Step/Speed selects */
.acu-jog-extra .elg-ctrl-speed-select { width: auto; min-width: 96px; max-width: 165px; flex: none; }  /* fits "Standard", grows for a longer locale */

/* ── Filament feed (load / unload / stop) row in the edit sheet ──────────── */
.acu-feed-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.acu-feed-btn {
  flex: 1;
  justify-content: center;
}
.acu-feed-btn--stop {
  flex: 0 0 auto;
  min-width: 64px;
  opacity: .85;
}
.acu-feed-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Not-mounted filament slot ────────────────────────────────────────────
   Grey fill + muted "?", but the real filament colour stays as the border
   (set inline) so the slot is still identifiable. Material shows below. */
.snap-fil-square--unmounted {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
}

/* ── Printer error alert (command-failure report) ───────────────────────────
   Dismissible bottom-sheet anchored to the side-card footprint (like .sfe-sheet)
   but on top of it. Shown by _acuShowError() when the printer reports a failed
   command (e.g. code 10901 "Home the axis before moving"). No message-center
   action — we don't have one. */
#acuErrRoot        { display: none; }
#acuErrRoot.open   { display: block; }
.acu-err-backdrop {
  position: fixed; top: 8px; right: 0; bottom: 8px;
  width: min(440px, 92vw);
  background: var(--scrim);
  backdrop-filter: blur(2px);
  border-top-left-radius: 14px; border-bottom-left-radius: 14px;
  z-index: 9000;
}
.acu-err-sheet {
  position: fixed; right: 0; bottom: 8px;
  width: min(440px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border); border-right: none;
  border-radius: 18px 0 0 14px;
  padding: 20px 20px 22px;
  box-shadow: -8px -4px 32px rgba(0, 0, 0, .22);
  z-index: 9001;
  animation: acuErrUp .26s cubic-bezier(.4, 0, .2, 1);
}
@keyframes acuErrUp { from { transform: translateY(calc(100% + 8px)); } to { transform: translateY(0); } }
.acu-err-x {
  position: absolute; top: 12px; right: 16px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted);
}
.acu-err-head  { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.acu-err-warn  { font-size: 18px; }
.acu-err-title { font-weight: 700; font-size: 15px; color: var(--text); }
.acu-err-card  { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.acu-err-code  { display: block; text-align: right; margin-bottom: 8px; }
.acu-err-code:empty { display: none; }
.acu-err-code:not(:empty) {
  color: var(--danger-text); font-size: 12px; font-weight: 600;
  background: var(--danger-soft); border-radius: 6px; padding: 2px 8px;
}
.acu-err-msg   { color: var(--text); font-size: 14px; line-height: 1.4; }
.acu-err-ok    { width: 100%; }

/* ── File-management sheet — source tabs (On-printer / USB) ────────────────
   Mirrors the Elegoo file-sheet tab bar (.elg-fs-tabs). File rows + print/
   delete buttons reuse the shared .cre-file-* / .cre-files-* classes. */
.acu-fs-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px 0;
  background: var(--surface);
  flex-shrink: 0;
}
.acu-fs-tabs:empty { display: none; }   /* single-source view → no tab bar */
.acu-fs-tabs:not(:empty) { border-bottom: 1px solid var(--border); }
.acu-fs-tab {
  flex: 1;
  padding: 6px 4px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: color .12s, border-color .12s;
  margin-bottom: -1px;      /* overlap the tab bar's border-bottom */
  border-radius: 6px 6px 0 0;
}
.acu-fs-tab:hover { color: var(--text); }
.acu-fs-tab--active {
  color: var(--primary-text);
  border-bottom-color: var(--primary);
}

/* Print is hold-to-confirm here (it starts a real job) — give it the same
   fill/feedback as the shared delete button, in green. Scoped to the Anycubic
   sheet so other brands' click-only print buttons are unaffected. */
#acuFileSheet .cre-file-btn--print { position: relative; overflow: hidden; }
#acuFileSheet .cre-file-btn--print .hold-progress {
  position: absolute; left: 0; top: 0;
  width: 0; height: 100%;
  background: color-mix(in srgb, var(--success) 30%, transparent);
  pointer-events: none;
}
#acuFileSheet .cre-file-btn--print .icon { position: relative; z-index: 1; }
#acuFileSheet .cre-file-btn--print.is-holding {
  background: color-mix(in srgb, var(--success) 15%, transparent); border-color: color-mix(in srgb, var(--success) 40%, transparent);
}
#acuFileSheet .cre-file-btn--print.is-confirming { background: var(--success); border-color: var(--success); }
#acuFileSheet .cre-file-btn--print.is-confirming .icon { background-color: var(--on-accent); }

/* Cloud files are account-level (shown for every printer) but a sliced gcode
   only prints on the machine it was sliced for — so the print button is disabled
   on incompatible files (and while a job runs). Keep it visibly inert. */
#acuFileSheet .cre-file-btn--print:disabled {
  opacity: .35;
  cursor: not-allowed;
  background: var(--surface-2);
  border-color: var(--border);
}
#acuFileSheet .cre-file-btn--print:disabled:hover { background: var(--surface-2); border-color: var(--border); }
#acuFileSheet .cre-file-btn--print:disabled .icon { background-color: var(--muted); }
#acuFileSheet .cre-file-row--incompatible .cre-file-name { color: var(--muted); }
