/* ============================================================================
   zz_studio_canvas_toolbar.css — the Post studio canvas toolbar: the chart-type
   chip row ABOVE the canvas (plan stage C-6b; docs/new_content/studio_control_map.md
   A3 "Type block" -> "Canvas toolbar"; docs/design/new_content_screen.md §7 = the
   orange view-switcher idiom; DS §4 "Filtr chip (navigace)", §5 "Chip řada" —
   horizontal, overflow-x:auto on phones).

   Scope: #new-content-shell .sp-studio-canvas-toolbar — the id-less Div that
   is the ONLY child of #preview-action-panel (until UX 4.3 / D-62, 2026-09-15,
   the #preview-data-toolbar SHOWING row followed it there; that row lives in the
   inspector's DATA card now — assets/zz_studio_data_scope.css) and holds the
   SAME `visual-type-step-wrapper` WHOLE: the
   `visual-type-card` Card, the `cfg-chart-kind` SegmentedControl (same id,
   same 4 values Line / Scatter / Bar / Vertical, same writer / readers), the
   `cfg-aggregate` Switch and the hidden proxy div (`cfg-chart-type`,
   `cfg-vertical-lines-mode`). Nothing here is a new id; the chips ARE the
   segmented control's own labels, restyled (the C-2 / C-4 precedent: Mantine's
   sliding indicator retired, `[data-active]` paints the chip).

   Gating (CSS only, the callback is untouched): `_orchestrate_steps` writes
   the wrapper's inline `style` — display:none before the visual stage, {}
   from then on. The toolbar row hides with it through
   :has(> #visual-type-step-wrapper[style*="display: none"]); `display` is
   never set on the wrapper itself.

   Old homes: the block used to sit under #workspace-right-panel /
   .sp-inspector-root-panel, whose rules (zz_new_content.css:1399–1408,
   4692–4699, 4763, 4909) no longer match. What DOES still match after the
   move — the generic .sp-builder-step-card chrome (zz_new_content.css:687,
   733–737, 915, 3979), the .sp-setup-choice-control well (:955–975, the
   ≤720 band :1047, :1088) and the #cfg-chart-kind accent re-assertion in
   zz_studio_chrome.css:62–68 — is flattened here at 2-id specificity
   (#new-content-shell + the wrapper / card / control id), !important only
   against !important. This file sorts BEFORE zz_studio_chrome.css
   ("zz_studio_ca" < "zz_studio_ch"), so every override of a chrome rule
   carries one class more than the rule it replaces.

   Mobile ≤640: the B3/C band (zz_new_content.css:5559) hides the whole
   #preview-action-panel (the SHOWING row was desktop chrome). The panel is
   re-shown at 2 ids ONLY while the wrapper is not callback-hidden
   (:not([style*="display: none"]) — a plain show would beat the inline gate).
   Fullscreen: the toolbar
   is hidden (the fullscreen surface stays exactly as it was — the type block
   was never part of it).

   Nothing here sets `display` on .sp-mob-* / .mantine-Tabs-* /
   .sp-config-root-tab elements (control map §C4 — the mobile shell is C-6c).
   Nothing in styles.css / zz_new_content.css is edited.
   ========================================================================== */

#new-content-shell .sp-studio-canvas-toolbar {
  --ct-ui: "Instrument Sans", "Manrope", var(--bc-body);
  --ct-chip-h: 32px;
  --ct-toggle-w: 38px;
  --ct-toggle-h: 24px;
  --ct-toggle-knob: 18px;
  --ct-toggle-inset: 3px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 2px 0 8px;
  margin: 0 0 6px;
  border-bottom: 1px solid var(--bc-border-soft);
}

/* the phase gate: the wrapper's callback-written display:none hides the row */
#new-content-shell .sp-studio-canvas-toolbar:has(> #visual-type-step-wrapper[style*="display: none"]) {
  display: none;
}

/* the SAME wrapper / card: no panel chrome, no margins (zz_new_content.css:687
   / :915 / :3979 paint the card as a bordered panel — 2 ids + classes here) */
