/* Styles for components e.g. avatars, modals, alerts */

.avatar img {
  border: 1px solid var(--color-heading);
  border-radius: 100%;
  box-shadow: 0px 0px 0px 1.5px white;
  object-fit: contain;
  height: 100%;
  width: 100%;
}
.avatar + .avatar {
  margin-left: -0.25rem;
}
.sidebar {
  z-index: 9;
  min-width: 220px;
  max-width: 100%;
  width: 100%;
}
@media (min-width: 992px) {
  .sidebar {
    width: 100%;
    max-width: 220px;
  }
}

.sidebar .badge {
  display: inline-block; 
  text-decoration: none !important;
  padding: 0 0 0 0.3em;
  margin: 0;
  /* margin-left: 0.25em; */
  font-size: 1em;
  font-weight: normal;
  height: 1em;
  color: var(--color-muted);
}
.sidebar a.active .badge {
  color: var(--color-accent);
}
.sidebar .badge::before {
  margin-left: -0.25rem;
  content: "(";
}
.sidebar .badge::after {
  content: ")";
}

.modal-content {
  /* Fix for bottom of tall modals going offscreen */
  max-height: calc(100vh - 2 * var(--bs-modal-margin));
}
.modal-footer {
  justify-content: start;  
}
.modal {
  --bs-modal-border-radius: var(--border-radius-common);
  --bs-modal-inner-border-radius: var(--border-radius-common);
  --bs-modal-border-color: var(--color-border);
  --bs-modal-width: 80ch;
}

.badge {
  --bs-badge-font-weight: 400;
  --bs-badge-border-radius: 3em;
}
.badge-info {
  background: var(--color-background-light);
  border: 1px solid var(--color-border);
  color: var(--color-body);
}
.table td,
.table th {
    padding: 1rem 1rem;
}
.table :where(tr, td, th) {
  border-bottom: 1px solid var(--color-border);
}

/* Horizontal table showing a single submission */
.table-submission {
  border-top: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important;
}
.table-submission th {
  vertical-align: top;
  font-weight: 800;
}
.table-submission th>div {
  width: 20ch;
  color: var(--text-muted);
}
.table-submission td {
  width: 100%;
}

.tooltip-underline {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: default;
}

.tooltip {
  isolate: isolate;
  font-size: 12px;
}
.tooltip p {
  font-size: 0.75rem;
  line-height: 1rem;
}
.tooltip p:last-child {
  margin-bottom: 0 !important;
}
.tooltip a {
  --color-accent: white;
}

.pagination {
  --bs-pagination-active-border-color: var(--color-accent);
  --bs-pagination-active-bg: var(--color-accent);
  --bs-pagination-border-radius: var(--border-radius-common);
  --bs-pagination-border-color: var(--color-border);
  --bs-pagination-hover-border-color: var(--color-border);
}
.pagination a {
  text-decoration: none;
}

progress {
  accent-color: var(--color-accent);
}

input[type=file] {
  cursor: pointer;
}

.form-control,
.form-control-lg,
.form-select {
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius-common);
  border: 1px solid var(--color-heading);
}
.form-group {
  margin-bottom: 15px;
}
/* Use <fielset disabled>...</fieldset> wrapped around fields to stop them being selectable by
   the keyboard and mouse for e.g. when a form is submitting. */
fieldset[disabled] {
  opacity: 0.25;
}

input.form-control::file-selector-button {
  padding: 0.25rem 1rem !important;
  margin-left: -0.5rem !important;
  border: 2px solid var(--color-accent) !important;
  border-radius: var(--border-radius-common) !important;
  color: var(--color-accent) !important;
  background: transparent !important;
}
/* Crispy forms field error feedback */
.invalid-feedback {
  color: var(--bs-danger);
}
/* Fields generated by Crispy Forms */
form div[id^=div_id] {
  margin-bottom: 1.5rem !important;
}
.form-label {
  margin-bottom: 0.25rem;
}

.signup-wrapper {
  width: 100%;
  max-width: 500px;
  margin: auto;
}

