/* ── Elegoo printer sidecard styles ───────────────────────────────────────
   Loaded after 55-creality.css (numeric order via <link> tags in
   inventory.html). Shared .snap-* live-block classes live in
   50-snapmaker.css — this file only adds Elegoo-specific overrides.
   Nothing in this file is used outside the Elegoo brand context.
   ──────────────────────────────────────────────────────────────────────── */

/* Camera host — mirrors .ffg-cam-host from 40-printers.css.
   The .pp-cam-full container (aspect ratio + positioning) is defined in
   50-snapmaker.css and shared across all brands. */
.elg-cam-host {
  position: relative;
  overflow: hidden;
  background: #000;
  border-radius: 10px 10px 0 0;
}

/* Live MJPEG stream image */
.elg-camera-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border: none;
}

/* Fallback overlay when stream fails */
.elg-cam-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.elg-cam-fallback-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.6;
}

.elg-cam-fallback-img--placeholder {
  background: var(--surface-2);
}

.elg-cam-fallback-overlay {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  width: 100%;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.elg-cam-fallback-icon {
  background-color: var(--warning);
}

.elg-cam-fallback-msg {
  font-size: 12px;
  color: var(--ink-85);
  text-align: center;
}

/* Log section — same visual as .snap-log-section in 50-snapmaker.css.
   No rule needed here unless Elegoo needs a visual difference. */
.elg-log-host {
  /* inherits all snap-log-section styles; placeholder for future overrides */
}

/* ── File explorer — history status badges ─────────────────────────────── */
.cre-file-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}
.cre-file-thumb--placeholder .icon {
  background-color: var(--muted);
}

.elg-hist-status {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
}
.elg-hist-status--ok     { color: var(--success-text);   background: color-mix(in srgb, var(--success) 12%, transparent); }
.elg-hist-status--cancel { color: var(--muted);          background: var(--surface-2); }

/* ── Mono-extruder filament grid (no Canvas hub) ───────────────────────────
   Single "Ext." slot aligned left, same size as one slot in the 4-up grid.
   Gap = 8px, 4 items → each slot width = (100% - 3×8px) / 4 = 25% - 6px. */
.snap-fil-grid--mono {
  justify-content: flex-start;
}
.snap-fil-grid--mono .snap-fil {
  flex: 0 0 calc(25% - 6px);
}

/* ══════════════════════════════════════════════════════════════════════════
   Elegoo File Sheet — tabs + print button
   ══════════════════════════════════════════════════════════════════════════ */

/* Tab bar */
.elg-fs-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.elg-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 border-bottom of the tab bar */
  border-radius: 6px 6px 0 0;
}
.elg-fs-tab:hover { color: var(--text); }
.elg-fs-tab--active {
  color: var(--primary-text);
  border-bottom-color: var(--primary);
}

/* Print button inside each file row */
.elg-fs-print-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--primary-text);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .1s, border-color .1s;
  opacity: 0;                   /* hidden by default — reveals on row hover */
  pointer-events: none;
}
.cre-file-row:hover .elg-fs-print-btn {
  opacity: 1;
  pointer-events: auto;
}
.elg-fs-print-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-accent);
}
.elg-fs-print-btn:active {
  background: var(--primary-hover);
}

/* Timelapse download button — sits left of the print button in history rows.
   Uses the same shape as .elg-fs-print-btn but with a neutral tint. */
