// --------------------------------------------------
// Topic lists
// --------------------------------------------------
.list-container .full-width {
  margin-left: 0;
}

.topic-list {
  &-body {
    border-width: 1px;
  }

  .num.posts-map {
    font-size: var(--font-up-2);
    padding: 0;

    > button,
    > a {
      padding: 0;
    }
  }

  .num.activity a {
    padding: 0;
  }

  // so the topic excerpt is full width
  // as the containing div is 80%
  .topic-excerpt {
    display: block;
    padding-right: 0;
    width: 120%;
  }

  .topic-excerpt-more {
    color: var(--tertiary);
  }

  .right {
    margin-left: 55px;
  }

  .topic-list-data {
    padding: 7px 0;
    max-width: 300px;
  }

  .main-link {
    line-height: var(--line-height-medium);
    position: relative;
    font-size: var(--font-up-1);

    a.title {
      color: var(--primary);
      padding: 0;
    }

    .topic-statuses {
      a {
        line-height: 0.8;
        color: var(--primary-medium);
      }
    }
  }

  .badge-notification,
  .category-topic-link td.num .badge-notification {
    position: relative;
    display: inline-block;
    top: -1px;
    font-size: var(--font-0);
    line-height: var(--line-height-small);
    padding: 0.15em 0.4em 0.2em 0.4em;

    .d-icon {
      color: var(--secondary);
    }

    &.new-topic::before {
      margin-right: 0;
    }

    &.new-topic {
      padding: 0;
    }
  }

  .category-topic-link td.num .badge-notification {
    &.unread-posts {
      color: var(--secondary);
    }
  }

  .topic-item-stats {
    position: relative;
    display: flex;
    align-items: baseline;
    margin-top: 0.5em;
    z-index: z("base");

    span.relative-date {
      vertical-align: text-top;
    }

    .num.activity {
      margin-left: auto;
      font-size: var(--font-down-1);
    }

    .category a {
      max-width: 160px;
    }

    .num .d-icon {
      color: var(--primary-medium);
    }
  }

  .topic-item-stats__category-tags {
    margin-right: 0.5em;
    max-width: 90%;
    line-height: var(--line-height-medium);

    .badge-category__wrapper {
      vertical-align: bottom;
      margin-right: 0.5em;
      max-width: 100%;
    }

    .badge-wrapper,
    .discourse-tag {
      // disabling clicks because these targets are too small on mobile
      pointer-events: none;
    }

    .discourse-tags {
      display: inline;

      &__tag-separator {
        position: absolute;
        display: inline-block;
        vertical-align: middle;
        margin-left: -0.5em;
        margin-top: 0.25em;
      }

      .discourse-tag {
        margin: 0 0.5em 0 0;
      }
    }

    .badge-wrapper {
      max-width: 100%;
      vertical-align: bottom;
    }
  }

  .age {
    white-space: nowrap;

    a {
      color: var(--primary-medium);
    }
  }
}

// Category list
// --------------------------------------------------
.categories-list .category-list {
  margin-bottom: 2em;

  td {
    padding: 12px 5px;
    color: var(--primary-med-or-secondary-high);
    vertical-align: top;
  }

  th {
    padding: 10px 0 0;
  }

  td:first-of-type {
    padding-left: 10px;
  }

  tbody {
    border-top: none;

    .category {
      border-left: 6px solid;
    }
  }
}

.category-list-item.category {
  tr:first-of-type {
    border: none;
  }

  // Allow percentage widths on table cells to include their padding
  box-sizing: border-box;

  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }

  .posts {
    vertical-align: top;
  }

  .age {
    margin-left: 5px;
  }

  // numbers get dimmer as they get colder
  .coldmap {
    &-high {
      opacity: 0.4;
    }

    &-med {
      opacity: 0.6;
    }

    &-low {
      opacity: 0.8;
    }
  }
}

.subcategory-list-item.category {
  display: block;
  width: calc(100% + 20px);
  margin: 1.25em 10px 0;
  border-bottom: none !important;
  border-top: 1px solid var(--content-border-color) !important;

  &:last-of-type {
    margin-top: 0;
    margin-bottom: 1.25em;
    border-bottom: 1px solid var(--content-border-color) !important;
  }

  td:first-of-type {
    padding: 12px 0;
  }

  .category-logo.aspect-image {
    display: none;
  }

  .subcategories {
    padding-left: 10px;
  }
}

