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

.card-container {
  padding: 8px;
  border-radius: var(--border-radius-medium);
  background-color: var(--fxview-background-color-secondary);
  margin-block-end: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  @media (prefers-contrast) {
    border: 1px solid var(--fxview-border);
  }

  &[isOpenTabsView] {
    margin-block-end: 0;
  }

  &[open]::details-content {
    display: contents;
  }
}

.card-container-header {
  display: inline-flex;
  gap: 14px;
  width: 100%;
  align-items: center;
  cursor: pointer;
  border-radius: var(--border-radius-xsmall);
  outline-offset: 4px;
  padding: 6px;
  padding-inline-end: 0;
  margin-block-end: 6px;
  height: 24px;
}

.card-container-header[withViewAll] {
  width: 83%;
}

.card-container-header[hidden] {
  display: none;
}

.card-container-header[toggleDisabled] {
  cursor: auto;
}

.view-all-link {
  color: var(--fxview-primary-action-background);
  float: inline-end;
  outline-offset: 6px;
  border-radius: var(--border-radius-xsmall);
  width: 12%;
  text-align: end;
  padding: 6px;
  padding-inline-start: 0;
}

.card-container-header:focus-visible,
.view-all-link:focus-visible {
  outline: var(--focus-outline);
}

.chevron-icon {
  background-image: url("chrome://global/skin/icons/arrow-up.svg");
  padding: 2px;
  display: inline-block;
  justify-self: start;
  fill: currentColor;
  margin-block: 0;
  width: 16px;
  height: 16px;
  background-position: center;
  -moz-context-properties: fill;
  border: none;
  background-color: transparent;
  background-repeat: no-repeat;
  border-radius: var(--border-radius-small);
}

.chevron-icon:hover {
  background-color: var(--fxview-element-background-hover);
}

@media (forced-colors) {
  .chevron-icon {
    border: 1px solid ButtonText;
    color: ButtonText;
  }

  .chevron-icon:hover {
    border: 1px solid SelectedItem;
    color: SelectedItem;
  }

  .chevron-icon:active {
    color: SelectedItem;
  }

  .chevron-icon,
  .chevron-icon:hover,
  .chevron-icon:active {
    background-color: ButtonFace;
  }
}

.card-container:not([open]) .chevron-icon {
  background-image: url("chrome://global/skin/icons/arrow-down.svg");
}

.card-container:not([open]) a {
  display: none;
}

::slotted([slot="header"]),
::slotted([slot="secondary-header"]) {
  align-self: center;
  margin: 0;
  font-size: 1.13em;
  font-weight: var(--heading-font-weight);
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  white-space: nowrap;
}

::slotted([slot="header"]) {
  flex: 1;
  width: 0;
}

::slotted([slot="secondary-header"]) {
  padding-inline-end: 1em;
}

.card-container-footer {
  display: flex;
  justify-content: center;
  color: var(--fxview-primary-action-background);
  cursor: pointer;
}

::slotted([slot="footer"]:not([hidden])) {
  text-decoration: underline;
  display: inline-block;
  outline-offset: 2px;
  border-radius: var(--border-radius-xsmall);
  margin-block: 0.5rem;
}

@media (max-width: 39rem) {
  .card-container-header[withViewAll] {
    width: 76%;
  }
  .view-all-link {
    width: 20%;
  }
}

.card-container.inner {
  border: 1px solid var(--fxview-border);
  box-shadow: none;
  margin-block: 8px 0;
}

details.empty-state {
  box-shadow: none;
  border: 1px solid var(--fxview-border);
  border-radius: var(--border-radius-medium);
}
