.facesheet-instance-generator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;

  .current-state-footer-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 24px 48px;
    border-top: 1px solid var(--color-border-secondary);
    width: 100%;
  }

  .current-state-container {
    display: flex;
    gap: 12px;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    height: 100%;
    width: 100%;

    .current-state-title {
      display: flex;
      flex-direction: column;
      gap: 32px;
      justify-content: flex-start;
      width: 100%;
      font-weight: var(--weight-bold);
      margin-top: 32px;
      font-size: 24px;
    }

    .current-state-content {
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;
      gap: 32px;
      overflow-y: auto;
      max-width: 1240px;

      /* Hide scrollbar */
      scrollbar-width: none; /* Firefox */
      -ms-overflow-style: none; /* IE and Edge */

      &::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
      }

      .info-box-container {
        margin-top: 128px;
      }
    }

    .templates-selection-container {
      display: grid;
      grid-template-columns: 1fr 1fr;
      grid-gap: 24px;

      .templates-selection-box {
        border: 1px solid var(--color-border-secondary);
        border-radius: 12px;
        background-color: var(--color-base-white);
        padding: 24px;
        min-width: 0;
      }

      .templates-selection-box-header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        gap: 16px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--color-border-secondary);

        .templates-selection-box-title-container {
          display: flex;
          flex-direction: column;
          gap: 8px;
          min-width: 0;

          .templates-selection-box-title {
            font-weight: var(--weight-semi-bold);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }

          .templates-selection-box-subtitle {
            font-size: var(--font-size-sm);
            color: var(--color-text-secondary);
            font-weight: var(--weight-light);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }

          .templates-selection-sections-count {
            font-size: var(--font-size-xs);
            color: var(--color-text-secondary);
            font-weight: var(--weight-light);
          }
        }
      }

      .templates-selection-box-sections {
        padding-top: 16px;
        padding-bottom: 16px;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        color: var(--color-text-quaternary);
        font-size: 12px;
      }

      .templates-selection-box-footer {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-top: 16px;
      }
    }

    .sections-builder-container {
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;

      .category-accordion-header {
        color: var(--color-text-secondary);
        font-size: 14px;
        padding-top: 16px;
        padding-bottom: 16px;
      }

      .no-sections-selected-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 2;
        padding: 32px;

        .no-sections-selected-footer {
          display: flex;
          gap: 12px;
          margin-top: 32px;
          width: 100%;
        }
      }

      .sections-builder-header {
        padding: 30px;
        font-weight: 600;
        border-bottom: 1px solid var(--color-border-secondary);
        background-color: var(--color-base-white);
      }

      .sections-builder-body {
        display: flex;
        flex-direction: row;
        min-height: 0;
        height: 100%;

        .section-list-container {
          flex: 1;
          overflow: auto;

          /* Hide scrollbar */
          scrollbar-width: none; /* Firefox */
          -ms-overflow-style: none; /* IE and Edge */

          &::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Opera */
          }
        }

        .sections-list {
          display: flex;
          flex-direction: column;
          overflow-y: auto;
          flex: 1;
          padding: 32px;
          border-right: 1px solid var(--color-border-secondary);

          &.selected {
            flex: 2;
            background-color: var(--color-base-white);
            gap: 16px;
          }

          .section-header {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            margin-bottom: 24px;

            .section-title {
              font-weight: var(--weight-bold);
              font-size: 14px;
            }

            .section-header-actions {
              .sections-search-input {
                width: 100px;
                height: 22px;

                &:focus {
                  width: 100%;
                  height: auto;
                }
              }
            }
          }

          .section-box {
            display: flex;
            flex-direction: row;
            gap: 12px;
            padding: 24px;
            border: 1px solid var(--color-border-primary);
            border-radius: 12px;
            background-color: var(--color-base-white);
            margin-bottom: 12px;

            .section-box-description {
              display: flex;
              flex-direction: column;
              gap: 12px;
              flex: 1;

              .section-box-title {

              }

              .section-box-subtitle {
                color: var(--color-text-secondary);
                font-size: 12px;
              }
            }

            .section-box-action {
              display: flex;
              align-items: center;
              justify-content: center;
              gap: 12px;

              &.draggable {
                cursor: grab;
              }
            }
          }

          .section-footer {
            display: flex;
            justify-content: space-between;
            justify-self: flex-end;
          }
        }
      }
    }

    .section-results-container {
      display: flex;
      flex-direction: column;
      gap: 24px;
      border-radius: 8px;
      border: 1px solid var(--color-border-secondary);
      padding: 24px;
      background-color: var(--color-bg-primary);

      .section-results-header {
        .section-results-header-left {
          display: flex;
          flex-direction: column;
          gap: 8px;

          .section-results-header-title {
            font-size: var(--font-size-lg);
            line-height: var(--line-height-text-md);
            font-weight: var(--weight-semi-bold);
          }

          .section-results-header-subtitle {
            font-size: var(--font-size-sm);
            line-height: var(--line-height-text-sm);
            font-weight: var(--weight-light);
            color: var(--color-text-quaternary);
          }
        }
      }

      .section-result-box {
        display: flex;
        flex-direction: column;
        border-radius: 8px;
        border: 1px solid var(--color-border-secondary);
        background: var(--color-bg-primary);
        padding-top: 24px;

        .section-result-box-drag-container {
          display: flex;
          justify-content: center;
          align-items: center;

          &.draggable {
            cursor: grab;
          }
        }

        .section-result-box-row {
          display: flex;
          gap: 24px;
          padding-left: 24px;
          padding-right: 24px;
        }

        .section-result-box-main-container {
          flex: 1;
          display: flex;
          flex-direction: column;
          gap: 16px;
          overflow: auto;
          max-height: 500px;
          padding-bottom: 24px;

          .section-result-box-header {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .section-result-box-header-title {
              font-size: var(--font-size-xs);
              line-height: var(--line-height-text-xs);
              font-weight: var(--weight-semi-bold);
            }

            .section-result-box-header-actions {
              align-items: center;
              display: flex;
              gap: 4px;

              i {
                color: var(--color-fg-quaternary);
                font-size: var(--font-size-sm);

                &:hover {
                  color: var(--color-fg-secondary);
                }
              }
            }
          }

          .section-result-box-items {
            display: flex;
            row-gap: 24px;
            flex-wrap: wrap;

            .section-result-box-item {
              display: flex;
              flex-direction: column;
              gap: 12px;
              width: 150px;
              border-right: 1px solid var(--color-border-secondary);
              padding-left: 18px;
              padding-right: 18px;

              &:last-child {
                border-left: none;
              }

              .section-result-box-item-name {
                font-size: var(--font-size-xs);
                line-height: var(--line-height-text-xs);
                font-weight: var(--weight-regular);
                color: var(--color-text-secondary);
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              }

              .section-result-box-item-value {
                font-size: var(--font-size-sm);
                line-height: var(--line-height-text-sm);
                font-weight: var(--weight-regular);
                color: var(--color-text-secondary);
              }
            }
          }

          .section-result-box-note-title {
            font-size: var(--font-size-sm);
            line-height: var(--line-height-text-sm);
            font-weight: var(--weight-semi-bold);
            color: var(--color-text-secondary);
          }

          .section-result-box-note {
            font-size: var(--font-size-sm);
            line-height: var(--line-height-text-sm);
            font-weight: var(--weight-regular);
            color: var(--color-text-secondary);
          }

          .readmission-risk-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
          }
        }

        .section-result-box-citations-label {
          display: flex;
          gap: 8px;
          font-size: var(--font-size-xs);
          line-height: var(--line-height-text-xs);
          color: var(--color-text-quaternary);
          margin-bottom: 24px;
        }

        .section-result-box-citations-container {
          display: none;
          flex-direction: column;
          max-height: 300px;
          width: 100%;
          background-color: var(--color-bg-secondary);
          padding: 24px;
          gap: 12px;

          .section-result-box-citations-header {
            display: flex;
            justify-content: space-between;

            .section-result-box-citations-title {
              font-weight: var(--weight-semi-bold);
              font-size: var(--font-size-xs);
              line-height: var(--line-height-text-xs);
            }
          }

          .section-result-box-citations-rows-container {
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;

            .section-result-box-citations-row {
              display: flex;
              flex-direction: column;
              gap: 4px;

              .section-result-box-citations-row-quote {
                font-size: var(--font-size-xs);
                line-height: var(--line-height-text-xs);
                color: var(--color-text-quaternary);
                font-style: italic;
              }

              .section-result-box-citations-row-label {
                font-size: var(--font-size-xs);
                line-height: var(--line-height-text-xs);

                .section-result-box-citations-row-label-bold {
                  font-weight: var(--weight-semi-bold);
                }
              }
            }
          }
        }
      }
    }
  }
}

