/*!
 * USP.Center static search widget — supplements the theme's existing
 * .ais-* / .hit-item / .pagination styles. Scoped to body.usp-search-on,
 * which is added by search-widget.js only after successful init.
 */

body.usp-search-on .searchbox-algolia {
  display: block;
  width: 4.4rem;
  min-width: 4.4rem;
  overflow: visible;
}

body.usp-search-on .algolia-search-icon {
  cursor: pointer;
  border: none;
  background-color: transparent;
  min-width: 3.4rem;
  height: 2.8rem;
  background-repeat: no-repeat;
}

.--algolia .product-modal__inner {
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.--algolia .hit-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #e3efe5;
}

.--algolia .hit-item:hover .hit-primary,
.--algolia .hit-item:focus .hit-primary {
  text-decoration: underline;
}

.--algolia .hit-section {
  display: inline-block;
  margin-left: 0.8rem;
  padding: 0.1rem 0.8rem;
  border-radius: 1rem;
  background: #e3efe5;
  color: #1b1e4b;
  font-size: 1.1rem;
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}

.--algolia .hit-snippet {
  font-size: 1.3rem;
  line-height: 1.5;
  color: #444;
  margin-bottom: 0.5rem;
}

.--algolia .hit-url {
  font-size: 1.1rem;
  color: #888;
  word-break: break-all;
}

.--algolia mark.ais-Highlight-highlighted {
  background: #fff3b0;
  color: inherit;
  padding: 0;
  font-style: normal;
}

.--algolia #stats {
  padding: 0 1rem;
  font-size: 1.2rem;
  color: #666;
}

/* Valid, flat pagination markup shared by themed and fallback modals. */
.usp-search-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  list-style: none;
  gap: 0.4rem;
  margin: 2rem 0 0;
  padding: 0;
}

.usp-search-pagination li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.usp-search-page a {
  display: inline-block;
  min-width: 2em;
  padding: 0.2em 0.3em;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.--algolia .usp-search-page a {
  color: #1b1e4b;
  font-size: 1.5rem;
}

.usp-search-pagination .pagination__arrow a {
  display: inline-flex;
  align-items: center;
}

/* --- Fallback icon for themes without their own search markup ----------- */

.usp-search-fallback {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  z-index: 50;
}

@media (max-width: 991px) {
  .usp-search-fallback {
    right: 60px;
  }
}

.usp-search-fallback-icon {
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px 22px;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23374957' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  opacity: 0.85;
}

.usp-search-fallback-icon:hover,
.usp-search-fallback-icon:focus {
  opacity: 1;
}

/* --- Complete modal styling, scoped to the widget-created modal only ----- */

.usp-search-fallback-modal {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  overflow: auto;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
  font-size: 16px;
  line-height: 1.5;
}

.usp-search-fallback-modal .product-modal__inner {
  width: 94%;
  max-width: 680px;
  margin: 6vh auto;
  padding: 24px 24px 32px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  max-height: 86vh;
  overflow-y: auto;
}

.usp-search-fallback-modal .product-modal__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.usp-search-fallback-modal .product-modal__top h2 {
  margin: 0;
  font-size: 1.4em;
}

.usp-search-fallback-modal .product-modal__close {
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.usp-search-fallback-modal .ais-SearchBox-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

.usp-search-fallback-modal #stats {
  margin: 10px 0 4px;
  font-size: 0.85em;
  color: #666;
}

.usp-search-fallback-modal .hit-item {
  display: block;
  padding: 12px 4px;
  border-bottom: 1px solid #eee;
  color: inherit;
  text-decoration: none;
}

.usp-search-fallback-modal .hit-primary {
  font-weight: 600;
  margin-bottom: 4px;
}

.usp-search-fallback-modal .no-results {
  padding: 16px 4px;
  color: #666;
}

.usp-search-fallback-modal .pagination__arrow svg {
  width: 32px;
  height: auto;
}

.usp-search-fallback-modal .pagination__arrow--prev {
  transform: scaleX(-1);
}

/* Fallback icon rendered as a nav menu item. */
.usp-search-fallback-item {
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.usp-search-fallback-item .usp-search-fallback-icon {
  width: 28px;
  height: 28px;
  background-size: 20px 20px;
}
