@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=swap');

:root {
  --monospace: "Geist Mono", "SF Mono", Menlo, Consolas, 'Courier New', Courier, monospace;
}

body {
  font-size: 16px;
  font-family: "Geist", system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

h2 {
  margin: 0;
  font-size: 1.5rem;
}

h3 {
  margin: 0;
}

#app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, auto) 1fr;
  grid-template-areas:
    "navigation-bar navigation-bar"
    "source-code output-panels";
  padding: 1rem;
  gap: 1rem;
}

#navigation-bar {
  grid-area: navigation-bar;
}

#navigation-bar .brand {
  font-size: 1.25rem;
  font-weight: 600;
}

#input,
#output {
  flex: 1;
  flex-shrink: 0;
}

#input {
  border: 1px solid #000;
  display: flex;
  flex-direction: column;
  grid-area: source-code;
}

#input .toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f0f0f0;
  border-bottom: 1px solid #000;
}

#output {
  grid-area: output-panels;
}

#editor {
  padding: 0.5rem;
  width: 100%;
  height: 100%;
  resize: none;
  border: none;
  font-family: var(--monospace);
  font-size: 0.875rem;
}

#editor:focus {
  outline: none;
}

.select {
  line-height: 1.5;
  background: #ffffff;
  border: 1px solid #000;
  box-shadow: rgb(187, 187, 187) 2px 2px 0px 0px;
}

.select:focus {
  outline: none;
  box-shadow: rgb(187, 187, 187) 2px 2px 0px 0px, 0 0 0 .1rem rgba(52, 130, 255, 0.84);
}

.button {
  line-height: 1.5;
  background: rgb(153, 197, 255);
  border: 1px solid #000;
  box-shadow: rgb(187, 187, 187) 2px 2px 0px 0px;
}

.button:focus {
  box-shadow: rgb(187, 187, 187) 2px 2px 0px 0px, 0 0 0 .1rem rgba(0, 0, 0, .2);
}

collapsible-tree {
  font-family: var(--monospace);
}

details {
  margin-left: 1em;
  cursor: pointer;
}

summary {
  outline: none;
  list-style: none;
}

details>summary::-webkit-details-marker {
  display: none;
}

details:not([open]):not([leaf])>summary::after {
  font-weight: bold;
  content: " ...";
}

collapsible-tree details {
  position: relative;
}

collapsible-tree details>.rule {
  position: absolute;
  top: 1rem;
  left: 1px;
  bottom: 0;
  border-left: 1px dashed rgba(0, 0, 0, .2);
}

collapsible-tree>details {
  margin-left: 0;
}

/* Hide the radio buttons */
.tabs input[type="radio"] {
  display: none;
}

/* Basic styling for tab labels (can be made more "style-less" by removing borders, padding) */
.tabs>label {
  display: inline-flex;
  align-items: center;
  height: 1.75rem;
  padding: 0 0.5rem;
  border: 1px solid #000;
  /* Minimalist border */
  cursor: pointer;
  /* To make borders overlap slightly */
  background: #f0f0f0;
  /* Light gray background for non-active tabs */
}

/* Hide all tab content by default */
.tab-content {
  margin-top: 0.5rem;
  display: none;
  border: 1px solid #000;
  padding: 10px;
  height: calc(100% - 2.25rem);
  overflow: auto;
  /* Align with the bottom border of the labels */
}

/* Show the content of the checked tab and style the active tab label */
.tabs input[type="radio"]:checked+label {
  background: #fff;
  outline: 1px solid #000;
  /* White background for active tab */
  /* border-bottom: none; */
  /* Makes it look like the content is part of the tab */
}

.tabs input[type="radio"]+label {
  margin-right: 0.25rem;
}


/*
When radio button with id="tab1" is checked, the element with id="content1" that
is a sibling of it (~) will be displayed.
*/
#radio-typer:checked~#tab-typer,
#radio-parser:checked~#tab-parser,
#radio-elaborator:checked~#tab-elaborator,
#radio-resolver:checked~#tab-resolver,
#radio-lowering:checked~#tab-lowering,
#radio-code-generation:checked~#tab-code-generation {
  display: block;
}

/* Optional: Basic layout for the labels to appear in a row */
.tabs {
  overflow: hidden;
  /* Clear floats or prevent margin collapse, depending on label styling */
}

.tab-content pre {
  margin: 0;
}

.tab-content h3 {
  margin-bottom: 0.5rem;
}

pre>code {
  font-family: var(--monospace);
}

pre>code.output {
  font-size: 0.875rem;
}

pre>code.traces {
  font-size: 0.875rem;
}

pre>code.js {
  font-size: 0.875rem;
}

header.tree-display,
header.traces {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.tree-display>div.hint {
  font-size: 0.75rem;
  opacity: 0.5;
  font-weight: bold;
}

label[for="show-traces"] {
  font-size: 0.875rem;
}

.compile-time-report {
  font-size: 0.875rem;
  margin-left: auto;
  align-self: center;
}

#tab-typer .results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.typer-result {
  display: flex;
  flex-direction: column;
  background: #f0f0f0;
  padding: 0.5rem;
  gap: 0.5rem;
  border: 1px solid #000;
}

.typer-result .source {
  top: 0;
  position: sticky;
  font-size: 0.875rem;
  background-color: #ffffff;
  padding: 0.5rem;
  border: 1px solid #000;
  box-shadow: 0 0 0.5rem 0 rgba(0, 0, 0, 0.1);
}

.typer-result .output {
  font-size: 0.875rem;
}
