/*!
 * ===========================
 * Author: Steve Gotthardt
 * Created: 5/2025
 * ===========================
 */

:root {
  --no-shadow: 0px 0px 2px rgba(0, 0, 0, 0);
  --small-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  --large-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
  --transition-time: 250ms;
}

#SearchFilter-main-container {
  position: relative;
  padding: 24px 24px 96px;
  @media screen and (min-width: 768px) {
    padding-left: 48px;
    padding-right: 48px;
  }
  @media screen and (min-width: 1376px) {
    padding-left: 0;
    padding-right: 0;
  }
}

#SearchFilter-search-filter-container {
  display: grid;
  grid-template-areas: "type" "region" "area" "search" "btns";
  grid-row-gap: 12px;
  grid-column-gap: 12px;
  margin: 0 auto;
  width: 100%;
  max-width: 1280px;
  @media screen and (min-width: 768px) {
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr auto;
    grid-template-areas: "search search type region area btns";
    grid-row-gap: 18px;
  }
  .filter-container,
  #SearchFilter-search-bar-container {
    position: relative;
    border-radius: 10px;
    box-shadow: var(--small-shadow);
    background: white;
    height: 54px;
    overflow: hidden;
  }
  .filter-container {
    &#Filter-type-container {
      grid-area: type;
    }
    &#Filter-region-container,
    &#Filter-location-container {
      grid-area: region;
    }
    &#Filter-area-container,
    &#Filter-topic-container {
      grid-area: area;
    }
    label {
      text-transform: uppercase;
      font-size: 10px;
      letter-spacing: 1px;
      color: #999;
      position: relative;
      text-indent: 18px;
      margin: 1px 0 0;
      select {
        position: absolute;
        top: 0;
        margin: 0;
        border: 0;
        background: transparent;
        padding: 16px 16px 0;
        color: #262626;
        height: 54px;
        &:hover {
          cursor: pointer;
        }
      }
    }
  }
  #SearchFilter-search-container {
    grid-area: search;
    position: relative;
    input[type="search"] {
      width: 100%;
      height: 54px;
      padding: 0 16px;
      font: 16px/24px "Roboto", Helvetica, Arial, sans-serif;
      color: #262626;
    }
    button {
      position: absolute;
      width: 54px;
      height: 54px;
      top: 0;
      right: 0;
      background-color: #f6f6f6;
      display: none;
      @media screen and (min-width: 360px) {
        display: inline;
      }
      i {
        width: 20px;
        height: 20px;
        color: #777;
      }
      &:hover {
        background-color: white;
        i {
          color: #0072c6;
        }
      }
    }
    #SearchFilter-search-quick-results {
      position: absolute;
      z-index: 9999;
      background-color: rgba(255, 255, 255, 0.9);
      top: 55px;
      left: 10px;
      width: calc(100% - 20px);
      padding: 12px 24px 12px;
      box-shadow: var(--large-shadow);
      &.hide {
        display: none;
      }
      ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
        li {
          &.hide {
            display: none;
          }
          a {
            font-size: 0.9rem;
            line-height: 1.4;
            font-weight: 600;
            padding: 6px 0;
            display: inline-block;
            width: 100%;
          }
        }
      }
    }
  }
  #SearchFilter-btns {
    display: flex;
    justify-content: center;
    margin: 12px auto 0;
    grid-area: btns;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--small-shadow);
    @media screen and (min-width: 768px) {
      margin-top: 0;
    }
    button {
      width: 40px;
      height: 40px;
      margin: 0;
      background-color: #f6f6f6;
      color: #777;
      font-size: 16px;
      @media screen and (min-width: 768px) {
        width: 54px;
        height: 54px;
        font-size: inherit;
      }
      &.active,
      &:active,
      &:hover {
        background-color: white;
        color: #0072c6;
      }
      i {
        pointer-events: none;
      }
      &#Btn-Grid,
      &#Btn-List {
        display: none;
        @media screen and (min-width: 960px) {
          display: block;
        }
        &:focus {
          background-color: white;
          color: #0072c6;
        }
      }
    }
  }
}

#SearchFilter-msg {
  text-align: center;
  font-weight: bold;
  padding: 36px 12px 48px;
  color: #262626;
  @media screen and (min-width: 768px) {
    padding-top: 48px;
    padding-bottom: 54px;
  }
  .msg.hide {
    display: none;
  }
}

#List-header {
  display: none;
}

