html,
body {
  height: 100%;
  width: 100%;
}

body {
  margin-top: $header-margin;
}

#popover-root-btn {
  border: 0;
}

#stac-browser {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  height: 100%;
  min-height: 100%;
  gap: $block-margin;

  @include media-breakpoint-only(xxxl) {
    max-width: 75vw;
  }

  > header {
    .site {
      border-bottom: 3px solid map-get($theme-colors, "primary");

      > .col-md-12 {
        > .title {
          > span {
            font-size: 1.5rem;
            font-weight: 600;
          }
        }

        .logo {
          max-height: $logo-image-height;
        }
      }
    }
    .site,
    .page {
      padding: $block-margin 0;

      > .col-md-12 {
        display: flex;
        gap: 1rem;
        align-items: center;

        > .title {
          word-break: break-word;
          display: flex;
          flex-grow: 1;
          margin: 0;
          padding: 0;
          align-items: center;
          gap: 1rem;

          h1,
          h2 {
            margin: 0;
            padding: 0;
          }

          h1 {
            font-weight: 700;
            align-items: center;
            font-size: 2.2rem;
          }
          @include media-breakpoint-down(xl) {
            h1 {
              font-size: 2rem;
            }
          }
          @include media-breakpoint-down(md) {
            h1 {
              font-size: 1.75rem;
            }
          }
        }
      }
    }
    .site {
      > .col-md-12 {
        > .title {
          justify-content: center;
        }
      }
    }
  }
  > main {
    flex: 1;
  }
  > footer {
    padding-bottom: $block-margin;
    text-align: center;

    .footer-links {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      list-style: none;
      padding: 0;
      margin: 0 0 $block-margin 0;
      font-size: 0.875rem;

      li:not(:last-child)::after {
        content: "|";
        margin: 0 0.5em;
      }
    }

    .poweredby {
      display: block;
    }
  }

  .popover-large {
    width: 80%;
    max-width: 800px;

    .popover-body {
      overflow-y: auto;
      overflow-x: hidden;
      max-height: 80vh;
    }
  }

  .map {
    height: 350px;
    background-color: transparent;
    overflow: hidden;
    position: relative;
    z-index: 0;
  }

  h2 {
    color: map-get($theme-colors, "secondary");
    font-weight: 600;
  }

  .maps-preview {
    position: static;

    .nav-pills {
      margin: 0;
      padding: 0;

      > li {
        margin: 0 0.5rem;
        &:only-child {
          display: none;
        }
        &:first-of-type {
          margin-top: 0.5rem;
        }
        &:last-of-type {
          margin-bottom: 0.5rem;
        }
      }
    }
  }

  .service {
    &.bsky {
      @include button-variant(#1185fe, #1185fe);
    }
    &.mastodon {
      @include button-variant(#6364ff, #6364ff);
    }
    &.x {
      @include button-variant(#000000, #000000);
    }
  }

  .icon {
    max-width: $max-icon-size;
    max-height: $max-icon-size;
  }
  h1 > .icon {
    max-width: 1.2em;
    max-height: 1.2em;
  }

  .global-error {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 5000;
    opacity: 0.9;
    max-width: 50vh;
    margin: 1rem;
  }

  abbr[title],
  abbr[data-original-title] {
    text-decoration: none;
    border-bottom: 1px dotted $body-color;
  }

  .card {
    background: transparent;
  }

  input:invalid {
    border-color: map-get($theme-colors, "danger");
  }

  a.list-group-item {
    color: $link-color;
    text-decoration: $link-decoration;

    &:hover {
      color: $link-hover-color;
      text-decoration: $link-hover-decoration;
    }
  }

  .btn-group,
  .btn-group-vertical {
    .btn-primary,
    .btn-secondary {
      border-color: darken(map-get($theme-colors, "primary"), 15%);
      &:hover {
        border-color: darken(map-get($theme-colors, "primary"), 30%);
      }
    }
    .btn-secondary {
      background-color: lighten(
        desaturate(map-get($theme-colors, "primary"), 50%),
        20%
      );
      &:hover {
        background-color: darken(map-get($theme-colors, "primary"), 5%);
      }
    }
  }
  .btn-group-vertical.actions {
    .btn {
      text-align: left;
    }
  }

  .btn {
    &.disabled,
    &:disabled {
      cursor: not-allowed;
      filter: grayscale(1);
    }
  }

  .button-label {
    display: none;
  }
  @include media-breakpoint-up(lg) {
    .button-label {
      display: inline-block;
      margin-left: 0.25rem;
      white-space: nowrap;
    }
  }

  .expandable-card > .card-header {
    padding: 0;
    background-color: transparent;
  }
  .expandable-card > .card-header > .btn,
  .mimic-expandable-card > .list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.03);

    > .title {
      text-align: left;
      flex-grow: 9;
    }
    > .badges {
      flex-grow: 1;
      text-align: right;

      .badge {
        margin: 0.125rem;
        text-transform: uppercase;
      }
    }
  }

  .items,
  .catalogs,
  .features {
    > .list {
      position: relative;
    }

    > header {
      margin-bottom: 0.5rem;

      > h2.title {
        vertical-align: middle;
        display: inline-block;
        margin-bottom: 0.25rem;
      }
      .badge {
        vertical-align: middle;
      }
      .btn-group {
        vertical-align: middle;
        margin: 0.25rem 0;
      }
    }
  }

  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    grid-auto-rows: min-content;
    // The layout uses margin-bottom instead of row-gap (on .catalog-grid), because
    // the .card-img-wrapper is supposed to collapse to 0px height when there are no
    // images in a row. row-gap would prevent that from happening.
    column-gap: 1rem;
    padding: 0.5rem 0;
    grid-auto-flow: dense;

    .catalog-card,
    .item-card,
    .feature-card {
      display: grid;
      grid-template-rows: subgrid;
      gap: 0;
      box-sizing: border-box;
      overflow: hidden;
      // See note in .card-grid (below) why margin-bottom is used instead of row-gap
      margin-bottom: 0.75rem;

      &.queued {
        min-height: 4rem;
      }
    }

    .catalog-card,
    .item-card {
      grid-row: span 7;

      .card-body {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: span 4;
      }
    }

    .feature-card {
      grid-row: span 1;
    }
  }

  .catalog-card,
  .item-card,
  .feature-card {
    &.deprecated {
      opacity: 0.5;

      &:hover {
        opacity: 1;
      }
    }

    .card-img {
      width: auto;
      height: auto;
      object-fit: scale-down;
      object-position: center;
    }

    .card-img-wrapper {
      background-color: rgba(0, 0, 0, 0.03);
      display: grid;
      overflow: hidden;

      img {
        margin: auto;
        border-radius: 0;

        &.thumbnail.card-img {
          max-width: 100%;
          max-height: 250px;
        }
      }
    }

    .card-title {
      overflow-wrap: anywhere;
      margin-bottom: 0.25rem;
    }

    .card-body,
    .card-footer {
      position: relative;
      gap: 0.5rem;

      > p {
        margin: 0;
      }
    }
    .card-footer {
      .btn-group-vertical {
        width: 100%;
      }
    }
    .card-footer:empty {
      display: none;
    }

    .badge.deprecated {
      text-transform: uppercase;
    }

    .intro {
      display: -webkit-box;
      -webkit-line-clamp: 3;
      line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
      overflow-wrap: anywhere;
      text-align: left;
      line-height: 1.5em;
      max-height: 4.5em; /* 3 lines at 1.5em line-height */
    }

    .datetime {
      color: $secondary;
    }
  }

  .card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;

    .catalog-card {
      box-sizing: border-box;
      display: flex;
      overflow: hidden;

      .card-img-wrapper {
        width: 33%;
        position: relative;
        overflow: hidden;

        &:empty {
          display: none;
        }

        .card-img-right {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          object-fit: scale-down;
          object-position: center;
        }
      }

      .card-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        gap: 0.25rem;

        .intro {
          -webkit-line-clamp: 2;
          line-clamp: 2;
          max-height: 3rem;
        }
      }

      .card-footer {
        width: 175px;
        border-top: 0;
      }
    }
  }
}

