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

@import url("chrome://global/skin/design-system/tokens-brand.css");
@import url("chrome://global/skin/design-system/text-and-typography.css");

@namespace html "http://www.w3.org/1999/xhtml";
@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

:host(.anonymous-content-host),
:root {
  /* Keep these in sync with:
   *
   *  * nsXPLookAndFeel::GenericDarkColor
   *  * The default value of browser.display.foreground_color.dark and
   *    browser.display.background_color.dark
   */

  --in-content-border-invalid: light-dark(var(--red-50), rgb(255, 132, 139));

  --categories-width: var(--size-sidebar);

  --dialog-warning-text-color: light-dark(var(--red-60), var(--red-40));

  --blue-40: #45a1ff;
  --blue-50: #0a84ff;
  --blue-60: #0060df;
  --grey-30: #d7d7db;
  --grey-90-a10: rgba(12, 12, 13, 0.1);
  --grey-90-a20: rgba(12, 12, 13, 0.2);
  --grey-90-a30: rgba(12, 12, 13, 0.3);
  --green-70: #058b00;
  --orange-50: #ff9400;
  --red-40: #ff4f5e;
  --red-50: #ff0039;
  --red-60: #d70022;
  --yellow-50: #ffe900;
  --yellow-60: #d7b600;
  --yellow-60-a30: rgba(215, 182, 0, 0.3);
  --yellow-90: #3e2800;

  --card-padding: 16px;

  -moz-theme: non-native;
  color-scheme: light dark;
  @media not (forced-colors) {
    accent-color: var(--color-accent-primary);
  }
}

@media (prefers-color-scheme: dark) and (not (forced-colors)) {
  /* For dialogs, use a different background colour. We don't do
   * this in forced colors mode, as we should be using system colours then.
   */
  :root[dialogroot] {
    --background-color-canvas: #42414d;
  }
}

@media (forced-colors) {
  :host(.anonymous-content-host),
  :root {
    /* This is not great, but there is no suitable keyword for this.
     * In theory, we shouldn't be conveying invalid state just with a colour
     * change... */
    --in-content-border-invalid: ThreeDShadow;

    --dialog-warning-text-color: -moz-FieldText;
  }
}

:root {
  appearance: none;
  background-color: var(--background-color-canvas);
  color: var(--text-color);
}

:root:not(.system-font-size) {
  font-size: var(--font-size-root);
}

html|body {
  margin: 0;
}

html|hr {
  border-style: solid none none none;
  border-color: var(--border-color);
}

.main-content {
  padding: 40px 28px;
  overflow: auto;
}

/* tabpanels and tabs */

xul|tabpanels {
  border: none;
  padding: 0;
}

xul|tabs {
  margin-bottom: 10px;
  border-bottom: var(--button-border);
}

xul|tab {
  padding: 2px 20px 0;
  min-height: 44px;
  border-bottom: 2px solid transparent;
  transition: background-color 50ms ease 0s;

  &:where(:hover) {
    background-color: var(--button-background-color-hover);
    color: var(--button-text-color-hover);
    border-bottom-color: var(--border-color);

    @media (forced-colors) {
      border-bottom-color: currentColor;
    }
  }

  &:where(:hover:active) {
    background-color: var(--button-background-color-active);
    color: var(--button-text-color-active);
  }

  &[selected] {
    color: var(--button-background-color-primary);
    border-bottom-color: currentColor;
  }
}

.tabs-left {
  flex: 0;
}

.tabs-right {
  flex: 1;
}

/* html buttons */

html|button {
  font: inherit;
}

/* xul buttons and menulists */

button,
html|select,
html|input[type="color"],
xul|menulist {
  appearance: none;
  min-height: var(--button-min-height);
  color: var(--button-text-color);
  border: var(--button-border);
  border-radius: var(--button-border-radius);
  background-color: var(--button-background-color);
  font-weight: normal;
  padding: 0.45em 1em;
  text-decoration: none;
  margin: 4px 8px;
  /* Ensure font-size isn't overridden by widget styling (e.g. in forms.css) */
  font-size: 1em;
}

