:root {
  --system-ui: system-ui, Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #f8f8f8;
  font-family: var(--system-ui);
}

a {
  color: #004f9f;
  &:hover {
    color: #004f9f;
  }
}

select {
  color: #000000;
  &:hover {
    color: #ba2121;
  }
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

h1 {
  font-size: 2rem;
  font-weight: bold;
  @media screen and (min-width: 880px) {
    font-size: 3rem;  
  }
  
}

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

h5 {
  font-weight: bold;
  margin: 0 0 0.4rem 0;
  font-size: 1.2rem;
}

h6 {
  font-size: 1rem;
  font-weight: bold;
  margin: 0 0 0.4rem 0;
}

.notes {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  margin: 0;
  padding: 20px;
  color: #333;
  display: flex;
  gap: 64px;
  position: relative;
  
  & .notes-nav {
    width: 30%;
    
    & .nav-jump-links {
      display: block;
      font-size: 0.9rem;
      padding: 4px 0;
      margin-top: 2px;
    }
    
    & .nav-section {
      display: block;
      color: rgba(0,0,0,0.4);
      margin-top: 1.5rem;
      font-size: 0.8rem;
    }
  }
  
  & .notes-body {
    padding: 24px 0;
  }
  
  & .notes-section {
    display: flex;
    gap: 64px;
    border-top: 1px solid rgba(0,0,0,0.2);
    padding-top: 32px;
    margin-bottom: 2rem;
    position: relative;
  }
  
  & h5:after {
    content: ".";
    background: #333;
    width: 160px;
    height: 2px;
    color: transparent;
    position: absolute;
    top: 0;
    left: 0;
  }
  
  & .notes-note {
    width: 50%;
  }
  
  & .notes-details {
    width: 50%;
  }
  
  & h2 {
    margin-top: 16px;
  }
  
  & h3 {
    text-transform: uppercase;
    font-size: 0.92rem;
    font-weight: bold;
    margin: 0;
  }
  
  & h6 {
    color: teal;
  }
  
  & p {
    margin-bottom: 1rem;
  }
  
  & i {
      font-size: 1rem;
      background: white;
      padding: 0 4px;
      font-family: monospace;
      border-radius: 4px;
      color: darkgoldenrod;
      font-style: normal;
      white-space: nowrap;
  }
  
  & blockquote {
    background: #283336;
    border-top: 2px solid rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    border-radius: 5px;
    color: rgba(255,255,255,0.6);;
    
    & code {
      font-size: 0.8rem;
      background: rgba(255,255,255,0.2);
      color: #fff;
    }
    
    & i {
      font-size: 0.8rem;
      background: rgba(255,255,255,0.2);
      color: aquamarine;
    }
    
    & h6 {
      font-size: 0.6rem;
      text-transform: uppercase;
      letter-spacing: 0.1rem;
      color: gold;
    }
  }
}

code {
  font-size: 1rem;
  background: white;
  padding: 0 4px;
  border-radius: 4px;
  color: cadetblue;
  white-space: nowrap;
}

hr {
  margin: 3rem 0;
  border-color: rgba(0,0,0,0.2);
}

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1600px;
  margin: auto;
  padding: 0 24px 16px;

  .columns-2,
  .columns-3 {
    display: grid;
    grid-gap: 24px;
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
}

@media screen and (min-width: 880px) {
  main {
    .columns-2,
    .columns-3 {
      flex: 0 0 50%;
      grid-template-columns: 1fr 1fr;
    }
  }
}

@media screen and (min-width: 1200px) {
  main {
    .columns-3 {
      flex: 0 0 50%;
      grid-template-columns: 1fr 1fr 1fr;
    }
  }
}

.col-span-2 {
  grid-column: span 1;
  @media screen and (min-width: 1200px) {
    grid-column: span 2;
  }
}

.banner {
  background: #eb002b43;
  width: 100%;
  font-size: 0.85em;

  .banner-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 1600px;
    margin: auto;
    padding: 16px 22px;
    position: relative;
    font-weight: 600;
  }

  & .section {
    display: flex;
    gap: 16px;
  }

  .navigation-title-image {
    margin: -2px 8px 0 8px;
    display: inline-block;
  }

  & .link-list {
    display: flex;
    gap: 16px;
  }

  .external-link {
    &::after {
      content: ' ↗';
    }
  }
  
  & a {
    color: #fff;
    display: inline-block;
    padding: 4px 2px;
  }
  
  & span {
    display: inline-block;
    padding: 4px 2px;
  }
}

