@tailwind components;

/**
 * @prop --mds-filter-items-background-active: Sets the background-color of the items row area when a filter is active
 * @prop --mds-filter-items-background: Sets the background-color of the items row area
 * @prop --mds-filter-items-gap: Sets the gap between items
 * @prop --mds-filter-items-padding: Sets the padding of the items row area
 * @prop --mds-filter-items-radius: Sets the border-radius of the items row area
 * @prop --mds-filter-items-scroll-behavior: Sets the scroll-behavior animation;
 * @prop --mds-filter-label-padding: Sets the padding of the label
 * @prop --mds-filter-wrapper-shadow-color: Sets the effect of the outline border
 * @prop --mds-filter-wrapper-shadow: Sets the shadow used as outline border
 * @prop --mds-filter-wrapper-shodow-opacity: Sets the opacity of the outline border
 */

:host {
  --mds-filter-items-background-active: rgb(var(--tone-neutral-09));
  --mds-filter-items-background: rgb(var(--tone-neutral-09));
  --mds-filter-items-gap: 0.5rem;
  --mds-filter-items-padding: 0.5rem;
  --mds-filter-items-radius: 9999px;
  --mds-filter-items-scroll-behavior: smooth;
  --mds-filter-label-padding: 0 1.5rem;
  --mds-filter-wrapper-shadow-color: rgb(var(--tone-neutral-06));
  --mds-filter-wrapper-shadow: 0 0 0 2px var(--mds-filter-wrapper-shadow-color) inset;
  --mds-filter-wrapper-shodow-opacity: 0.1;
  gap: 0.25rem;

  display: grid;
  grid-auto-rows: min-content;
}