button {
  font-weight: var(--button-font-weight);
}

/* Small buttons get sized to 6/12px padding (when adding the 1px border) */
button.small-button {
  padding: 0.25em 1em;
  font-size: var(--font-size-small);
  min-height: 28px;
}

/* Remove margin added by button.css */
xul|button > .button-box > .button-text {
  margin: 0;
}

button {
  /* Use the same margin of other elements for the alignment */
  margin-inline: 4px;
}

button:focus-visible,
html|select:focus-visible,
html|input:where([type="color"]):focus-visible,
xul|menulist:focus-visible,
xul|tab:focus-visible > .tab-middle > .tab-text {
  box-shadow: none;
  /* Don't set `var(--focus-outline)` here to allow more complicated UIs
     to use a different color when needed */
  outline: var(--focus-outline-width) solid var(--focus-outline-color);
  outline-offset: var(--focus-outline-offset);
}

html|select:not([size], [multiple]) {
  /* The following padding matches how a menulist is internally spaced.
   * 15px is the menulist's standard padding-inline, 3px is for
   * the internal label margin, 12px is the dropmarker's width
   * and 4px is the dropmarker's margin-inline-end.
   *
   * [------|---|---label---|dropmarker|----|------]
   *   15px  3px                12px    4px   15px
   * start-padding          background- end-padding
   *                        image-width
   *
   * Users of this element can change the variable --logical-padding. Other
   * variables should adjust automatically.
   */
  --logical-padding: 15px;
  --start-padding: calc(var(--logical-padding) + 3px);
  --end-padding: calc(var(--logical-padding) + 4px);
  --background-image-width: 12px;
  background-image: url("chrome://global/skin/icons/arrow-down-12.svg");
  background-position: right var(--end-padding) center;
  background-repeat: no-repeat;
  background-size: auto var(--background-image-width);
  -moz-context-properties: fill;
  fill: currentColor;
  font: inherit;
  font-weight: var(--font-weight-semibold);

  /* See above for some explanation about these values. */
  padding-inline-start: var(--start-padding);
  padding-inline-end: calc(var(--background-image-width) + var(--end-padding));
  text-overflow: ellipsis;
}

html|select:not([size], [multiple]):dir(rtl) {
  background-position-x: left var(--end-padding);
}

html|select:not([size], [multiple]) > html|option {
  background-color: var(--background-color-box);
  color: var(--text-color);
}

html|button:enabled:hover,
html|select:not([size], [multiple]):enabled:hover,
html|input[type="color"]:hover,
xul|button:not([disabled]):hover,
xul|menulist:not([disabled]):hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
  border-color: var(--button-border-color-hover);
}

html|button:enabled:hover:active,
html|select:not([size], [multiple]):enabled:hover:active,
html|input[type="color"]:enabled:hover:active,
xul|button:not([disabled]):hover:active,
xul|button[open],
xul|button[open]:hover,
xul|menulist[open="true"]:not([disabled]) {
  background-color: var(--button-background-color-active);
  color: var(--button-text-color-active);
  border-color: var(--button-border-color-active);
}

html|button:disabled,
html|select:disabled,
html|input[type="color"]:disabled,
xul|button[disabled],
xul|menulist[disabled] {
  opacity: 0.4;
}

html|button[autofocus],
html|button[type="submit"],
xul|button[default],
button.primary {
  background-color: var(--button-background-color-primary);
  color: var(--button-text-color-primary);
  border-color: var(--button-border-color-primary);
}

html|button[autofocus]:enabled:hover,
html|button[type="submit"]:enabled:hover,
html|button.primary:enabled:hover,
xul|button[default]:not([disabled]):hover,
xul|button.primary:not([disabled]):hover {
  background-color: var(--button-background-color-primary-hover);
  color: var(--button-text-color-primary-hover);
  border-color: var(--button-border-color-primary-hover);
}