.link-dashboards {
  font-size: 0.8rem;
  padding: 12px 0;
  margin: 0 0 2rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  
  & div {
    margin: 0 auto;
    padding: 0 12px;
    max-width: 1600px;
  }
  & a {
    color: #333;
    padding: 12px;
    margin-right: 8px;
  }
  & a:hover {
    text-decoration: none;
  }
  & a.active {
    border-bottom: 3px solid #333;
  }
}

.navigation {
  font-size: 0.9em;
  color: rgba(0, 0, 0, 0.5);

  & form, ul {
    display: block;
    width: 100%;
    max-width: 1600px;
    margin: auto;
    position: relative;
  }

  & select {
    padding: 4px 32px 4px 8px;
    margin: 0 2px;
    background-color: #d9e3ff;
    border-radius: 4px;
    /** for the dropdown indicator */
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='Gray' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 0.9em;
    
    @media screen and (max-width: 880px) {
      width: 100%;
    }

    &.active {
      background-color: #fff;
      background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='Blue' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
      color: #0035bc;
      font-weight: bold;
    }
  }
}

.date-updated {
  width: 100%;
  margin-top: 6px;
  font-size: 0.9em;
}

@media screen and (min-width: 880px) {
  .date-updated {
    text-align: right;
    margin-top: -3em;
    padding-bottom: 1.5rem;
  }
}

.divider {
  margin: 24px 0;
  height: 12px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 16px 20px 20px;

  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  
  &&.blank {
    background: rgba(0,0,0,0.05);
    border: none;
  }

  .chart {
    height: 260px;
    margin: -8px;
  }

  & h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-right: 24px;
  }

  & h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 18px;
  }

  .figures {
    margin: 12px 0;

    & .large-num {
      font-size: 2rem;
      font-weight: 700;
    }

    & .detail p {
      font-size: 0.9rem;
    }
  }

  .info {
    display: flex;
    position: absolute;
    top: 16px;
    right: 16px;
    justify-content: center;
    align-items: center;
    background: #999;
    width: 18px;
    height: 18px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 100px;
    cursor: pointer;
    text-align: left;
    &::before {
      content: "?";
    }

    .info-hover-text {
      display: none;
      flex-direction: column;
      gap: 6px;
      position: absolute;
      right: 32px;
      background: #222;
      width: 200px;
      font-size: 0.75rem;
      font-weight: 400;
      padding: 8px 10px;
      border-radius: 6px;
      color: #eee;
      opacity: 0;
      animation: fadeIn 190ms;

      /* triangle */
      &:after {
        content: "";
        position: absolute;
        top: 50%;
        right: -6px;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 6px solid #222;
      }

      > p > span {
        font-weight: 800;
        color: #fff;
      }
    }

    &:hover {
      .info-hover-text {
        display: flex;
        opacity: 1;
      }
    }
  }
}

@media screen and (max-width: 880px) {
  .table-wrap {
    overflow-y: scroll;
    margin-right: -20px;
  }
}

.table-scroll-message {
  text-align: right;
  margin: 24px 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
}

