/* reusable parts */
  [visible="false"] {
    display: none !important;
  }
  .flex-row {
    display: flex;
    flex-direction: row;
    column-gap: 5px;
    width: 100%;
    align-items: center; /* vertical alignment */
  }
  .center { justify-content: center; }
  .space-between { justify-content: space-between; }
  .button {
    text-decoration: none;
    border: 1px solid var(--fg);
    padding: 5px;
    color: var(--fg);
    cursor: pointer;
    text-align: center;
    &:hover {
      box-shadow: 0 0 0 2px var(--fg);
    }
    user-select: none;
    height: fit-content;
  }

/* light/dark mode */
  :root {
    color-scheme: light dark;
    --fg: light-dark(black, white);
    --bg: light-dark(white, black);
    --gray: light-dark(#555555, #aaaaaa);
    --red: #CC0000;
    --orange: #E69138;
    --green: #6AA84F;
    --blue: #3C78D8;
    --purple: #8E7CC3;
  }

  /* invert the diagrams if dark mode is enabled */
  @media (prefers-color-scheme: dark) {
    img, svg {
      filter: invert(1);
    }
  }

body {
  margin: 5px;
  color: var(--fg);
  background-color: var(--bg);
}

/* some wierd thing from the HTML blobs that should be hidden */
.sr-only { display: none; }

/* content */
  #content {
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: 5px;
  }

  select {
    padding: 5px;
    border: 1px solid var(--fg);
    margin: 0;
    box-sizing: border-box;
  }

/* user */
  #user-select {
    font-family: monospace;
    font-size: 13px;
  }
  #user-input {
    width: 2in;
    color: var(--fg);
    background-color: var(--bg);
    display: inline;
    font-family: monospace;
    font-size: 13px;
  }

/* filters */
  #exam-select {
    font-family: monospace;
    font-size: 13px;
  }
  #answer-type-select {
    font-family: monospace;
    font-size: 13px;
  }

  #grid {
    min-width: 7in;
    border-collapse: collapse;
    border-bottom: 1px solid var(--fg);
    font-family: monospace;
    margin-left: auto;
    margin-right: auto;
    tbody {
      border-left: 1px solid var(--fg);
      td {
        border-top: 1px solid var(--fg);
        border-bottom: 1px solid var(--fg);
        color: var(--gray);

        &.filter-cell:hover, &.filter-cell[selected="true"] {
          box-shadow: inset 0px 0px 0px 2px var(--fg);
          color: var(--fg);
          font-weight: bold;
        }
        &.filter-cell.superdomain, &.filter-cell.domain {
          text-align: center;
        }
        cursor: pointer;
      }
    }
    thead td {
      padding: 0px 0px 5px 0px;
      border-top: none !important;
    }
  }
  .progress-info > div {
    display: flex;
    flex-direction: row;
    column-gap: 1px;
    padding: 0px 2px 0px 2px;
  }
  .answered-questions-count {
    width: 3ch;
    text-align: right;
  }
  .total-questions-count {
    color: var(--gray);
    font-size: small;
    width: 3ch;
    text-align: right;
  }

