/* burble-core.css / core-choices.css: Radio pills, segmented control, toggle rows, checkboxes, radios, switch.
   Linked by common/burble_core_css.php, in the order listed there. */

/* ── Radio pill list ──────────────────────────────────────────
   Radios as a wrapping row of bordered pills; .bc-segmented below is the
   joined-track kind.

   Usage: <div class="bc-radio-group">
            <div class="bc-radio-item"><input type="radio" id="x"><label for="x">…

   The label's margin:0 resets sb-admin-2's `label { margin-bottom: .5rem }`,
   which would push it off the pill’s centre line. */
.bc-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.bc-radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-light);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.bc-radio-item:hover {
  border-color: var(--teal);
  background: var(--white);
}
.bc-radio-item label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* ── Segmented control ───────────────────────────────────────
   Mutually exclusive options sharing one track.

   Usage: <div class="bc-segmented" role="group" aria-label="Status">
            <button type="button" class="bc-segmented-btn is-active">Active</button>

   Each option is a <button> the page script moves .is-active between, or a
   <label> around a radio, which needs no script: the radio is hidden and the
   label lights up while it is checked.

   --sm      smaller type.
   --joined  bordered, options divided by seams, for a matrix of rows.
   Option tones --danger / --teal / --blue / --muted fill the active option
   with that colour. */
.bc-segmented {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 2px;
  background: var(--sl-100);
  border-radius: 7px;
}
.bc-segmented input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
/* margin:0 resets the global sb-admin-2 `label { margin-bottom: .5rem }`,
   which left a label option's fill short of the track. */
.bc-segmented-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}
.bc-segmented-btn:hover {
  color: var(--text-strong);
}
.bc-segmented-btn.is-active,
.bc-segmented-btn:has(input:checked) {
  background: var(--white);
  color: var(--sl-900);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.bc-segmented-btn:focus-visible,
.bc-segmented-btn:has(input:focus-visible) {
  outline: 1px solid var(--teal);
  outline-offset: 2px;
}
.bc-segmented-btn:disabled,
.bc-segmented-btn:has(input:disabled) {
  opacity: 0.5;
  pointer-events: none;
}

.bc-segmented--sm .bc-segmented-btn {
  font-size: 11.5px;
  font-weight: 500;
}

.bc-segmented--joined {
  gap: 0;
  padding: 0;
  background: transparent;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.bc-segmented--joined .bc-segmented-btn {
  min-height: 28px;
  padding: 0 14px;
  border-radius: 0;
  border-right: 1px solid var(--border-color);
  font-size: 12.5px;
  line-height: 1;
}
.bc-segmented--joined .bc-segmented-btn:last-child {
  border-right: none;
}
/* The divider on an active option's left is its neighbour's border; the
   shadow paints over it so the fill sits flush on both sides. */
.bc-segmented--joined .bc-segmented-btn.is-active,
.bc-segmented--joined .bc-segmented-btn:has(input:checked) {
  background: var(--teal);
  color: var(--white);
  border-right-color: var(--teal);
  box-shadow: -1px 0 0 var(--teal);
}

.bc-segmented-btn--danger.is-active,
.bc-segmented-btn--danger:has(input:checked) {
  --ba-segmented-fill: var(--danger);
}
.bc-segmented-btn--teal.is-active,
.bc-segmented-btn--teal:has(input:checked) {
  --ba-segmented-fill: var(--teal);
}
.bc-segmented-btn--blue.is-active,
.bc-segmented-btn--blue:has(input:checked) {
  --ba-segmented-fill: var(--blue);
}
.bc-segmented-btn--muted.is-active,
.bc-segmented-btn--muted:has(input:checked) {
  --ba-segmented-fill: var(--sl-400);
}
.bc-segmented .bc-segmented-btn[class*="bc-segmented-btn--"].is-active,
.bc-segmented
  .bc-segmented-btn[class*="bc-segmented-btn--"]:has(input:checked) {
  background: var(--ba-segmented-fill);
  color: var(--white);
  border-right-color: var(--ba-segmented-fill);
}
.bc-segmented--joined .bc-segmented-btn[class*="bc-segmented-btn--"].is-active,
.bc-segmented--joined
  .bc-segmented-btn[class*="bc-segmented-btn--"]:has(input:checked) {
  box-shadow: -1px 0 0 var(--ba-segmented-fill);
}
/* The last option has no divider of its own to recolour. */
.bc-segmented--joined .bc-segmented-btn:last-child.is-active,
.bc-segmented--joined .bc-segmented-btn:last-child:has(input:checked) {
  border-right: none;
}

/* ── Toggle row ───────────────────────────────────────────────
   A checkbox with its label, and an optional line of explanation under it.

     <div class="bc-toggle-item">
       <input type="checkbox" id="x" name="x">
       <label for="x">
         <div>What it does</div>
         <div class="bc-help">Why you would want it</div>
       </label>
     </div>

   A .bc-toggle-item-icon at the start of the label adds a teal icon before
   the title. Wrap several rows in .bc-toggle-group to space them as a list. */
.bc-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Lay the rows out across instead of down, for short on/off labels. */
.bc-toggle-group--row {
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: 28px;
}
.bc-toggle-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
/* An option that only applies when the row above is on: indented to line up
   with that row's label (16px box + 12px gap). */
.bc-toggle-item--nested {
  margin-left: 28px;
}
.bc-toggle-item label {
  font-size: 13px;
  color: var(--text-label);
  font-weight: 500;
  margin: 0;
}
/* A one-line explanation under the label text, inside the <label> so a click
   on it still toggles the box. */
.bc-toggle-item label .bc-help {
  display: block;
  margin-top: 2px;
  font-weight: 400;
}
.bc-toggle-item-icon {
  margin-right: 8px;
  color: var(--teal);
  flex-shrink: 0;
}

/* ── Checkbox ─────────────────────────────────────────────────
   Every checkbox on a page that loads this sheet. Drawn rather than left to
   accent-color, which would pick a dark tick against a fill this light; the
   tick should read white. appearance:none drops native focus styling, so the
   ring below replaces it, and accent-color no longer has any effect. */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 1px 0 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--sl-300);
  border-radius: 5px;
  background: var(--white);
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}
input[type="checkbox"]:hover {
  border-color: var(--teal);
}
input[type="checkbox"]:checked {
  background-color: var(--teal);
  border-color: var(--teal);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 10px;
}
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-strong);
}
input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
/* Bootstrap's custom-control hides the real input and paints a label instead;
   leave that one alone or the hidden box starts affecting layout. */
