@use "../../../ui/styles/variables" as *;
@use "uswds-core" as *;

// Shared styles
.mainContainer {
  display: flex;
  flex-direction: column;
  flex: auto;
  margin-bottom: 0 !important;
  max-width: 70rem !important;
}
input.errorMessage {
  border: 2px solid color("error-dark");
}
.errorMessage {
  display: flex;
  align-items: center;
  color: color("error-dark");
  margin-top: 0.25rem;
  line-height: 1.25rem;

  svg {
    margin-right: 0.25rem;
    margin-bottom: 2.5px;
  }
}
// Condition styles

.templateContainer {
  padding: 3.5rem 5rem;
  border-radius: 4px;
  min-height: 30rem;
  min-width: 100%;
}

.startFromScratchLink {
  font-weight: 700;
  text-decoration: none;

  &:active,
  &:visited {
    color: $accent-primary;
  }
}

.conditionSelectionForm {
  background-color: white;
  padding: 2rem;
  min-height: 25rem;
}

.querySelectionFormSearch {
  border: 1px solid $border;
  border-radius: 4px;
  height: 1.5rem;
  padding: 0.75rem;
  min-width: 53rem;
}

#templateSearch:first-child {
  flex: 1;
}

.categoryHeading {
  text-transform: uppercase;
  color: $text-secondary;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1rem;
  margin-top: 0;
}

.displayCol:first-of-type {
  border-right: 1px solid $border-light;
}

.displayCol:nth-of-type(2) {
  padding-left: 2rem;
}
.categoryOption {
  margin: 2rem 0;
}
.categoryOption:last-of-type {
  margin-bottom: 3rem;
}

.bluePill {
  background-color: $brand-lighter;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}

// Value Set and Concept styles

.valueSetTemplateContainer {
  padding: 0.5rem 0.5rem 0 0.5rem;
  border-radius: 0.5rem;
  display: flex;
  flex: auto;
}

.valueSetTemplateContainer__inner {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

.customQuery__name {
  .inputLabel {
    line-height: 1.375rem !important;
    margin-top: 0 !important;
  }

  .input {
    width: 20.75rem;
    height: 2.875rem;
  }
}

.queryBuildingButton {
  line-height: 28px;
  height: 3.75rem;
  font-size: 1.25rem;
  padding: 1rem 1.5rem;
}

.valueSetSearch {
  width: 25rem !important;
  padding: 0.75rem 0.75rem 0.75rem 2.25rem !important;
  margin: 0 !important;
  height: 3rem !important;
}

.valueSetTemplate__left {
  display: flex;
  flex-direction: row;
  width: 18rem;
  min-width: 25%;
  justify-content: space-between;
  padding: 1rem 0 0 0.5rem !important;
}

.valueSetTemplate__right {
  background-color: white;
  width: 50rem;
  min-width: 70%;
  border-radius: 8px;
  margin-left: 0.5rem;
  min-height: 50rem;

  .codeLibrary__empty {
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
    gap: 1.5rem;
  }

  .icon {
    height: 10rem;
    width: 10rem;
    color: $background-darkest;
  }

  .codeLibrary__emptyText {
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0;
  }

  .codeLibrary__button {
    width: 16.75rem;
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    line-height: 26px;
  }
}

.valueSetTemplate__search {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.accordionContainer {
  width: 100%;
  margin-top: 0;
}

.accordionInnerWrapper > fieldset {
  padding: 0;
  margin: 0;
  overflow: visible;
  border: none;
}

.accordionInnerWrapper > fieldset > legend {
  width: 100%;
}

.accordionInnerWrapper > fieldset:last-of-type {
  border-bottom: 1px solid $border;
}

.accordionHeaderContent {
  background-color: transparent;
  justify-content: space-between;
  align-items: center;
  display: flex;
  width: 100%;
}

.accordionLabel {
  text-transform: capitalize;
  display: flex;
  align-items: center;
}

.accordionHeaderCount {
  font-size: 1rem !important;
  font-weight: 400 !important;
  background-color: inherit;
}

.accordionBodyWrapper {
  background-color: transparent;
}

.accordionInnerWrapper > div {
  margin-top: 0 !important;
}

.accordionInnerWrapper > fieldset > legend {
  border-top: 1px solid #dfe1e2;
}

.accordionInnerWrapper > legend > button {
  display: flex;
  word-wrap: break-word;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  background-color: $background-dark;
  padding: 1rem 1.5rem;
  border-bottom: 1px $border solid;
  color: black;

  // override default accordion hover styles (headers should not change on hover):
  &:hover {
    background-color: $background-dark !important;

    .accordionHeaderCount {
      color: black;
    }
  }
}

.accordionWrapper > div {
  margin: 0.1rem 0rem;
  padding: 1rem 1.5rem;
}

.sideBarMenu {
  width: 100%;

  &__content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: 0.5rem;

    .section_templates,
    .section_custom {
      gap: 1rem;
      display: flex;
      flex-direction: column;
    }
    .sectionTitle {
      width: 100%;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      color: $text-secondary;
      font-size: 1rem;
      line-height: 1.2;
    }

    .addCondition {
      font-size: 1rem;
      color: $brand-dark;
      line-height: 18.8px;
      font-weight: 700;
      display: flex;
      align-items: center;

      :hover {
        cursor: pointer;
      }
    }
  }

  .deleteIcon {
    &:hover {
      cursor: pointer;
    }
  }
  .deleteIconContainer {
    color: color("error");
    width: 32px;
    height: 32px;
    display: none;
  }

  .card {
    background: transparent;
    border-radius: 4px;
    padding: 1rem;
    line-height: 22px;
    color: black;
    cursor: pointer;
    position: relative;

    &:focus-within .deleteIconContainer,
    &:hover .deleteIconContainer {
      display: inline-block;
      position: absolute;
      right: 3%;
      top: 20%;
      height: fit-content;
      width: fit-content;
      background-color: inherit;
    }
  }

  .active {
    background: white;
  }
}

.medicalRecordSectionRow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 1rem;
}