.elg-fs-dl-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .1s, border-color .1s, color .1s;
  opacity: 0;
  pointer-events: none;
}
.cre-file-row:hover .elg-fs-dl-btn,
.elg-fs-dl-btn--always {
  opacity: 1;
  pointer-events: auto;
}
.elg-fs-dl-btn .icon {
  background-color: var(--muted);
  height: 13px;
  aspect-ratio: 1 / 1;
  -webkit-mask-image: url('../../assets/svg/icons/icon_download.svg');
          mask-image: url('../../assets/svg/icons/icon_download.svg');
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  transition: background-color .1s;
}
.elg-fs-dl-btn:hover {
  background: rgba(99, 179, 237, .15);
  border-color: #63b3ed;
  color: #63b3ed;
}
.elg-fs-dl-btn:hover .icon {
  background-color: #63b3ed;
}
:root:not([data-theme="dark"]) .elg-fs-dl-btn:hover { border-color: var(--info-text); color: var(--info-text); }
:root:not([data-theme="dark"]) .elg-fs-dl-btn:hover .icon { background-color: var(--info-text); }
.elg-fs-dl-btn:active {
  background: rgba(99, 179, 237, .25);
}

/* ── Job card — name row (filename + pause/stop buttons on same line) ──────── *
 * Buttons are taken OUT of flow (position:absolute) so they never push the
 * name or create overflow. The name reserves padding-right equal to the
 * buttons' footprint so text doesn't slide under them.
 * ─────────────────────────────────────────────────────────────────────────── */
.elg-job-name-row {
  position: relative;   /* stacking context for absolute buttons */
  min-width: 0;
  min-height: 32px;     /* at least as tall as the buttons (32 px) */
  display: flex;
  align-items: center;
}
/* When buttons are present, reserve space on the right so text doesn't
   slide under them: 2 × 32px + 8px gap + 2px breathing room = 74px. */
.elg-job-name-row--with-btns .snap-job-name {
  padding-right: 74px;
}
/* Buttons float at the vertical centre of the row, flush with the right edge */
.elg-job-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin-top: 0;         /* cancel the 10px from .cre-actions */
}

/* ── Temp pills — inline edit (click to set target) ──────────────────────── */
.snap-temp--editable {
  cursor: pointer;
  transition: background .12s;
}
.snap-temp--editable:hover {
  background: var(--surface-2);
}
/* Number input that replaces .snap-temp-val on click */
.snap-temp-input {
  width: 52px;
  padding: 1px 4px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  text-align: center;
  outline: none;
  /* Remove browser spin arrows — we want compact width */
  -moz-appearance: textfield;
  appearance: textfield;
}
.snap-temp-input::-webkit-outer-spin-button,
.snap-temp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   Elegoo Control card (.elg-ctrl)
   widget_control.js — jog pad / fans / LED / print speed
   ══════════════════════════════════════════════════════════════════════════ */

/* icon-fan mask — added here to keep it Elegoo-scoped (only used in .elg-ctrl) */
.icon-fan {
  -webkit-mask-image: url('../../assets/svg/icons/icon_fan.svg');
          mask-image: url('../../assets/svg/icons/icon_fan.svg');
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  aspect-ratio: 1 / 1;
}

/* ── Position display — single horizontal line, centred above Step selector */
.elg-ctrl-pos {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.elg-ctrl-pos b { color: var(--text); font-weight: 700; margin-left: 2px; }

/* ── Right pill: Home X · Home Y (mirrors Z pill) ────────────────────────── */
.elg-jog-right-pill {
  width: 40px;
  height: 110px;
  border-radius: 20px;
  background: var(--surface-2);
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 12px 0;
  flex-shrink: 0;
  align-self: center;
}

/* ── Info column (right of right pill): position + step + speed ──────────── */
.elg-jog-info-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

/* [][] dans l'info col — côte à côte, même taille que cre-action-btn */
.elg-ctrl-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
/* annule le margin-left:auto du variant --files quand il est dans cette zone */
.elg-ctrl-actions .cre-action-btn--files { margin-left: 0; }
/* pas de bordure sur les boutons Dossier et LED dans la zone de contrôle Elegoo */
.elg-ctrl-actions .cre-action-btn { border: none; }

/* ── Jog pad ─────────────────────────────────────────────────────────────── */

/* Outer wrapper — transparent, just flex alignment */
.elg-jog-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 4px;
}

