/* Menu */
.feedback-menu {
  display: flex;
  flex-direction: column;
  font-size: 1.2rem;

  background: var(--menu-background-color);
  color: var(--menu-text-color);
  width: max(33%, 20em);
  border-left: 2px solid var(--menu-border-color);
}

/* Badges */

.feedback-badge {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--background-color);
}

.feedback-badge[data-count="0"] {
  visibility: hidden;
}

.open-button .icon-combo {
  display: grid;
  grid-template-areas: "icons";
  justify-items: center;
}

.open-button .icon-combo span {
  grid-area: icons;
}

.open-button .icon-combo .fa-question {
  font-size: 60%;
  line-height: 1.5;
  color: var(--background-color);
}

.open-button .feedback-badge {
  font-size: 50%;
}

.feedback-badge,
.counter {
  font-family: var(--ui-font-family);
  font-weight: bold;
  line-height: 1;
  text-align: center;
  vertical-align: baseline;
  white-space: nowrap;
  border-radius: 0.4em;
  padding: 0.2em 0.4em;
  background-color: var(--color-error);
  color: var(--background-color);
}

.feedback-badge.answered,
.counter.answered {
  background-color: var(--accent3);
}

/* Menu Parts */

div.feedback-menu.authorized div.feedback-footer {
  display: none;
}

div.feedback-menu.authorized input.feedback-token-input,
div.feedback-menu.authorized button.feedback-lock {
  visibility: hidden;
}

div.feedback-header {
  flex: 0 1 content;

  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: space-between;

  min-height: var(--common-menu-header-height);
  max-height: var(--common-menu-header-height);

  padding: var(--common-menu-header-padding);
  background: var(--menu-header-background-color);
  color: var(--menu-header-text-color);
}

div.feedback-title {
  flex: 0 1;
  margin-right: 1em;
}

div.counter[data-count="0"] {
  visibility: hidden;
}

div.counter {
  flex: 0 1;
  margin-right: 1em;
  font-size: 0.9em;
}

.hidden {
  visibility: hidden;
}

div.feedback-menu div.feedback-header input {
  font-family: var(--ui-font-family);
  /* font-size: 0.8em; */
}

div.feedback-header input[type="text"],
div.feedback-header input[type="password"] {
  flex: 1 1;
  min-width: 2em;
  max-width: 100em;
  background-color: var(--feedback-input-background-color);
  border: none;
  border-radius: var(--feedback-element-border-radius);
  padding: 0.3em;
  margin: 0;
  color: var(--foreground-color);
}

div.feedback-header button {
  /* flex: 0 1; */
  color: var(--menu-header-text-color);
}

div.feedback-footer button {
  flex: 0 1;
  color: var(--feedback-footer-text-color);
}

div.feedback-menu button {
  cursor: pointer;
  border: none;
  background-color: var(--icon-background-color);
}

div.feedback-menu button:hover {
  color: var(--icon-hover-color);
}

div.feedback-menu button:active {
  color: var(--icon-active-color);
}

div.feedback-header button > span {
  font-size: 0.5em;
  display: none;
}

div.feedback-menu .feedback-list {
  flex: 1 1;
  background-color: var(--list-background);
  padding: 0.3em;
  /* font-size: 0.8em; */
  overflow-y: scroll;
}

div.feedback-menu .feedback-list .feedback-item {
  color: var(--foreground-color);
  background-color: var(--background-color);
  font-family: var(--ui-font-family);
  line-height: 125%;
  border: none;
  border-radius: var(--feedback-element-border-radius);
  margin-bottom: 0.5em;
  padding: 0.3em;

  display: flex;
  flex-flow: row nowrap;
  /*  align-items: center; */
  justify-content: space-between;
}

div.feedback-content {
  margin: 0;
  padding: 0;
  padding-right: 0.1em;
  background-color: rgb(0, 0, 0, 0);
  overflow: hidden;
}

.feedback-item.answer {
  display: block;
  background-color: rgba(230, 230, 230, 0.9);
  margin-left: 4ex;
  font-size: 80%;
}

.feedback-item.answer > div.link {
  float: right;
}

div.feedback-menu div.feedback-controls {
  margin-left: 0.5em;
}

div.feedback-controls-wrapper {
  position: relative;
  top: 50%;
  transform: translate(0, -50%);
}

.feedback-list button {
  color: var(--icon-inactive-color);
  border: none;
  margin: 0;
  padding: 0;

  font-size: calc(var(--icon-size) * 0.75);
}

div.feedback-menu button.answered {
  color: var(--color-success);
}

div.feedback-menu button.notanswered {
  color: var(--color-error);
}

div.feedback-menu button.cantvote {
  cursor: default;
  color: var(--icon-disabled-color);
}

div.feedback-menu button.cantvote:hover {
  color: var(--icon-disabled-color);
}

.feedback-item button {
  flex: 0 1 content;
}

div.feedback-menu div.feedback-question-input {
  flex: 0 1;
  padding: 0.3em;

  background: var(--feedback-list-background-color);

  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}