table {
  width: 100%;
  /* width: calc(100% - 20px); */
  margin: 36px 0 18px 0;
  font-size: 0.9rem;

  & tr {
    border-bottom: 1px solid rgb(224, 224, 224);
  }

  & tbody {
    & .totals {
      background: #fff8d7;
    }
    & tr {
      &:hover:not(.totals) {
        background: #f8f8f8;
      }
      &:last-child {
        border-bottom: none;
      }
    }
  }

  & th,
  & td {
    text-align: left;
    font-weight: 400;
    padding: 6px 12px;
    border-right: 1px solid rgb(224, 224, 224);
    white-space: nowrap;
    &:last-child {
      border-right: none;
    }
  }

  & th {
    font-weight: 700;
  }

  & .head-bg {
    background: #eee;
  }

  & .number {
    text-align: right;
  }

  &.relaxed {
    & th,
    & td {
      padding: 12px 0px;
      font-size: 1rem;
      font-weight: 600;
    }
    & .secondary {
      color: #717171;
      padding-left: 12px;
      border-top: 1px solid #eee;
    }
  }
}

.cohort {
  margin: 24px 0;
  display: flex;
  flex-direction: row wrap;
  gap: 24px;
}

.cohort-quarter {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  width: 120px;
}
.cohort-detail {
  font-size: 0.9rem;

  & b {
    display: block;
    white-space: nowrap;
  }

  & .text-grey {
    margin-top: 1em;
    font-size: 0.85em;
  }
}

