// ---------------------------
// COLLECTION PAGES
// ---------------------------


// Search form

.collection-search {
  position: relative;
  padding-right: 75px;
  input[type=search] {
    height: 34px;
    padding-left: 25px;
    border-right-width: 0;
    background-repeat: no-repeat;
    background-position: left 5px center;
    border-radius: $btnBorderRadius 0 0 $btnBorderRadius;
    @include background-svg(16, 16, '<path fill="#{$bodyFgLight}" d="M15.21,13.79l-3.32-3.32C12.59,9.49,13,8.3,13,7c0-3.31-2.69-6-6-6C3.69,1,1,3.69,1,7s2.69,6,6,6 c1.3,0,2.49-0.42,3.47-1.11l3.32,3.32c0.2,0.2,0.45,0.29,0.71,0.29s0.51-0.1,0.71-0.29C15.6,14.82,15.6,14.18,15.21,13.79z M2.5,7 c0-2.48,2.02-4.5,4.5-4.5c2.48,0,4.5,2.02,4.5,4.5c0,2.48-2.02,4.5-4.5,4.5C4.52,11.5,2.5,9.48,2.5,7z"/>');
  }
  button {
    top: 0;
    right: 0;
    position: absolute;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

.dataTables_filter.search {
  position: relative;
  input[type=search] {
    height: 34px;
    padding-left: 25px;
    background-repeat: no-repeat;
    background-position: left 5px center;
    border-radius: $btnBorderRadius;
    @include background-svg(16, 16, '<path fill="#{$bodyFgLight}" d="M15.21,13.79l-3.32-3.32C12.59,9.49,13,8.3,13,7c0-3.31-2.69-6-6-6C3.69,1,1,3.69,1,7s2.69,6,6,6 c1.3,0,2.49-0.42,3.47-1.11l3.32,3.32c0.2,0.2,0.45,0.29,0.71,0.29s0.51-0.1,0.71-0.29C15.6,14.82,15.6,14.18,15.21,13.79z M2.5,7 c0-2.48,2.02-4.5,4.5-4.5c2.48,0,4.5,2.02,4.5,4.5c0,2.48-2.02,4.5-4.5,4.5C4.52,11.5,2.5,9.48,2.5,7z"/>');
  }
  button {
    top: 0;
    right: 0;
    position: absolute;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

// Overview

.collection-intro {
  width: 100%;
  display: table;
  margin-bottom: $gapSize/2;
  &_image {
    display: table-cell;
    vertical-align: top;
    padding-right: $gapSize;
    img {
      padding: 5px;
      background: #FFF;
      background-clip: padding-box;
      border: 1px solid rgba(#000, 0.06);
    }
  }
  &_about {
    width: 100%;
    display: table-cell;
    vertical-align: middle;
    p { margin-top: 0; }
  }
}

.collection-work {
  clear: both;
  padding: $gapSize;
  border-radius: 4px;
  margin-bottom: $gapSize / 2;
  background-clip: padding-box;
  border: 1px solid rgba(#000, 0.06);
  background-color: mix(#FFF, $bodyBg, 35%);
  overflow: hidden;
  &_image {
    display: inline-block;
    float: left;
    padding: 5px;
    background: #FFF;
    margin-right: $gapSize;
    margin-bottom: $gapSize;
    background-clip: padding-box;
    border: 1px solid rgba(#000, 0.06);
    img {
      width: 8em;
      padding: 3px;
      background: #FFF;
      border: 1px solid rgba(#000, 0.1);
    }

  }
  &_title {
    margin: 0;
    a {
      text-decoration: none;
      color: darken($fgLink, 10%);
      &:hover { color: $fgLink; }
    }
  }
  &_snippet {
    margin: 0.5em 0 0 0;
    font-size: $fontSizeSmall;
  }
  &_action {
    font-style: italic;
  }
  &_stats {
    width: 100%;
    color: $bodyFgFaded;
    margin: 0.5em 0 0 0;
    overflow: auto;
    > span {
      padding-right: 10px;
      display: table-cell;
      white-space: nowrap;
      &:last-child {
        padding: 0;
        width: 100%;
        text-align: right;
      }
    }
    .progress { max-width: 300px; }
  }
  &.search_result {
    max-width: 90vw;
  }
}

.hidden {
  visibility: hidden;
}

.user-label.owner {
  margin: $gapSize 0 $gapSize;
}

// Collection users

.collection-users {
  margin-top: $gapSize * 2;
  .justified_box {
    width: 30%;
    vertical-align: top;
  }
}

.collection-user {
  width: 100%;
  margin: 0.3em 0;
  white-space: nowrap;
  vertical-align: top;
  display: inline-block;
  &:before {
    float: right;
    line-height: 20px;
    color: $bodyFgLight;
    margin: 5px 0 0 3px;
    font-size: $fontSizeSmall;
  }
  &_link {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;

    .userpic {
      font-size: 26px;
      margin-right: 6px;
    }
  }
}

//Contributor users

.contributor-users {
  margin-top: $gapSize * 2;
  .justified_box {
    width: 30%;
    vertical-align: top;
  }
}

.contributor-user {
  width: 100%;
  margin: 0.3em 0;
  white-space: nowrap;
  vertical-align: top;
  display: inline-block;
  &:before {
    float: right;
    line-height: 20px;
    color: $bodyFgLight;
    margin: 5px 0 0 3px;
    font-size: $fontSizeSmall;
  }
  &_link {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    &:after {
      height: 0;
      content: '';
      width: 100%;
      margin-left: 5px;
      display: inline-block;
    }
    .userpic {
      font-size: 26px;
      margin-right: 6px;
    }
  }
}

// Categories

.category-back-message {
  text-align: center;
  color: $bodyFgFaded;
  padding-bottom: $gapSize;
  margin: -$gapSize / 2 0 $gapSize 0;
  border-bottom: 1px solid rgba(#000, 0.1);
}

.collection-categories {
  width: 100%;
  display: table;
  table-layout: fixed;
  margin-bottom: $gapSize;
  .category-tree, .category-articles {
    vertical-align: top;
    display: table-cell;
  }
  .category-tree {
    width: 30%;
    padding-right: $gapSize;
    border-right: 1px solid rgba(#000, 0.1);
  }
  .category-articles {
    padding-left: $gapSize;
  }
}

.category-tree {
  $bullet-expanded: '<polygon fill="#000" points="0.5,1 4.5,8 8.5,1"/>';
  $bullet-collapsed: '<polygon fill="#000" points="1,0.5 8,4.5 1,8.5"/>';
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
    li {
      margin: 0;
      padding: 0;
    }
    ul {
      display: none;
      padding-left: 18px;
    }
  }
  .tree-item {
    display: block;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    color: $bodyFgLight;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.2s;
    text-overflow: ellipsis;
    padding: 5px 0 5px 18px;
    &:hover, &.selected { color: $bodyFg; }
  }
  .tree-bullet {
    left: 0;
    top: 50%;
    width: 18px;
    height: 32px;
    opacity: 0.5;
    display: block;
    cursor: pointer;
    margin-top: -16px;
    position: absolute;
    transition: opacity 0.2s;
    background-repeat: no-repeat;
    background-position: 2px center;
    @include background-svg(9, 9, $bullet-collapsed);
    &:hover { opacity: 1; }
  }
  .expanded {
    > .tree-item .tree-bullet { @include background-svg(9, 9, $bullet-expanded); }
    > ul { display: block; }
  }
  &.static {
    .tree-item { padding-left: 0; }
    ul { display: block; }
  }
}

.category-article {
  margin: 0;
  padding: 0;
  display: none;
  > dd {
    width: 100%;
    display: inline-block;
    a {
      float: left;
      width: 33.33%;
      margin: 0.4em 0;
      line-height: 1.2;
      padding-right: 1em;
      box-sizing: border-box;
    }
  }
}

.category-article dd {
  &:not(.actions) {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.category-article dd p {
  width: 33%;
  display: flex;
}

.category-article dd p a {
  width: 100%;
  text-decoration: none;
}

.category-article dd p span {
  width: 40%;
}

.grey-number {
  color: grey;
  margin-right: 5px;
  font-size: medium;
  padding-left: 10px;
}

// Collection stats

.collection-stats {
  &_counters {
    text-align: center;
    margin-bottom: $gapSize;
    padding-bottom: $gapSize;
    border-bottom: 1px solid rgba(#000, 0.1);
    display: flex;
    justify-content: center;
    &:last-child {
      border: 0;
      padding: 0;
    }
    .samplings {
      width: 90%;
      margin: 1em 0;
      max-width: 800px;
    }
    .counter {
      width: 30%;
      max-width: 300px;
      line-height: 1.2;
      font-size: 2.344vw;
      vertical-align: top;
      border-left: 1px solid rgba(#000, 0.1);
      &:first-child { border: 0; }
    }
    a.counter {
      text-decoration: none;
      &:before {
        color: inherit;
      }
      span {
        text-decoration: underline;
      }
    }

    @media screen and (max-width: $widthMin) {
      .counter { font-size: 18px; }
    }
    @media screen and (min-width: 850px) {
      .counter { font-size: 20px; }
    }
  }
  &_recent {
    text-align: center;
    font-size: 0;
    margin-bottom: $gapSize * 2;
    .counter {
      width: 12%;
      font-size: 15px;
      line-height: 1.2;
      vertical-align: top;
    }
  }
}

.collection-work-stats {
  padding: 0;
  width: 100%;
  margin: 1em 0 0 0;
  border-top: 1px solid rgba(#000, 0.08);
  tr {
    margin: 0;
    display: table-row;
    > span {
      color: $bodyFgLight;
      display: table-cell;
      white-space: nowrap;
      padding: $gapSize / 2;
      border-bottom: 1px solid rgba(#000, 0.08);
      &:first-child, &:last-child { width: 50%; }
      &:first-child {
        max-width: 200px;
        overflow: hidden;
        font-size: $fontSizeBig;
        text-overflow: ellipsis;
      }
      b {
        color: $bodyFg;
        font-weight: normal;
      }
    }
  }
}


// Collection settings
.collection-meta-wrapper {
  overflow: auto;
}

.collection-works-manage {
  .action {
    top: 50%;
    display: none;
    position: absolute;
    color: $bodyFgLight;
    right: $gapSize / 2;
    text-decoration: none;
    line-height: $iconSize;
    margin-top: -$iconSize / 2;
    &:hover { color: $fgHover; }
    .icon { vertical-align: top; }
  }
}

.collection-settings-wrapper {
  width: 80%;
  float: left;
  padding-left: 2%;
  border-left: 1px solid rgba(#000, 0.15);
}

.collection-settings {
  border-collapse: separate;
  border-spacing: 0.25em 0.5em;

  th {
    white-space: normal !important;
    vertical-align: top;
  }
  td:nth-child(1), th {
    width: 30%;
  }
  td:nth-child(2) {
    width: 70%;
  }
  p {
    margin: 0;
  }

  input[type="checkbox"], input[type="radio"] {
    margin-right: 0.5em;
    margin-bottom: 0.5em;
    margin-top: 7px; // align with label
    vertical-align: top;
  }
  select, .inline-btn, .select2 {
    display: inline-block;

    &.select2-hidden-accessible {
      display: none;
    }
  }
  .action-btn {
    margin-bottom: 0.5em;
  }
  td label {
    vertical-align: top;
    width: 95%;
  }
  .collection-label {
    margin-right: 10px;
  }
  .settings-label {
    display: inline-block;
  }
  .image-form label {
    width: 150px;
  }
  .button[disabled] {
    pointer-events: none;
  }
}

.page-settings {
  .sidecol {
    padding-top: 0.5em;
  }
}

.side-tabs {
  $textColor: #322;
  float: left;
  padding-right: 2%;
  font-family: $fontFamilyHead;
  font-size: $fontSizeBig;
  a {
    display: block;
    margin: 0 0 1em 0;
    text-decoration: none;
    color: rgba($textColor, 0.65);
    &:hover {
      text-decoration: underline;
    }
    &.active {
      color: $textColor;
      cursor: default;
      &:hover {
        text-decoration: none;
      }
    }
    .icon {
      margin-right: 0.5em;
    }
  }
}

.image-upload {
  height: auto !important;
  min-height: 50px;
  max-height: 150px;
  width: auto !important;
  min-width: 120px;
  max-width: 150px;
}

.users-list {
  $bgColor: mix($themeLight, $bodyBg, 50);
  background-color: $bgColor;
  border: 1px solid $bgColor;
  border-radius: 16px;
  padding: 1em;
  display: inline-block;
  width: 100%;
  overflow: none;
  position: relative;

  .expand-btn {
    color: $bodyFgLight;
    text-decoration: none;
    position: absolute;
    bottom: 1em;
    right: 1em;
    width: fit-content;

    .no-display {
      display: none;
    }
    .icon {
      transform: rotate(0deg);
      transition: transform 0.3s;
    }
  }
  .user-label {
    float: left;
    min-width: 40%;
    width: fit-content;

    &:nth-child(n+6) {
      display: none;
    }
    &:nth-child(5) {
      margin-right: 60px; // prevent overlap with expand button
    }
    a {
      padding-right: 1em;
    }
  }

  &.expanded {
    .user-label {
      display: inline-block;
      &:nth-child(5) {
        margin-right: 0; // expand button is gone
      }
    }
    .expand-btn .icon {
      transform: rotate(-180deg);
      transition: transform 0.3s;
    }
  }

  .nodata {
    margin: 0;
    padding: 20px;
    border: none;
    background-color:inherit;
  }

  &.disabled {
    $disabledBg: mix($bodyBg, gray, 90);
    $disabledFg: mix($bodyFgLight, $disabledBg, 70);
    background-color: $disabledBg;
    a, h3 {
      text-decoration: none;
      color: $disabledFg;
    }
  }
}

.danger-warning {
  background-color: mix($bgRed, red, 90);
  border: 1px solid $bgRed;
  border-radius: 16px;
  padding: 1em;
  color: $fgRed;
  .icon {
    margin-right: 0.5em;
  }
}

.footer-preview {
  $bgColor: mix($themeLight, $bodyBg, 50);
  background-color: $bgColor;
  border-radius: 16px;
  padding: 1em;

  text-align: center;
  color: $bodyFgLight;
}

.clipboard-btn {
  color: inherit;
  .icon {
    margin-left: 0.5em;
  }
}

// Collection export

.bulk-export {
  padding: 0;
  margin: 1.5em 0;
  list-style: none;

  li {
    margin: 0;
    display: flex;
    padding: 15px 0;
    border-style: solid;
    border-width: 1px 0 0 0;
    border-color: rgba(#000, 0.15);

    &:last-child {
      border-width: 1px 0;
    }
  }

  &_format {
    flex: 1 1 auto;
    padding-right: 15px;

    h5 {
      display: flex;
      align-items: center;
      margin: 0 0 0.25em 0;

      input {
        width: 19px;
        height: 19px;
        margin-right: 5px;
      }
    }
  }

  &_options {
    display: flex;
    flex: 0 0 180px;
    padding-left: 15px;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid rgba(#000, 0.15);

    label {
      margin: 3px 0;
      display: flex;
      align-items: center;

      input {
        margin-right: 3px;
      }
    }
  }
}


// Configure buttons

.edit-buttons {
  padding: 0;
  margin: 1.5em 0;
  list-style: none;

  li {
    margin: 0;
    display: flex;
    padding: 15px 0;
    border-style: solid;
    border-width: 1px 0 0 0;
    border-color: rgba(#000, 0.15);

    &:last-child {
      border-width: 1px 0;
    }
  }

  &_format {
    flex: 1 1 auto;
    padding-right: 15px;

    h5 {
      display: flex;
      align-items: center;
      margin: 0 0 0.25em 0;

      input {
        width: 19px;
        height: 19px;
        margin-right: 5px;
      }
    }
  }

  &_options {
    display: flex;
    flex: 0 0 300px;
    padding-left: 15px;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid rgba(#000, 0.15);

    label {
      margin: 3px 0;
      display: flex;
      align-items: center;

      input {
        margin-right: 3px;
      }
    }
  }
}


// Edit transcription fields

.field-form {
  width: 100%;

  margin-bottom: 15px;

  th, td {
    padding: 4px;
    vertical-align: top;

    &:first-child {
      padding-left: 0;
    }

    &:last-child {
      padding-right: 0;
    }
  }

  th {
    padding-top: 15px;
  }

  &_line {
    font-weight: bold;
    font-size: $fontSizeBig;
    padding: 20px 0 0 0 !important;
  }

  &_label {
    width: 35%;
  }

  &_type {
    width: 15%;
  }

  &_options {
    width: 50%;
  }

  &_actions {
    min-width: 52px;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
  }

  &_width,
  &_page {
    min-width: 75px;
    box-sizing: border-box;
  }

  &_icon {
    padding: 6px 4px;
    color: $bodyFgLight;
    display: inline-block;

    &[disabled] {
      opacity: 0.3;
      pointer-events: none;
    }

    &:hover {
      color: $bodyFg;
    }

    &.reorder {
      cursor: ns-resize;
    }
  }

  textarea {
    height: calc(2em + 2px);
    min-height: calc(2em + 2px);
  }

  .ui-sortable-placeholder td {
    height: 34px;
  }
}

a.field_icons {
  margin: 5px;
  color: $bodyFgLight;
  display: inline-block;

  &:hover {
    color: $bodyFg;
  }
}

// Collection works list

.collection-work-list {
  position: relative;
  .row-alignment {
    width: 33%;
    position: absolute;
    right: 0;
    top: 0;
  }
  h2 {
    width: 30%;
    float: left;
  }
  .start_link {
    float: right;
    margin: 0 0 .5em 0;
    label {
      display: inline;
    }
  }
}

p.transcribed {
  text-align: right;
  margin: 0;
  font-style: italic;
}

// Collection footer

.collection-footer {
  text-align: center;
  color: $bodyFgLight;
  margin-top: $gapSize * 3;
  padding-top: $gapSize * 1.5;
  border-top: 1px dotted $borderColor;
}

// Document Set work list

td.document_set input[type="checkbox"] {
  margin-left: 8px;
}

li.document_set input[type="checkbox"] {
  margin-left: 50px;
}

// Facets

#slider1, #slider2, #slider3 {
  margin-top: 0.5em;
  margin-bottom: 1em;
}


.approval-delta {
  color: $fgWhite;
  padding: 0 0.5em;
  line-height: 1.75;
  border-radius: 3px;
  white-space: nowrap;
  display: inline-block;

  &-0 { background-color: #490; }
  &-1 { background-color: #990; }
  &-2 { background-color: #E90; }
  &-3 { background-color: #E60; }
  &-4 { background-color: #D33; }
}

.sidecol-url {
  padding: 0.75em;
  border-radius: 4px;
  background: rgba(#FFF, 0.5);
  box-shadow: inset 0 0 0 1px rgba(#000, 0.08);

  small {
    display: block;
  }

  a {
    width: 100%;
    display: block;
    overflow: scroll;
    padding: 0.75em 0;
    margin: -0.75em 0;
    white-space: nowrap;
  }
}

.sidecol-desc {
  margin-top: 2em;

  dt {
    margin-top: 1em;
    font-weight: bold;
  }

  dd {
    color: $bodyFgFaded;
  }
}