ul#SearchFilter-list {
  margin: 0;
  list-style: none;
  li {
    &.hide {
      display: none;
    }
    a {
      .item-image {
        background-size: cover;
        background-position: center;
      }
      .title {
        font-weight: 600;
      }
      &:hover,
      &:focus {
        text-decoration: none;
        .title {
          color: inherit;
          text-decoration: underline;
        }
      }
    }
  }
}

/* Grid View */
.grid-view ul#SearchFilter-list {
  display: grid;
  grid-gap: 24px;
  @media screen and (min-width: 768px) {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 36px;
  }
  @media screen and (min-width: 1200px) {
    grid-template-columns: repeat(3, 1fr);
  }
  li {
    a {
      display: grid;
      align-items: stretch;
      position: relative;
      margin: 0;
      background: white;
      position: relative;
      border-radius: 10px;
      overflow: hidden;
      height: 100%;
      box-shadow: var(--small-shadow);
      transition: margin var(--transition-time),
        box-shadow var(--transition-time);
      @media screen and (min-width: 400px) {
        grid-template-columns: 130px 1fr;
      }
      &:hover,
      &:focus {
        box-shadow: var(--no-shadow);
        margin: 0.1rem -0.1rem -0.1rem 0.1rem;
        transition: margin var(--transition-time),
          box-shadow var(--transition-time);
      }
      &::after {
        font-family: "Font Awesome 6 Pro";
        position: absolute;
        top: 4px;
        right: 4px;
        width: 20px;
        height: 20px;
        font-size: 16px;
        font-weight: 600;
        color: white;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 6px;
        border-radius: 10px;
        background-color: black;
      }
      .item-image {
        min-height: 250px;
        @media screen and (min-width: 400px) {
          min-height: 130px;
        }
      }
      .item-text {
        padding: 18px 48px 18px 18px;
        align-self: center;
        .details {
          display: grid;
          grid-template-columns: auto 1fr;
          grid-column-gap: 6px;
          font-size: 0.9rem;
          line-height: 1.4;
          margin: 4px 0 0;
          color: #757575;
          & > * {
            display: inline;
          }
          .region {
            img {
              width: 17px;
              display: inline;
            }
          }
          .area,
          .topic,
          .type,
          .location {
            display: none;
          }
        }
      }
    }
    &[data-type="certificate"] a {
      &::after {
        content: "\f559";
        background-color: #9d6ba7;
        @media screen and (min-width: 400px) {
          background-color: #cecece;
        }
      }
      @media screen and (min-width: 400px) {
        &:hover::after,
        &:focus::after {
          background-color: #9d6ba7;
          transition: background-color var(--transition-time);
        }
      }
    }
    &[data-type="course"] a {
      &::after {
        content: "\f518";
        background-color: #bc441b;
        @media screen and (min-width: 400px) {
          background-color: #cecece;
        }
      }
      @media screen and (min-width: 400px) {
        &:hover::after,
        &:focus::after {
          background-color: #bc441b;
          transition: background-color var(--transition-time);
        }
      }
    }
  }
}

/* List View */
.list-view #List-header,
.list-view ul#SearchFilter-list li a,
.list-view ul#SearchFilter-list li a .item-text,
.list-view ul#SearchFilter-list li a .item-text .details {
  display: grid;
  align-items: stretch;
}
#List-header {
  grid-template-columns: 80px auto 160px 220px 80px;
  align-items: center;
  background-color: #217da1;
  padding: 18px;
  button {
    text-align: start;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    line-height: 1.3;
    font-weight: 600;
    color: white;
    &.asc,
    &.desc {
      &::after {
        content: "\f0d7";
        font-family: "Font Awesome 6 Pro";
        margin-left: 5px;
        display: inline-block;
      }
    }
    &.desc::after {
      content: "\f0d8";
    }
    &:hover,
    &:focus {
      text-decoration: underline;
    }
  }
}
.list-view ul#SearchFilter-list {
  li {
    background-color: white;
    a {
      grid-template-columns: 80px auto;
      &:hover,
      &:focus {
        background-color: #f6f6f6;
      }
      .item-image {
        min-height: 80px;
      }
      .item-text {
        grid-template-columns: 1fr auto;
        border-bottom: 1px solid #d4ebf5;
        .title,
        .details {
          padding: 18px;
          align-self: center;
        }
        .details {
          grid-template-columns: 160px 220px 80px;
          grid-template-areas: "type area region";
          align-items: center;
          color: #262626;
          .area-and-type,
          .topic-and-type {
            display: none;
          }
          .type {
            grid-area: type;
          }
          .region,
          .location {
            grid-area: region;
          }
          .area,
          .topic {
            grid-area: area;
          }
        }
      }
    }
  }
}