/* burble-core.css / core-buttons.css: Buttons and button groups.
   Linked by common/burble_core_css.php, in the order listed there. */

/* ── Buttons ─────────────────────────────────────────────────
   Usage: <button class="bc-btn bc-btn--primary">Save</button>
   Modifiers: --primary --secondary --save --success --danger --delete
              --outline --danger-outline
              --xs --sm --lg --icon --wide --block                 */
.modal .modal-footer .btn,
.bc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.18s,
    border-color 0.18s,
    color 0.15s,
    transform 0.1s,
    box-shadow 0.18s;
  box-sizing: border-box;
  white-space: nowrap;
  user-select: none;
  color: var(--white);
  box-shadow: var(--shadow-rest);
}

.bc-btn:not(:disabled):hover,
.bc-btn:focus-within {
  text-decoration: none;
  box-shadow: var(--shadow-hover);
  color: var(--white);
}
.bc-btn:not(:disabled):active {
  transform: scale(0.97);
}
/* A link worn as a button: sb-admin-2's link hover carries an element on top
   of its class, which outranks the rule above and underlined it. */
a.bc-btn:hover,
a.bc-btn:focus {
  text-decoration: none;
}
/* display:inline-flex outranks the browser's own [hidden] rule, so a button a
   script hides with the attribute would otherwise stay on screen. */
.bc-btn[hidden] {
  display: none;
}

.bc-btn a {
  color: var(--white);
  text-decoration: none;
}

/* ── Button group ──
   Actions on the same object, joined into one control.
   Usage: <div class="bc-btn-group"> <button class="bc-btn bc-btn--outline">…
   Only the outer corners stay round. Segments overlap by their border width so
   the seam is one line, and a hovered segment is lifted above its neighbours. */
.bc-btn-group {
  display: inline-flex;
  align-items: stretch;
}
.bc-btn-group > .bc-btn {
  border-radius: 0;
}
.bc-btn-group > .bc-btn:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.bc-btn-group > .bc-btn:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.bc-btn-group > .bc-btn + .bc-btn {
  margin-left: -1.5px;
}
.bc-btn-group > .bc-btn:not(:disabled):hover,
.bc-btn-group > .bc-btn:focus-visible {
  position: relative;
  z-index: 1;
}
/* Two filled segments meeting need a seam of their own, or the fills smear. */
.bc-btn-group > .bc-btn:not(.bc-btn--outline) + .bc-btn:not(.bc-btn--outline) {
  box-shadow: inset 1.5px 0 0 rgba(255, 255, 255, 0.4);
}
/* The press scale would break the group apart at the seams. */
.bc-btn-group > .bc-btn:not(:disabled):active {
  transform: none;
}
.bc-btn:focus-visible {
  outline: 1px solid var(--teal);
  outline-offset: 2px;
}
/* .is-disabled is for the elements that cannot carry the attribute: a link with
   nowhere to go is rendered as a <span> or an <a> without href, and neither can
   be :disabled. aria-disabled="true" belongs on it too — the class only paints. */
.bc-btn:disabled,
.bc-btn[disabled],
.bc-btn.is-disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none !important;
}
/* A disabled <button> keeps its pointer events, so the cursor above shows: the
   browser already ignores its clicks, and the hover and active rules skip
   :disabled. A link or span cannot be disabled, so .is-disabled still stops
   the pointer (and so shows no cursor of its own). */
.bc-btn.is-disabled {
  pointer-events: none;
}
/* An outlined button is mostly white, so 0.75 barely reads as off: fainter. */
.bc-btn--outline:is(:disabled, [disabled], .is-disabled),
.bc-btn--danger-outline:is(:disabled, [disabled], .is-disabled) {
  opacity: 0.4;
}

.modal .modal-footer .btn-sm,
.bc-btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  gap: 5px;
}
/* For a dense grid whose rows are too short for --sm (Manage Products). */
.bc-btn--xs {
  height: 24px;
  padding: 0 8px;
  font-size: 11.5px;
  gap: 4px;
  border-radius: var(--radius-xs);
}
.bc-btn--lg {
  height: 44px;
  padding: 0 22px;
  font-size: 14px;
  gap: 8px;
}

