/* CHANGELISTS */

#changelist {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  .changelist-form-container {
    flex: 1 1 auto;
    min-width: 0;
  }

  table {
    width: 100%;
  }
}

.change-list {
  .hiddenfields {
    display: none;
  }

  .filtered {
    table {
      border-right: none;
    }

    min-height: 400px;

    .results,
    .paginator {
      width: auto;
    }
  }
}

.filtered {
  #toolbar,
  div.xfull {
    width: auto;
  }
}

.change-list .filtered table tbody th {
  padding-right: 1em;
}

#changelist-form .results {
  overflow-x: auto;
  width: 100%;
}

#changelist {
  .toplinks {
    border-bottom: 1px solid var(--hairline-color);
  }

  .paginator {
    color: var(--body-quiet-color);
    border-bottom: 1px solid var(--hairline-color);
    background: var(--body-bg);
    overflow: hidden;
  }

  table {
    thead th {
      padding: 0;
      white-space: nowrap;
      vertical-align: middle;

      &.action-checkbox-column {
        width: 1.5em;
        text-align: center;
      }
    }

    tbody td.action-checkbox {
      text-align: center;
    }

    tfoot {
      color: var(--body-quiet-color);
    }
  }
}

/* CHANGELIST TABLES */

/* TOOLBAR */

#toolbar {
  padding: 8px 10px;
  margin-bottom: 15px;
  border-top: 1px solid var(--hairline-color);
  border-bottom: 1px solid var(--hairline-color);
  background: var(--darkened-bg);
  color: var(--body-quiet-color);

  form input {
    border-radius: 4px;
    font-size: 14px;
    padding: 5px;
    color: var(--body-fg);
  }

  #searchbar {
    height: 19px;
    border: 1px solid var(--border-color);
    padding: 2px 5px;
    margin: 0;
    vertical-align: top;
    font-size: 13px;
    max-width: 100%;

    &:focus {
      border-color: var(--body-quiet-color);
    }
  }

  form input[type="submit"] {
    border: 1px solid var(--border-color);
    font-size: 13px;
    padding: 4px 8px;
    margin: 0;
    vertical-align: middle;
    background: var(--body-bg);
    box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset;
    cursor: pointer;
    color: var(--body-fg);

    &:focus,
    &:hover {
      border-color: var(--body-quiet-color);
    }
  }
}

#changelist-search img {
  vertical-align: middle;
  margin-right: 4px;
}

/* FILTER COLUMN */

#changelist-filter {
  flex: 0 0 240px;
  order: 1;
  background: var(--darkened-bg);
  border-left: none;
  margin: 0 0 0 30px;

  h2 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 15px;
    margin-bottom: 12px;
    border-bottom: none;
  }

  h3 {
    font-weight: 400;
    padding: 0 15px;
    margin-bottom: 10px;
  }

  ul {
    margin: 5px 0;
    padding: 0 15px 15px;
    border-bottom: 1px solid var(--hairline-color);

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

  li {
    list-style-type: none;
    margin-left: 0;
    padding-left: 0;
  }

  a {
    display: block;
    color: var(--body-quiet-color);
    text-overflow: ellipsis;
    overflow-x: hidden;
  }

  li.selected {
    border-left: 5px solid var(--hairline-color);
    padding-left: 10px;
    margin-left: -15px;

    a {
      color: var(--link-selected-fg);
    }
  }

  a {
    &:focus,
    &:hover {
      color: var(--link-hover-color);
    }
  }

  li.selected a {
    &:focus,
    &:hover {
      color: var(--link-hover-color);
    }
  }

  #changelist-filter-clear a {
    font-size: 13px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--hairline-color);
  }
}

/* DATE DRILLDOWN */

.change-list ul.toplinks {
  display: block;
  float: left;
  padding: 0;
  margin: 0;
  width: 100%;

  li {
    padding: 3px 6px;
    font-weight: bold;
    list-style-type: none;
    display: inline-block;
  }

  .date-back a {
    color: var(--body-quiet-color);

    &:focus,
    &:hover {
      color: var(--link-hover-color);
    }
  }
}

/* PAGINATOR */

.paginator {
  font-size: 13px;
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 22px;
  margin: 0;
  border-top: 1px solid var(--hairline-color);
  width: 100%;

  a {
    &:link,
    &:visited {
      padding: 2px 6px;
      background: var(--button-bg);
      text-decoration: none;
      color: var(--button-fg);
    }

    &.showall {
      border: none;
      background: none;
      color: var(--link-fg);

      &:focus,
      &:hover {
        background: none;
        color: var(--link-hover-color);
      }
    }
  }

  .end {
    margin-right: 6px;
  }

  .this-page {
    padding: 2px 6px;
    font-weight: bold;
    font-size: 13px;
    vertical-align: top;
  }

  a {
    &:focus,
    &:hover {
      color: white;
      background: var(--link-hover-color);
    }
  }
}

/* ACTIONS */

.filtered .actions {
  border-right: none;
}

#changelist {
  table {
    input {
      margin: 0;
      vertical-align: baseline;
    }

    tbody tr.selected {
      background-color: var(--selected-row);
    }
  }

  .actions {
    padding: 10px;
    background: var(--body-bg);
    border-top: none;
    border-bottom: none;
    line-height: 24px;
    color: var(--body-quiet-color);
    width: 100%;

    &.selected {
      /* XXX Probably unused? */
      background: var(--body-bg);
      border-top: 1px solid var(--body-bg);
      border-bottom: 1px solid #edecd6;
    }

    span {
      &.all,
      &.action-counter,
      &.clear,
      &.question {
        font-size: 13px;
        margin: 0 0.5em;
      }
    }

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

    select {
      vertical-align: top;
      height: 24px;
      color: var(--body-fg);
      border: 1px solid var(--border-color);
      border-radius: 4px;
      font-size: 14px;
      padding: 0 0 0 4px;
      margin: 0;
      margin-left: 10px;

      &:focus {
        border-color: var(--body-quiet-color);
      }
    }

    label {
      display: inline-block;
      vertical-align: middle;
      font-size: 13px;
    }

    .button {
      font-size: 13px;
      border: 1px solid var(--border-color);
      border-radius: 4px;
      background: var(--body-bg);
      box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset;
      cursor: pointer;
      height: 24px;
      line-height: 1;
      padding: 4px 8px;
      margin: 0;
      color: var(--body-fg);

      &:focus,
      &:hover {
        border-color: var(--body-quiet-color);
      }
    }
  }
}
