/* ========================================
   STAREL SEARCH — PHASE 4 v4
======================================== */

@supports (scrollbar-gutter: stable) {
  html {
    scrollbar-gutter: stable;
  }
}

:root {
  --starel-search-overlay-top: 0px;
  --starel-search-overlay-z-index: 99;
  --starel-search-scrollbar-compensation: 0px;
  --starel-search-backdrop-z-index: 98;
  --starel-search-panel-gutter: 32px;
  --starel-search-inner-left: 24px;
  --starel-search-feature-start: 356px;
  --starel-search-sidebar-width: calc(var(--starel-search-feature-start) - var(--starel-search-inner-left) - var(--starel-search-panel-gutter));
  --starel-search-border: #eeeeee;
  --starel-search-muted: #767676;
  --starel-search-black: #1c1c1c;
  --starel-search-surface: #ffffff;
  --starel-search-card-bg: #f4f4f4;
}

.starel-search-backdrop[hidden],
.starel-search-overlay[hidden],
.starel-search-overlay__state[hidden],
.starel-search-overlay [hidden] {
  display: none !important;
}

.starel-search-backdrop {
  position: fixed;
  top: var(--starel-search-overlay-top);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--starel-search-backdrop-z-index);
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 160ms ease;
}

body.starel-search-is-open .starel-search-backdrop {
  opacity: 1;
}

.starel-search-overlay {
  position: fixed;
  top: var(--starel-search-overlay-top);
  right: 0;
  left: 0;
  z-index: var(--starel-search-overlay-z-index);
  display: block;
  max-height: calc(100vh - var(--starel-search-overlay-top));
  background: var(--starel-search-surface);
  border-top: 0;
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

body.starel-search-is-open .starel-search-overlay {
  opacity: 1;
  transform: translateY(0);
}

body.starel-search-is-open {
  overflow: hidden;
  padding-right: var(--starel-search-scrollbar-compensation, 0px);
}

.starel-search-overlay__inner {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 16px 24px 48px var(--starel-search-inner-left);
  box-sizing: border-box;
}

.starel-search-overlay__state {
  display: grid;
  grid-template-columns: var(--starel-search-sidebar-width) minmax(0, 1fr);
  gap: var(--starel-search-panel-gutter);
  width: 100%;
  min-height: 0;
}

.starel-search-overlay__sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
  padding-top: 0;
}

.starel-search-overlay__section {
  display: block;
}

.starel-search-overlay__heading {
  margin: 0 0 16px;
  color: var(--starel-search-black);
  font-family: var(--e-global-typography-secondary-font-family, inherit);
  font-size: 18px !important;
  font-weight: 400;
  line-height: 1.15;
}

.starel-search-overlay__link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.starel-search-overlay__link-item {
  margin: 0;
  padding: 0;
}

.starel-search-overlay__text-link {
  display: inline-flex;
  align-items: center;
  color: var(--starel-search-black);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  text-decoration: none;
  transition:
    color 160ms ease,
    opacity 160ms ease;
}

.starel-search-overlay__link-list:hover .starel-search-overlay__text-link,
.starel-search-overlay__link-list:focus-within .starel-search-overlay__text-link {
  color: #7a7a7a;
}

.starel-search-overlay__link-list:hover .starel-search-overlay__text-link:hover,
.starel-search-overlay__link-list:focus-within .starel-search-overlay__text-link:focus,
.starel-search-overlay__link-list:focus-within .starel-search-overlay__text-link:focus-visible {
  color: var(--starel-search-black) !important;
  opacity: 1;
  outline: none;
}

.starel-search-overlay__feature-area,
.starel-search-overlay__results-area {
  min-width: 0;
  padding-right: 0;
}

.starel-search-overlay__feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.starel-search-overlay__feature-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--starel-search-black);
  text-decoration: none;
  background: transparent;
}

.starel-search-overlay__feature-card:hover,
.starel-search-overlay__feature-card:focus-visible {
  color: var(--starel-search-black);
  outline: none;
}

.starel-search-overlay__feature-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--starel-search-card-bg);
  overflow: hidden;
  border-radius: 5px;
}

.starel-search-overlay__feature-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 360ms ease;
}

.starel-search-overlay__feature-card:hover .starel-search-overlay__feature-media img,
.starel-search-overlay__feature-card:focus-visible .starel-search-overlay__feature-media img {
  transform: scale(1.035);
}

.starel-search-overlay__feature-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
  color: var(--starel-search-black);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.starel-search-overlay__feature-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-1px);
  transition: transform 160ms ease;
}

