/* ── Custom properties ── */
:root {
  --eh-overlay-z: 99999;
  --eh-panel-w-filter: 280px;
  --eh-color-primary: #00a99d;
  --eh-color-chip-bg: #f5f5f5;
  --eh-color-chip-active: #e0f7f5;
  --eh-color-chip-active-border: var(--eh-color-primary);
  --eh-color-text: #1a1a1a;
  --eh-color-muted: #666;
  --eh-radius: 8px;
  --eh-shadow: 0 8px 40px rgba(0,0,0,.18);
  --eh-transition: 200ms ease;
}

/* ── Backdrop ── */
.eh-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--eh-overlay-z);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.eh-overlay[hidden] { display: none; }

.eh-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  cursor: pointer;
}

/* ── Panel ── */
.eh-overlay__panel {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 92vh;
  margin-top: 4vh;
  background: #fff;
  border-radius: var(--eh-radius);
  box-shadow: var(--eh-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: eh-slide-in var(--eh-transition);
}
@keyframes eh-slide-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.eh-overlay__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.eh-overlay__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--eh-color-text);
  background: transparent;
}
.eh-overlay__close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--eh-color-muted);
  padding: 4px 8px;
  line-height: 1;
}

/* ── Body ── */
.eh-overlay__body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Filter Panel ── */
.eh-filter-panel {
  width: var(--eh-panel-w-filter);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.eh-filter-group__label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--eh-color-muted);
  margin: 0 0 8px;
}

.eh-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.eh-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--eh-color-chip-bg);
  border: 1.5px solid transparent;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--eh-transition);
  user-select: none;
}
.eh-chip input[type="checkbox"],
.eh-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.eh-chip:has(input:checked) {
  background: var(--eh-color-chip-active);
  border-color: var(--eh-color-chip-active-border);
  color: var(--eh-color-primary);
  font-weight: 600;
}
.eh-chip--sub { font-size: 12px; }

.eh-chip-list__more {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--eh-color-primary);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
}

.eh-sub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--eh-color-chip-active-border);
}

/* Secondary collapsible */
.eh-filter-secondary summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--eh-color-primary);
  list-style: none;
  padding: 6px 0;
}
.eh-filter-secondary summary::-webkit-details-marker { display: none; }
.eh-filter-secondary > div { margin-top: 14px; }

/* Price range — dual-handle slider */
.eh-price-range { display: flex; flex-direction: column; gap: 10px; }
.eh-price-range__slider { position: relative; height: 20px; margin: 4px 0; }
.eh-price-range__track {
  position: absolute; top: 50%; left: 0; right: 0;
  height: 4px; background: var(--eh-color-border, #e2e2e2);
  border-radius: 2px; transform: translateY(-50%);
}
.eh-price-range__fill {
  position: absolute; height: 100%;
  background: var(--eh-color-primary); border-radius: 2px;
}
.eh-price-range__slider input[type="range"] {
  position: absolute; width: 100%; top: 50%; transform: translateY(-50%);
  -webkit-appearance: none; appearance: none;
  background: transparent; pointer-events: none; margin: 0; padding: 0;
}
.eh-price-range__slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--eh-color-primary);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer; pointer-events: all;
}
.eh-price-range__slider input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--eh-color-primary); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: pointer; pointer-events: all;
}
.eh-price-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--eh-color-muted); }

/* Mobile filter toggle — hidden on desktop */
.eh-filter-panel__mobile-close { display: none; }
.eh-mobile-filter-btn { display: none; }

/* ── Results Panel ── */
.eh-results-panel {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* ── Tabs ── */
.eh-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 2px solid #eee;
  flex-shrink: 0;
  padding: 0 16px;
  scrollbar-width: none;
}
.eh-tabs::-webkit-scrollbar { display: none; }
.eh-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--eh-color-muted);
  transition: var(--eh-transition);
}
.eh-tab.is-active {
  color: var(--eh-color-primary);
  border-bottom-color: var(--eh-color-primary);
  font-weight: 700;
}
.eh-tab[disabled] { opacity: .4; cursor: default; }
.eh-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--eh-color-chip-bg);
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}

/* ── Results ── */
.eh-results {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}
.eh-results__hint { color: var(--eh-color-muted); font-size: 14px; text-align: center; margin-top: 40px; }
.eh-results__section-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--eh-color-muted); margin: 20px 0 8px; }
.eh-results__section-heading:first-child { margin-top: 0; }

.eh-result-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; text-decoration: none; color: inherit; }
.eh-result-item:last-child { border-bottom: none; }
.eh-result-item__thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #f5f5f5; }
.eh-result-item__body { flex: 1; min-width: 0; }
.eh-result-item__title { font-size: 14px; font-weight: 600; margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eh-result-item__meta { font-size: 12px; color: var(--eh-color-muted); }
.eh-result-item__price { font-size: 13px; font-weight: 700; color: var(--eh-color-primary); margin-top: 2px; }

.eh-results__empty { color: var(--eh-color-muted); font-size: 14px; text-align: center; padding: 40px 16px; }

/* ── Fallback ── */
.eh-fallback { padding: 24px 16px; border-top: 1px solid #eee; }
.eh-fallback__heading { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.eh-fallback__body { font-size: 14px; color: var(--eh-color-muted); margin: 0 0 16px; }
.eh-fallback__cta { display: flex; gap: 10px; flex-wrap: wrap; }
.eh-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.eh-btn--primary { background: var(--eh-color-primary); color: #fff; }
.eh-btn--wa { background: #25d366; color: #fff; }
.eh-fallback__suggestions { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.eh-fallback-suggestion-group__label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--eh-color-muted); margin: 0 0 8px; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .eh-overlay__panel { max-width: 100%; margin: 0; max-height: 100vh; border-radius: 0; }
  .eh-overlay__body { flex-direction: column; }

  .eh-filter-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 80vh;
    width: 100%;
    border-right: none;
    border-top: 1px solid #eee;
    border-radius: 16px 16px 0 0;
    box-shadow: var(--eh-shadow);
    background: #fff;
    z-index: calc(var(--eh-overlay-z) + 1);
    transform: translateY(100%);
    transition: transform var(--eh-transition);
    overflow-y: auto;
  }
  .eh-filter-panel.is-open { transform: translateY(0); }
  .eh-filter-panel__mobile-close {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--eh-color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
  }
  .eh-mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--eh-color-chip-bg);
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    margin: 10px 16px;
    align-self: flex-start;
  }
}
