/* =========================================================
   SHOP STAR GLOW — HEADER SEARCH
   Minimal, compact predictive search
========================================================= */

:root {
  --ssg-search-accent: #d5b56a;
  --ssg-search-text: #242424;
  --ssg-search-muted: #777;
  --ssg-search-border: #e9e6e0;
  --ssg-search-bg: #fff;
}

/* Prevent background scrolling */
body.ssg-search-open {
  overflow: hidden;
}

/* Overlay */
.ssg-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 20px 30px;
}

.ssg-search-overlay[hidden] {
  display: none;
}

.ssg-search-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.48);
  backdrop-filter: blur(2px);
}

/* Search dialog */
.ssg-search-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 780px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ssg-search-bg);
  border-radius: 5px;
  box-shadow: 0 15px 55px rgba(0, 0, 0, 0.12);
}

/* Header */
.ssg-search-header {
  padding: 25px 30px 20px;
  border-bottom: 1px solid var(--ssg-search-border);
}

.ssg-search-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.ssg-search-header__eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--ssg-search-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
}

.ssg-search-header h2 {
  margin: 0;
  color: var(--ssg-search-text);
  font-family: "Playfair Display", serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
}

/* Close button */
.ssg-search-close {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ssg-search-border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.ssg-search-close:hover {
  background: #f7f5f0;
  border-color: var(--ssg-search-accent);
}

.ssg-search-close svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

/* Search input */
.ssg-search-form {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border: 1px solid var(--ssg-search-border);
  border-radius: 3px;
  background: #faf9f7;
  transition: border-color 0.2s ease;
}

.ssg-search-form:focus-within {
  border-color: var(--ssg-search-accent);
}

.ssg-search-form__icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #777;
  stroke-width: 1.5;
}

.ssg-search-form input[type="search"] {
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: var(--ssg-search-text);
  font-family: "Poppins", sans-serif;
  font-size: 12px;
}

.ssg-search-form input[type="search"]:focus {
  outline: none;
  box-shadow: none;
}

.ssg-search-form input::placeholder {
  color: #999;
}

.ssg-search-submit {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 0;
  border-radius: 2px;
  background: var(--ssg-search-text);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ssg-search-submit:hover {
  background: #a88a4b;
}

/* Results area */
.ssg-search-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 30px;
}

.ssg-search-section {
  margin-bottom: 24px;
}

.ssg-search-section[hidden],
.ssg-search-loading[hidden],
.ssg-search-error[hidden],
.ssg-search-empty[hidden],
.ssg-search-view-all[hidden] {
  display: none !important;
}

.ssg-search-section__heading {
  margin-bottom: 12px;
}

.ssg-search-section__heading h3 {
  margin: 0;
  color: var(--ssg-search-text);
  font-family: "Poppins", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Search pills */
.ssg-search-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ssg-search-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--ssg-search-border);
  border-radius: 2px;
  background: #fff;
  color: #555;
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  line-height: 1.3;
  text-decoration: none;
  transition: all 0.2s ease;
}

.ssg-search-pill:hover {
  border-color: var(--ssg-search-accent);
  background: #faf8f2;
  color: var(--ssg-search-text);
}

/* Product grid */
.ssg-search-products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.ssg-search-product {
  min-width: 0;
  display: block;
  color: var(--ssg-search-text);
  text-decoration: none;
}

.ssg-search-product__image {
  aspect-ratio: 1 / 1;
  margin-bottom: 9px;
  overflow: hidden;
  background: #f6f4f0;
}

.ssg-search-product__image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ssg-search-product:hover .ssg-search-product__image img {
  transform: scale(1.04);
}

.ssg-search-product__name {
  display: block;
  margin-bottom: 4px;
  color: var(--ssg-search-text);
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
}

.ssg-search-product__price {
  display: block;
  color: #777;
  font-family: "Poppins", sans-serif;
  font-size: 10px;
}

/* Collections */
.ssg-search-collections-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ssg-search-collection {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--ssg-search-border);
  color: var(--ssg-search-text);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.ssg-search-collection:hover {
  border-color: var(--ssg-search-accent);
}

.ssg-search-collection__image {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  overflow: hidden;
  background: #f6f4f0;
}

.ssg-search-collection__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ssg-search-collection__name {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  font-weight: 500;
}

.ssg-search-collection__count {
  display: block;
  margin-top: 3px;
  color: var(--ssg-search-muted);
  font-size: 9px;
}

/* Loading */
.ssg-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 25px 0;
  color: var(--ssg-search-muted);
  font-family: "Poppins", sans-serif;
  font-size: 10px;
}

