/* =====================
   Wrapper Layout
   ===================== */
.custom-search-listing-wrapper {
  display: flex; /* default */
  gap: 20px;
  align-items: flex-start;
  box-sizing: border-box;
  width: 100%;
}
.custom-search-listing-wrapper.sidebar-left { flex-direction: row; }
.custom-search-listing-wrapper.sidebar-right { flex-direction: row-reverse; }
.custom-search-listing-wrapper.sidebar-top { flex-direction: column; }

.custom-search-listing-wrapper.layout-flex {
  display: flex;
}
.custom-search-listing-wrapper.layout-grid {
  display: grid;
}

/* Flexbox utility classes (applied via Elementor controls) */
.custom-search-listing-wrapper.justify-flex-start { justify-content: flex-start; }
.custom-search-listing-wrapper.justify-center { justify-content: center; }
.custom-search-listing-wrapper.justify-flex-end { justify-content: flex-end; }
.custom-search-listing-wrapper.justify-space-between { justify-content: space-between; }
.custom-search-listing-wrapper.justify-space-around { justify-content: space-around; }
.custom-search-listing-wrapper.justify-space-evenly { justify-content: space-evenly; }

.custom-search-listing-wrapper.align-flex-start { align-items: flex-start; }
.custom-search-listing-wrapper.align-center { align-items: center; }
.custom-search-listing-wrapper.align-flex-end { align-items: flex-end; }
.custom-search-listing-wrapper.align-stretch { align-items: stretch; }

.custom-search-listing-wrapper.wrap-nowrap { flex-wrap: nowrap; }
.custom-search-listing-wrapper.wrap-wrap { flex-wrap: wrap; }

/* =====================
   Sidebar
   ===================== */
.custom-search-listing-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 0 0 auto;
  box-sizing: border-box;
  background: #fff;
  border: none;
  border-radius: 5px;
}

/* First Container */
.custom-search-listing-sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 4px;
  padding: 25px;
  padding-top: 0;
}

/* Second Container */
.custom-search-listing-sidebar-extra {
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 4px;
  padding: 10px;
}

/* =====================
   Heading
   ===================== */
.custom-search-listing-search-heading {
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
}

/* =====================
   Search
   ===================== */
.custom-search-listing-search {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.custom-search-listing-search .custom-search-listing-input {
  flex: 1;
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}
.custom-search-listing-search .custom-search-listing-input:focus {
  border-color: #0073aa;
}

/* Input with icon inside */
.custom-input-icon-wrap {
  position: relative;
  width: 100%;
}
.custom-input-icon-wrap .custom-search-listing-input {
  width: 100%;
  padding-right: 44px;
}
.custom-input-icon-wrap .custom-search-input-icon {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 6px;
  line-height: 1;
  cursor: pointer;
}

/* External search button */
.custom-search-listing-search .custom-search-listing-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: #0073aa;
  color: #fff;
  transition: all .2s ease;
}
.custom-search-listing-search .custom-search-listing-search-btn:hover {
  background: #005f8d;
}

/* Icon wrappers */
.custom-search-listing-btn-icon,
.custom-search-input-icon .elementor-icon,
.custom-search-input-icon svg {
  display: inline-block;
  vertical-align: middle;
}

/* =====================
   Categories
   ===================== */
.custom-search-listing-cats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.custom-search-listing-cats.horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}
.custom-search-listing-cats a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all .15s ease;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
}

/* =====================
   Results Grid
   ===================== */
.custom-search-listing-results {
  flex: 1 1 auto;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}
.custom-search-listing-item {
  box-sizing: border-box;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.custom-search-listing-item > .elementor,
.custom-search-listing-item > .elementor-section,
.custom-search-listing-item > .elementor-column,
.custom-search-listing-item > .elementor-widget {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* =====================
   Pagination + Load More
   ===================== */
/* Always span full grid and center below items */
.custom-search-listing-pagination,
.custom-search-listing-loadmore-wrap,
.custom-search-listing-prevnext,
.custom-search-listing-pagination-dots {
  grid-column: 1 / -1;
  justify-self: center;
  text-align: center;
  margin-top: 10px;
}

.custom-search-listing-pagination ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.custom-search-listing-loadmore-wrap {
  display: flex;
  justify-content: center; /* default center */
  grid-column: 1 / -1; /* span full grid width */
  margin-top: 20px;
}

.custom-search-listing-loadmore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--loadmore-gap, 0.5rem); /* controlled by Elementor */
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  line-height: 1;
}

/* Ensure elementor icon holding element and SVG scale correctly */
.custom-search-listing-loadmore .elementor-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  width: 15px;
  height: 15px;
}

/* Make pagination blocks span the full results grid and center properly */
.custom-search-listing-pagination,
.custom-search-listing-loadmore-wrap,
.custom-search-listing-prevnext,
.custom-search-listing-pagination-dots {
  grid-column: 1 / -1;
  justify-self: center;
  text-align: center;
  margin-top: 10px;
}

/* Center the <ul> for numbered pagination */
.custom-search-listing-pagination ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

/* Hover states (basic) - elementor-controlled colors will override */
.custom-search-listing-pagination li a:hover,
.custom-search-listing-loadmore:hover {
  opacity: 0.95;
}

/* Icon sizing selectors will be populated by control selectors, but include safe defaults */
.custom-search-listing-loadmore .elementor-icon { font-size: 1rem; }
.custom-search-listing-loadmore .elementor-icon svg { width: 1rem; height: 1rem; }



/* =====================
   Loading State
   ===================== */
.custom-search-listing-loading .custom-search-listing-results {
  opacity: 0.6;
  pointer-events: none;
}

/* Masonry layout (if enabled) */
.custom-search-listing-results.masonry {
  display: masonry;
}

/* Equal Height items */
.custom-search-listing-results.equal-height > .custom-search-listing-item {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Ensure child content stretches so items align bottoms */
.custom-search-listing-item .listing-fallback {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* =====================
   Responsive Layout
   ===================== */

/* Large tablets and small desktops (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  .custom-search-listing-wrapper {
    flex-direction: column !important;
    gap: 15px;
  }
  .custom-search-listing-sidebar {
    width: 100% !important;
    flex: none !important;
  }
  .custom-search-listing-results {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px;
  }
}

/* Small tablets (768px and below) */
@media (max-width: 768px) {
  .custom-search-listing-wrapper {
    flex-direction: column !important;
    gap: 15px;
  }
  .custom-search-listing-sidebar {
    width: 100% !important;
    flex: none !important;
  }
  .custom-search-listing-results {
    grid-template-columns: repeat(1, 1fr) !important;
  }
  .custom-search-listing-sidebar-extra {
    display: none !important;
  }
}

/* Mobile devices (480px and below) */
@media (max-width: 480px) {
  .custom-search-listing-wrapper {
    flex-direction: column !important;
    gap: 10px;
  }
  .custom-search-listing-sidebar {
    width: 100% !important;
  }
  .custom-search-listing-results {
    grid-template-columns: repeat(1, 1fr) !important;
    gap: 10px;
  }
  .custom-search-listing-sidebar-top {
    padding: 15px;
  }
}
