.sidebar {
  background-color: var(--color-sidebar-background);
  display: flex;
  flex-direction: column;
  grid-area: sidebar;
}

.sidebar__header {
  align-items: center;
  background-color: var(--color-sidebar-background);
  border-block-end: 1px solid var(--color-sidebar-border);
  display: flex;
  font-size: 1.25rem;
  gap: 1rem;
  inset-block-start: 0;
  justify-content: space-between;
  padding-block-end: 1rem;
  padding: 1rem;
  position: sticky;
  z-index: 1;
}

.btn__run-tests {
  background-color: transparent;
  border: 2px solid var(--color-btn);
  border-radius: 50%;
  cursor: pointer;
  padding: 1.25rem;
  position: relative;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.btn__run-tests:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn__run-tests::after {
  background-color: var(--color-btn);
  mask: url("/svg/play.svg") no-repeat center;
  content: "";
  inset: 50% 0 0 50%;
  position: absolute;
  transform: translate(-50%, -50%);
}

.btn__run-tests.running::after {
  background-color: var(--color-btn);
  mask: url("/svg/stop.svg") no-repeat center;
  content: "";
}

.btn__run-tests:hover,
.btn__run-tests:focus-visible {
  border-color: var(--color-btn-hover);
}

.btn__run-tests:hover::after,
.btn__run-tests:focus-visible::after {
  color: var(--color-btn-hover);
}

.btn__sort-tests--wrapper {
  position: relative;
}

.btn__sort-tests--wrapper::after {
  background-color: var(--color-sidebar-foreground);
  mask: url("/svg/chevron-down.svg") no-repeat center;
  content: "";
  height: 0.75rem;
  inset-inline-end: 0.75rem;
  position: absolute;
  inset-block-start: 50%;
  transform: translateY(-50%);
  width: 0.75rem;
}

.btn__sort-tests {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--color-sidebar-border);
  border: 0;
  border-radius: 1rem;
  color: var(--color-sidebar-foreground);
  font-size: 1rem;
  overflow: hidden;
  padding: 0.25rem 2rem 0.25rem 1rem;
}

.coverage {
  text-wrap: nowrap;
  text-align: end;
  width: 4.75rem;
}

.sidebar__search--wrapper {
  align-items: center;
  border-block-end: 1px solid var(--color-sidebar-border);
  display: flex;
  gap: 1rem;
  padding: 1rem;
}

.btn__home {
  background-color: transparent;
  border: 2px solid var(--color-btn);
  border-radius: 50%;
  cursor: pointer;
  padding: 1rem;
  position: relative;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.btn__home:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn__home::after {
  background-color: var(--color-btn);
  mask: url("/svg/home.svg") no-repeat center;
  content: "";
  font-size: 1rem;
  inset: calc(50% - 0.5rem) 0 0 calc(50% - 0.5rem);
  line-height: 1;
  position: absolute;
  transform: translate(calc(-50% + 0.5rem), calc(-50% + 0.5rem));
}

.sidebar__search {
  position: relative;
  width: 100%;
}

.sidebar__search input {
  border: 0;
  border-radius: 1rem;
  background-color: var(--color-sidebar-border);
  color: var(--color-sidebar-foreground);
  padding: 0.25rem 2rem 0.25rem 1rem;
  width: 100%;
}

.sidebar__search input:not(:placeholder-shown) + .btn__search-clear {
  opacity: 1;
  visibility: visible;
}

.btn__search-clear {
  background-color: transparent;
  border: 0;
  color: var(--color-sidebar-foreground);
  cursor: pointer;
  font-size: 1.25rem;
  inset-inline-end: 0.5rem;
  opacity: 0;
  padding: 0.25rem;
  position: absolute;
  inset-block-start: 50%;
  transform: translateY(-50%);
  transition:
    color 0.2s,
    opacity 0.2s;
  visibility: hidden;
}

.btn__search-clear:hover {
  color: var(--color-btn-hover);
}

.sidebar__tests {
  overflow: auto;
  padding: 0.5rem 0 0.5rem 0.5rem;
  scrollbar-gutter: stable;
}

.sidebar__tests--file {
  border-radius: 0.75rem;
  cursor: pointer;
  margin-inline-start: -1px;
  padding: calc(0.5rem + 1px);
}

.sidebar__tests--file.open {
  background-color: var(--color-sidebar-border);
}

.sidebar__tests--file-container {
  display: flex;
  font-weight: bold;
  gap: 1rem;
  justify-content: space-between;
}

.sidebar__tests--file-status::after {
  background-color: var(--color-btn);
  display: inline-block;
  height: 100%;
  text-align: center;
  width: 1.25rem;
}

/* Pending */
.sidebar__tests--file-status.status-0::after {
  background-color: var(--color-btn);
  mask: url("/svg/question.svg") no-repeat center;
  content: "";
}

/* Running */
.sidebar__tests--file-status.status-1::after {
  animation: spin 1s linear infinite;
  background-color: var(--color-btn);
  mask: url("/svg/loader.svg") no-repeat center;
  content: "";
}

/* Passed */
.sidebar__tests--file-status.status-2::after {
  background-color: var(--color-coverage-bar-covered);
  mask: url("/svg/check.svg") no-repeat center;
  content: "";
}

/* Failed */
.sidebar__tests--file-status.status-3::after {
  background-color: var(--color-coverage-bar-uncovered);
  mask: url("/svg/x.svg") no-repeat center;
  content: "";
}

/* No Tests */
.sidebar__tests--file-status.status-4::after {
  background-color: var(--color-btn);
  mask: url("/svg/minus.svg") no-repeat center;
  content: "";
}

.sidebar__tests--file-title {
  direction: rtl;
  list-style: none;
  margin-inline-start: auto;
  max-width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  user-select: none;
  white-space: nowrap;
}

[dir="rtl"] .sidebar__tests--file-title {
  direction: ltr;
  text-align: right;
}

.sidebar__tests--tests {
  padding-block-end: 0.25rem;
  padding-inline-start: 2.4rem;
}

.sidebar__tests--tests:empty::after {
  color: var(--color-foreground-dark);
  content: "No functions found";
  font-style: italic;
}

.sidebar__tests--test {
  color: var(--color-sidebar-foreground);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  list-style: none;
}

.sidebar__tests--test-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__tests--file-coverage,
.sidebar__tests--test-coverage {
  align-items: center;
  color: var(--color-sidebar-foreground);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  min-width: 3.5rem;
}

.sidebar__coverage-circle {
  flex-shrink: 0;
  height: 1rem;
  position: relative;
  width: 1rem;
}

.sidebar__coverage-circle svg {
  height: 100%;
  transform: rotate(-90deg);
  width: 100%;
}

.sidebar__coverage-circle-bg {
  fill: none;
  stroke: var(--color-foreground-dark);
  stroke-width: 6;
  opacity: 0.5;
}

.sidebar__coverage-circle-fill {
  fill: none;
  stroke-width: 6;
  transition: stroke-dasharray 0.3s ease;
}

.sidebar__coverage-text {
  flex-shrink: 0;
  font-size: 0.8rem;
  min-width: 2.5rem;
  text-align: end;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