.ssg-search-loading__spinner {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--ssg-search-border);
  border-top-color: var(--ssg-search-accent);
  border-radius: 50%;
  animation: ssg-search-spin 0.7s linear infinite;
}

@keyframes ssg-search-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty and error states */
.ssg-search-empty {
  padding: 35px 15px;
  text-align: center;
}

.ssg-search-empty__icon {
  display: block;
  margin-bottom: 8px;
  color: var(--ssg-search-accent);
  font-size: 20px;
}

.ssg-search-empty h3 {
  margin: 0 0 6px;
  font-family: "Playfair Display", serif;
  font-size: 17px;
  font-weight: 500;
}

.ssg-search-empty p {
  max-width: 300px;
  margin: 0 auto;
  color: var(--ssg-search-muted);
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  line-height: 1.7;
}

.ssg-search-error {
  padding: 12px;
  color: #a33;
  font-size: 11px;
}

/* Footer */
.ssg-search-footer {
  padding: 13px 30px;
  border-top: 1px solid var(--ssg-search-border);
  text-align: center;
}

.ssg-search-view-all {
  color: var(--ssg-search-text);
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.ssg-search-view-all:hover {
  color: #a88a4b;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767px) {
  .ssg-search-overlay {
    align-items: flex-start;
    padding: 0;
  }

  .ssg-search-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .ssg-search-header {
    padding: 20px 17px 16px;
  }

  .ssg-search-header h2 {
    font-size: 19px;
  }

  .ssg-search-content {
    padding: 18px 17px;
  }

  .ssg-search-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }

  .ssg-search-collections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ssg-search-collection {
    gap: 8px;
    padding: 6px;
  }

  .ssg-search-collection__image {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .ssg-search-footer {
    padding: 13px 17px;
  }
}

/* Small mobile screens */
@media (max-width: 380px) {
  .ssg-search-header {
    padding-right: 13px;
    padding-left: 13px;
  }

  .ssg-search-content {
    padding-right: 13px;
    padding-left: 13px;
  }

  .ssg-search-products-grid {
    gap: 15px 10px;
  }
}

/* =========================================
   SEARCH OVERLAY — REFINEMENTS
========================================= */

/* Search header */
.ssg-search-header {
  position: relative;
  background: #fff;
}

.ssg-search-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  position: relative;
}

.ssg-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #e9e6e1;
  border-radius: 50%;
  background: #fff;
  color: #222;
  cursor: pointer;
  z-index: 5;
}

.ssg-search-close svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* Remove search button if it still exists */
.ssg-search-submit {
  display: none !important;
}

/* Search input */
.ssg-search-form {
  display: flex;
  align-items: center;
}

.ssg-search-form input[type="search"] {
  min-width: 0;
  flex: 1;
}

/* Prevent background scrolling */
body.ssg-search-open {
  overflow: hidden;
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 767px) {
  .ssg-search-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 999999;
    overflow: hidden;
  }

  .ssg-search-dialog {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .ssg-search-header {
    flex: 0 0 auto;
    padding: 20px 18px 16px;
    position: relative;
    z-index: 2;
  }

  .ssg-search-header__top {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
  }

  .ssg-search-header__brand {
    display: block !important;
    min-width: 0;
  }

  .ssg-search-header__brand h2 {
    display: block !important;
    margin: 5px 0 0;
    font-size: 23px;
    line-height: 1.25;
  }

  .ssg-search-close {
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    margin: 0;
  }

  .ssg-search-form {
    width: 100%;
  }

  .ssg-search-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 18px;
  }

  .ssg-search-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    background: #fff;
    padding: 12px 18px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .ssg-search-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 14px;
  }

  .ssg-search-collections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Small phones */
@media (max-width: 380px) {
  .ssg-search-header {
    padding: 16px 14px 14px;
  }

  .ssg-search-header__brand h2 {
    font-size: 21px;
  }

  .ssg-search-content {
    padding: 14px;
  }
}

/* Predictive search product pricing */

.ssg-search-product__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  margin-top: 6px;
  font-family: "Poppins", sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: #777;
}

.ssg-search-product__price del {
  color: #999;
  opacity: 1;
  text-decoration: line-through;
}

.ssg-search-product__price ins {
  color: #222;
  font-weight: 600;
  text-decoration: none;
}

.ssg-search-product__price .woocommerce-Price-amount {
  white-space: nowrap;
}

.ssg-search-product__price .woocommerce-Price-currencySymbol {
  font-size: inherit;
}
