/* ITEM SEARCH archive-item.php
------------------------------------------------------------*/
#search-page {
  h1.wp-block-heading em i {
    font-style: normal;
    color: #000;
    padding: 0 2px;
  }
  #search-area {
    margin-block: 4px;
    padding-block: 0.5rem;
    .searchform {
      margin-inline: auto;
      max-width: 952px;
      input.search-input {
        width: 100%;
        height: 62px;
      }
    }
  }
  .wrapper {
    padding-block: 2rem 5rem;
    border-top: 1px solid var(--lightgray);
    form > div {
      margin-bottom: 3rem;
    }
  }
  .search-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--blue);
    p {
      font-size: 1.25rem;
      font-weight: 700;
      @media screen and (max-width: 640px) {
        font-size: 1rem;
      }
    }
    button {
      position: relative;
      padding-inline: 1.25rem 0.5rem;
      color: #666;
      background: #fff;
      font-size: 0.875rem;
      border: 1px solid var(--lightgray);
      border-radius: 100vh;
      i {
        font-style: normal;
      }
      &::after,
      &::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0.75rem;
        width: 1px;
        height: 12px;
        background: #666;
        transform: translate(-50%, -50%) rotate(45deg);
      }
      &::before {
        transform: translate(-50%, -50%) rotate(-45deg);
      }
    }
    @media screen and (max-width: 1023px) {
      button {
        padding: 0;
        width: 1.5rem;
        height: 1.5rem;
        i {
          display: none;
        }
      }
    }
  }
  .toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    cursor: pointer;
    margin-top: 10px;
    input {
      opacity: 0;
      width: 0;
      height: 0;
      &:checked + .toggle-slider {
        background-color: var(--orange);
      }
      &:checked + .toggle-slider:before {
        transform: translateX(20px);
      }
    }
    .toggle-slider {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: #ccc;
      transition: 0.3s;
      border-radius: 100vh;
      &::before {
        position: absolute;
        content: "";
        height: 22px;
        width: 22px;
        left: 4px;
        bottom: 3px;
        background: #fff;
        transition: 0.3s;
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
      }
    }
  }
  .checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1;
    cursor: pointer;
    .checkbox {
      appearance: none;
      position: relative;
      width: 20px;
      height: 20px;
      border: 1px solid #666;
      background: #fff;
      cursor: pointer;
      &:checked {
        background-color: var(--orange);
        border-color: var(--blue);
      }
      &:checked::after {
        content: "";
        position: absolute;
        top: 5px;
        left: 3px;
        width: 12px;
        height: 6px;
        border-bottom: 2px solid #fff;
        border-left: 2px solid #fff;
        transform: rotate(-45deg);
      }
    }
  }
  .checkbox-item:not(:last-of-type) {
    margin-bottom: 1rem;
  }
  .search-result-count {
    @media screen and (min-width: 1024px) {
      margin-top: 1rem;
    }
    text-align: right;
  }
  .list-card {
    padding-top: 1rem;
    @media screen and (min-width: 1024px) {
      padding-top: 2rem;
    }
  }
  aside > .search-filter-header {
    border-top: 0;
  }
}
@media screen and (min-width: 1024px) {
  #sp-filter-btn {
    display: none;
  }
}
@media screen and (max-width: 1023px) {
  #js-search-form {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: space-between;
    @media screen and (max-width: 690px) {
      gap: 0;
      > div {
        width: 49%;
      }
    }
    @media screen and (max-width: 410px) {
      > div {
        width: 100%;
      }
    }
    > button {
      width: 100%;
    }
    .search-filter-block {
      padding-bottom: 3rem;
    }
  }
  #sp-filter-btn {
    margin-bottom: 1rem;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 100vh;
    color: #fff;
    background: var(--orange) url(../images/icon-filter.svg) no-repeat calc(100% - 1.25rem) 50% / 1.25rem auto;
  }
  #sp-filter-close {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 2rem;
    background: #fff;
    z-index: 10;
    &:before,
    &:after {
      display: block;
      position: absolute;
      right: 1rem;
      width: 20px;
      height: 2px;
      content: "";
      background: #000;
      transition: 0.5s ease-in-out;
    }
    &:before {
      top: 20px;
      transform: translateY(0) rotate(45deg);
    }
    &:after {
      top: 30px;
      transform: translateY(-10px) rotate(-45deg);
    }
  }

  #sp-search-filter {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 5rem 1rem 1rem;
    z-index: -100;
    opacity: 0;
    overflow: auto;
    transition: 0.3s;
    &.is-filter-open {
      opacity: 1;
      z-index: 100;
      background: #fff;
    }
  }
}
#results {
  position: relative;
  min-height: 300px;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7); /* 薄い白背景 */
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 100px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e0e0e0;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