html|button[autofocus]:enabled:hover:active,
html|button[type="submit"]:enabled:hover:active,
html|button.primary:enabled:hover:active,
xul|button[default]:not([disabled]):hover:active,
xul|button.primary:not([disabled]):hover:active {
  background-color: var(--button-background-color-primary-active);
  color: var(--button-text-color-primary-active);
  border-color: var(--button-border-color-primary-active);
}

@media not (forced-colors) {
  html|button.semi-transparent:not(.ghost-button, .primary):enabled {
    background-color: color-mix(in srgb, currentColor 10%, transparent);
  }

  html|button.semi-transparent:not(.primary):enabled:hover {
    background-color: color-mix(in srgb, currentColor 20%, transparent);
  }

  html|button.semi-transparent:not(.primary):enabled:hover:active {
    background-color: color-mix(in srgb, currentColor 30%, transparent);
  }
}

.danger-button {
  --button-background-color-primary: var(--button-background-color-destructive);
  --button-background-color-primary-hover: var(--button-background-color-destructive-hover);
  --button-background-color-primary-active: var(--button-background-color-destructive-active);
}

@media not (forced-colors) {
  html|button.ghost-button {
    background-color: transparent;
  }
}

html|button.ghost-button:not(.semi-transparent):enabled:hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
}

html|button.ghost-button:not(.semi-transparent):enabled:hover:active {
  background-color: var(--button-background-color-active);
  color: var(--button-text-color-active);
}

html|button.ghost-button.icon-button {
  height: 16px;
  width: 16px;
  min-width: auto;
  background-repeat: no-repeat;
  background-size: 16px;
  background-position: center;
  fill: currentColor;
  -moz-context-properties: fill;
}

html|input[type="color"] {
  padding: 6px;
  width: 50px;
}

xul|menulist[image]::part(icon) {
  margin-inline-end: 5px;
}

xul|menulist > xul|menupopup {
  appearance: none;

  /* Reset native styles on Windows and macOS */
  border: none;
  background-color: transparent;

  --panel-border-color: var(--border-color);
  --panel-border-radius: 2px;
  --panel-background: var(--background-color-box);
  --panel-color: var(--text-color);
  --panel-padding: 0;
}

xul|menulist > xul|menupopup xul|menu,
xul|menulist > xul|menupopup xul|menuitem {
  appearance: none;
  font-size: 1em;
  padding-block: 0.2em;
  padding-inline: 10px 30px;
}

xul|menulist > xul|menupopup > xul|menu:not([disabled])[_moz-menuactive="true"],
xul|menulist > xul|menupopup > xul|menuitem:not([disabled])[_moz-menuactive="true"] {
  color: var(--text-color-list-item-hover);
  background-color: var(--background-color-list-item-hover);
}

xul|menulist > xul|menupopup > xul|menu:not([disabled])[selected],
xul|menulist > xul|menupopup > xul|menuitem:not([disabled])[selected] {
  color: var(--text-color-accent-primary-selected);
  background-color: var(--color-accent-primary-selected);
}

xul|menulist > xul|menupopup > xul|menu[disabled],
xul|menulist > xul|menupopup > xul|menuitem[disabled] {
  color: #999;
  /* override the [_moz-menuactive="true"] background color from
     global/menu.css */
  background-color: transparent;
}

xul|menulist > xul|menupopup xul|menuseparator {
  appearance: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-color);
  border-bottom: none;
}

/* textboxes */

html|input:where([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]),
html|textarea {
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-medium);
  color: inherit;
  background-color: var(--background-color-box);
}

html|input:where([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]),
html|textarea {
  box-sizing: border-box;
  font-family: inherit;
  font-size: inherit;
  padding: 0.45em;
  margin: 2px 4px;
  min-height: var(--input-text-min-height);
}

html|textarea {
  min-height: auto;
}

