:root {
  --nav-width: 12rem;
  --box-shadow-color: rgba(0, 0, 0, 0.3);
  --primary-color: #354595;
  --primary-dimmed-color: #b5bde3;
  --dark: #202644;
  --light: white;

  --chosen-survey-height: 2rem;
  --graph-height: 75px;
  --question-width: 12rem;
  --theme-name-width: 8rem;
  --label-width: 6rem;
  --percentage-width: 3rem;

  --critical-color: #DB8288;
  --concerning-color: #F8C9CC;
  --average-color: #FDEA00;
  --celebrate-color: #5FB9B1;

/*  --theme-score-width: 5rem;*/
}
* {
  box-sizing: border-box;
}
@keyframes rotate {
  0{
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
* {
  box-sizing: border-box;
}
html {
  font-family: 'Mulish', sans-serif;
  color: var(--dark);
}
html,
body {
  padding: 0;
  margin: 0;
}
body {
  min-width: 22rem;
}
body:has(nav.active) {
  margin-left: var(--nav-width);
}
main {
  padding: 0 1rem;
/*  width: 100%;*/
  max-width: 75rem;
  margin: 3rem auto 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.5rem;
  color: var(--primary-color);
}
* + h1,
* + h2,
* + h3,
* + h4,
* + h5,
* + h6 {
  margin-top: 2rem;
}
div[data-view] {
  padding-bottom: 2rem;
}

.scroller {
  overflow: auto;
  max-height: calc(100vh - 20rem);
}
form {
  max-width: 35rem;
  min-width: 22rem;
}
label {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}
button + label {
  margin-top: .5rem;
}
label[hidden] {
  display: none;
}
form label + label{
  margin-top: 0.1rem;
}
label > span {
  margin-left: 0.5rem;
}

form label span:first-child {
  display: inline-block;
  width: 9rem;
  margin-left: 0;
}
form input[type="password"],
form input[type="email"],
form input[type="text"],
form input:not([type]) {
  flex: 1;
}
form input[type="submit"] {
  display: block;
  width: 100%;
  max-width: 20rem;
  margin-top: 0.5rem;
  opacity: 1;
  cursor: pointer;
}
input[type=submit].align-to-text-input {
  width: calc(100% - 9rem);
  max-width: none;
  margin-left: 9rem;
}

form:invalid input[type="submit"],
button:disabled,
a[disabled],
input[type="submit"]:disabled {
  background-color: var(--primary-dimmed-color);
  pointer-events: none;
}
nav a[disabled] {
  background-color: var(--light);
  color: var(--primary-dimmed-color);
}

button,
input[type="submit"] {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: var(--light);
  border-radius: 0.25rem;
  border: none;
  transition: background-color 0.2s ease-out;
  box-shadow: 1px 3px 4px var(--box-shadow-color);
}
button:hover,
input[type="submit"]:hover {
  background-color: #185db7;
}

nav {
  width: var(--nav-width);
  height: 100vh;
  position: fixed;
  top: 0;
  z-index: 3;
  left: calc(-1 * var(--nav-width));
  transition: left 0.3s ease-in-out;
  background: var(--light);
}
nav.active {
  left: 0;
  box-shadow: 2px 0 3px var(--box-shadow-color);
}
nav.active > .menu-toggle svg {
  transform: rotate(90deg);
}
.menu-toggle {
  width: 2rem;
  height: 2rem;
  position: absolute;
  top: 0.5rem;
  border-radius: 0 0.25rem 0.25rem 0;
  right: -2rem;
  background-color: var(--light);
  margin-left: -99rem;
  box-shadow: 2px 0 2px var(--box-shadow-color);
}
.menu-toggle svg {
  position: absolute;
  left: 0;
  top:0;
  width: 32px;
  height: 32px;
  fill: var(--primary-color);
  transition: transform .3s ease-in-out;
}
.menu-toggle:hover {
  background-color: var(--light);
  cursor: pointer;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
nav li {
  flex-grow: 1;
}
nav li:empty{
  height: 1px;
  background: var(--primary-dimmed-color);
}
nav a {
  display: block;
  padding: 0.5rem;
  color: var(--primary-color);
  transition: color 0.2s ease-out, background-color 0.2s ease-in 0.1s;
}
nav a:hover {
  color: var(--light);
  background: var(--primary-color);
}
.loading {
  height: 2rem;
  width: 2rem;
  margin-top: .5rem;
  background: url(/img/loading.svg?cb=225bf8b52d902a94e05b809c67c3443f8a0be03b) no-repeat left center;
  animation: .6s infinite linear normal rotate;
}
.loading > * {
  display: none;
}

.login-error,
.report-error {
  color: #9D0B28;
  text-align: right;
  border-bottom: 2px solid currentcolor;
  padding: .5rem;
  margin: .5rem;
}
c-filter input {
  display: block;
  margin-bottom: 1rem;
}

.result-link {
  display: block;
}

c-database-import {
  display: block;
  padding-top: 1rem;
}

.chosen-survey {
  position: sticky;
  width: 100%;
  top: 0;
  height: var(--chosen-survey-height);
  background: white;
  z-index: 2;
}
.survey-selector {
  padding: .5rem 0;
}
.survey-selector button {
  border-radius: .5rem;
  padding: .25rem .5rem;
  background: var(--primary-dimmed-color);
  color: white;
  box-shadow: none;
  margin: 0 .5rem .5rem 0;
  cursor: pointer;
}
.survey-selector button:hover {
  background: var(--primary-color);
}

table {
  border-collapse: collapse;
  table-layout: fixed;
}
.score-distribution-table {
  width: calc(var(--question-width) + var(--theme-name-width) + var(--label-width) + (6 * var(--percentage-width)));
}
.score-distribution-table thead th {
  position: sticky;
  top: var(--chosen-survey-height);
  background: white;
  z-index: 2;
}
.score-distribution-table td{
  vertical-align: bottom;
  padding: .25rem;
}
.score-distribution-table td.spacer {
  height: .5rem;
}
.score-distribution-table td:not(.question) {
  white-space: nowrap;
}
.score-distribution-table .question-column,
.score-distribution-table .question {
  width: var(--question-width);
}
.score-distribution-table .theme-column,
.score-distribution-table .theme {
  width: var(--theme-name-width);
}

.score-distribution-table .percentage-column,
.score-distribution-table th.percentage,
.score-distribution-table td.percentage,
.score-distribution-table td.value {
  width: var(--percentage-width);
}

.score-distribution-table .question {
  font-weight: bold;
}
.score-distribution-table td.percentage {
  height: var(--graph-height);
  padding: 0;
  position: relative;
  border-bottom: 1px solid #ccc;
}

.score-distribution-table td.percentage > div {
  width: 100%;
  position: absolute;
  bottom: 0;
  height: calc(1% * var(--percentage));
}

.score-distribution-table td.average:after {
  content: "";
  position: absolute;
  display: block;
  height: var(--graph-height);
  width: 3px;
  border-radius: 2px 2px 0 0;
  background: rgba(0,0,0,.3);
  bottom: 0;
  left: calc((-1 * var(--percentage-width)) + (var(--average) * var(--percentage-width)));
  z-index: 1;
}
.score-distribution-table .percentage > div {
    background: #a02121;
}
.score-distribution-table .percentage  + .percentage > div {
    background: #b7682c;
}
.score-distribution-table .percentage  + .percentage + .percentage > div {
    background: #eff920;
}
.score-distribution-table .percentage  + .percentage + .percentage + .percentage > div {
    background: #96e81b;
}
.score-distribution-table .percentage  + .percentage + .percentage + .percentage + .percentage > div {
    background: #26cc14;
}
.score-distribution-table .percentage  + .percentage + .percentage + .percentage + .percentage + .percentage > div {
    background: #910a50;
}

.score-distribution-table tbody tr:nth-child(4n+5) td {
  border-top: 1px solid #eee;
}

td.value {
  text-align: center;
  height: 1.2rem;
}

.theme-distribution {
  --block-size: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.theme-distribution > div {
  display: flex;
  flex-direction: column;
}
.theme-distribution h4 {
  margin-top: .25rem;
  text-align: center;
}
.theme-distribution-values {
  display: flex;
  flex: 1;
  font-size: .75rem;
}
.theme-distribution-values > div {
  display: flex;
  flex-direction: column;
  width: var(--block-size);
  text-align: center;
}
.theme-distribution-bar-negative {
  flex: 1;
}
.theme-distribtion-bar.critical {
 background-color: var(--critical-color);
}
.theme-distribtion-bar.concerning {
 background-color: var(--concerning-color);
}
.theme-distribtion-bar.average {
 background-color: var(--average-color);
}
.theme-distribtion-bar.celebrate {  
 background-color: var(--celebrate-color);
}
.theme-distribtion-bar {
  border-bottom: 1px solid black;
  height: calc(var(--block-size) * var(--value));
  background-image:
    linear-gradient(-90deg, white 12%, transparent 12%, transparent 88%, white 88%),
    linear-gradient(0deg, white 20%, transparent 20%, transparent 96%, white 96%);
  background-size: var(--block-size) var(--block-size), var(--block-size) var(--block-size);
  background-position: bottom, bottom;
}

.theme-overview-table thead th {
  position: sticky;
  top: var(--chosen-survey-height);
  background: white;
  z-index: 2;
}
.theme-overview-table .theme-column,
.theme-overview-table th,
.theme-overview-table td {
  padding: .25rem .5rem;
}
.theme-overview-table th,
.theme-overview-table td {
  text-align: center;
}
.theme-overview-table .attention{
  background: #fce900;
}
.theme-overview-table .critical{
  background: #DB8288;
}
.theme-overview-table .celebrate{
  background: #5be8b0;
}
.theme-overview-table .divers{
  background: #354595;
}