.form-check-input {
  /* TODO: add input-border-color var instead? */
  border: 1px solid var(--color-heading);
  /* margin-top: 0.38rem; */
}
.form-check-input:checked {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline {
  --bs-btn-color: var(--color-accent);
  --bs-btn-hover-bg: transparent;
  --bs-btn-hover-border-color: var(--color-accent);
  --bs-btn-hover-color: var(--color-accent);
  --bs-btn-active-color: var(--color-accent);
  border: 2px solid;
}
.btn-link {
  padding: 0;
  vertical-align: baseline;
}
.btn {
  text-decoration: none !important;
  --bs-btn-padding-x: 1em;
}
.btn {
  --bs-btn-border-width: 2px;
  --bs-btn-font-size: 1rem;
}
.btn.btn-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 2.3rem;
}

.alert {
  background: white;
  font-size: 1rem;
  line-height: 1.5rem;
  border-radius: var(--border-radius-common);
  border: 2px solid var(--bs-alert-color);
  border-left: 6px solid var(--bs-alert-color);
  padding: 1em 1em 1em 3.5em;
  position: relative;
}
.alert,
.alert a {
  color: var(--bs-alert-color);
}
.alert-warning {
  --bs-alert-color: var(--bs-warning);
}
.alert-danger {
  --bs-alert-color: var(--bs-danger);
}
.alert-success {
  --bs-alert-color: var(--bs-success);
}
.alert-info {
  --bs-alert-color: var(--bs-info);
}
.alert:after {
  content: "";
  position: absolute;  
  left: 1em;
  top: 1em;
  width: 2.2em;
  height: 2.2em;

  --icon-size: 1.5em;
}
.alert:after {
  content: "";
  position: absolute;
  
  /* Custom colored SVGs using background-color with mask-image. See:
     https://codepen.io/noahblon/post/coloring-svgs-in-css-background-images;  */
  background-color: var(--bs-alert-color);
  -webkit-mask-image: var(--icon-svg);
  mask-image: var(--icon-svg);
  -webkit-mask-size: var(--icon-size) var(--icon-size);
  mask-size: var(--icon-size) var(--icon-size);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.alert-info:after {
  --icon-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2302469A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E");
}
.alert-success:after {
  --icon-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-check-circle-2'%3E%3Cpath d='M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z'%3E%3C/path%3E%3Cpath d='m9 12 2 2 4-4'%3E%3C/path%3E%3C/svg%3E");
}
.alert-warning:after {
  --icon-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-alert-triangle'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'%3E%3C/path%3E%3Cline x1='12' x2='12' y1='9' y2='13'%3E%3C/line%3E%3Cline x1='12' x2='12.01' y1='17' y2='17'%3E%3C/line%3E%3C/svg%3E");
}
.alert-danger:after {
  --icon-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");  
}
.alert ul {
  font-size: inherit;
  line-height: inherit;
  list-style: none;
  padding-left: 0;
}
.alert ul li + .alert ul li {
  margin-top: 1em;
}
.alert button {
  border: 0;
  background: none;
}
.messages-container .alert:last-of-type {
  margin-bottom: 2em !important;
}

.toast > div {
  padding: 1em;
  border-radius: var(--border-radius-common);
}
.toast-success,
.toast-info {
  background: var(--color-heading);
  color: white;
}
.toast-danger {
  background: var(--bs-danger);
  color: white;
}
.toast-warning {
  background: var(--color-warning);
  color: white;
}

.toc li {
  line-height: 1rem;
  font-size: 0.75rem;
}
.toc li > ul,
.toc li > ol {
  margin-top: 0.5rem;
}
.toc li + li {
  margin-top: 0.75em;
}
.toc ul {
  margin-left: 0.5em;
  padding-left: 0;
  list-style: none;
}
.toc > ul {
  margin-left: 0.25rem;
  list-style: none;
}
.toc a {
  display: inline-block;
}
.toc > ul:last-child,
.toc > ul > li:last-child {
  margin-bottom: 0;
}