/* 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/. */

/*
 * A radiogroup styled to hide the radio buttons
 * and present tab-like labels as buttons
 */

.toggle-group {
  display: inline-flex;
  min-height: var(--button-min-height-small);
}

.toggle-group-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 6px 10px;
  background-color: var(--button-background-color);
}

.toggle-group-input {
  position: absolute;
  inset-inline-start: -100px;
}

.toggle-group-label-iconic::before {
  width: var(--icon-size);
  height: var(--icon-size);
  margin-inline-end: 5px;
  -moz-context-properties: fill;
  fill: currentColor;
}

.toggle-group-label:first-of-type {
  border-start-start-radius: var(--border-radius-small);
  border-end-start-radius: var(--border-radius-small);
}

.toggle-group-label:last-of-type {
  border-start-end-radius: var(--border-radius-small);
  border-end-end-radius: var(--border-radius-small);
}

.toggle-group-input:disabled + .toggle-group-label {
  opacity: 0.4;
}

.toggle-group-input:enabled + .toggle-group-label:hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
}

.toggle-group-input:enabled + .toggle-group-label:hover:active {
  background-color: var(--button-background-color-active);
  color: var(--button-text-color-active);
}

.toggle-group-input:focus-visible + .toggle-group-label {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  z-index: 1;
}

.toggle-group-input:checked + .toggle-group-label {
  background-color: var(--button-background-color-primary);
  color: var(--button-text-color-primary);
}

.toggle-group-input:enabled:checked + .toggle-group-label:hover {
  background-color: var(--button-background-color-primary-hover);
  color: var(--button-text-color-primary-hover);
}

.toggle-group-input:enabled:checked + .toggle-group-label:hover:active {
  background-color: var(--button-background-color-primary-active);
  color: var(--button-text-color-primary-active);
}