/* control panel*/
  #control-panel {
    position: static;
    z-index: 99;
    top: 5px;

    width: 100%;
    max-width: 14in;
    padding: 5px;
    box-sizing: border-box;

    background-color: var(--bg);
    border: 1px solid var(--fg);

    font-family: monospace;
    font-size: 13px;

    display: flex;
    flex-direction: column;
    row-gap: 5px;
  }
  #questions-count::after {
    content: " total";
  }
  #selected-questions-count::after {
    content: " selected";
  }
  #answered-questions-count::after {
    content: " answered";
  }
  #control-panel-toggle[state=true]::after {
    content: "hide";
  }
  #control-panel-toggle[state=false]::after {
    content: "show";
  }
  #control-panel-columns {
    display: flex;
    justify-content: space-between;
    column-gap: 5px;

  }

  .subdomain-filter {
    line-height: 15px;
    display: flex;
    column-gap: 5px;
  }

  input[type="checkbox"]{
    margin: 0;
    border-radius: 0;
    appearance: none;
    width: 15px;
    height: 15px;

    border: 1px solid var(--fg);
    flex-shrink: 0;
    &:checked {
      border: 5px solid var(--fg);
    }
  }

  input[type="radio"] {
    appearance: none;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    border: 1px solid var(--fg);
    &:checked {
      border: 5px solid var(--fg);
    }
  }

  /* control panel users */
    #user-panel {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      row-gap: 5px;
    }

  /* control panel column 2 - difficulty filters*/
    #control-panel-difficulty {
      display: flex;
      flex-direction: column;
      row-gap: 5px;
    }
    .difficulty-filter {
      display: flex;
      column-gap: 5px;
      align-items: center;
    }
    .difficulty-H {
      color: var(--red);
      &::after { content: "H"; }
    }
    .difficulty-M {
      color: var(--orange);
      &::after { content: "M"; }
    }
    .difficulty-E {
      color: var(--green);
      &::after { content: "E"; }
    }
    .difficulty-H, .difficulty-M, .difficulty-E {
      font-family: monospace;
      font-weight: bold;
      font-size: large;
      text-align: center;
    }
    .response-type-MCQ { color: var(--blue); }
    .response-type-FRQ { color: var(--purple); }

  /* control panel column 3 - subdomain filters */
    #control-panel-subdomain {
      display: flex;
      flex-direction: column;
      row-gap: 5px;
    }
    #search {
      border: 1px solid var(--fg);
      font-size: large;
      font-family: monospace;
      color: var(--fg);
      text-align: center;
      background-color: var(--bg);
    }
    .filter-table {
      display: table;
      border-collapse: collapse;
      border-style: hidden;
    }
    .filter-table-row {
      display: table-row;
      border-bottom: 1px solid var(--fg);
    }
    .filter-table-cell {
      display: table-cell;
      vertical-align: middle;
      padding: 5px;
    }
    .filter-table-domain {
      display: flex;
      flex-direction: column;
      align-items: center;
      row-gap: 5px;
      max-width: 2in;
      text-align: center;
    }
    #subdomain-filters {
      display: flex;
      flex-direction: column;
      row-gap: 5px;
    }

/* question viewer */
  #question-viewer {
    width: 100%;
    height: 100%;
    max-width: 14in;
    display: flex;
    justify-content: center;
  }
  #question-viewer-control {
    display: flex;
    flex-direction: row;
    column-gap: 5px;
    align-items: center;
  }
  #question-viewer-loading {
    &::after {
      content: "loading...";
    }
  }
  #question-viewer-no-questions {
    &::after {
      content: "no questions exist";
    }
  }

/* question */
  /* question block */
    .question-block {
      margin: auto;
      width: 100%;
      border: 1px solid var(--fg);
      padding: 5px;
    }
    .question-block:hover {
      box-shadow: 0 0 0 2px var(--fg);
    }

  /* question metadata */
    .question-header {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      column-gap: 15px;
      font-family: monospace;
      font-size: large;
    }
    .question-checkmark {
      visibility: visible;
      font-weight: bold;
      color: inherit;
      padding-top: 0px;
      padding-bottom: 0px;
    }
    .question-checkmark span::after {
      content: "✓";
    }
    .question-checkmark:hover {
      color: var(--fg);
      background-color: var(--bg);
      border: 1px solid var(--bg);
      box-shadow: none;
    }
    .question-checkmark:hover span::after {
      content: "✗";
    }
    .question-checkmark[invisible="true"] {
      visibility: hidden;
    }
    .question-uuid {
      cursor: pointer;
    }
    .question-classification {
      font-style: italic;
    }

  /* question body and answers */
    .question-body {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      font-family: sans-serif;
      font-size: 20px;
    }
    .question-body-item {
      flex-basis: 6.5in;
    }
    .answer-options {
      width: fit-content;
    }
    .answer-option {
      &:hover, &[wrong="true"] {
        text-decoration: line-through var(--red) 2px;
        filter: brightness(50%) sepia(100%) saturate(100);
        color: var(--red);
      }
    }

  /* answer dropdown */
    summary {
      text-align: center;
      &:hover {
        color: var(--bg);
        background-color: var(--fg);
      }
    }

/* footer */
  #footer {
    font-family: monospace;
    border: 1px solid grey;
    text-align: center;
    display: flex;
    flex-direction: column;
    width: fit-content;
    margin: 20px auto 5px auto;
    padding: 5px;
    color: var(--gray);
    a {
      color: var(--gray) !important;
    }
  }
