/* DS Instant Search (Hybrid) */

/* Lock scroll when modal open */
body.dsis-lock {
  overflow: hidden;
}
.dsis {
  display: flex;
  justify-content: center;
  align-items: center;
}
/* Trigger (input-style bar) */
.dsis-trigger.dsis-trigger--bar {
  width: min(680px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 12px;
  cursor: text;
  color: #000 !important;
}
.dsis-trigger.dsis-trigger--bar:hover {
  background: #fafbfc;
}
.dsis-trigger-icon {
  opacity: 0.7;
}
.dsis-trigger-placeholder {
  flex: 1;
  text-align: left;
  opacity: 0.6;
  font-size: 14px;
}
.dsis-trigger-hint {
  opacity: 0.45;
  font-size: 12px;
  border: 1px solid #eef0f3;
  padding: 4px 8px;
  border-radius: 999px;
}

/* Modal */
.dsis-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}
.dsis-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}
.dsis-panel {
  position: relative;
  width: 100%;
  height: min(860px, calc(100% - 48px));
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.dsis-panel {
  width: 100%;
  height: min(860px, calc(100% - 48px));
}
/* Header */
.dsis-header {
  padding: 16px;
  border-bottom: 1px solid #eef0f3;
}
.dsis-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e5e7eb;
  padding: 12px 12px;
  border-radius: 10px;
}
.dsis-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 16px;
}
.dsis-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
}
.dsis-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
}
.dsis-chip {
  border: 0;
  background: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.8;
  color: #000;
}
.dsis-chip:hover {
  background: none;
  color: #000;
  text-decoration: underline;
  border: 0;
}
.dsis-chip--block {
  width: 100%;
  text-align: left;
}

/* HOME view (original layout) */
.dsis-home[hidden],
.dsis-resultsview[hidden] {
  display: none !important;
}

.dsis-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 18px 18px 0;
  flex: 1;
  overflow: hidden;
}

.dsis-left {
  border-right: 1px solid #eef0f3;
  padding-right: 18px;
  overflow: auto;
}

.dsis-right {
  overflow: auto;
  padding-right: 6px;
  padding-bottom: 18px;
}

.dsis-section-title {
  font-weight: 600;
  margin: 6px 0 12px;
}

.dsis-popular {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.dsis-divider {
  margin: 16px 0;
  height: 1px;
  background: #eef0f3;
}

/* Recommended cards (HOME) */
.dsis-recommended {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 14px;
}

.dsis-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.dsis-card-img {
  aspect-ratio: 4/3;
  border-bottom: 1px solid #eef0f3;
  display: grid;
  place-items: center;
  background: #fff;
}

.dsis-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dsis-card-title {
  font-size: 13px;
  padding: 10px 10px 0;
  min-height: 36px;
}

.dsis-card-meta {
  padding: 6px 10px 12px;
  font-weight: 600;
  font-size: 13px;
}

/* HOME: simple results list */
.dsis-results .dsis-hint {
  opacity: 0.65;
  padding: 12px 0;
}

.dsis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}

.dsis-result {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
}

.dsis-result:hover {
  background: #fafbfc;
}

.dsis-result-img {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.dsis-result-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dsis-result-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.dsis-result-meta {
  opacity: 0.7;
  font-size: 12px;
  margin-top: 6px;
}

/* RESULTS VIEW (facets + grid) */
.dsis-body--layer {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 16px;
  flex: 1;
  overflow: hidden;
}

/* Sidebar facets */
.dsis-sidebar {
  border-right: 1px solid #eef0f3;
  padding-right: 16px;
  min-height: 0;
  overflow: auto;
}

.dsis-facet {
  padding-bottom: 14px;
  border-bottom: 1px solid #eef0f3;
  margin-bottom: 14px;
}

.dsis-facet-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  background: transparent;
  padding: 8px 0;
  cursor: pointer;
  font-weight: 600;
}

.dsis-chevron {
  opacity: 0.6;
}

.dsis-facet-content.is-collapsed {
  display: none;
}

.dsis-hint {
  opacity: 0.65;
  padding: 10px 0;
  font-size: 13px;
}

/* Category checklist */
.dsis-checklist {
  display: grid;
  gap: 10px;
  padding: 6px 0 2px;
}

