:root {
  --color-header: #024a70;
  --color-background: #1e2939;
  --color-foreground: #fff;
  --color-foreground-dark: #5c6e87;
  --color-sidebar-background: #030712;
  --color-sidebar-border: #364153;
  --color-line-covered: #05df7222;
  --color-line-uncovered: #ff646722;
  --color-coverage-bar-covered: #016630;
  --color-coverage-bar-uncovered: #9f0712;
  --color-btn: #99a1af;
  --color-btn-hover: #d1d5dc;
  --color-sidebar-foreground: #cad5e2;
  --color-footer-background: #18181b;
  --color-footer-border: #09090b;
  --color-heatmap-high: #22c55e;
  --color-heatmap-medium: #eab308;
  --color-heatmap-low: #ef4444;
  --color-heatmap-none: #6b7280;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  height: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  background-color: var(--color-background);
  color: var(--color-foreground);
  display: grid;
  font-family: sans-serif;
  height: 100%;
  line-height: 1.5;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

p {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

.layout--default {
  grid-template-areas:
    "header header header"
    "coverage-bar coverage-bar coverage-bar"
    "sidebar content content"
    "sidebar footer footer";
  grid-template-columns: min(24rem, 50%) 1fr 1fr;
  grid-template-rows: 4rem 0.5rem 1fr min(16rem, calc(50vh - 4.5rem));
}

@media (width < 64rem) {
  .layout--default {
    grid-template-areas:
      "header"
      "coverage-bar"
      "sidebar"
      "footer";
    grid-template-columns: 100%;
    grid-template-rows: 4rem 0.5rem 1fr;
  }
}

#main-content {
  box-shadow: 0 0 0.5rem 0 rgb(0, 0, 0, 0.5) inset;
  grid-area: content;
  overflow: auto;
  padding-block: 1rem;
  position: relative;
  scrollbar-gutter: stable;
}

@media (width < 64rem) {
  #main-content {
    display: none;
  }
}

#main-content:empty::after {
  color: var(--color-foreground-dark);
  content: "Please select a file to check its coverage";
  inset-inline: 0;
  padding: 1rem;
  position: absolute;
  text-align: center;
  inset-block-start: 50%;
  transform: translateY(-50%);
}

#dashboard-container {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  overflow: hidden;
}

.dashboard {
  padding: 1rem 2rem;
  display: block;
  max-width: 50rem;
  margin: 0 auto;
  width: 100%;
}

.dashboard__widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.dashboard__widget {
  background-color: var(--color-sidebar-background);
  border: 1px solid var(--color-sidebar-border);
  border-radius: 1rem;
  box-shadow: 0 0 0.5rem 0 rgb(0, 0, 0, 0.25);
  padding: 1.5rem;
  width: 100%;
}

.dashboard__widget--heatmap {
  grid-column: span 2;
}

.dashboard__widget h3 {
  border-block-end: 1px solid var(--color-sidebar-border);
  color: var(--color-foreground);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  padding-block-end: 1rem;
}

.widget__stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.stat__label {
  color: var(--color-sidebar-foreground);
  font-size: 0.9rem;
}

.stat__value {
  color: var(--color-foreground);
  font-weight: 600;
  font-size: 1.1rem;
}

.status {
  display: flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
}

.status__running,
.status__idle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status__running::before,
.status__idle::before {
  content: "";
  height: 1rem;
  width: 1rem;
}

.status__running::before {
  animation: spin 1s linear infinite;
  background-color: var(--color-btn);
  mask: url("/svg/loader.svg") no-repeat center;
  mask-size: contain;
}

.status__idle::before {
  background-color: var(--color-heatmap-none);
  mask: url("/svg/pause.svg") no-repeat center;
}

.heatmap-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.heatmap-grid {
  display: grid;
  gap: 0.25rem;
  grid-template-columns: repeat(auto-fit, minmax(1.25rem, 1fr));
  max-width: 100%;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.heatmap-cell--high {
  background-color: #22c55e;
}

.heatmap-cell--medium {
  background-color: #eab308;
}

.heatmap-cell--low {
  background-color: #ef4444;
}

.heatmap-cell--no-coverage {
  background-color: #6b7280;
}

.heatmap-tooltip {
  position: fixed;
  background-color: var(--color-footer-background);
  border: 1px solid var(--color-footer-border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  white-space: nowrap;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  margin-block-end: 0.5rem;
}

.heatmap-tooltip--visible {
  opacity: 1;
}

.heatmap-legend {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  gap: 0.5rem;
}

.legend-color {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
}

.legend-color--high {
  background-color: var(--color-heatmap-high);
}

.legend-color--medium {
  background-color: var(--color-heatmap-medium);
}

.legend-color--low {
  background-color: var(--color-heatmap-low);
}

.legend-color--none {
  background-color: var(--color-heatmap-none);
}

.legend-label {
  font-size: 0.8rem;
  color: var(--color-sidebar-foreground);
}

.file-path {
  background-color: var(--color-background);
  border-block-end: 1px solid var(--color-sidebar-border);
  color: var(--color-sidebar-foreground);
  font-family: monospace;
  padding: 0.75rem 1rem;
  position: sticky;
  inset-block-start: 0;
  transform: translateY(-1rem);
  z-index: 1;
}

.main-content__code--line {
  align-items: start;
  display: grid;
  grid-template-columns: 3rem 1fr;
}

.main-content__code--line-number {
  border-inline-end: 1px solid var(--color-foreground-dark);
  color: var(--color-foreground-dark);
  padding-inline-end: 1rem;
  text-align: end;
  user-select: none;
}

.main-content__code--line-content {
  padding-inline-start: 0.5rem;
  tab-size: 4;
  white-space: pre;
}

.covered {
  background-color: var(--color-line-covered);
}

.uncovered {
  background-color: var(--color-line-uncovered);
}

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