/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * Copyright © 2026 Marcel Rymenhout and IniqDash contributors */
/* Entity List Widget V1 — widget-specific CSS only (tokens from assets/css/tokens.css). Namespace: iq-elist. */
.iq-elist {
  position: relative;
  container: iq-elist / size;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 72px;
  overflow: hidden;
  border-radius: var(--radius-device);
  color: var(--text-primary);
  font-family: var(--font);
  background: linear-gradient(165deg, var(--surface-primary-top), var(--surface-primary) 55%, var(--surface-secondary));
  box-shadow: var(--shadow-primary), inset 0 0 0 1px var(--border-subtle);
}
.iq-elist [hidden] { display: none !important; }
.iq-elist__head { flex: none; padding: 11px 14px 6px; min-width: 0; }
.iq-elist__name { margin: 0; font-size: 14px; font-weight: var(--iq-fw-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-elist__sub { margin: 1px 0 0; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-elist__list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0 6px 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.iq-elist__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic who ctl" "ic val ctl"; align-items: center; column-gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 10px; }
.iq-elist__ic { grid-area: ic; width: 30px; height: 30px; margin-right: 2px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--text-secondary); background: var(--surface-tertiary); }
.iq-elist__ic svg { width: 16px; height: 16px; }
.iq-elist__ic[data-on="true"] { color: var(--accent); background: var(--accent-soft); }
.iq-elist__row[data-na="true"] .iq-elist__ic { opacity: var(--unavailable-opacity); }
.iq-elist__row + .iq-elist__row { border-top: 1px solid var(--border-subtle); }
.iq-elist__who { grid-area: who; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
span.iq-elist__who { cursor: default; }
.iq-elist__who:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 6px; }
/* the whole row opens the details (a comfortable touch target, not just the name); the row's own control stays above it */
.iq-elist__row { position: relative; }
button.iq-elist__who::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.iq-elist__row > button[data-type] { position: relative; z-index: 1; }
.iq-elist__n { display: block; font-size: 13.5px; font-weight: var(--iq-fw-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-elist__val { grid-area: val; min-width: 0; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.iq-elist__row[data-na="true"] .iq-elist__val { color: var(--text-muted); font-style: italic; }
.iq-elist__row > button[data-type] { grid-area: ctl; }
.iq-elist__sw { position: relative; flex: none; width: 42px; height: 24px; padding: 0; border: 0; border-radius: 12px; cursor: pointer; background: var(--control-well); box-shadow: var(--control-well-shadow); }
.iq-elist__sw i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); transition: transform .2s ease, background .2s ease; }
.iq-elist__sw[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 35%, var(--control-well)); }
.iq-elist__sw[aria-checked="true"] i { transform: translateX(18px); background: var(--accent); }
.iq-elist__btn { height: 28px; padding: 0 12px; border: 0; border-radius: 14px; cursor: pointer; font: var(--iq-fw-control) 12px var(--font); color: var(--text-primary); background: var(--control-well); box-shadow: var(--control-well-shadow); }
.iq-elist__sw:disabled, .iq-elist__btn:disabled { cursor: progress; opacity: .55; }
.iq-elist__sw:focus-visible, .iq-elist__btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.iq-elist__empty { margin: 0; flex: 1 1 auto; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 14px 18px; text-align: center; font-size: 12.5px; line-height: 1.4; color: var(--text-muted); }
.iq-elist__empty::before { content: ""; width: 34px; height: 34px; border-radius: var(--radius-sm); background: linear-gradient(var(--text-muted), var(--text-muted)) 8px 10px / 18px 2px no-repeat, linear-gradient(var(--text-muted), var(--text-muted)) 8px 16px / 12px 2px no-repeat, linear-gradient(var(--text-muted), var(--text-muted)) 8px 22px / 7px 2px no-repeat, var(--surface-tertiary); }
.iq-elist__empty[hidden] { display: none; }
/* the widget's OWN width: wide → name | value | control on one line */
@container iq-elist (min-width: 360px) {
  .iq-elist__row { grid-template-columns: auto minmax(0, 1fr) minmax(0, .8fr) auto; grid-template-areas: "ic who val ctl"; min-height: 40px; }
  .iq-elist__val { text-align: right; }
}
@container iq-elist (max-width: 190px) { .iq-elist__ic { display: none; } .iq-elist__row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "who" "val" "ctl"; row-gap: 2px; } .iq-elist__row > button[data-type] { justify-self: start; } }
@container iq-elist (max-height: 110px) { .iq-elist__head { padding-bottom: 2px; } .iq-elist__sub { display: none; } }
@container iq-elist (max-height: 160px) { .iq-elist__empty::before { display: none; } }
.iq-elist__list:empty { display: none; }
/* the shared expandable list (components/expandlist): collapsed, the Show more control sits right under the rows */
.iq-elist__list[data-iqx="closed"] { flex: 0 1 auto; }

/* ROW SLIDER (rowSliders): icon · name · switch · brightness slider · % */
.iq-elist__row.iq-elist__row--level { grid-template-columns: auto minmax(0, 1fr) auto minmax(110px, 1.35fr); grid-template-areas: "ic who ctl lvl" "ic val ctl lvl"; column-gap: 14px; }
.iq-elist__lvl { grid-area: lvl; display: flex; align-items: center; gap: 10px; min-width: 0; }
.iq-elist__lvl input { flex: 1 1 auto; min-width: 0; height: 22px; margin: 0; appearance: none; -webkit-appearance: none; background: none; cursor: pointer; }
.iq-elist__lvl input::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) var(--lvl, 0%), var(--surface-interactive, rgba(255, 255, 255, .14)) var(--lvl, 0%)); }
.iq-elist__lvl input::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-interactive, rgba(255, 255, 255, .14)); }
.iq-elist__lvl input::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
.iq-elist__lvl input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #f4f5f8; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.iq-elist__lvl input::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #f4f5f8; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.iq-elist__lvl input:disabled { opacity: .45; cursor: default; }
.iq-elist__pct { flex: none; min-width: 3.2ch; text-align: right; font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
@container iq-elist (max-width: 359px) { .iq-elist__row.iq-elist__row--level { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic who ctl" "lvl lvl lvl"; } }

/* a row's NOTE (your own short second line): under the name, quieter */
.iq-elist__row.iq-elist__row--note .iq-elist__who { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-width: 0; }
.iq-elist__note { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82em; color: var(--text-secondary); font-weight: 400; }