.dsis-check {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.dsis-check input {
  width: 16px;
  height: 16px;
}

.dsis-check-count {
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* Price facet */
.dsis-price {
  padding: 8px 0 2px;
}

.dsis-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.dsis-price-row--small {
  opacity: 0.6;
  font-weight: 400;
  margin-top: 6px;
}

.dsis-range {
  width: 100%;
  margin: 8px 0;
}

/* Main */
.dsis-main {
  /* turn main into a column so topbar stays fixed and results scroll */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden; /* important: the inner results will scroll */
  padding-right: 4px;
}

.dsis-topbar {
  flex: 0 0 auto; /* fixed topbar */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 00 12px;
}

.dsis-count {
  font-weight: 600;
  font-size: 13px;
  opacity: 0.9;
}

.dsis-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  opacity: 0.9;
}

.dsis-sort-select {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.dsis-results--grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;

  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 14px;
  padding-bottom: 18px;
  align-content: start;
}

.dsis-card2 {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  min-height: 260px;
}

.dsis-card2-img {
  aspect-ratio: 4/3;
  border-bottom: 1px solid #eef0f3;
  display: grid;
  place-items: center;
  background: #fff;
}

.dsis-card2-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dsis-card2-title {
  font-size: 13px;
  padding: 10px 10px 0;
  min-height: 36px;
}

.dsis-card2-meta {
  padding: 6px 10px 12px;
  font-weight: 600;
  font-size: 13px;
}

/* Placeholder */
.dsis-img-ph {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    #f3f4f6,
    #f3f4f6 10px,
    #ffffff 10px,
    #ffffff 20px
  );
}

/* Footer */
.dsis-footer {
  border-top: 1px solid #eef0f3;
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
}

.dsis-brand {
  font-size: 12px;
  opacity: 0.6;
}

/* Responsive */
@media (max-width: 1280px) {
  .dsis-results--grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }
  .dsis-recommended {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 980px) {
  .dsis-body {
    grid-template-columns: 1fr;
  }
  .dsis-left {
    border-right: none;
    border-bottom: 1px solid #eef0f3;
    padding-right: 0;
    padding-bottom: 12px;
  }

  .dsis-body--layer {
    grid-template-columns: 1fr;
  }
  .dsis-sidebar {
    border-right: none;
    border-bottom: 1px solid #eef0f3;
    padding-right: 0;
    padding-bottom: 12px;
  }

  .dsis-results--grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .dsis-grid {
    grid-template-columns: 1fr;
  }

  .dsis-recommended {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

/* ---- FIX: enable scrolling inside results area (grid/flex overflow) ---- */
.dsis-panel {
  /* already flex-column; keep */
}

/* Allow grid children to shrink so overflow:auto works */
.dsis-body,
.dsis-body--layer {
  min-height: 0;
}

/* Home view scroll columns */
.dsis-left,
.dsis-right {
  min-height: 0;
  overflow: auto;
}

/* Results view scroll columns */
.dsis-sidebar,
.dsis-main {
  min-height: 0;
  overflow: auto;
}

/* Make sure results grid doesn't expand the container */
.dsis-results--grid {
  align-content: start;
}

/* ===============================
   DSIS SCROLL FIX (v2 - final)
   =============================== */

/* Make panel a real flex column with shrinkable children */
.dsis-panel {
  display: flex;
  flex-direction: column;
  min-height: 0; /* critical */
}

/* The view wrappers must fill remaining height */
.dsis-home,
.dsis-resultsview {
  flex: 1 1 auto; /* critical */
  min-height: 0; /* critical */
  display: flex; /* so children can use flex:1 */
  flex-direction: column;
}

/* The body area inside each view fills available space */
.dsis-body,
.dsis-body--layer {
  flex: 1 1 auto; /* critical */
  min-height: 0; /* critical */
  overflow: hidden; /* keep scroll inside columns/grid */
}

/* Scrollable columns */
.dsis-left,
.dsis-right,
.dsis-sidebar {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Main results area: topbar fixed, grid scrolls */
.dsis-main {
  min-height: 0;
  overflow: hidden; /* important: don't scroll the whole main */
  display: flex;
  flex-direction: column;
}

/* The actual scrolling container for results */
.dsis-results--grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* OPTIONAL: if your theme hides scrollbars globally, force them back */
.dsis-left,
.dsis-right,
.dsis-sidebar,
.dsis-results--grid {
  scrollbar-width: auto;
  -ms-overflow-style: auto;
}
.dsis-left::-webkit-scrollbar,
.dsis-right::-webkit-scrollbar,
.dsis-sidebar::-webkit-scrollbar,
.dsis-results--grid::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