/* ── Z pill (left) ── */
.elg-jog-z-pill {
  width: 40px;
  height: 110px;
  border-radius: 20px;
  background: var(--surface-2);
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 8px 0;
  flex-shrink: 0;
  align-self: center;
}

.elg-jog-z-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  cursor: pointer;
  width: 100%;
  padding: 6px 0;
  text-align: center;
  border-radius: 6px;
  transition: color .1s, background .1s;
  user-select: none;
  line-height: 1;
}
.elg-jog-z-btn:hover  { color: var(--primary-text); }
.elg-jog-z-btn:active { color: var(--primary-text); font-weight: 900; }

/* ── Home button (circle with ⌂ glyph) ── */
.elg-jog-home-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);   /* home icon matches the other control icons (muted); white on hover */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  transition: background .1s, border-color .1s;
  flex-shrink: 0;
  user-select: none;
}
.elg-jog-home-btn:hover  { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.elg-jog-home-btn:active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); opacity: .8; }

/* ── XY circle ── */
.elg-jog-xy-circle {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  flex-shrink: 0;
  overflow: hidden;   /* clips sector highlights to circle shape */
}

/* Sector highlights — triangular quadrants clipped by parent border-radius */
/* Sector highlights — each triangle lit up on button hover */
.elg-jog-sector {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--primary);
  opacity: 0;
  transition: opacity .15s;
  z-index: 0;
}
.elg-jog-sector--n { clip-path: polygon(50% 50%, 0%   0%,   100% 0%  ); }
.elg-jog-sector--s { clip-path: polygon(50% 50%, 0%   100%, 100% 100%); }
.elg-jog-sector--w { clip-path: polygon(50% 50%, 0%   0%,   0%   100%); }
.elg-jog-sector--e { clip-path: polygon(50% 50%, 100% 0%,   100% 100%); }

/* Show sector when its button is hovered */
.elg-jog-xy-btn--n:hover ~ .elg-jog-sector--n { opacity: .18; }
.elg-jog-xy-btn--s:hover ~ .elg-jog-sector--s { opacity: .18; }
.elg-jog-xy-btn--w:hover ~ .elg-jog-sector--w { opacity: .18; }
.elg-jog-xy-btn--e:hover ~ .elg-jog-sector--e { opacity: .18; }

/* Direction buttons — no background ever, only color changes so camembert shows */
.elg-jog-xy-btn {
  position: absolute;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: .08em;
  cursor: pointer;
  padding: 4px 6px;
  transition: color .1s;
  user-select: none;
  white-space: nowrap;
  z-index: 2;
}
.elg-jog-xy-btn:hover  { color: var(--primary-text); background: transparent; }
.elg-jog-xy-btn:active { color: var(--primary-text); }  /* pas de font-weight: 900 — ça change la taille et casse le transform */

/* Positions + transforms déclarés ensemble pour chaque bouton.
   Le transform est répété sur :active pour qu'il ne soit jamais perdu. */
.elg-jog-xy-btn--n,
.elg-jog-xy-btn--n:active { top: 8px;    left: 50%; transform: translateX(-50%); }
.elg-jog-xy-btn--s,
.elg-jog-xy-btn--s:active { bottom: 8px; left: 50%; transform: translateX(-50%); }
.elg-jog-xy-btn--w,
.elg-jog-xy-btn--w:active { left: 6px;   top:  50%; transform: translateY(-50%); }
.elg-jog-xy-btn--e,
.elg-jog-xy-btn--e:active { right: 6px;  top:  50%; transform: translateY(-50%); }

/* Center home XY — compact circle, fond = surface-2 (même que le cercle),
   z-index 2 → au-dessus des secteurs orange périphériques */
.elg-jog-home-btn--xy {
  position: absolute;
  top:  calc(50% - 20px);   /* 20px = moitié de height:40px — plus de transform */
  left: calc(50% - 20px);
  transform: none;           /* explicite : empêche tout transform hérité ou browser default */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 38px;
  padding: 0;
  line-height: 1;
  z-index: 2;
}
.elg-jog-home-btn--xy:hover  { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.elg-jog-home-btn--xy:active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); opacity: .8; }