.cohort-bar {
  display: flex;
  overflow: hidden;
  gap: 2px;
  color: #fff;
  font-weight: 700;
  flex-direction: column;
  height: 340px;
  border-radius: 4px;
  margin: 0 0 8px 0;
  & .segment {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5em;
    font-size: 0.9em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}
.key {
  gap: 16px;
  margin-top: 12px;
  
  @media screen and (min-width: 880px) {
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }
  
  & div {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  &.key-per-row {
    flex-direction: column;
    align-items: start;
    gap: 4px;
  }
}

.key-color-box {
  display: inline-flex;
  width: 18px;
  height: 18px;
  content: "";
  border-radius: 2px;
  justify-content: center;
  align-items: center;
  position: relative;
  top: -1px;
  text-align: center;
  line-height: 16px;
}

.key-text {
  font-size: 0.92em;
  
  @media screen and (min-width: 880px) {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.warning {
  color: #ff3355;
  background: rgba(255, 51, 85, 0.1);
  border: 1px solid rgba(255, 51, 85, 0.3);
  border-right: 1px solid rgb(224, 224, 224);
  border-left-width: 0px;
  &::before {
    content: "⚠️ ";
    color: #ff3355;
  }

  &.warning-key {
    border-width: 1px;
  }
}

.expiry {
  background: #ffffe8;
  color: #c89900;
  border: 1px solid rgba(255, 221, 51, 0.75);
  border-right: 1px solid rgb(224, 224, 224);
  border-left-width: 0;
  /* display: flex; */
  gap: 8px;
  justify-content: space-between;
  content: "Risk of expiring meds";
  &.expiry-key {
    color: #d7ba27;
    border-width: 1px;
  }
}

.expiry-text {
  display: flex;
  justify-content: space-between;
  &::before {
    content: "Risk of expiring meds";
  }
}

.facility-list {
  & li {
    padding: 6px 0 0 0;
  }
}

.text-center th {
  text-align: center;
}

.text-right {
  text-align: right;
}

.coverage {
  background: rgb(241, 241, 241);
  box-shadow: inset 0 1px 3px -1px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  margin: 10px 0 4px;
  height: 36px;
  overflow: hidden;
}

.coverage-fill {
  position: relative;
  display: block;
  background: #363636;
  height: 100%;
  content: "";
}

.coverage-fill-indicator {
  bottom: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
}

.coverage-fill-indicator-line {
  height: 34px;
  width: 2px;
  background: #b51bdc;
  content: "";
}

.coverage-fill-indicator-percentage {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 6px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  /* background: rgb(239, 239, 239); */
  border-radius: 4px;
  padding: 1px 4px;
}

/* 
  Used to move the % figure inside the color block when the % is > 88% 
  Without this the % figure will be hidden by the overflow setting 
*/
.coverage-fill-indicator-percentage[data-percentage="87"],
.coverage-fill-indicator-percentage[data-percentage="88"],
.coverage-fill-indicator-percentage[data-percentage="89"],
.coverage-fill-indicator-percentage[data-percentage="90"],
.coverage-fill-indicator-percentage[data-percentage="91"],
.coverage-fill-indicator-percentage[data-percentage="92"],
.coverage-fill-indicator-percentage[data-percentage="93"],
.coverage-fill-indicator-percentage[data-percentage="94"],
.coverage-fill-indicator-percentage[data-percentage="95"],
.coverage-fill-indicator-percentage[data-percentage="96"],
.coverage-fill-indicator-percentage[data-percentage="97"],
.coverage-fill-indicator-percentage[data-percentage="98"],
.coverage-fill-indicator-percentage[data-percentage="99"],
.coverage-fill-indicator-percentage[data-percentage="100"] {
  right: 0;
  left: initial;
  margin-left: 0;
  margin-right: 6px;
  color: #fff;
}

.coverage-detail {
  text-align: right;
  font-size: 0.85rem;
  margin: 0;
}

.data-line {
  display: flex;
  justify-content: space-between;
  margin: 0 0 36px 0;
}

/* animations */
.fade-in {
  animation: fadeIn 5s;
}
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.facilities-without-bp-monitor {
  font-size: 0.9rem;
}

/* Text */

.bold {
  font-weight: 700;
}

.text-grey {
  color: #888;
}

.bp-controlled {
  color: #3bb231;
}
.bp-controlled-bg {
  background: #3bb231;
}

.bp-uncontrolled {
  color: #eeab00;
}
.bp-uncontrolled-bg {
  /* background: #f6b100; */
  background: #eeab00;
}
.bp-uncontrolled-dark {
  color: #C08B00;
}

.bp-uncontrolled-dark-bg {
  background: #C08B00;
}

.three-month-ltfu {
  color: #ed6300;
}
.three-month-ltfu-bg {
  background: #ed6300;
}

.twelve-month-ltfu {
  color: #ff3355;
}
.twelve-month-ltfu-bg {
  background: #ff3355;
}

.under-care {
  color: #b51bdc;
}
.under-care-bg {
  background: #b51bdc;
}

.registrations {
  color: #007ee4;
}
.registrations-bg {
  background: #007ee4;
}

.step-one-drugs {
  background: #222;
}
.step-two-drugs {
  background: #d8db56;
}
.step-three-drugs {
  background: #18d6a8;
}

/* Display options */
.desktop-only {
  @media screen and (max-width: 880px) {
    display: none;
  }
}

.mobile-only {
  @media screen and (min-width: 880px) {
    display: none;
  }
}

/* Table sort */

th[role="columnheader"] div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

th[role="columnheader"] div:not(.no-sort) {
  cursor: pointer;
  /* white-space: nowrap; */
}

th[role="columnheader"] div:not(.no-sort):after {
  content: "";
  /* float: right; */
  margin-top: 9px;
  border-bottom: none;
  border-width: 4px 4px 0;
  border-color: #404040 transparent;
  opacity: 0.25;
  -ms-user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

th.text-right[role="columnheader"] div {
  flex-direction: row-reverse;
}

th.text-right[role="columnheader"] div:not(.no-sort):after {
  /* float: left; */
}

th[aria-sort="ascending"] div:not(.no-sort):after {
  border-width: 0 4px 4px;
  border-style: solid;
  border-color: #0035bc transparent;
  opacity: 1;
  margin-bottom: 8px;
}

th[aria-sort="descending"] div:not(.no-sort):after {
  border-bottom: none;
  border-width: 4px 4px 0;
  border-color: transparent #0035bc;
  opacity: 1;
}

th[aria-sort]:not(.no-sort) div:after {
  visibility: visible;
  opacity: 0.8;
  border-color: #0035bc transparent;
  margin-top: 9px;
}

th[aria-sort]:not(.no-sort) {
  background: #d9e3ff;
  color: #0035bc;
  outline: 1px solid #4b7eff;
  outline-offset: -1px;
}

th[role="columnheader"] div:not(.no-sort):hover:after {
  visibility: visible;
  opacity: 1;
}