html|input:where([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):focus,
html|textarea:focus,
xul|tree:focus-visible,
xul|richlistbox:focus-visible {
  border-color: transparent;
  outline: var(--focus-outline);
  outline-offset: -1px; /* Prevents antialising around the corners */
}

html|input:where([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):user-invalid,
html|textarea:user-invalid {
  border-color: transparent;
  outline: 2px solid var(--in-content-border-invalid);
  outline-offset: -1px; /* Prevents antialising around the corners */
}

html|input:where([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):disabled,
html|textarea:disabled {
  opacity: 0.4;
}

/* Links */

html|a,
.text-link,
::part(support-link) {
  cursor: pointer;
  color: var(--link-color);
}

html|a:visited,
::part(support-link):visited {
  color: var(--link-color-visited);
}

html|a:hover,
.text-link:hover,
button.text-link:is(:not([disabled]), :enabled):hover,
::part(support-link):hover {
  color: var(--link-color-hover);
}

html|a:hover:active,
.text-link:hover:active,
button.text-link:is(:not([disabled]), :enabled):hover:active,
::part(support-link):hover:active {
  color: var(--link-color-active);
  text-decoration: none;
}

html|a:focus-visible,
.text-link:focus-visible,
::part(support-link):focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--link-focus-outline-offset);
  border-radius: var(--border-radius-small);
}

button.text-link {
  background-color: transparent !important; /* override hover related background changes */
  padding: 0;
  border: 0;
  font-weight: normal;
  min-height: 0;
  min-width: 0;
}

/* Checkboxes and radio buttons */

/* Add invisible vertical click-target */
xul|*.radio-check,
xul|*.checkbox-check,
html|input:where([type="checkbox"], [type="radio"]) {
  /* TODO Bug 1876537: Make this em-based, probably? */
  height: 16px;
  width: 16px;
  padding: 0;
  margin-block: var(--space-xxsmall);
  margin-inline: 0 var(--checkbox-margin-inline);
  flex-shrink: 0; /* avoid shrinking inside flex container */
}

xul|richlistitem > xul|*.checkbox-check {
  margin: 3px 6px;
}

html|*.radio-container-with-text,
html|*.toggle-container-with-text {
  display: flex;
  align-items: center;
}

xul|radio {
  margin-inline-start: 0;
  appearance: none;
}

xul|*.radio-label-box {
  margin-inline: 0 8px;
  padding-inline-start: 0;
}

/* Disabled checkboxes, radios and labels */

xul|checkbox[disabled],
xul|radio[disabled],
xul|label[disabled] {
  color: inherit;
}

xul|checkbox[disabled] > .checkbox-label-box,
xul|radio[disabled] > .radio-label-box,
xul|label[disabled] {
  opacity: 0.5;
}

/* Category List */

#categories {
  appearance: none;
  background-color: initial; /* override the background-color set on all richlistboxes in common.inc.css */
  margin: 70px 0 0;
  border-width: 0;
  width: var(--categories-width);
  outline: none;
}

@media print {
  #categories {
    display: none;
  }
}

html|*#categories {
  box-sizing: border-box;
  padding: 1px;
}

#categories > .category {
  border: var(--button-border);
  border-color: var(--button-border-color-primary);
  border-radius: var(--border-radius-small);
  min-height: 48px;
  appearance: none;
  color: inherit;
  margin-inline-start: 34px;
  padding-inline: 10px;
  transition: background-color 150ms;
}

html|*#categories > html|*.category {
  border: var(--button-border);
  border-color: var(--button-border-color-primary);
  background-color: initial;
  background-size: 24px;
  background-repeat: no-repeat;
  background-position-x: 10px;
  background-position-y: 12px;
  margin-inline-end: 0;
  min-width: auto;
  padding-inline-start: 34px;
  text-align: start;
  -moz-context-properties: fill, fill-opacity;
  fill: currentColor;
}

html|*#categories > html|*.category:dir(rtl) {
  background-position-x: right 10px;
}

#categories > .category:hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
  border-color: var(--button-border-color-hover);
}

#categories > .category:hover:active {
  background-color: var(--button-background-color-active);
  color: var(--button-text-color-active);
  border-color: var(--button-border-color-active);
}

