:host {
  --top-bar-progress: 0%;
  display: grid;
  grid-template-rows: 0fr;
  transition: var(--timing-fast) grid-template-rows;
  overflow: hidden;
  --ds-icon-size-box--small: var(--font-size-body-s);
  --ds-icon-size--small: 100%;
}
:host > * {
  overflow: hidden;
}

:host(.disable-transition) {
  --progress-bar-transition-speed: 0 !important;
}

:host(.visible) {
  grid-template-rows: 1fr;
}

.top-state-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-gap-l);
  border-radius: 4px;
  list-style: var(--font-size-body-s);
  display: flex;
  /*states*/
}
.top-state-bar > * {
  position: relative;
  z-index: 1;
}
.top-state-bar__outer-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-gap-l);
  padding: var(--spacing-padding-l) var(--spacing-padding-l);
}
.top-state-bar__outer-wrapper::after, .top-state-bar__outer-wrapper::before {
  border-radius: 4px;
}
.top-state-bar__outer-wrapper::before {
  content: "";
  inline-size: 100%;
  block-size: 100%;
  inset-inline-start: 0;
  inset-block-start: 0;
  position: absolute;
  background-color: var(--color-accent-surface-elevation-3);
  z-index: 0;
}
.top-state-bar__outer-wrapper::after {
  content: "";
  inset-inline-start: 1px;
  inset-block-start: 1px;
  inline-size: calc(100% - 1px * 2);
  block-size: calc(100% - 1px * 2);
  position: absolute;
  background-color: var(--color-accent-surface-surface);
  z-index: 1;
}
.top-state-bar__inner-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: var(--spacing-gap-m);
  position: relative;
  z-index: 2;
}
.top-state-bar__caption {
  color: var(--color-text-neutral-strawberry);
  font-size: var(--font-size-body-s);
  line-height: var(--font-size-body-s);
  font-weight: var(--font-style-regular);
  display: flex;
  align-items: center;
  font-style: italic;
}
.top-state-bar__progress-wrapper {
  block-size: 4px;
  background-color: var(--color-accent-surface-elevation-1);
  position: relative;
  z-index: 2;
}
.top-state-bar__close {
  cursor: pointer;
  transition: var(--timing-fast) background-color;
}
.top-state-bar__inner-wrapper, .top-state-bar__progress-wrapper, .top-state-bar__close {
  opacity: 0;
  transition: 150ms opacity;
}
.top-state-bar--accent .progress-bar {
  background-color: var(--color-accent-primary-default);
}
.top-state-bar--success .progress-bar {
  background-color: var(--color-border-success-default);
}
.top-state-bar--warning .progress-bar {
  background-color: var(--color-border-warning-default);
}
.top-state-bar--error .progress-bar {
  background-color: var(--color-border-error-default);
}
.top-state-bar--in-progress .top-state-bar__outer-wrapper:before {
  block-size: 0;
  inline-size: 120%;
  padding-block-start: 60%;
  padding-block-end: 60%;
  background: linear-gradient(90deg, rgba(91, 167, 255, 0.4) 0%, rgba(63, 168, 155, 0.4) 100%);
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  -webkit-animation: inProgressBackgroundColor 1s linear infinite;
  animation: inProgressBackgroundColor 1s linear infinite;
}
.top-state-bar--in-progress .progress-bar {
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.top-state-bar--in-progress .progress-bar:after {
  content: "";
  position: absolute;
  z-index: 0;
  inline-size: 300%;
  block-size: 100%;
  inset-inline-start: 0;
  background: linear-gradient(90deg, #93f5eb 0%, #1aa3ff 33%, #93f5eb 66%, #1aa3ff 100%);
  animation-name: inProgressBar;
  animation-duration: 2s;
  animation-iteration-count: infinite;
}
.top-state-bar--visible .top-state-bar__inner-wrapper,
.top-state-bar--visible .top-state-bar__progress-wrapper,
.top-state-bar--visible .top-state-bar__close {
  opacity: 1;
}
.top-state-bar--visible .top-state-bar__close:hover {
  opacity: 0.75;
}
.top-state-bar--visible .top-state-bar__close:active {
  opacity: 0.5;
}

:host(.with-close-button) .top-state-bar__outer-wrapper {
  padding-block-start: 4px;
  gap: var(--spacing-gap-xs);
}

/*in progress animation*/
@-webkit-keyframes inProgressBackgroundColor {
  0% {
    transform: translate(-50%, -50%) rotate(0);
  }
  100% {
    transform: translate(-50%, -50%) rotate(1turn);
  }
}
@-webkit-keyframes inProgressBar {
  0% {
    inset-inline-start: 0%;
  }
  100% {
    inset-inline-start: -200%;
  }
}
@-moz-keyframes inProgressBar {
  0% {
    inset-inline-start: 0%;
  }
  100% {
    inset-inline-start: 200%;
  }
}
@keyframes inProgressBar {
  0% {
    inset-inline-start: 0%;
  }
  100% {
    inset-inline-start: -200%;
  }
}
.progress-bar {
  display: block;
  transition: all var(--progress-bar-transition-speed);
  inline-size: var(--top-bar-progress);
  border-radius: calc(4px / 2);
  block-size: 100%;
}

:host(.no-border) .top-state-bar__outer-wrapper:before,
:host(.border-block-start) .top-state-bar__outer-wrapper:before,
:host(.border-block-end) .top-state-bar__outer-wrapper:before {
  display: none;
}

:host(.border-block-start) .top-state-bar__outer-wrapper {
  border-block-start: 1px solid var(--color-border-surface-on-elevation-1);
}

:host(.border-block-end) .top-state-bar__outer-wrapper {
  border-block-end: 1px solid var(--color-border-surface-on-elevation-1);
}