@use '@carbon/colors';
@use '@carbon/layout';
@use '@carbon/type';
@use '@openmrs/esm-styleguide/src/vars' as *;

.defaultQueueTable {
  margin: layout.$spacing-05;
}

.container {
  border: 1px solid colors.$gray-20;
}

.tableSection {
  background: colors.$gray-10;
  padding-bottom: layout.$spacing-05;
}

.headerContainer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: layout.$spacing-05;
  background-color: colors.$gray-10;
}

.headerButtons {
  display: flex;

  .filterSearch {
    margin-left: layout.$spacing-05;
  }
}

.loaderContainer {
  display: flex;
  flex: 0.25;
  justify-content: center;
  align-items: center;
  background-color: $ui-02;

  :global(.cds--inline-loading) {
    justify-content: end;
  }
}

.filterContainer {
  :global(.cds--dropdown__wrapper--inline) {
    gap: 0;
  }

  :global(.cds--list-box__menu-icon) {
    height: layout.$spacing-05;
  }
}

.search {
  max-width: 16rem;
  display: inline;

  input {
    background-color: $ui-02 !important;
  }
}

.statusTableContainer {
  padding: layout.$spacing-05;
  background-color: colors.$gray-10;
}

.statusTableHeader {
  padding: layout.$spacing-03 0;
}

.tableHeader {
  padding: layout.$spacing-03 0;
}

.tableContainer {
  background-color: colors.$gray-10;
  // margin: 0 layout.$spacing-05;
  padding: 0 1rem;

  a {
    text-decoration: none;
  }

  th {
    color: $text-02;
  }

  :global(.cds--data-table) {
    background-color: $ui-03;
  }

  .toolbarContainer {
    display: flex;
    justify-content: space-between;
  }

  .toolbarContent {
    display: flex;
    align-items: center;
    z-index: 1; // prevent dropdown from getting covered by table elements
    column-gap: layout.$spacing-03;
  }

  :global(.cds--table-toolbar) {
    flex: 3;
    position: static;
    overflow: visible;
  }
}

.desktopHeading {
  h2 {
    @include type.type-style('heading-compact-02');
    color: $text-02;
  }
}

.tabletHeading {
  h2 {
    @include type.type-style('heading-03');
    color: $text-02;
  }
}

.desktopHeading,
.tabletHeading {
  text-align: left;
  text-transform: capitalize;
  margin-bottom: layout.$spacing-05;

  h2:after {
    content: '';
    display: block;
    width: layout.$spacing-07;
    padding-top: 3px;
    border-bottom: 0.375rem solid var(--brand-03);
  }
}

.expandedActiveVisitRow {
  td {
    padding: layout.$spacing-03;

    > div {
      max-height: max-content !important;
      background-color: $ui-02;
    }
  }

  th[colspan] td[colspan] > div:first-child {
    padding: 0 layout.$spacing-05;
  }
}

// Overriding styles for RTL support
html[dir='rtl'] {
  .headerContainer {
    svg {
      margin-left: 0;
      margin-right: layout.$spacing-03;
    }

    h2 {
      text-align: right;
    }
  }

  .tableContainer {
    th > div {
      text-align: right;
    }

    td {
      text-align: right;

      .serviceColor {
        margin-right: 0;
        margin-left: layout.$spacing-03;
      }

      button {
        padding: layout.$spacing-03 0 layout.$spacing-03 layout.$spacing-05;
        text-align: right;
      }
    }
  }
}

.tabList {
  padding-left: layout.$spacing-05;
}

.tileContainer {
  border-top: 1px solid $ui-03;
  padding: layout.$spacing-07 layout.$spacing-05;
  background: $ui-02;
  margin: 0 layout.$spacing-05;
}

.tile {
  background-color: colors.$gray-10;
  margin: auto;
  width: fit-content;
}

.tileContent {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.content {
  @include type.type-style('heading-compact-02');
  color: $text-02;
  margin-bottom: layout.$spacing-03;
}

.helper {
  @include type.type-style('body-compact-01');
  color: $text-02;
}

.hiddenRow {
  display: none;
}