div.feedback-question-input textarea {
  resize: none;
  padding: 0.3em;
  flex-grow: 1;

  color: var(--foreground-color);
  background-color: var(--feedback-input-background-color);

  border: none;
  border-radius: var(--feedback-element-border-radius);
  font-size: 0.8em;
}

div.feedback-question-input button.feedback-send-button {
  font-size: 1.5rem;
  flex-grow: 0;
  background-color: var(--accent5);
  color: var(--background-color);
  padding: 1rem;
  border-radius: var(--feedback-element-border-radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

div.feedback-question-input button.feedback-send-button:hover {
  background-color: var(--accent5-bg);
  color: var(--foreground-color);
}

div.feedback-question-input button.feedback-send-button span.fas {
  padding: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  div.feedback-question input textarea {
    background-color: var(--shade1);
  }
}

div.feedback-question-input textarea[answer] {
  background-color: var(--accent3-bbg);
  border: solid 1px var(--accent4-bbg);
}

div.feedback-question-input textarea::placeholder {
  color: var(--shade6);
}

div.feedback-menu div.feedback-footer {
  flex: 0 1 content;

  display: flex;
  flex-flow: row nowrap;
  align-items: center;

  padding: 0.3em;
  color: var(--feedback-footer-text-color);
  background: var(--feedback-footer-background-color);
}

div.feedback-credentials {
  display: flex;
  flex: 1 0;
}

div.feedback-credentials.visible {
  visibility: visible;
}

div.feedback-credentials:not(.visible) {
  visibility: hidden;
}

div.feedback-credentials input {
  flex: 1 0;
  color: var(--foreground-color);
  margin: 0;
  margin-left: 0.5em;
  padding: 0.3em;
  width: 40%;

  background-color: var(--feedback-input-background-color);

  border: none;
  border-radius: var(--feedback-element-border-radius);

  font-size: 0.8em;
}

div.feedback-credentials input.error {
  background-color: var(--accent0-bbg);
}

div.feedback-credentials button {
  background-color: var(--accent5);
  color: var(--background-color);
  font-weight: bold;
  margin-left: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
}

div.feedback-credentials button:hover {
  background-color: var(--accent5-bg);
  color: var(--foreground-color);
}

div.feedback-credentials button:active {
  background-color: var(--accent5-fg);
  color: var(--background-color);
}

div.feedback-login {
  flex: 0 1;

  color: var(--feedback-footer-text-color);
  background-color: rgba(0, 0, 0, 0);
  font-size: 1em;
}

div.feedback-login:not(.admin) {
  opacity: 1;
  color: var(--feedback-footer-text-color);
}

div.feedback-login.admin {
  opacity: 1;
  color: var(--accent0);
}

div.feedback-menu .feedback-item p,
div.feedback-menu ul,
div.feedback-menu ol {
  padding-bottom: 0.3em;
}

div.feedback-menu .feedback-item p:last-child,
div.feedback-menu .feedback-item ul:last-child,
div.feedback-menu .feedback-item ol:last-child {
  padding-bottom: 0;
}

/* Markdown Styling of questions and answers */

div.feedback-menu .feedback-item {
  font-size: 1em;
}

div.feedback-menu .feedback-item em {
  font-style: italic;
}

div.feedback-menu .feedback-item strong {
  font-weight: bold;
}

div.feedback-menu .feedback-item a {
  color: var(--accent4-fg);
}

div.feedback-menu .feedback-item ol {
  list-style-type: lower-alpha;
  list-style-position: inside;
}

div.feedback-menu .feedback-item ul {
  list-style-type: disc;
  list-style-position: inside;
}

div.feedback-menu .feedback-item code {
  font-family: var(--code-font-family);
  font-size: 0.9em;
}

div.feedback-menu .feedback-item pre {
  padding: 0.2em;
  background-color: var(--code-background-color);
  white-space: pre-wrap;
}

div.feedback-menu .feedback-item h1 {
  font-size: 1.2em;
  font-weight: bold;
  padding-bottom: 0.2em;
  padding-top: 0.2em;
  color: #333;
}

div.feedback-menu .feedback-item h2 {
  font-size: 1.1em;
  font-weight: bold;
  padding-bottom: 0.2em;
  padding-top: 0.2em;
  color: #333;
}

div.feedback-menu .feedback-item img {
  width: 100%;
  image-rendering: pixelated;
}

/* Slide Menu Badges */
li.slide-list-item[data-questions]::after {
  content: attr(data-questions);
  margin: 0 0.5em 0 1em;
  font-size: 0.9em;
  height: 1em;

  /* from class counter */
  background-color: var(--accent0);
  color: white;

  /* from class badge */
  font-family: var(--ui-font-family);
  font-weight: bold;
  line-height: 1;
  text-align: center;
  vertical-align: baseline;
  white-space: nowrap;
  border-radius: 0.4em;
  padding: 0.2em 0.4em;
}

li.slide-list-item[data-questions][data-answered="true"]::after {
  background-color: var(--accent3);
}

@media print {
  .feedback-menu {
    display: none;
  }
}