@media not (forced-colors) {
  #categories > .category[selected],
  #categories > .category.selected {
    color: var(--color-accent-primary);
  }

  #categories > .category[selected]:not(:hover) {
    /* override richlistitem selected style while letting hover style above apply */
    background-color: transparent;
  }

  #categories > .category[selected]:hover:active,
  #categories > .category.selected:hover:active {
    color: var(--color-accent-primary-active);
  }
}

@media (forced-colors) {
  #categories > .category {
    /* The transition causes issues with the text getting a background while
     * transitioning and it looks weird. */
    transition: none;
    /* We need a true transparent but in HCM this would compute to an actual color,
     * so select the page's background color instead: */
    border-color: var(--background-color-canvas);
  }

  #categories > .category[selected],
  #categories > .category.selected {
    background-color: var(--button-background-color-hover);
    color: var(--button-text-color-hover);
    border-color: var(--button-border-color-hover);
  }
}

#categories[keyboard-navigation="true"]:focus-visible > .category[current],
#categories > .category:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-inset);
}

html|*#categories[last-input-type="mouse"] > html|button.category:focus-visible {
  outline: none;
}

.category-name {
  font-size: 1.07em;
  line-height: 1.4em;
  padding-inline-start: 9px;
  margin: 0;
  user-select: none;
}

.category-icon {
  width: 24px;
  height: 24px;
  -moz-context-properties: fill, fill-opacity;
  fill: currentColor;
}

.category[selected] > .category-icon,
.category.selected > .category-icon {
  fill-opacity: 1;
}

@media (max-width: 830px) {
  :root {
    --categories-width: var(--size-sidebar-narrow);
  }

  html|*.category:not(.category-no-icon) > html|*.category-name,
  .category-icon + .category-name {
    display: none;
  }

  #categories > .category {
    padding-inline-start: 12px; /* make category icons align center */
    margin-inline-end: 33px;
  }

  html|*#categories > html|*.category {
    width: 48px;
    min-width: auto;
    box-sizing: border-box;
  }

  html|*#categories > html|*.category,
  /* We need to override the full-width RTL rule, so explicitly specify RTL. */
  html|*#categories > html|*.category:dir(rtl) {
    background-position: center;
  }

  .main-content {
    padding-inline: 0;
  }

  .pane-container {
    margin-inline-end: 10px;
  }
}

/* header */

.header {
  margin-inline-end: 4px; /* add the 4px end-margin of other elements */
  margin-bottom: 15px;
  padding-bottom: 15px;
  align-items: baseline;
}

.header-name {
  margin: 0;
}

/* List boxes */

html|select[size][multiple],
xul|listheader,
xul|richlistbox {
  appearance: none;
  margin-inline: 0;
  background-color: var(--background-color-box);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  color: var(--text-color);
}

xul|listheader {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  overflow: clip; /* Clip border-radius */
}