.items {
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

.items::-webkit-scrollbar {
    display: none;
  }

.items{
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(1, 0, 0, 1);

  background-color: var(--mds-filter-items-background);
  border-radius: var(--mds-filter-items-radius);
  display: flex;
  gap: var(--mds-filter-items-gap);
  overflow: auto;
  padding: var(--mds-filter-items-padding);
  position: relative;
  scroll-behavior: var(--mds-filter-items-scroll-behavior);
  scroll-snap-type: x mandatory;
  transition-property: background-color;
}

.items-wrapper {
  display: grid;
  overflow: hidden;
  position: relative;
}

.items-wrapper::after {
  border-radius: var(--mds-filter-items-radius);
  box-shadow: var(--mds-filter-wrapper-shadow);
  content: "";
  inset: 0;
  opacity: var(--mds-filter-wrapper-shodow-opacity);
  pointer-events: none;
  position: absolute;
}

.items::-webkit-scrollbar {
  display: none;
}

.label {
  padding: var(--mds-filter-label-padding);
}

.active {
  background-color: var(--mds-filter-items-background-active);
}

.reset{
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(1, 0, 0, 1);

  display: flex;
  flex-grow: 1;
  justify-content: flex-end;
  transform: scale(0);
  transform-origin: center;
  transition-property: transform;
}

.reset-button{
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(1, 0, 0, 1);

  transform: scale(0);
  transition-property: transform;
}

.reset-button-opened {
  transform: scale(1);
}

:host([reset]:not([reset="false"])) .reset {
  transform: scale(1);
}

:host-context(.pref-animation-reduce) {
  --mds-filter-items-scroll-behavior: auto;
}

:host-context(.pref-animation-reduce),
:host-context(.pref-animation-reduce) .reset-button,
:host-context(.pref-animation-reduce) .items {
  transition-duration: 0s;
}

@media (prefers-reduced-motion) {
  :host-context(.pref-animation-system) {
    --mds-filter-items-scroll-behavior: auto;
  }

  :host-context(.pref-animation-system),
  :host-context(.pref-animation-system) .reset-button,
  :host-context(.pref-animation-system) .items {
    transition-duration: 0s;
  }
}

:host-context(.pref-theme-dark) .items {
  --mds-filter-items-background-active: rgb(var(--tone-neutral-10));
  --mds-filter-items-background: rgb(var(--tone-neutral-09));
}

@media (prefers-color-scheme: dark) {
  :host-context(.pref-theme-system) .items {
    --mds-filter-items-background-active: rgb(var(--tone-neutral-10));
    --mds-filter-items-background: rgb(var(--tone-neutral-09));
  }
}

:host-context(.pref-contrast-more) {
  --mds-filter-items-background-active: rgb(var(--tone-neutral-09));
  --mds-filter-items-background: rgb(var(--tone-neutral-10));
  --mds-filter-wrapper-shadow-opacity: 0.3;
  --mds-filter-wrapper-shadow-color: rgb(var(--tone-neutral-07));
  --mds-filter-wrapper-shadow: 0 0 0 0.125rem var(--mds-filter-wrapper-shadow-color) inset;
}

@media (prefers-contrast: more) {
  :host-context(.pref-contrast-system) {
    --mds-filter-items-background-active: rgb(var(--tone-neutral-09));
    --mds-filter-items-background: rgb(var(--tone-neutral-10));
    --mds-filter-wrapper-shadow-opacity: 0.3;
    --mds-filter-wrapper-shadow-color: rgb(var(--tone-neutral-07));
    --mds-filter-wrapper-shadow: 0 0 0 0.125rem var(--mds-filter-wrapper-shadow-color) inset;
  }
}

:host(:not(:is([hydrated], .hydrated))) {
  animation-duration: 0s;
  border-color: transparent;
  box-shadow: 0 0 0 transparent;
  opacity: 0;
  outline-color: transparent;
  transition-delay: 0s;
  transition-duration: 0s;
  visibility: hidden;
}

/* TODO refact(stencil): Uses only used selector from parent shadowDOM component */

mds-accordion:not(:is([hydrated], .hydrated)),
mds-accordion-item:not(:is([hydrated], .hydrated)),
mds-accordion-timer:not(:is([hydrated], .hydrated)),
mds-accordion-timer-item:not(:is([hydrated], .hydrated)),
mds-author:not(:is([hydrated], .hydrated)),
mds-avatar:not(:is([hydrated], .hydrated)),
mds-badge:not(:is([hydrated], .hydrated)),
mds-banner:not(:is([hydrated], .hydrated)),
mds-benchmark-bar:not(:is([hydrated], .hydrated)),
mds-bibliography:not(:is([hydrated], .hydrated)),
mds-breadcrumb:not(:is([hydrated], .hydrated)),
mds-breadcrumb-item:not(:is([hydrated], .hydrated)),
mds-button:not(:is([hydrated], .hydrated)),
mds-card:not(:is([hydrated], .hydrated)),
mds-card-content:not(:is([hydrated], .hydrated)),
mds-card-footer:not(:is([hydrated], .hydrated)),
mds-card-header:not(:is([hydrated], .hydrated)),
mds-card-media:not(:is([hydrated], .hydrated)),
mds-chip:not(:is([hydrated], .hydrated)),
mds-details:not(:is([hydrated], .hydrated)),
mds-dropdown:not(:is([hydrated], .hydrated)),
mds-entity:not(:is([hydrated], .hydrated)),
mds-file:not(:is([hydrated], .hydrated)),
mds-file-preview:not(:is([hydrated], .hydrated)),
mds-filter:not(:is([hydrated], .hydrated)),
mds-filter-item:not(:is([hydrated], .hydrated)),
mds-header:not(:is([hydrated], .hydrated)),
mds-header-bar:not(:is([hydrated], .hydrated)),
mds-help:not(:is([hydrated], .hydrated)),
mds-horizontal-scroll:not(:is([hydrated], .hydrated)),
mds-hr:not(:is([hydrated], .hydrated)),
mds-icon:not(:is([hydrated], .hydrated)),
mds-img:not(:is([hydrated], .hydrated)),
mds-input:not(:is([hydrated], .hydrated)),
mds-input-field:not(:is([hydrated], .hydrated)),
mds-input-range:not(:is([hydrated], .hydrated)),
mds-input-select:not(:is([hydrated], .hydrated)),
mds-input-switch:not(:is([hydrated], .hydrated)),
mds-input-tip:not(:is([hydrated], .hydrated)),
mds-input-tip-item:not(:is([hydrated], .hydrated)),
mds-input-upload:not(:is([hydrated], .hydrated)),
mds-keyboard:not(:is([hydrated], .hydrated)),
mds-keyboard-key:not(:is([hydrated], .hydrated)),
mds-kpi:not(:is([hydrated], .hydrated)),
mds-kpi-item:not(:is([hydrated], .hydrated)),
mds-label:not(:is([hydrated], .hydrated)),
mds-list:not(:is([hydrated], .hydrated)),
mds-list-item:not(:is([hydrated], .hydrated)),
mds-modal:not(:is([hydrated], .hydrated)),
mds-note:not(:is([hydrated], .hydrated)),
mds-notification:not(:is([hydrated], .hydrated)),
mds-paginator:not(:is([hydrated], .hydrated)),
mds-paginator-item:not(:is([hydrated], .hydrated)),
mds-pref:not(:is([hydrated], .hydrated)),
mds-pref-animation:not(:is([hydrated], .hydrated)),
mds-pref-consumption:not(:is([hydrated], .hydrated)),
mds-pref-contrast:not(:is([hydrated], .hydrated)),
mds-pref-language:not(:is([hydrated], .hydrated)),
mds-pref-language-item:not(:is([hydrated], .hydrated)),
mds-pref-theme:not(:is([hydrated], .hydrated)),
mds-price-table:not(:is([hydrated], .hydrated)),
mds-price-table-features:not(:is([hydrated], .hydrated)),
mds-price-table-features-cell:not(:is([hydrated], .hydrated)),
mds-price-table-features-row:not(:is([hydrated], .hydrated)),
mds-price-table-header:not(:is([hydrated], .hydrated)),
mds-price-table-list:not(:is([hydrated], .hydrated)),
mds-price-table-list-item:not(:is([hydrated], .hydrated)),
mds-progress:not(:is([hydrated], .hydrated)),
mds-push-notification:not(:is([hydrated], .hydrated)),
mds-push-notifications:not(:is([hydrated], .hydrated)),
mds-quote:not(:is([hydrated], .hydrated)),
mds-separator:not(:is([hydrated], .hydrated)),
mds-spinner:not(:is([hydrated], .hydrated)),
mds-stepper-bar:not(:is([hydrated], .hydrated)),
mds-stepper-bar-item:not(:is([hydrated], .hydrated)),
mds-tab:not(:is([hydrated], .hydrated)),
mds-tab-bar:not(:is([hydrated], .hydrated)),
mds-tab-bar-item:not(:is([hydrated], .hydrated)),
mds-tab-item:not(:is([hydrated], .hydrated)),
mds-table:not(:is([hydrated], .hydrated)),
mds-table-body:not(:is([hydrated], .hydrated)),
mds-table-cell:not(:is([hydrated], .hydrated)),
mds-table-footer:not(:is([hydrated], .hydrated)),
mds-table-header:not(:is([hydrated], .hydrated)),
mds-table-header-cell:not(:is([hydrated], .hydrated)),
mds-table-row:not(:is([hydrated], .hydrated)),
mds-text:not(:is([hydrated], .hydrated)),
mds-toast:not(:is([hydrated], .hydrated)),
mds-tooltip:not(:is([hydrated], .hydrated)),
mds-tree:not(:is([hydrated], .hydrated)),
mds-tree-item:not(:is([hydrated], .hydrated)),
mds-url-view:not(:is([hydrated], .hydrated)),
mds-usage:not(:is([hydrated], .hydrated)),
mds-video-wall:not(:is([hydrated], .hydrated)),
mds-zero:not(:is([hydrated], .hydrated))
{
  animation-duration: 0s;
  border-color: transparent;
  box-shadow: 0 0 0 transparent;
  opacity: 0;
  outline-color: transparent;
  transition-delay: 0s;
  transition-duration: 0s;
  visibility: hidden;
}