.medicalRecordSectionRow label {
  font-weight: 700;
}

.valueSetTemplate__titleCheckbox {
  text-transform: capitalize;
  background-color: $background-dark;
}

.valueSetTemplate__toggleRowHeader {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
}

.valueSetTemplate__toggleRowHeader > svg {
  color: black;
}

.accordionBodyExpanded {
  padding: 1.5rem 1.5rem 0 3rem;
  background-color: white;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.checkboxInfoContainer:focus {
  outline: none;
  label::before {
    outline: 0.25rem solid $focus-outline;
    outline-offset: 0.25rem;
    border-radius: 0.05rem;
  }
}

.viewCodesBtn {
  // toggle to block on hover
  display: none;
  min-width: 8rem;
  height: 2rem;
  font-size: 14px;
  padding: 0.5rem 1.25rem;
}

.accordionBodyExpanded {
  &:hover,
  &:focus,
  &:focus-within {
    .viewCodesBtn {
      display: block;
    }

    .displayCount {
      display: none;
    }
  }

  &:hover {
    .valueSetTemplate__checkbox {
      background-color: unset;
    }

    .viewCodesBtn {
      &:hover {
        cursor: pointer;
      }
    }
  }
}

.accordionExpandedInner {
  border-bottom: none !important;

  &:last-of-type {
    border-bottom: 1px $border solid;
  }
}

.accordionExpandedInner {
  padding-bottom: 1rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.expandedContent {
  font-size: 1rem;
  font-weight: 400;
}

.expandedContent > div {
  text-transform: none !important;
  padding-right: 1rem;
}

.vsName {
  color: black;
  max-width: 40rem;
}

.vsDetails {
  color: $text-secondary;
  display: flex;
  padding-left: 1.75rem;
}

.accordionBodyExpanded__right {
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  min-width: 20%;
  justify-content: flex-end;
  width: fit-content;
}

.customQuery__header > h1 {
  line-height: 2.5rem !important;
}

.customQuery__controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.conceptSelectionTable {
  display: grid;
}

$conditionColumnSpacing: 1.25rem 2fr 5fr;
$columnGap: 1rem;
.conceptSelectionRow {
  text-align: left;
  display: grid;
  grid-template-columns: $conditionColumnSpacing;
  column-gap: $columnGap;
  margin-top: 1.5rem;
  align-items: center;
}

.conceptCode {
  word-break: break-all;
}

.conditionDrawerHeader {
  color: $text-secondary;
  font-size: 1rem;
  font-style: normal;
  font-weight: 700;
  line-height: normal;
  text-transform: uppercase;

  display: flex;
  padding-top: 2rem;
  padding-bottom: 0.75rem;
  justify-content: left;
  align-items: center;
  gap: 0.625rem;
  align-self: stretch;
}

.conditionItem {
  display: flex;
  padding: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  align-self: stretch;
  border-radius: 0.25rem;
  width: 100%;

  &:hover,
  &:focus-within {
    background: white;
  }
  &:hover .addButton,
  &:focus-within .addButton {
    display: inline-block;
  }

  &:hover .addedStatus,
  &:focus-within .addedStatus {
    display: inline-block;
  }
}

.addedStatus,
.addButton {
  font-size: 1rem;
  font-style: normal;
  line-height: 1.375rem;
  display: none;
}

.addButton {
  color: $accent-primary;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
}

.selectAll {
  color: #2e6276;
  font-weight: 700;
  text-decoration: none;
  margin-right: 1rem;

  &:hover {
    text-decoration: none;
  }
}

.bulkActionButtons {
  padding: 1rem 3rem 0.5rem 3rem !important;
  max-width: fit-content;
}

.accordionBulkAction {
  display: flex;
  justify-content: space-between;
  padding-right: 1.5rem;

  // narrower width if the placeholder "All Dates" is shown
  input:placeholder-shown {
    width: 7.5rem;
  }
}