#new-content-shell .sp-studio-canvas-toolbar > #visual-type-step-wrapper {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card.sp-builder-step-card.mantine-Card-root {
  width: 100%;
  min-width: 0;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible;
}

/* the card's Stack (chips + the Aggregate row) becomes ONE horizontal row */
#new-content-shell .sp-studio-canvas-toolbar #visual-type-card > .mantine-Stack-root {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

/* ---- the chips = the SAME cfg-chart-kind segmented control ---------------
   (zz_new_content.css:955 well + :733 raised track: both !important) */
#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control.mantine-SegmentedControl-root {
  display: flex !important;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 6px;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100%;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* the sliding indicator is retired — the active chip paints itself
   (zz_new_content.css:735 / :962, zz_studio_chrome.css:62 are !important) */
#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control .mantine-SegmentedControl-indicator {
  display: none !important;
}

#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind .mantine-SegmentedControl-control {
  flex: 0 0 auto !important;
  width: auto;
  min-width: 0;
  border: 0 !important;
}

#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind .mantine-SegmentedControl-control::before {
  content: none !important; /* Mantine's item separators */
}

/* DS §4 "Filtr chip": transparent, hairline #2A2C33, text #B8B4AC, pill
   (zz_new_content.css:969 / :975 / :1047 / :1088 min-heights + paddings and
   :737 color are !important) */
#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control .mantine-SegmentedControl-label {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--ct-chip-h);
  min-height: var(--ct-chip-h) !important;
  padding: 0 12px !important;
  border: 1px solid var(--bc-border);
  border-radius: 999px;
  background: transparent;
  color: var(--bc-text2) !important;
  font-family: var(--ct-ui);
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control .mantine-SegmentedControl-label:hover {
  border-color: var(--bc-text2);
  color: var(--bc-text) !important;
}

/* the icon + text Group inside each label (sp-visual-choice-compact) */
#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind .mantine-SegmentedControl-label .sp-visual-choice-compact {
  width: auto;
  gap: 6px !important;
  flex-wrap: nowrap;
}

#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind .mantine-SegmentedControl-label .sp-visual-choice-compact svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* the label's Text inherits the chip color (zz_new_content.css:689 paints
   every step-card Text with the body color) */
#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind .mantine-SegmentedControl-label .mantine-Text-root {
  color: inherit !important;
  font-family: inherit;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit;
}

/* active = navigation orange (DS §4 filter chip active: bg + border #FF6B2C,
   text #0D0E12; spec §7 view-switcher idiom). zz_studio_chrome.css:67 sets
   the accent COLOR at 2 ids + 3 classes and loads later — one class more here. */
#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label {
  border-color: var(--bc-accent);
  background: var(--bc-accent);
  color: var(--bc-accent-ink) !important;
}

#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label:hover {
  border-color: var(--bc-accent-hover);
  background: var(--bc-accent-hover);
}

#new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind .mantine-SegmentedControl-input:focus-visible + .mantine-SegmentedControl-label {
  outline: 2px solid var(--bc-text);
  outline-offset: 2px;
}

/* ---- the Aggregate chip-toggle = the SAME cfg-aggregate Switch -------------
   (its .sp-basics-row Group is the LAST item of the row: label + DS toggle
   38×24 — DS §4 "Toggle": track #2A2C33, knob #F2EFE9, ON track #FF6B2C) */
#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row.mantine-Group-root {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px !important;
  box-sizing: border-box;
  height: var(--ct-chip-h);
  margin-left: auto;
  padding: 0 8px 0 12px;
  border: 1px solid var(--bc-border);
  border-radius: 999px;
  background: transparent;
  min-height: 0;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row > .mantine-Text-root {
  color: var(--bc-text2) !important;
  font-family: var(--ct-ui);
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1;
  white-space: nowrap;
}