tr.category-topic-link {
  border-bottom: 1px solid var(--content-border-color);

  &:last-of-type {
    border-bottom: none;
  }
}

.category-list-item,
.subcategory-list-item {
  padding: 0 0 0 3px;
  border-left: 6px solid;

  h3,
  h4 {
    max-width: 100%;
    padding: 0 0 0 10px;

    .d-icon {
      margin-right: 5px;
    }

    a[href] {
      color: var(--primary);
    }
  }

  h3 {
    font-size: var(--font-up-2);
  }

  h4 {
    font-size: var(--font-up-1);
  }

  .category-name {
    max-width: 80vw;
  }

  .category-topic-link .main-link,
  .subcategories-list td,
  .category-description td {
    padding-left: 10px;
  }

  .category-topic-link .main-link .age {
    font-size: var(--font-down-1);
  }

  .category-description td {
    padding-top: 0;
    padding-bottom: 15px;
  }

  .subcategories-list {
    border-bottom: none;

    td {
      padding-top: 15px;
    }
  }

  .category-topic-link {
    .num {
      white-space: nowrap;
    }

    .topic-excerpt {
      width: 110%;
    }
  }

  .posters {
    float: left;
  }

  > footer {
    border-top: 1px solid var(--content-border-color);
    padding: 7px 10px;

    .category-stat {
      float: left;
      margin: 3px 1em 0 0;
      font-weight: normal;
      font-size: var(--font-down-1);

      .value {
        font-weight: bold;
      }
    }

    .btn {
      float: right;
      margin-left: 7px;
    }
  }
}

.category-list-item {
  padding: 0.5em 0 0.25em;
  border-top: 1px solid var(--content-border-color) !important;
  border-bottom: 1px solid var(--content-border-color) !important;
  margin: 1em 0 2em;
}

.category-box {
  h3 {
    margin: 0 0 0.5em 0;
  }
}

.category-topics-count a {
  color: var(--primary);
}

.topic-list-bottom {
  margin: 20px 0 0 0;
}

// Misc. stuff
// --------------------------------------------------
.dropdown,
.multiselect {
  position: relative;
}

.dropdown-toggle:active,
.open .dropdown-toggle {
  outline: 0;
}

.fade.in {
  opacity: 1;
}

.category-heading {
  p {
    font-size: var(--font-up-1);
    margin-bottom: 0.75em;
  }
}

.category-logo.aspect-image {
  display: block;
  margin: 1.5em 0 1em;
}

// base defines extra padding for easier click/top of title field
// this is a bit too much for mobile
td .main-link {
  width: 78%;
  display: inline-block;

  a.title {
    padding: 0.33em 0.67em 0.33em 0;
    word-wrap: break-word;
  }
}

.category-list.with-topics .category-list-item .category-description {
  display: none;
}

.category-list .category.muted a.category-title-link {
  color: var(--primary-medium);
  font-size: var(--font-down-1);
}

.muted-categories-link {
  margin-left: 0;
}

// Bulk select
.topic-list-header {
  display: none;
}

.topic-list.sticky-header {
  .topic-list-header {
    display: table-header-group;
    position: sticky;
    z-index: z("base") + 2;
    top: var(--header-offset);
    background: var(--secondary);

    tr {
      display: flex;
      align-items: center;
      border: none;
    }

    .topic-list-data {
      display: none;

      &.bulk-select {
        display: inline-block;
      }

      &.default {
        display: flex;

        .bulk-select-topic-dropdown__count {
          display: none;
        }
      }
    }

    button.bulk-select {
      padding-left: 0.85em; // visual alignment
    }
  }
}

.bulk-select-topics {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0.85em;
  gap: 0.5em;
  font-size: var(--font-down-1);

  .select-kit-collection {
    font-size: var(--font-up-1);
  }
}

.topic-list-data .pull-left {
  label {
    // bulk select checkbox
    display: flex;
    width: 45px;
    height: 45px;
    justify-content: center;
    align-items: center;
  }
}

.topic-replies-toggle-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 1; // making sure the underline offset is on top of the topiclist
  position: relative;

  .topics-replies-toggle {
    flex-grow: 1;
    background: none;
    border: none;
    padding: 0.75em;
    position: relative;

    &.active {
      @include nav-active;

      &::after {
        height: 0.15em;
        bottom: -0.15em;
      }
    }
  }
}

#list-area .show-more .alert {
  align-items: center;
  gap: 0.5em;

  &.loading {
    color: var(--primary-medium);
  }
}