/* Z pill home btn — large glyph */
.elg-jog-z-pill .elg-jog-home-btn { font-size: 40px; }

/* Home SVG icon sizing per context (mask-image icons ignore font-size) */
.elg-home-icon                    { height: 15px; }  /* right pill X/Y: compact, axis label above */
.elg-jog-z-pill  .elg-home-icon  { height: 22px; }  /* Z pill: no axis label, more room */
.elg-jog-home-btn--xy .elg-home-icon { height: 28px; }  /* XY center: largest */


/* Axis label (X / Y) sitting above the home icon inside right-pill buttons */
.elg-jog-home-btn { flex-direction: column; gap: 0; }
.elg-jog-home-axis {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
  color: var(--muted);
  display: block;
}
.elg-jog-home-btn:hover  .elg-jog-home-axis,
.elg-jog-home-btn:active .elg-jog-home-axis { color: inherit; }

/* ── Speed / step selectors ─────────────────────────────────────────────── */
.elg-ctrl-speed-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* icon + dropdown align to the right of the info column */
  gap: 6px;
}
.elg-ctrl-speed-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
/* The Step / Speed labels are now icons — make them bigger than the default
   14px so they read clearly next to the dropdown. */
.elg-ctrl-speed-label .icon { width: 20px; height: 20px; }
.elg-ctrl-speed-select {
  flex: none;
  /* Sized by its own widest option, floored at the Latin width and capped so a
     long label cannot push the card: a fixed 110px clipped Russian's
     "Сбалансированный" to "Сбалансирова…", and every locale is free to be
     longer than English. flex:1 + max-width does not reliably cap a native
     select, hence auto + min/max. */
  width: auto;
  min-width: 110px;
  max-width: 165px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  appearance: auto;
}

/* ── Fan section (below jog pad) ─────────────────────────────────────────── */
.elg-fan-section {
  padding-top: 2px;
  margin-top: 0;
}

/* Tous les fans côte à côte */
.elg-fan-cols {
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: space-around;
}

/* Chaque fan dans sa propre card */
.elg-fan-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  background: var(--surface-2);
  border: none;
  border-radius: 8px;
  padding: 6px 4px;
}

/* Ligne haute : [] LABEL */
.elg-fan-col-head {
  display: flex;
  align-items: center;
  gap: 5px;
}

.elg-fan-col-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

/* Ligne basse : [−][%][+] */
.elg-fan-col-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Icon toggle button (grey / green when on) */
.elg-fan-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .1s, border-color .1s;
  padding: 0;
}
.elg-fan-icon-btn .icon           { background-color: var(--muted); transition: background-color .1s; }
.elg-fan-icon-btn:hover           { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.elg-fan-icon-btn:hover .icon     { background-color: var(--primary); }
.elg-fan-icon-btn--on             { background: color-mix(in srgb, var(--success) 10%, transparent); }
.elg-fan-icon-btn--on .icon       { background-color: var(--success); }
.elg-fan-icon-btn--on:hover       { background: color-mix(in srgb, var(--success) 20%, transparent); }

/* LED icon — amber when on */
.elg-fan-icon-btn--light.elg-fan-icon-btn--on             { background: color-mix(in srgb, var(--warning) 10%, transparent); }
.elg-fan-icon-btn--light.elg-fan-icon-btn--on .icon       { background-color: var(--warning); }
.elg-fan-icon-btn--light.elg-fan-icon-btn--on:hover       { background: color-mix(in srgb, var(--warning) 20%, transparent); }

/* − / + step buttons */
.elg-fan-step-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background .1s;
  flex-shrink: 0;
}
.elg-fan-step-btn:hover  { background: var(--primary); color: var(--on-accent); }
.elg-fan-step-btn:active { background: var(--primary); color: var(--on-accent); opacity: .8; }

/* % value */
.elg-fan-pct {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