/* ON: the label reads as active */
#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row:has(.mantine-Switch-input:checked) > .mantine-Text-root {
  color: var(--bc-text) !important;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-root {
  --switch-width: var(--ct-toggle-w);
  --switch-height: var(--ct-toggle-h);
  --switch-thumb-size: var(--ct-toggle-knob);
  --switch-track-padding: var(--ct-toggle-inset);
  --switch-radius: 999px;
  width: auto !important;
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-body {
  width: auto;
  gap: 0;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-track {
  box-sizing: border-box;
  width: var(--ct-toggle-w);
  min-width: var(--ct-toggle-w);
  height: var(--ct-toggle-h);
  border: 0;
  border-radius: 999px;
  background: var(--bc-border);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-thumb {
  width: var(--ct-toggle-knob);
  height: var(--ct-toggle-knob);
  border: 0;
  border-radius: 999px;
  background: var(--bc-text);
  inset-inline-start: var(--ct-toggle-inset);
  transition: inset-inline-start 0.2s ease;
}

/* ON: orange track, the knob stays #F2EFE9 (zz_new_content.css:4078 paints it
   ink at 1 id — overridden at 2 ids, !important against !important) */
#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-input:checked + .mantine-Switch-track {
  background: var(--bc-accent) !important;
  border-color: var(--bc-accent) !important;
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-input:checked + .mantine-Switch-track .mantine-Switch-thumb {
  background: var(--bc-text) !important;
  border-color: var(--bc-text) !important;
  inset-inline-start: calc(100% - var(--ct-toggle-knob) - var(--ct-toggle-inset));
}

#new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row .mantine-Switch-input:focus-visible + .mantine-Switch-track {
  outline: 2px solid var(--bc-accent);
  outline-offset: 2px;
}

/* ---- fullscreen: the surface stays exactly as it was (styles.css:669 keeps
   #preview-action-panel visible there — the SHOWING row; not the chips) ---- */
#new-content-shell #preview-fullscreen-shell.is-open .sp-studio-canvas-toolbar {
  display: none;
}

/* ---- mobile ≤640 (DS §3.1 touch ladder; DS §5 chip row scrolls) ---------- */
@media (max-width: 640px) {
  /* the B3/C band hides the whole panel at 2 ids + !important
     (zz_new_content.css:5559); re-show it ONLY while the chip row is not
     callback-hidden — later file wins the tie — and drop its desktop chrome */
  #new-content-shell #preview-action-panel:has(> .sp-studio-canvas-toolbar > #visual-type-step-wrapper:not([style*="display: none"])) {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  /* (UX 4.3 / D-62, 2026-09-15: the SHOWING / Edit filter row this band used to
     hide here is no longer a child of #preview-action-panel — it moved into the
     inspector's DATA card, hidden at ≤640 by assets/zz_studio_data_scope.css.) */

  #new-content-shell .sp-studio-canvas-toolbar {
    --ct-chip-h: 36px;
    --ct-toggle-w: 34px;
    --ct-toggle-h: 22px;
    --ct-toggle-knob: 16px;
    padding: 0 0 2px;
    margin: 0 0 2px;
    border-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  #new-content-shell .sp-studio-canvas-toolbar::-webkit-scrollbar {
    display: none;
  }

  /* the row keeps its natural width so the toolbar scrolls, never the page */
  #new-content-shell .sp-studio-canvas-toolbar > #visual-type-step-wrapper,
  #new-content-shell .sp-studio-canvas-toolbar #visual-type-card.sp-builder-step-card.mantine-Card-root {
    width: max-content;
    min-width: 100%;
  }

  #new-content-shell .sp-studio-canvas-toolbar #visual-type-card > .mantine-Stack-root {
    width: max-content;
    min-width: 100%;
    padding-inline: 2px;
  }

  #new-content-shell .sp-studio-canvas-toolbar #cfg-chart-kind.sp-setup-choice-control .mantine-SegmentedControl-label {
    font-size: 12.5px !important;
    padding: 0 13px !important;
  }

  #new-content-shell .sp-studio-canvas-toolbar #visual-type-card .sp-basics-row.mantine-Group-root {
    margin-left: 4px;
  }
}
