/* Python Blocks: vars.js. Variables and Lists as Scratch has them: the name
   box with its list and eyes, a function's inputs and a loop's variable as
   pills on their blocks, the Make a variable dialog, and the monitors (live
   values) over the output. */

/* The checkbox beside a variable's pill (drawn in the palette's SVG). */
.pb-mon-check { cursor: pointer; }
.pb-mon-box { fill: #16131f; stroke: #6f6890; stroke-width: 2; transition: fill 160ms ease, stroke 160ms ease; }
.pb-mon-tick { stroke: transparent; }
.pb-mon-check.is-on .pb-mon-box { fill: #8b5cf6; stroke: #8b5cf6; }
.pb-mon-check.is-on .pb-mon-tick { stroke: #fff; }
@media (hover: hover) {
  .pb-mon-check:hover .pb-mon-box { stroke: var(--gold); }
}
.pb-mon-check:active .pb-mon-box { fill: var(--gold); stroke: var(--gold); }
/* Labels under Variables and Lists ("Only inside greet", "Any list"): quieter than a category's name. */
.pb-blocks .pb-var-label .blocklyFlyoutLabelText { fill: var(--muted); font-weight: 600; }

/* A function's inputs on its define block, and a loop's variable: orange pills to drag a copy of. */
.pb-blocks .pb-pill > .blocklyFieldRect, .pb-blocks .pb-pill > rect { fill: #ff8c1a; stroke: #fff; stroke-opacity: 0.85; stroke-width: 1.5; fill-opacity: 1; rx: 12px; ry: 12px; }
.pb-blocks .pb-pill.is-list > .blocklyFieldRect, .pb-blocks .pb-pill.is-list > rect { fill: #ff661a; }
/* self on a method: the object it belongs to, in the Objects colour. */
.pb-blocks .pb-pill.is-self > .blocklyFieldRect, .pb-blocks .pb-pill.is-self > rect { fill: #14a89c; }
.pb-blocks .pb-pill .blocklyText { fill: #fff; }
.pb-blocks .pb-pill { cursor: grab; }
.pb-blocks .pb-loopvar > .blocklyFieldRect, .pb-blocks .pb-loopvar > rect { fill: #ff8c1a; stroke: #fff; stroke-opacity: 0.85; stroke-width: 1.5; fill-opacity: 1; rx: 12px; ry: 12px; }
.pb-blocks .pb-loopvar .blocklyText, .pb-blocks .pb-loopvar .blocklyDropdownText { fill: #fff; }
.pb-blocks .pb-loopvar { cursor: grab; }
/* The loop or define block a picked pill belongs to: its name lit in gold (vars.js lightOwner). */
.pb-blocks .pb-loopvar.is-owner > .blocklyFieldRect, .pb-blocks .pb-loopvar.is-owner > rect,
.pb-blocks .pb-pill.is-owner > .blocklyFieldRect, .pb-blocks .pb-pill.is-owner > rect { stroke: var(--gold); stroke-opacity: 1; stroke-width: 4; }

/* Make a variable / Make a list. */
.pb-var-form { display: grid; gap: 8px; }
.pb-var-input { font-family: var(--mono); font-size: 16px; }
.pb-var-scopes { display: grid; gap: 4px; margin: 6px 0 0; padding: 0; border: 0; }
.pb-var-scopes legend { margin-bottom: 4px; padding: 0; }
.pb-var-scope { display: flex; align-items: flex-start; gap: 10px; min-height: 36px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 0; cursor: pointer; }
.pb-var-scope input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: #8b5cf6; }
.pb-var-scope span { display: grid; gap: 2px; }
.pb-var-scope small { color: var(--muted); font-size: 0.78rem; }
.pb-var-scope:has(input:checked) { background: var(--tint); border-color: var(--accent); }
.pb-var-scope-fn { display: flex; align-items: center; gap: 6px; }
.pb-var-scope-fn .pb-var-scope { flex: none; align-items: center; }
.pb-var-fn { flex: 1 1 auto; min-width: 0; min-height: 36px; font-family: var(--mono); }
@media (hover: hover) {
  .pb-var-scope:hover { border-color: var(--gold); }
}

/* Make a function: its name, its inputs, whether it gives back, and how its define block will read. */
.pb-fn-inputs { display: grid; gap: 6px; }
.pb-fn-inputs:empty { display: none; }
.pb-fn-row { display: flex; align-items: center; gap: 6px; }
.pb-fn-row .pb-var-input { flex: 1 1 auto; min-width: 0; }
.pb-fn-x { flex: none; width: 36px; height: 36px; font-size: 1.2rem; }
.pb-fn-add { justify-self: start; }
.pb-fn-gives { display: flex; align-items: center; gap: 10px; min-height: 36px; margin-top: 4px; cursor: pointer; }
.pb-fn-gives input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: #8b5cf6; }
.pb-fn-preview { margin: 6px 0 0; padding: 10px 12px; overflow-wrap: anywhere; color: #fff; background: #ff6680; line-height: 2; }
.pb-fn-name { padding: 2px 8px; color: #16131f; background: #fff; font-family: var(--mono); }
.pb-fn-pill { padding: 2px 10px; background: #ff8c1a; border: 1.5px solid rgba(255, 255, 255, 0.85); border-radius: 12px; }
.pb-fn-slot { display: inline-block; width: 34px; height: 1.3em; vertical-align: middle; background: rgba(0, 0, 0, 0.25); border-radius: 12px; }

/* Monitors: Scratch's boxes on the stage, a band over the output and the Screen. */
.pb-monitors { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; max-height: 40%; padding: 6px 8px; overflow: auto; background: #14111d; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.pb-monitors[hidden] { display: none; }
.pb-mon { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; color: #e9e4f5; background: #262040; border: 1px solid #3c3360; border-radius: 0; font-size: 0.78rem; }
.pb-mon-name { font-weight: 700; white-space: nowrap; }
.pb-mon-name small { color: var(--muted); font-weight: 600; }
.pb-mon-val { min-width: 34px; max-width: 220px; padding: 2px 8px; overflow: hidden; color: #fff; background: #ff8c1a; border-radius: 0; font: 600 0.78rem/1.3 var(--mono); text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.pb-mon-val.is-none { color: rgba(255, 255, 255, 0.75); background: #6f6890; }
.pb-mon.is-list { flex-direction: column; align-items: stretch; gap: 4px; width: 170px; padding: 4px; }
.pb-mon.is-list .pb-mon-name { padding: 0 4px; text-align: center; }
.pb-mon-items { max-height: 120px; margin: 0; padding: 2px; overflow-y: auto; list-style: none; background: #16131f; border-radius: 0; scrollbar-width: thin; }
.pb-mon-items:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pb-mon-items li { display: flex; align-items: center; gap: 6px; padding: 1px 2px; }
.pb-mon-items li i { flex: none; min-width: 1.6em; color: var(--muted); font: 600 0.7rem/1 var(--mono); font-style: normal; text-align: right; }
.pb-mon-items li span { flex: 1 1 auto; min-width: 0; padding: 1px 6px; overflow: hidden; color: #fff; background: #ff661a; border-radius: 0; font: 0.74rem/1.4 var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.pb-mon-items li.is-empty { justify-content: center; color: var(--muted); font-size: 0.74rem; }
.pb-mon-len { color: var(--muted); font-size: 0.7rem; text-align: center; }

@media (max-width: 760px) {
  .blocklyDropDownDiv .blocklyMenuItem, .blocklyWidgetDiv .blocklyMenuItem { min-height: 36px; display: flex; align-items: center; }
  .pb-mon { min-height: 36px; }
  .pb-monitors { max-height: 30%; }
}
/* The few lines that say what a variable or a list is, before there is one. */
.pb-blocks .pb-var-note .blocklyFlyoutLabelText { fill: var(--muted); font-weight: 500; }

/* The bubble that says what a value dropped on a name box did (vars.js showTip): a note, not an error's red. */
.blocklyTextBubble.pb-tip path, .blocklyTextBubble.pb-tip rect { fill: #2c2540; stroke: var(--gold); }
.blocklyTextBubble.pb-tip text, .blocklyTextBubble.pb-tip .blocklyText { fill: #f3eefc; }

/* A variable's name, typed in its box on the block (vars.js typeName). */
.pb-varname { position: relative; width: 100%; height: 100%; }
.pb-varname-input { width: 100%; height: 100%; box-sizing: border-box; padding: 0 8px; color: #1d1929; background: #fff; border: 2px solid var(--gold); border-radius: 0; outline: none; font: 600 14px var(--body); }
@media (max-width: 760px) { .pb-varname-input { font-size: 16px; } }
/* Under it: why a name will not do or what it will do, with buttons, then the names this block can use, each with an eye to watch it. */
.pb-varname-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 2; display: grid; gap: 4px; width: max-content; min-width: 220px; max-width: 300px; }
.pb-varname-panel.is-up { top: auto; bottom: calc(100% + 4px); }
.pb-varname-panel .pb-suggest { position: static; max-width: none; max-height: 200px; }
.pb-varname-why { padding: 8px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--gold); border-radius: 0; box-shadow: 3px 3px 0 var(--edge); font: 0.82rem/1.35 var(--body); }
.pb-varname-why[hidden] { display: none; }
.pb-varname-why p { margin: 0; }
.pb-varname-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pb-varname-btn { min-height: 30px; padding: 4px 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font: 600 0.78rem/1.25 var(--body); text-align: left; cursor: pointer; }
.pb-varname-btn.is-main { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.pb-varname-row { display: flex; align-items: stretch; }
.pb-varname-row .pb-suggest-item { flex: 1 1 auto; min-width: 0; }
.pb-varname-eye { flex: none; display: grid; place-items: center; width: 34px; padding: 0; color: var(--faint); background: none; border: 0; border-radius: 0; cursor: pointer; }
.pb-varname-eye svg { width: 18px; height: 18px; }
.pb-varname-eye.is-on { color: var(--gold); }
@media (hover: hover) {
  .pb-varname-eye:hover { color: var(--bg); background: var(--gold); }
  .pb-varname-btn:hover { border-color: var(--gold); }
}
.pb-varname-btn:focus-visible, .pb-varname-eye:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (max-width: 760px) {
  .pb-varname-eye { width: 44px; }
  .pb-varname-btn { min-height: 40px; }
}
