/* ==========================================================================
   DanielsHawaii Filter — mobile-first
   ========================================================================== */

/* ── Wrapper ────────────────────────────────────────────────────────────── */
.dh-filter-wrap,
.dh-filter {
  width: 100%;
  box-sizing: border-box;
}

.dh-filter-wrap {
  position: relative;
  top: 0;
}

/* Remove Elementor padding anywhere the filter lives (header templates nest deeply) */
.elementor-element-populated:has(.dh-filter-wrap),
.elementor-widget-container:has(.dh-filter-wrap) {
  padding: 0 !important;
}

/* ── Sticky header (logo + search) ─────────────────────────────────────── */
.dh-filter__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  transition: box-shadow .2s ease;
}

/* Shadow appears when header is "stuck" to the top (toggled via JS) */
.dh-filter__header.is-stuck {
  box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}

/* ── Logo ───────────────────────────────────────────────────────────────── */
.dh-filter__logo {
  flex-shrink: 0;
}

.dh-filter__logo img {
  display: block;
  max-height: 32px;
  width: auto;
}

/* ── Search field ───────────────────────────────────────────────────────── */
.dh-filter__search {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

.dh-filter__search::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  pointer-events: none;
}

/* ── Custom search shortcode (.dh-inline-search) inside the filter ──────── */
/* Hide our CSS icon — the shortcode has its own button */
.dh-filter__search:has(.dh-inline-search)::before {
  display: none;
}

/* Make the shortcode fill the search slot and match filter styling */
.dh-filter__search .dh-inline-search {
  position: relative;
  width: 100%;
  display: block;
}

.dh-filter__search .dh-inline-search-input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 44px 0 14px; /* right room for search button */
  border: 1.5px solid rgba(0, 0, 0, .14);
  border-radius: 10px;
  font-size: .88rem;
  font-family: inherit;
  background: #f6f6f6;
  color: #111;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, background .15s;
}

.dh-filter__search .dh-inline-search-input:focus {
  outline: none;
  border-color: #0b7fc2;
  background: #fff;
}

.dh-filter__search .dh-inline-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dh-filter__search-input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 14px 0 38px;
  border: 1.5px solid rgba(0, 0, 0, .14);
  border-radius: 10px;
  font-size: .88rem;
  font-family: inherit;
  background: #f6f6f6;
  color: #111;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, background .15s;
}

.dh-filter__search-input:focus {
  outline: none;
  border-color: #0b7fc2;
  background: #fff;
}

/* ── Chips row ──────────────────────────────────────────────────────────── */
.dh-filter__chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 0 32px 10px 12px; /* extra right padding so last chip clears fade */
  overflow-x: auto;
  scrollbar-width: none;
  /* Fade-out hint at right edge */
  -webkit-mask-image: linear-gradient(to right, #000 80%, transparent 98%);
  mask-image: linear-gradient(to right, #000 80%, transparent 98%);
}

.dh-filter__chips::-webkit-scrollbar {
  display: none;
}

/* ── Chip button / link ─────────────────────────────────────────────────── */
.dh-chip,
.dh-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border: 1.5px solid rgba(0, 0, 0, .15);
  border-radius: 999px;
  background: #fff;
  font-size: .84rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  color: #222;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}

.dh-chip.is-active {
  background: #0b7fc2;
  color: #fff;
  border-color: #0b7fc2;
}

.dh-chip:hover {
  background: #0b7fc2;
  color: #fff;
  border-color: #0b7fc2;
}

.dh-chip:focus-visible,
.dh-reset:focus-visible {
  outline: 2px solid #0b7fc2;
  outline-offset: 2px;
}

/* ── Reset link ─────────────────────────────────────────────────────────── */
.dh-reset {
  border-color: transparent;
  color: #666;
  font-weight: 500;
  padding-left: 8px;
  padding-right: 4px;
}

.dh-reset:hover {
  background: transparent;
  color: #0b7fc2;
  border-color: transparent;
}

/* ── Island + price chips row — dark blue nav style ────────────────────── */
.dh-filter__chips--islands,
.dh-filter__chips--prices {
  background: #003459;
  padding: 10px 12px 10px 12px;
  margin: 0 0 10px;
  border-radius: 0 0 15px 15px;
  -webkit-mask-image: none;
  mask-image: none;
  /* overflow-x: auto inherited from .dh-filter__chips; clip only vertically for collapse */
  overflow-x: auto;
  overflow-y: hidden;
  /* Collapse animation */
  max-height: 120px;
  opacity: 1;
  transition: max-height .3s ease, opacity .25s ease, padding .3s ease, margin .3s ease;
}

.dh-filter__chips--islands.is-collapsed,
.dh-filter__chips--prices.is-collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.dh-filter__chips--islands .dh-chip,
.dh-filter__chips--prices .dh-chip {
  background: rgba(255, 255, 255, .15);
  border-color: transparent;
  color: #fff;
}

.dh-filter__chips--islands .dh-chip.is-active,
.dh-filter__chips--islands .dh-chip:hover,
.dh-filter__chips--prices .dh-chip.is-active,
.dh-filter__chips--prices .dh-chip:hover {
  background: rgba(255, 255, 255, .35);
  border-color: transparent;
  color: #fff;
}

/* ── Loading state ──────────────────────────────────────────────────────── */
.dh-filter-wrap.is-loading .dh-filter__chips {
  opacity: .55;
  pointer-events: none;
  transition: opacity .18s ease;
}

.dh-filter-wrap.is-loading .dh-filter__search-input {
  opacity: .6;
  pointer-events: none;
}

.dh-filter-wrap.is-loading .dh-filter__search::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, .15);
  border-top-color: #0b7fc2;
  border-radius: 50%;
  animation: dh-spin .7s linear infinite;
}

@keyframes dh-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* Remove fade mask from chips row when header is in fixed/stuck mode
   (the overflow context changes and the gradient can bleed) */
.dh-filter__header.is-stuck + .dh-filter__chips,
.dh-filter-wrap .dh-filter__chips:only-child {
  -webkit-mask-image: none;
  mask-image: none;
}

/* ── Desktop ─────────────────────────────────────────────────────────────── */
@media (min-width: 641px) {
  .dh-filter__header {
    padding: 10px 16px;
    gap: 10px;
  }

  .dh-filter__logo img {
    max-height: 38px;
  }

  .dh-filter__search-input {
    min-height: 44px;
    font-size: .95rem;
  }

  /* Allow chips to wrap on desktop so reset button can sit at the end */
  .dh-filter__chips {
    flex-wrap: wrap;
    overflow-x: visible;
    padding: 0 16px 12px;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .dh-filter__chips--islands,
  .dh-filter__chips--prices {
    margin: 0 0 12px;
    padding: 10px 16px;
    max-height: 120px;
  }

  .dh-chip,
  .dh-reset {
    font-size: .875rem;
    padding: 8px 18px;
    min-height: 40px;
  }

  .dh-reset {
    margin-left: auto;
    padding-left: 8px;
    padding-right: 4px;
  }
}