.custom-control-input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: auto;
  height: auto;
  border: 0;
  background: none;
}

/* ── Radio ────────────────────────────────────────────────────
   The checkbox above, round, with a dot for a tick. Every radio on a page
   that loads this sheet: under accent-color the browser draws a heavy dark
   ring round the dot. The .bc-segmented hiding rule above outranks these. */
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 1px 0 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--sl-300);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
input[type="radio"]:hover {
  border-color: var(--teal);
}
input[type="radio"]:checked {
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: inset 0 0 0 3px var(--white);
}
input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
input[type="radio"]:checked:focus-visible {
  box-shadow:
    inset 0 0 0 3px var(--white),
    var(--focus-ring);
}
input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
/* Bootstrap's custom-control hides the real input and paints a label instead;
   leave that one alone or the hidden box starts affecting layout. */
.custom-control-input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: auto;
  height: auto;
  border: 0;
  background: none;
}

/* ── Switch ───────────────────────────────────────────────────
   The sliding on/off control (.bc-toggle-item is the checkbox-and-label
   kind).

     <label class="bc-switch">
       <input type="checkbox">
       <span class="bc-switch-track"></span>
     </label>

   On is the same teal as a checked checkbox. The knob is the track's
   ::after; the selector is ~ rather than + so an intervening node cannot
   break it. Modifiers: --danger, --sm.                         */
.bc-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}
/* [type="checkbox"] is load-bearing: the .custom-control-input[type="checkbox"]
   reset above is (0,2,0) and puts width/height back to auto. Four of these
   switches carry that Bootstrap class, so this selector has to outrank it. */
.bc-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.bc-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--sl-400);
  transition: background 0.2s;
}
.bc-switch-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.bc-switch input:checked ~ .bc-switch-track {
  background: var(--teal);
}
.bc-switch input:checked ~ .bc-switch-track::after {
  transform: translateX(16px);
}
/* On means blocked or locked here, not enabled. */
.bc-switch--danger input:checked ~ .bc-switch-track {
  background: var(--danger);
}
.bc-switch input:focus-visible ~ .bc-switch-track {
  box-shadow: var(--focus-ring-strong);
}
.bc-switch input:disabled ~ .bc-switch-track {
  opacity: 0.3;
  cursor: not-allowed;
}
/* Smaller, 28x16, for a switch in every row of a dense grid (Manage
   Products, Discounts). */
.bc-switch--sm {
  width: 28px;
  height: 16px;
}
.bc-switch--sm .bc-switch-track::after {
  left: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
}
.bc-switch--sm input:checked ~ .bc-switch-track::after {
  transform: translateX(12px);
}

.bc-color-swatch {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
}
.CodeMirror {
  background: var(--bg-light) !important;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  height: 420px;
}

/* The picker opens above the swatch when there's no room below it
   (calendar_config.js); flip the plugin's arrow to point down at it.
   The classic booking/calendar_config.php carries the same rules inline. */
.colorpicker.colorpicker-above:before {
  top: auto;
  bottom: -7px;
  border-top: 7px solid rgba(0, 0, 0, 0.2);
  border-bottom: 0;
}
.colorpicker.colorpicker-above:after {
  top: auto;
  bottom: -6px;
  border-top: 6px solid var(--white);
  border-bottom: 0;
}

/* ── Toggle ───────────────────────────────────────────────────
   A .bc-switch and the label that names it, side by side on one line,
   whichever comes first. Inline, so it sits in a header, a row of actions
   or a section title like any other control; replaces a .bc-row (10px) and
   the topbar's .nd-toggle-wrap, which each spaced the pair their own way.

     <div class="bc-toggle-wrap">
       <label class="bc-switch"><input type="checkbox" id="x"><span class="bc-switch-track"></span></label>
       <label class="bc-label" for="x">Enable</label>
     </div>                                                           */
.bc-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* In a .bc-stack each toggle takes a line of its own, as a .bc-row did:
   inline, two of them would sit side by side. */
.bc-stack > .bc-toggle-wrap {
  display: flex;
}
