body.wp-child-theme-graceatwork-divi {
  /* Search and button module */
  .gaw-search-and-button-module {
    .flex-row {
      align-items: stretch;
      gap: 10px;

      .facetwp-facet,
      .facetwp-input-wrap,
      input {
        height: 100%;
        min-width: 280px;
      }

      .facetwp-input-wrap .facetwp-icon {
        background-color: var(--light-blue);
        padding: 20px;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius);
        border: none;
        color: var(--primary-color);
        font-size: 24px;
        opacity: 1;

        &::before {
          filter: invert(24%) sepia(47%) saturate(2129%) hue-rotate(174deg)
            brightness(99%) contrast(101%);
        }
      }

      input {
        border-radius: var(--radius);
        border: none;
        padding: 0 20px;
        font-size: var(--t-body);
        font-weight: 500;
        line-height: var(--default-line-height);
        font-family: var(--body-font-family);
        color: rgba(59, 52, 49, 0.5);
        background-color: var(--white);
      }

      a.button.home-hero-shop-button {
        height: 66px !important;
        max-height: 66px !important;
      }
    }
  }

  /* FacetWP components */
  .facetwp-facet {
    &.facetwp-type-search {
      /* Unified styling for all FacetWP search inputs */
      .facetwp-input-wrap {
        background-color: var(--white);
        border: 1px solid #e0e0e0;
        border-radius: var(--radius);
        display: flex;
        align-items: center;
        overflow: hidden;
        height: 68px;
        max-width: 450px;
        margin-left: auto;
        margin-right: auto;

        .facetwp-icon {
          background-color: var(--light-blue);
          padding: 0 20px;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          border: none;
          color: var(--primary-color);
          font-size: 24px;
          opacity: 1;
          flex-shrink: 0;

          &::before {
            filter: invert(24%) sepia(47%) saturate(2129%) hue-rotate(174deg)
              brightness(99%) contrast(101%);
          }
        }

        input.facetwp-search {
          border: none;
          padding: 0 20px;
          font-size: var(--t-body);
          font-weight: 500;
          line-height: var(--default-line-height);
          font-family: var(--body-font-family);
          color: rgba(59, 52, 49, 0.5);
          background-color: white !important;
          flex: 1;
          min-width: 0;
          height: 100%;

          &::placeholder {
            color: rgba(59, 52, 49, 0.5);
          }

          &:focus {
            outline: none;
            color: var(--text-color);
          }
        }
      }

      /* Smaller variant for compact contexts */
      &.facetwp-search--compact {
        .facetwp-input-wrap {
          height: 40px;

          .facetwp-icon {
            padding: 8px;
            font-size: 16px;
          }

          input.facetwp-search {
            padding: 0 12px;
            font-size: 14px;
          }
        }
      }
      & .facetwp-type-pager {
        width: 100%;
        margin: 2.5rem 0 0 0;
      }
    }

    .facetwp-pager {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      min-height: 1em;
    }

    .facetwp-page {
      display: none; /* Hide all by default */
    }

    .facetwp-page.prev,
    .facetwp-page.next {
      display: flex !important;
      align-items: center;
      font-weight: 700;
      font-size: 1.1rem;
      color: var(--primary-color);
      background: none;
      border: none;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      cursor: pointer;
      transition: color 0.2s;
      padding: 0;
      text-decoration: none;
    }

    .facetwp-page.prev {
      order: 1;
    }
    .facetwp-page.next {
      order: 3;
      margin-left: auto;
    }

    .facetwp-page.prev::before {
      content: "";
      display: inline-block;
      width: 1rem;
      height: 1rem;
      background-image: url(/wp-content/uploads/2025/06/right-arrow.svg);
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      margin-right: 0.5rem;
      margin-top: -2px;
      transform: rotate(180deg); /* flip arrow left */
      transition: all 0.3s ease;
    }

    .facetwp-page.next::after {
      content: "";
      display: inline-block;
      width: 1rem;
      height: 1rem;
      background-image: url(/wp-content/uploads/2025/06/right-arrow.svg);
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      margin-left: 0.5rem;
      margin-top: -2px;
      transition: all 0.3s ease;
    }

    .facetwp-page.prev:hover::before {
      transform: translateX(-6px) rotate(180deg);
    }
    .facetwp-page.next:hover::after {
      transform: translateX(6px);
    }

    .facetwp-page.prev[disabled],
    .facetwp-page.next[disabled] {
      opacity: 0.4;
      pointer-events: none;
    }

    &.facetwp-facet-sort_products {
      select {
        padding: 1rem;
        border-radius: var(--radius);
        color: var(--brown);
        height: 66px;
        max-height: 66px;
        font-size: var(--t-body);
        cursor: pointer;
        border: 1px solid #e0e0e0;
      }
    }
  }

  /* Global Search Results Popup */
  .gaw-section-has-global-inline-search {
    position: relative;
    overflow: visible;
    z-index: 1000;
  }

  .in-place-global-search-container {
    position: relative;

    .facetwp-facet {
      margin-bottom: 0;
    }

    /* Apply primary color to FacetWP search icon */
    .facetwp-facet-in_place_search {
      .facetwp-search-icon {
        filter: brightness(0) saturate(100%) invert(27%) sepia(51%)
          saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
      }

      /* Consistent styling for search input across hero and menu */
      .facetwp-input-wrap {
        height: 100%;
        background-color: var(--white);
        border: 1px solid #e0e0e0;
        border-radius: var(--radius);
        display: flex;
        align-items: center;
        overflow: hidden;

        .facetwp-icon {
          background-color: var(--light-blue);
          padding: 20px;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          border: none;
          color: var(--primary-color);
          font-size: 24px;
          opacity: 1;
          flex-shrink: 0;

          &::before {
            filter: invert(24%) sepia(47%) saturate(2129%) hue-rotate(174deg)
              brightness(99%) contrast(101%);
          }
        }

        input {
          border: none;
          padding: 0 20px;
          font-size: var(--t-body);
          font-weight: 500;
          line-height: var(--default-line-height);
          font-family: var(--body-font-family);
          color: rgba(59, 52, 49, 0.5);
          background-color: transparent;
          flex: 1;
          min-width: 0;
          height: 64px !important;
          max-height: 64px !important;
          background-color: var(--white) !important;

          &::placeholder {
            color: rgba(59, 52, 49, 0.5);
          }

          &:focus {
            outline: none;
            color: var(--text-color);
          }
        }
      }
    }

    /* Menu-specific styling */
    &.menu-search-container {
      /* Menu search trigger icon */
      .menu-search-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        background-color: transparent;
        border-radius: 50%;
        text-decoration: none;
        transition: all 0.3s ease;

        img {
          width: 100%;
          height: 100%;
          background-color: var(--blue);
          border-radius: 50%;
        }

        &:hover {
          background-color: rgba(0, 0, 0, 0.05);
          border-radius: 50%;
        }
      }

      /* Menu search input wrapper */
      .menu-search-input-wrapper {
        position: absolute;
        top: 100%;
        right: 0;
        left: auto;
        width: 350px;
        background: var(--white);
        border: 1px solid #e0e0e0;
        border-radius: var(--radius-medium);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 1001;
        padding: 16px;
        margin-top: 8px;

        /* Show animation */
        &.menu-search-input--visible {
          display: block !important;
          animation: slideDown 0.3s ease-out;
        }

        /* Hide animation */
        &.menu-search-input--hidden {
          display: none !important;
        }

        /* Menu-specific search input styling - smaller height */
        .facetwp-facet-in_place_search {
          .facetwp-input-wrap {
            height: 40px;

            .facetwp-icon {
              padding: 8px;
              font-size: 16px;
            }

            input {
              padding: 0 12px;
              font-size: 14px;
            }
          }
        }
      }

      /* Adjust positioning for menu context */
      .gaw-search-results-popup {
        /* This is positioned inside the input wrapper, so we adjust it */
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        margin-top: 10px;
        box-shadow: none;
        border: none;
        padding: 0;

        /* Ensure menu search popup appears above other menu items */
        z-index: 1001;
      }
    }

    .gaw-search-results-popup {
      position: absolute;
      width: 600px;
      max-width: 100vw;
      top: calc(100% + 10px);
      left: 0;
      right: 0;
      padding: 20px 30px;
      background: var(--white);
      border: 1px solid #e0e0e0;
      border-radius: var(--radius-medium);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      z-index: 1000;
      max-height: 400px;
      overflow-y: auto;
      display: none;

      &.gaw-search-results--visible {
        display: block;
      }

      &.gaw-search-results--loading {
        display: block;

        .gaw-search-results-container {
          position: relative;
          min-height: 100px;

          &::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 20px;
            height: 20px;
            border: 2px solid #f3f3f3;
            border-top: 2px solid var(--primary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
          }
        }
      }

      .gaw-search-results-container {
        padding: 16px 0;
      }

      .gaw-search-results-section {
        margin-bottom: 30px;

        &:last-child {
          margin-bottom: 0;
        }
      }

      .gaw-search-results-section-title {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 18px;
        font-weight: 600;
        color: var(--primary-color);
        margin: 0 0 1rem 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }

      .gaw-search-results-list {
        display: flex;
        flex-direction: column;
        gap: 24px;
      }

      .gaw-search-result-item {
        height: 70px;
        /* border-bottom: 1px solid #f0f0f0; */

        &:last-child {
          border-bottom: none;
        }
      }

      .gaw-search-result-link {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        width: 100%;
        text-decoration: none;
        color: inherit;
        height: 100%;
      }

      .gaw-search-result-thumbnail {
        width: 48px;
        height: 100%;
        margin-right: 12px;
        border-radius: var(--radius-small);
        overflow: hidden;
        background-color: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .gaw-search-result-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .gaw-search-result-placeholder {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #6c757d;

        svg {
          width: 20px;
          height: 20px;
        }

        &--product {
          color: var(--primary-color);
        }

        &--post {
          color: var(--brown);
        }

        &--page {
          color: var(--light-blue);
        }
      }

      .gaw-search-result-content {
        flex: 1;
        min-width: 0;
      }

      .gaw-search-result-title {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0 0 0.1rem 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .gaw-search-result-meta {
        font-size: 0.95rem;
        color: var(--brown);
        margin: 0 0 0.1rem 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
        span {
          margin-right: 0.5rem;
        }
      }

      .gaw-search-result-excerpt {
        font-size: 1rem;
        color: var(--brown);
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .gaw-search-no-results {
        padding: 24px 16px;
        text-align: center;
        color: var(--brown);

        p {
          margin: 0;
          font-size: 14px;
        }
      }

      /* Scrollbar styling */
      &::-webkit-scrollbar {
        width: 8px;
      }

      &::-webkit-scrollbar-track {
        background: transparent;
        margin: 4px 0;
      }

      &::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 4px;
        border: 2px solid transparent;
        background-clip: content-box;

        &:hover {
          background: #9ca3af;
          background-clip: content-box;
        }
      }

      /* Firefox scrollbar */
      scrollbar-width: thin;
      scrollbar-color: #d1d5db transparent;

      @media (max-width: 768px) {
        & {
          max-height: 300px;
          max-width: 80vw;
        }

        .gaw-search-result-thumbnail {
          width: 40px;
          height: 40px;
          margin-right: 10px;
        }

        .gaw-search-result-title {
          font-size: 15px;
        }

        .gaw-search-result-excerpt {
          font-size: 13px;
        }
      }
    }
  }

  /* Loading animation */
  @keyframes spin {
    0% {
      transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
      transform: translate(-50%, -50%) rotate(360deg);
    }
  }

  /* Menu search slide down animation */
  @keyframes slideDown {
    0% {
      opacity: 0;
      transform: translateY(-10px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Menu search form (standard WP search) styling */
  .menu-search-container .menu-search-input-wrapper {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    width: 350px;
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-medium);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    padding: 16px;
    margin-top: 8px;
  }
  .menu-search-form {
    display: flex;
    align-items: center;
    background: var(--light-blue);
    border-radius: var(--radius);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    box-shadow: none;
  }
  .menu-search-input {
    flex: 1;
    border: none;
    padding: 0 20px;
    font-size: var(--t-body);
    font-weight: 500;
    line-height: var(--default-line-height);
    font-family: var(--body-font-family);
    color: rgba(59, 52, 49, 0.5);
    background-color: transparent;
    min-width: 0;
    height: 48px;
  }
  .menu-search-input::placeholder {
    color: rgba(59, 52, 49, 0.5);
  }
  .menu-search-input:focus {
    outline: none;
    color: var(--text-color);
  }

  &,
  &.woocommerce {
    button[type="submit"].menu-search-submit {
      background: var(--light-blue);
      border: none;
      height: 48px;
      width: 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      border-radius: 0 var(--radius) var(--radius) 0;
      transition: background 0.2s;
      padding: 1px 6px;

      svg {
        color: var(--primary-color);
        width: 20px;
        height: 20px;
      }
      &:hover {
        background: var(--primary-color);
      }
      &:hover svg {
        color: var(--white);
      }
    }
  }

  /* Search Results: Flat, full-width list */
  .gaw-search-results-listing--search-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;

    .gaw-search-result-item {
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      background: var(--white);
      border-radius: var(--radius);
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
      overflow: hidden;
      transition: box-shadow 0.2s;
      min-height: 120px;
      height: 120px;
      &:hover {
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
      }
      .gaw-search-result-link {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        width: 100%;
        text-decoration: none;
        color: inherit;
        height: 100%;
      }
      .gaw-search-result-thumbnail {
        width: 120px;
        min-width: 120px;
        height: 100%;
        background: #f6f6f6;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        height: 100%;
      }
      .gaw-search-result-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 0;
        min-height: 90px;
        min-width: 90px;
      }
      .gaw-search-result-placeholder {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        background: #e9f3fa;
        svg {
          width: 24px;
          height: 24px;
          color: var(--primary-color);
        }
      }
      .gaw-search-result-content {
        flex: 1 1 auto;
        padding: 0.8rem 1.5rem 0.8rem 0.8rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
      }
      .gaw-search-result-title {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0 0 0.2rem 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .gaw-search-result-meta {
        font-size: 0.95rem;
        color: var(--brown);
        margin: 0 0 0.5rem 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
        span {
          margin-right: 0.5rem;
        }
      }
      .gaw-search-result-excerpt {
        font-size: 1rem;
        color: var(--brown);
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }

    .gaw-article-no-results {
      text-align: center;
      font-size: var(--t-h4);
    }

    @media (max-width: 700px) {
      .gaw-search-result-item {
        /* flex-direction: column; */
        /* height: auto; */
        /* max-width: 300px; */
        /* margin: 0 auto; */

        /* .gaw-search-result-thumbnail {
          max-width: 100%;
          min-width: 100%;
          height: 200px;
        }

        .gaw-search-result-content {
          padding: 1rem;
        }

        .gaw-search-result-link {
          flex-direction: column;
        } */
      }
    }
  }

  .facetwp-type-checkboxes {
    display: flex;
    gap: 10px;
    justify-content: center;

    .facetwp-checkbox {
      background-size: 18px 18px;
      padding-left: 26px;
    }
  }
}