xul|listheader + xul|richlistbox {
  margin-top: 0;
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

html|select[size][multiple] > html|option,
xul|treechildren::-moz-tree-row {
  padding: 0.3em;
  margin: 0;
  border: none;
  border-radius: 0;
  background-image: none;
}

xul|treechildren::-moz-tree-row(multicol, odd) {
  background-color: var(--table-row-background-color-alternate);
}

html|select[size][multiple] > html|option:hover,
xul|treechildren::-moz-tree-row(hover) {
  background-color: var(--background-color-list-item-hover);
  color: var(--text-color-list-item-hover);
}

xul|richlistbox > xul|richlistitem[selected],
xul|treechildren::-moz-tree-row(selected) {
  background-color: var(--color-accent-primary-selected);
  color: var(--text-color-accent-primary-selected);
}

@media not (forced-colors) {
  xul|richlistbox:not(#categories) > xul|richlistitem[selected] {
    /* Ensure buttons/menulists inside richlistitems (containers, applications) look OK */
    --button-background-color: color-mix(in srgb, currentColor 15%, transparent);
    --button-background-color-hover: color-mix(in srgb, currentColor 30%, transparent);
    --button-background-color-active: color-mix(in srgb, currentColor 45%, transparent);
    --button-text-color: var(--text-color-accent-primary-selected);
    --button-text-color-hover: var(--text-color-accent-primary-selected);
    --button-text-color-active: var(--button-text-color-hover);
    --focus-outline-color: var(--text-color-accent-primary-selected);
  }
}

xul|richlistitem[selected] xul|menulist:focus-visible {
  outline-offset: var(--focus-outline-inset);
}

/* Use a 2px border so that selected row highlight is still visible behind
    an existing forced colors border that uses the background color */
@media (forced-colors) {
  xul|treechildren::-moz-tree-row(selected) {
    border: 2px solid currentColor;
    border-radius: var(--border-radius-small);
  }
}

xul|panel[type="autocomplete-richlistbox"] {
  background-color: var(--background-color-box);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

/* Trees */

xul|tree {
  appearance: none;
  font-size: 1em;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  background-color: var(--background-color-box);
  color: inherit;
  margin: 0;
}

xul|treecols {
  appearance: none;
  border: none;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-bottom: var(--button-border);
  overflow: clip; /* Clip border-radius */
  padding: 0;
}

xul|treecol:not([hideheader="true"]),
.tree-columnpicker-button {
  appearance: none;
  border: none;
  border-radius: unset;
  background-color: var(--button-background-color);
  color: var(--button-text-color, inherit);
  padding: 5px 10px;
}

xul|treecol:not([hideheader="true"], [sortable="false"]):hover,
.tree-columnpicker-button:hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
}

xul|treecol:not([hideheader="true"], [sortable="false"]):hover:active,
.tree-columnpicker-button:hover:active {
  background-color: var(--button-background-color-active);
  color: var(--button-text-color-active);
}

xul|treecol:not([hideheader="true"], :first-child),
.tree-columnpicker-button {
  border-inline-start-width: 1px;
  border-inline-start-style: solid;
  border-image: linear-gradient(transparent 0%, transparent 20%, var(--border-color) 20%, var(--border-color) 80%, transparent 80%, transparent 100%) 1 1;
}

@media (forced-colors) {
  xul|treecol:not([hideheader="true"], :first-child),
  xul|treecolpicker {
    --border-color: var(--button-border-color);
  }
}

xul|treecol[sortDirection]:not([hideheader="true"]) > xul|*.treecol-sortdirection {
  list-style-image: url("chrome://global/skin/icons/sort-arrow.svg");
  -moz-context-properties: fill;
  fill: currentColor;
  width: 18px;
  height: 18px;
}

xul|treecol[sortDirection="ascending"]:not([hideheader="true"]) > xul|*.treecol-sortdirection {
  transform: scaleY(-1);
}

/* This is the only way to increase the height of a tree row unfortunately */
xul|treechildren::-moz-tree-row {
  min-height: 2em;
}

xul|treechildren::-moz-tree-cell-text(hover),
xul|treechildren::-moz-tree-twisty(hover),
xul|treechildren::-moz-tree-image(hover) {
  color: var(--text-color-list-item-hover);
}

xul|treechildren::-moz-tree-cell-text(selected),
xul|treechildren::-moz-tree-twisty(selected),
xul|treechildren::-moz-tree-image(selected) {
  color: var(--text-color-accent-primary-selected);
}

/* Message bars */
.message-bar {
  background-color: var(--background-color-box-info);
  border-radius: var(--border-radius-small);
  min-height: 32px;
  align-items: center;
  padding: 4px;
}

.message-bar-description {
  margin: 2px 0;
  line-height: 1.25;
}

.message-bar-description.rtl-locale {
  direction: rtl;
  text-align: match-parent;
}

/* The message-bar-button styles have extra specificity to override
 * the defaults for buttons. */
.message-bar-content > .message-bar-button {
  background-color: var(--grey-90-a10);
  border: none;
  border-radius: var(--border-radius-xsmall);
  height: 24px;
  margin-inline-start: 8px;
  padding: 0 8px;
}

.message-bar-content > .message-bar-button:hover {
  background-color: var(--grey-90-a20);
}

.message-bar-content > .message-bar-button:hover:active {
  background-color: var(--grey-90-a30);
}

.message-bar-icon {
  content: url("chrome://global/skin/icons/info.svg");
  width: 24px;
  height: 24px;
  padding: 4px;
  margin-inline-end: 4px;
  -moz-context-properties: fill;
  fill: currentColor;
}

/* Warning styles */
.message-bar-warning {
  background-color: var(--yellow-50);
  color: var(--yellow-90);
}

.message-bar-warning > .message-bar-icon {
  content: url("chrome://global/skin/icons/warning.svg");
}

input[type="text"][warning]:enabled:not(:focus) {
  border-color: var(--yellow-60);
  box-shadow:
    0 0 0 1px var(--yellow-60),
    0 0 0 4px var(--yellow-60-a30);
}

/* Cards */

.card {
  background: var(--background-color-box);
  /* Needed for high-contrast where the border will appear. */
  border: 1px solid var(--border-color-card);
  border-radius: var(--border-radius-small);
  box-shadow: var(--box-shadow-card);
  margin: 0 0 8px;
  /* Remove the border from the overall padding. */
  padding: calc(var(--card-padding) - 1px);
  transition: box-shadow 150ms;
}

.card:not(.card-no-hover):hover {
  box-shadow: var(--box-shadow-card-hover);
}

.card-heading-image {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  margin: -16px -16px 16px;
}

.card-heading-image:dir(rtl) {
  transform: scaleX(-1);
}

/* Sidebar footer links */

.sidebar-footer-list {
  list-style-type: none;
  margin-block: 0 36px;
  margin-inline: 34px 0;
  padding: 0;
}

.sidebar-footer-link {
  height: 36px;
  cursor: default;
  border: var(--button-border);
  border-radius: var(--border-radius-small);
  display: flex;
  align-items: center;
}

@media (forced-colors) {
  .sidebar-footer-link {
    /* We need a true transparent but in HCM this would compute to an actual color,
     * so select the page's background color instead: */
    border-color: var(--background-color-canvas);
  }
}

.sidebar-footer-link,
.sidebar-footer-link:visited {
  /* Override link style for :hover and :hover:active states */
  text-decoration: none !important;
  color: inherit;
}

xul|*.sidebar-footer-link {
  display: flex;
  align-items: center;
}

.sidebar-footer-link:hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
  border-color: var(--button-border-color-hover);
}