.starel-search-overlay__feature-card:hover .starel-search-overlay__feature-arrow,
.starel-search-overlay__feature-card:focus-visible .starel-search-overlay__feature-arrow {
  transform: translate(4px, -1px);
}

.starel-search-overlay__results-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.starel-search-overlay__results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.starel-search-overlay__results-title {
  margin: 0;
  color: var(--starel-search-black);
  font-family: var(--e-global-typography-secondary-font-family, inherit);
  font-size: 18px !important;
  font-weight: 400;
  line-height: 1.15;
}

.starel-search-overlay__view-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--starel-search-black);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.starel-search-overlay__view-all:hover,
.starel-search-overlay__view-all:focus-visible {
  color: var(--starel-search-black);
  outline: none;
}

.starel-search-overlay__product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.starel-search-overlay__product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--starel-search-black);
  text-decoration: none;
}

.starel-search-overlay__product-card:hover,
.starel-search-overlay__product-card:focus-visible {
  color: var(--starel-search-black);
  outline: none;
}

.starel-search-overlay__product-media {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--starel-search-card-bg);
  border-radius: 5px;
}

.starel-search-overlay__product-image,
.starel-search-overlay__product-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 360ms ease;
}

.starel-search-overlay__product-card:hover .starel-search-overlay__product-media img,
.starel-search-overlay__product-card:focus-visible .starel-search-overlay__product-media img {
  transform: scale(1.035);
}