@import "~vue-multiselect/dist/vue-multiselect.min.css";

// Datepicker related style
$default-color: map-get($theme-colors, "secondary");
$primary-color: map-get($theme-colors, "primary");

// Multiselect related style
#stac-browser {
  .multiselect__tags:focus-within {
    border-color: #48cce1;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(24, 129, 145, 0.25);
  }

  .multiselect__select:before {
    color: #495057;
    border-color: #495057 transparent transparent;
  }

  .multiselect__tags,
  .multiselect__single {
    border-color: #ccc;
    padding-left: 0.75rem;
    font-size: 16px;
    height: 100%;
  }

  .multiselect__input,
  .multiselect__single {
    padding: 4px 0 3px 0;
  }

  .multiselect__tag,
  .multiselect__tag-icon:hover,
  .multiselect__option--highlight,
  .multiselect__option--highlight:after {
    background-color: map-get($theme-colors, "primary");
  }

  .multiselect__option--selected.multiselect__option--highlight,
  .multiselect__option--selected.multiselect__option--highlight:after {
    background-color: map-get($theme-colors, "secondary");
  }

  .multiselect__placeholder {
    color: #999;
    font-size: 16px;
  }
}

#stac-browser-auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;

  > form {
    min-width: 200px;
    width: 50vw;
    border-radius: $border-radius;

    > .card {
      background-color: #fff;
    }
  }
}