.sidebar-footer-link:hover:active:not([disabled]) {
  background-color: var(--button-background-color-active);
  color: var(--button-text-color-active);
  border-color: var(--button-border-color-active);
}

.sidebar-footer-link:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-inset);
}

.sidebar-footer-icon {
  -moz-context-properties: fill, fill-opacity;
  fill: currentColor;
  width: 16px;
  height: 16px;
  margin: 10px;
  margin-inline-start: 13px;
}

.sidebar-footer-label {
  font-size: 0.9em;
  margin: 0 4px;
  user-select: none;
}

@media (max-width: 830px) {
  .sidebar-footer-list {
    margin-inline-start: 40px;
    align-items: flex-start;
  }

  .sidebar-footer-link {
    width: 36px;
    height: 36px;
    padding-inline-start: 0;
    margin-inline-start: 1px;
  }

  .sidebar-footer-icon {
    margin-inline-start: 10px;
  }

  .sidebar-footer-label {
    display: none;
  }
}

/* Icon helper classes */

xul|*.help-icon {
  list-style-image: url("chrome://global/skin/icons/help.svg");
}

xul|*.addons-icon {
  list-style-image: url("chrome://mozapps/skin/extensions/extension.svg");
}

/* Back button */

.back-button {
  -moz-context-properties: fill;
  fill: currentColor;
  background-image: url("chrome://global/skin/icons/arrow-left.svg");
  background-repeat: no-repeat;
  background-position: center;
  min-width: auto;
  width: 32px;
  margin-block: 0;
  margin-inline-start: 0;
}

.back-button:-moz-locale-dir(rtl),
.back-button:dir(rtl) {
  transform: scaleX(-1);
}
