/* Map list and search sidebar: items/index, items/_grid_item, items/_row_item */

/* -- Results -- */

.item-thumb {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 160px;
  margin-bottom: 10px;
  border: 1px solid rgba(150, 150, 150, 0.31);
  border-radius: 2px;
  background-color: white;
  background-position: center;
  background-size: cover;

  &:hover {
    border-color: rgb(150, 150, 150);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1), 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  }

  .details {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 8px 8px;
    border-radius: 0 0 1px 1px;
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    text-align: center;
  }

  @media (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
    width: 100%;
    height: 130px;

    .details {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  @media (max-device-width: 330px) and (-webkit-min-device-pixel-ratio: 2) {
    height: 100px;
  }
}

.items-list {
  @media (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
    margin-bottom: 0;
  }
}

.row-item {
  background-color: #fff;

  a > .details.col-md-9 {
    padding-left: 10px;

    h6 {
      margin-block: 5px;
      font-size: 12px;
    }

    h6 small {
      display: inline;
      color: var(--atlas-muted);
      font-size: 10px;
    }
  }

  h4 {
    margin-top: 2px;
    margin-bottom: 5px;
  }

  h6 {
    color: var(--atlas-muted);
    font-size: 10px;
  }

  h6 small {
    display: block;
    color: var(--atlas-primary);
    font-size: 14px;
    font-weight: normal;
  }

  .item-thumb {
    margin-top: 0;
    box-shadow: none;
  }
}

.page-controls {
  * {
    float: left;
  }

  @media (max-width: 767px) {
    text-align: center;
  }

  h4 {
    margin-top: 0;

    span {
      float: right;
      margin-left: 5px;
    }
  }

  .pagination {
    display: inline-block;
    float: none;
    width: 100%;
    margin: 0;
    font-family: "Roboto", sans-serif;
    text-align: center;
  }
}

/* -- Sidebar filters -- */

.toggle-item-view {
  float: right;
  width: 20px;
  height: 20px;
  margin: 5px;
  color: #999;
  font-size: 18px;

  &:hover {
    color: #222;
  }
}

.facet {
  position: relative;
}

.facet_titles {
  margin-block: 0;
  padding: 10px 10px 5px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-filters {
  li {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    list-style: none;

    a {
      flex-grow: 1;
    }

    .badge {
      flex-grow: 0;
      margin-right: 5px;
    }
  }

  &.many {
    height: 190px;
    padding: 3px;
    overflow: auto;

    &.top {
      border-top: 1px solid #e5e5e5;
    }

    &.bottom {
      border-bottom: 1px solid #e5e5e5;
    }
  }

  &::-webkit-scrollbar {
    width: 7px;
    -webkit-appearance: none;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(80, 80, 80, 0.5);
    box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
  }

  /* Currently applied filters, each with a remove (×) icon */
  &.active {
    padding-top: 8px;
    border-top: 1px solid rgba(160, 160, 160, 0.2);

    a {
      transition: all 0.3s ease-out;
    }

    .active-filter {
      display: flex;
      align-items: center;

      i {
        margin-left: auto;
      }

      &:hover {
        color: red;
      }
    }
  }
}

/* Year filter: two year inputs with a reset (×) inside each, plus Apply */
.year-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 10px 8px 0;

  input {
    width: 7em;
    padding-right: 1.8em; /* room for the reset button; the spinner sits left of it */
  }
}

.year-field {
  position: relative;
  display: inline-block;
}

.year-reset {
  position: absolute;
  top: 50%;
  right: 0.5em;
  transform: translateY(-50%);
  padding: 0 2px;
  border: 0;
  background: none;
  color: #999;
  font-size: 1.1em;
  line-height: 1;
  cursor: pointer;

  &:hover {
    color: #333;
  }

  &[hidden] {
    display: none;
  }
}

/* -- Upload page (admin/items/new): Dropzone file list -- */

#new_item {
  display: table;
  width: 100%;
  min-height: 300px;
  padding-bottom: 200px;

  .dropzone-heading {
    display: table-header-group;

    .dropzone-columns {
      display: table-row;
      border-bottom: 1px solid #555;
      font-weight: bold;

      div {
        display: table-cell;
        padding: 8px;
        border-bottom: 2px solid #adafae;
      }
    }
  }

  .uploading-item {
    display: table-row;

    div {
      position: relative;
      display: table-cell;
      padding: 2px;
    }

    .status {
      padding-left: 5px;

      &::after {
        content: "pending...";
      }
    }

    /* State classes added by Dropzone */
    &.dz-processing .status::after {
      content: "processing...";
    }

    &.dz-success .status::after {
      content: "✔ success!";
    }

    &.dz-error .status::after {
      content: "";
    }
  }

  .upload-progress {
    position: relative;

    > div {
      position: absolute;
      top: 20%;
      display: block;
      height: 60%;
      background-color: var(--atlas-primary);
    }
  }

  .dz-success .upload-progress > div {
    background-color: var(--bs-success);
  }

  .dz-error .upload-progress > div {
    background-color: var(--atlas-danger);
  }
}

.drop-message {
  text-align: center;
}