.facesheet-instance-card-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 24px;
  width: 100%;

  .facesheet-instance-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background-color: var(--color-base-white);
    border: 1px solid var(--color-border-secondary);
    border-radius: 12px;
    min-width: 0;

    .facesheet-instance-card-header {
      display: flex;
      justify-content: space-between;

      .facesheet-instance-card-title {
        font-weight: var(--weight-semi-bold);
        font-size: var(--font-size-md);
        line-height: var(--line-height-text-md);
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      .facesheet-instance-card-actions {
        align-items: center;
        display: flex;
        gap: 4px;

        i {
          color: var(--color-fg-quaternary);
          font-size: var(--font-size-sm);

          &:hover {
            color: var(--color-fg-secondary);
          }
        }
      }
    }

    .facesheet-instance-card-items {
      display: flex;
      gap: 12px;

      .facesheet-instance-card-item {
        display: flex;
        flex-direction: column;
        gap: 4px;

        .facesheet-instance-card-item-name {
          font-size: var(--font-size-xs);
          line-height: var(--line-height-text-xs);
          font-weight: var(--weight-regular);
          color: var(--color-text-secondary);
        }

        .facesheet-instance-card-item-value {
          font-size: var(--font-size-sm);
          line-height: var(--line-height-text-sm);
          font-weight: var(--weight-regular);
          color: var(--color-text-secondary);
        }
      }
    }
  }
}