/* Icon-only button — square, no label. .bc-btn takes its width from padding
   plus the label, so a lone <i> would come out narrower than it is tall.
   flex-shrink keeps it square beside a width:100% sibling in a flex row.
   Usage: .bc-btn .bc-btn--danger-outline .bc-btn--icon. Not sized for --lg. */
.bc-btn--icon {
  width: 38px;
  padding: 0;
  flex-shrink: 0;
}
/* --sm is 32px tall, so its square is 32 wide: the reveal/copy pair beside a
   secret field. */
.bc-btn--sm.bc-btn--icon {
  width: 32px;
}
.bc-btn--xs.bc-btn--icon {
  width: 24px;
}

/* A set of buttons in one column kept to one width, whatever their labels. */
.bc-btn--wide {
  min-width: 240px;
}
/* Full-width button, for a stacked action such as the /me portal's primary
   button; .bc-btn on its own is only as wide as its label. */
.bc-btn--block {
  display: flex;
  width: 100%;
  /* Block buttons stack, so they carry their own separation. */
  margin-bottom: 10px;
}

/* background-color under background-image, never two `background` shorthands:
   the shorthand resets the colour to transparent, so hover flashed see-through
   while the colour faded back in. With the colour identical in both states only
   the image changes, and that change is instant. */
.modal .modal-footer .btn-primary,
.bc-btn--primary {
  background-color: var(--blue-strong);
  background-image: linear-gradient(90deg, var(--blue), var(--blue-strong));
}
.modal .modal-footer .btn-primary:hover,
.bc-btn--primary:not(:disabled):hover {
  background-color: var(--blue-strong);
  background-image: none;
}

.bc-btn--secondary {
  background-color: var(--teal-strong);
  background-image: linear-gradient(90deg, var(--teal), var(--teal-strong));
}

.bc-btn--secondary:not(:disabled):hover {
  background-color: var(--teal-strong);
  background-image: none;
}

/* Use for every "Save Changes" primary action. */
.bc-btn--save {
  background-color: var(--success);
  background-image: linear-gradient(
    90deg,
    var(--success-light),
    var(--success)
  );
}

.bc-btn--save:not(:disabled):hover {
  background-color: var(--success);
  background-image: none;
}

.bc-btn--save:is(:disabled, [disabled], .is-disabled) {
  opacity: 0.45;
  box-shadow: none;
}

.modal .modal-footer .btn-success,
.bc-btn--success {
  background: var(--success);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
}
.modal .modal-footer .btn-success:hover,
.bc-btn--success:not(:disabled):hover {
  background: var(--success-strong);
  color: var(--white);
}

.modal .modal-footer .btn-danger,
.bc-btn--danger {
  background: var(--danger-strong);
  background-image: linear-gradient(90deg, var(--danger), var(--danger-strong));
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

.modal .modal-footer .btn-danger:hover,
.bc-btn--danger:not(:disabled):hover {
  background-color: var(--danger-strong);
  background-image: none;
}

.modal .modal-footer .btn-secondary,
.modal .modal-footer .btn-light,
.modal .modal-footer .btn-default,
.modal .modal-footer .btn-info[data-dismiss="modal"],
.bc-btn--outline,
.bc-btn--outline:focus {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border-color);
}
.modal .modal-footer .btn-secondary:hover,
.modal .modal-footer .btn-light:hover,
.modal .modal-footer .btn-default:hover,
.modal .modal-footer .btn-info[data-dismiss="modal"]:hover,
.bc-btn--outline:not(:disabled):hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-bg);
}

/* Copied: the 1.5s acknowledgement the copy handlers add and remove. Outline
   only, the variant those controls use. */
.bc-btn--outline.copied,
.bc-btn--outline.copied:not(:disabled):hover {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.bc-btn--danger-outline {
  background: var(--white);
  color: var(--danger-strong);
  border: 1px solid var(--danger-border);
}
.bc-btn--danger-outline:not(:disabled):hover {
  background: var(--danger-bg);
  color: var(--danger-strong);
  border-color: var(--danger-border);
}