.starel-search-overlay__product-title {
  display: block;
  color: var(--starel-search-black);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.starel-search-overlay__product-price {
  display: block;
  margin-top: 8px;
  color: var(--starel-search-black);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}

.starel-search-overlay__product-price .starel-loop-card__price,
.starel-search-overlay__product-price .starel-loop-card__price-main,
.starel-search-overlay__product-price .starel-loop-card__price-line {
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.starel-search-overlay__product-price del {
  color: #7a7a7a;
}

.starel-search-overlay__product-price ins {
  color: inherit;
  text-decoration: none;
}

.starel-search-overlay__product-price .starel-loop-card-price {
  display: block;
  margin: 0;
  white-space: normal;
}

/* Tile and standard /m² prices should read in one inline line. */
.starel-search-overlay__product-price .starel-loop-card-price--tile,
.starel-search-overlay__product-price .starel-price-per-sqm {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  white-space: normal;
}

.starel-search-overlay__product-price .starel-loop-card-price--tile .starel-loop-card-price__row,
.starel-search-overlay__product-price .starel-price-per-sqm .starel-loop-card-price__row,
.starel-search-overlay__product-price .starel-loop-card-price--tile .starel-loop-card-price__row--sqm,
.starel-search-overlay__product-price .starel-price-per-sqm .starel-loop-card-price__row--sqm {
  display: inline;
  width: auto;
  margin: 0;
  white-space: normal;
}

/* Slab pricing intentionally stays stacked: / slab above / m². */
.starel-search-overlay__product-price .starel-loop-card-price--slab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.starel-search-overlay__product-price .starel-loop-card-price--slab .starel-loop-card-price__row,
.starel-search-overlay__product-price .starel-loop-card-price--slab .starel-loop-card-price__row--slab,
.starel-search-overlay__product-price .starel-loop-card-price--slab .starel-loop-card-price__row--sqm {
  display: block;
  width: 100%;
  margin: 0;
  white-space: normal;
}

.starel-search-overlay__loading,
.starel-search-overlay__no-results {
  display: block;
  color: var(--starel-search-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
}

.starel-search-overlay__loading {
  margin-bottom: 18px;
}

.starel-header-search-form.is-starel-search-active {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #d8d8d8;
}

@media (max-width: 1279px) {
  .starel-search-overlay__state {
    grid-template-columns: minmax(220px, var(--starel-search-sidebar-width)) minmax(0, 1fr);
    gap: 28px;
  }

  .starel-search-overlay__inner {
    padding-right: 24px;
    padding-left: var(--starel-search-inner-left);
  }

  .starel-search-overlay__feature-area,
  .starel-search-overlay__results-area {
    padding-right: 0;
  }
}

@media (max-width: 1023px) {
  :root {
    --starel-search-panel-gutter: 24px;
    --starel-search-inner-left: 16px;
    --starel-search-feature-start: 16px;
    --starel-search-sidebar-width: 100%;
  }

  .starel-search-backdrop {
    top: var(--starel-search-overlay-top);
    background: rgba(0, 0, 0, 0.22);
  }

  .starel-search-overlay {
    top: var(--starel-search-overlay-top);
    max-height: calc(100dvh - var(--starel-search-overlay-top));
    border-top: 1px solid var(--starel-search-border);
    transform: translateY(-4px);
  }

  .starel-search-overlay__inner {
    padding: 16px 16px 32px;
  }

  .starel-search-overlay__state {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .starel-search-overlay__sidebar {
    gap: 24px;
    width: 100%;
  }

  .starel-search-overlay__state--results .starel-search-overlay__results-area {
    order: 1;
  }

  .starel-search-overlay__state--results .starel-search-overlay__sidebar {
    order: 2;
  }

  .starel-search-overlay__feature-area,
  .starel-search-overlay__results-area {
    width: 100%;
    padding-right: 0;
  }

  .starel-search-overlay__feature-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .starel-search-overlay__feature-media {
    aspect-ratio: 3 / 2;
  }

  .starel-search-overlay__feature-label {
    min-height: 0;
    max-height: 32px;
    padding: 10px 0 0;
    font-size: 13px;
    overflow: hidden;
  }

  .starel-search-overlay__results-head {
    align-items: center;
    margin-bottom: 16px;
  }

  .starel-search-overlay__product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }

  .starel-search-overlay__product-title {
    font-size: 13px;
  }

  body.starel-search-is-open {
    overflow: hidden;
    padding-right: 0;
  }
}

@media (max-width: 479px) {
  .starel-search-overlay__feature-grid,
  .starel-search-overlay__product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .starel-search-overlay__heading,
  .starel-search-overlay__results-title {
    font-size: 17px !important;
  }

  .starel-search-overlay__view-all {
    font-size: 12px;
  }
}


/* ========================================
   PHASE 3 — PRODUCT SEARCH RESULTS PAGE
======================================== */

body.starel-product-search-results .woocommerce-products-header__title,
body.starel-product-search-results .page-title,
body.starel-product-search-results .elementor-widget-archive-title .elementor-heading-title,
body.starel-product-search-results .elementor-widget-theme-archive-title .elementor-heading-title {
  font-family: var(--e-global-typography-secondary-font-family, inherit);
  font-weight: 400;
  letter-spacing: 0;
  color: #111111;
}

body.starel-product-search-results .woocommerce-products-header,
body.starel-product-search-results .elementor-widget-archive-title,
body.starel-product-search-results .elementor-widget-theme-archive-title {
  margin-bottom: 32px;
}

body.starel-product-search-results .starel-header-search-input {
  color: #111111;
}

.starel-search-results-empty {
  width: 100%;
  margin: 24px 0 72px;
  padding: 0;
}

.starel-search-results-empty__inner {
  max-width: 760px;
  padding: 40px;
  border: 1px solid #e7e7e7;
  border-radius: 5px;
  background: #ffffff;
}

.starel-search-results-empty__title {
  margin: 0 0 12px;
  font-family: var(--e-global-typography-secondary-font-family, inherit);
  font-size: 32px;
  line-height: 1.1;
  font-weight: 400;
  color: #111111;
}

.starel-search-results-empty__text {
  max-width: 560px;
  margin: 0 0 24px;
  color: #555555;
  font-size: 15px;
  line-height: 1.55;
}

.starel-search-results-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.starel-search-results-empty__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 22px 10px;
  border: 1px solid #111111;
  border-radius: 5px;
  background: #111111;
  color: #ffffff !important;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none !important;
}

.starel-search-results-empty__button:hover,
.starel-search-results-empty__button:focus-visible {
  background: #ffffff;
  color: #111111 !important;
}

.starel-search-results-empty__button--secondary {
  background: #ffffff;
  color: #111111 !important;
}

.starel-search-results-empty__button--secondary:hover,
.starel-search-results-empty__button--secondary:focus-visible {
  background: #111111;
  color: #ffffff !important;
}

.starel-search-results-empty__popular {
  display: grid;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid #eeeeee;
}

.starel-search-results-empty__popular-label {
  color: #767676;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.starel-search-results-empty__popular-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.starel-search-results-empty__popular-links a {
  color: #111111;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

@media (max-width: 767px) {
  .starel-search-results-empty__inner {
    padding: 28px 20px;
  }

  .starel-search-results-empty__title {
    font-size: 26px;
  }
}

/* ========================================
   PHASE 4 v5 — MOBILE CLOSE BUTTON ALIGNMENT FIX
   Keeps the OKA-style left drawer quick-search pattern.
   v5 makes the mobile close control a plain black X aligned with the search field.
======================================== */

.starel-search-overlay__mobile-header {
  display: none;
}

@media (max-width: 1023px) {
  :root {
    --starel-search-mobile-peek: clamp(28px, 9vw, 48px);
  }

  .starel-search-backdrop {
    top: 0;
    z-index: 999998;
    background: rgba(0, 0, 0, 0.3);
  }

  .starel-search-overlay {
    top: 0;
    z-index: 999999;
    right: auto;
    bottom: 0;
    left: 0;
    width: calc(100vw - var(--starel-search-mobile-peek));
    max-width: 520px;
    height: 100dvh;
    max-height: 100dvh;
    border-top: 0;
    border-right: 1px solid var(--starel-search-border);
    background: var(--starel-search-surface);
    transform: translateX(-100%);
    transition:
      opacity 180ms ease,
      transform 260ms ease;
  }

  body.starel-search-is-open .starel-search-overlay {
    transform: translateX(0);
  }

  .starel-search-overlay__inner {
    min-height: 100%;
    padding: 0 16px 40px;
  }

  .starel-search-overlay__mobile-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 -16px 20px;
    padding: 12px 16px;
    background: var(--starel-search-surface);
    border-bottom: 1px solid var(--starel-search-border);
  }

  .starel-search-overlay__mobile-form {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0;
  }

  .starel-search-overlay__mobile-close {
    -webkit-appearance: none;
    appearance: none;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    z-index: 4;
    display: inline-flex !important;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 48px;
    min-height: 48px;
    margin: 0 !important;
    padding: 0 !important;
    color: #111111 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    cursor: pointer;
    transform: none !important;
  }

  .starel-search-overlay__mobile-close::before,
  .starel-search-overlay__mobile-close::after {
    content: none !important;
    display: none !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .starel-search-overlay__mobile-close svg {
    display: block !important;
    width: 18px;
    height: 18px;
    color: #111111 !important;
    stroke: currentColor !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: none;
  }

  .starel-search-overlay__mobile-close svg path {
    stroke: #111111 !important;
  }

  .starel-search-overlay__state {
    gap: 28px;
  }

  .starel-search-overlay__sidebar {
    gap: 28px;
  }

  .starel-search-overlay__heading,
  .starel-search-overlay__results-title {
    margin-bottom: 12px;
    font-size: 18px !important;
  }

  .starel-search-overlay__link-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    margin-right: -16px;
    padding-right: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .starel-search-overlay__link-list::-webkit-scrollbar {
    display: none;
  }

  .starel-search-overlay__link-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .starel-search-overlay__text-link {
    white-space: nowrap;
    font-size: 14px;
    line-height: 1.45;
  }

  .starel-search-overlay__state--default {
    display: flex;
    flex-direction: column;
  }

  .starel-search-overlay__state--default .starel-search-overlay__sidebar {
    order: 1;
  }

  .starel-search-overlay__state--default .starel-search-overlay__feature-area {
    order: 2;
  }

  .starel-search-overlay__feature-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .starel-search-overlay__feature-media {
    aspect-ratio: 3 / 2;
  }

  .starel-search-overlay__feature-label {
    margin-top: 12px;
    min-height: 0;
    max-height: 32px;
    padding: 0;
    letter-spacing: 0.035em;
    overflow: hidden;
  }

  .starel-search-overlay__state--results {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .starel-search-overlay__state--results .starel-search-overlay__sidebar--results {
    display: contents;
  }

  .starel-search-overlay__state--results .starel-search-overlay__section--suggestions {
    order: 1;
  }

  .starel-search-overlay__state--results .starel-search-overlay__results-area {
    order: 2;
  }

  .starel-search-overlay__state--results .starel-search-overlay__section--categories {
    order: 3;
  }

  .starel-search-overlay__state--results .starel-search-overlay__section--help {
    order: 4;
  }

  .starel-search-overlay__results-head {
    margin-bottom: 16px;
  }

  .starel-search-overlay__product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 12px;
  }

  .starel-search-overlay__product-media {
    margin-bottom: 12px;
  }

  .starel-search-overlay__product-title {
    font-size: 13px;
    line-height: 1.28;
  }

  .starel-search-overlay__product-price {
    margin-top: 6px;
    font-size: 13px;
  }

  .starel-search-overlay__loading,
  .starel-search-overlay__no-results {
    font-size: 14px;
  }
}

@media (max-width: 479px) {
  .starel-search-overlay__inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .starel-search-overlay__link-list {
    gap: 18px;
  }

  .starel-search-overlay__feature-grid {
    gap: 24px;
  }

  .starel-search-overlay__product-grid {
    gap: 18px 12px;
  }
}

/* Phase 4 v7 — mobile flyout-only search placeholder refinement */
@media (max-width: 1023px) {
  .starel-search-overlay .starel-search-overlay__mobile-input::placeholder {
    font-size: 14px;
  }

  .starel-search-overlay .starel-search-overlay__mobile-input::-webkit-input-placeholder {
    font-size: 14px;
  }
}
