/* ======================================
   SEARCH OVERLAY WRAPPER
====================================== */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease;
  overflow-y: auto;
}

.search-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ======================================
   INNER CONTAINER
====================================== */
.search-overlay-inner {
  max-width: 100%;
  width: 100%;
  padding: 0 20px;
}

/* ======================================
   SEARCH BAR (INPUT + CLOSE BUTTON)
====================================== */
.search-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 900px;
  margin: 40px auto 20px;
}

/* Input field */
.search-bar input#livesearch {
  flex: 1;
  padding: 12px 16px;
  font-size: 1.2rem;
  border: none;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Close button */
.search-bar .close-button {
  background: rgba(255,255,255,0.85);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}
.search-bar .close-button:hover {
  background: rgba(255,255,255,1);
  transform: scale(1.08);
}
.search-bar .close-button svg {
  width: 24px;
  height: 24px;
  stroke: #333;
}

/* ======================================
   LIVE SEARCH RESULTS GRID
====================================== */
#livesearch-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 900px;
  margin: 20px auto 0;
  justify-content: center;
}

/* Result card */
.result-item {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  overflow: hidden;
  border: 1px solid #eee;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.result-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}
.result-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.result-item div {
  padding: 10px;
}
.result-item h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}
.result-item .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.result-item .badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.result-item .badge.country {
  background: #e7ffe7;
  color: #2d6a2d;
}
.result-item .badge.type {
  background: #e6f7ff;
  color: #0077b6;
}

/* ======================================
   RESPONSIVE (MOBILE)
====================================== */
@media (max-width: 600px) {
  .search-bar {
    flex-direction: row;
    width: 95%;
    margin: 20px auto 10px;
  }
  .search-bar input#livesearch {
    font-size: 1rem;
  }
  #livesearch-results {
    max-width: 95%;
    grid-template-columns: repeat(2, 1fr);
  }
  .result-item img {
    height: 100px;
  }
}

/* ======================================
   SEARCH RESULTS PAGE (STATIC SEARCH PAGE)
====================================== */
.search-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
}
.search-filters {
  border-right: 1px solid #eee;
  padding-right: 1rem;
}
.search-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.search-card {
  display: block;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  background: #fff;
  transition: box-shadow .2s;
}
.search-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.search-card-image {
  height: 180px;
  background-size: cover;
  background-position: center;
}
.search-card-info {
  padding: 1rem;
}
.search-card-title {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #222;
}
.search-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search-card-badges .badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: #eee;
  color: #444;
  white-space: nowrap;
}
.search-card-badges .badge.country {
  background: #e7ffe7;
  color: #2d6a2d;
}
.search-card-badges .badge.type {
  background: #e6f7ff;
  color: #0077b6;
}
@media (max-width: 1024px) {
  .search-card {
    flex-basis: calc(50% - 20px);
    max-width: calc(50% - 20px);
  }
}
@media (max-width: 600px) {
  .search-card {
    flex-basis: 100%;
    max-width: 100%;
  }
}

/* ======================================
   LOADING & FILTER SIDEBAR
====================================== */
.initial-load {
  opacity: 1;
  transition: opacity 0.3s ease, height 0.3s ease;
}
.facetwp-template:not(:empty) + .initial-load {
  opacity: 0;
  height: 0;
  overflow: hidden;
}
.facetwp-template .loading {
  font-size: 1.2em;
  text-align: center;
  color: #555;
  padding: 40px 0;
}
.facetwp-loading .loading::after {
  content: " ⏳";
  animation: blink 1s infinite;
}
@keyframes blink {
  50% { opacity: 0.5; }
}

/* Tooltip for filter hint */
.search-results-page.filter-page-wrapper {
  padding: 2rem 1rem;
  max-width: 1440px;
  margin: 0 auto;
}
.search-results-page .filter-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
}
.search-results-page .filter-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.search-results-page .search-results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.search-results-page .search-results h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.search-results-page .facetwp-pagination {
  margin-top: 2rem;
  text-align: center;
}
@media (max-width: 1024px) {
  .search-results-page .filter-grid {
    grid-template-columns: 1fr;
  }
  .search-results-page .filter-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: #fff;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease-in-out;
    z-index: 1000;
  }
  .search-results-page .filter-sidebar.active {
    left: 0;
  }
  .search-results-page #filter-overlay.active {
    display: block;
  }
}

/* Tooltip bubble */
.search-results-page .filter-tooltip {
  position: fixed;
  bottom: 85px;
  left: 15px;
  background: #ff5722;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  z-index: 9999;
  animation: fadeOut 6s ease-in forwards;
}

/* ======================================
   HEADER BLUR DISABLE WHEN SEARCH ACTIVE
====================================== */
body.search-open .site-header {
  background: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ======================================
   ASP (Ajax Search Pro) SEARCH FIXES
====================================== */
.search-overlay .asp_w_container {
  position: relative !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 99999 !important;
  max-width: 100% !important;
  margin: 0 auto !important;
}
.search-overlay .asp_main_container {
  position: relative !important;
  z-index: 99999 !important;
}
.search-overlay .asp_s {
  background: white !important;
  color: #333 !important;
}
.search-overlay .probox {
  max-width: 600px;
  margin: 0 auto;
}
.search-overlay .asp_main_container,
.search-overlay .asp_w_container {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}