/* =============================================
   PURPLE BASIL – AJAX SEARCH STYLES
   ============================================= */

/* ---------- Header search icon button ---------- */
.header-search-wrap {
  display: flex;
  align-items: center;
}

/* Mobile-only duplicate button: hidden by default on desktop */
.purple-search-mob {
  display: none !important;
}

/* ---- Mobile / Tablet (≤991px) ---- */
@media (max-width: 991px) {

  /* Show the mobile duplicate inside .top-logo */
  .purple-search-mob {
    display: flex !important;
    position: absolute;
    right: 68px;
    /* hamburger right:10px + ~34px wide + 24px gap */
    top: 8px;
    z-index: 10;
  }

  /* Hide the desktop trigger in .right-part */
  .header-search-wrap {
    display: none !important;
  }

  /* Reduce logo width so logo + search icon + hamburger all fit on one row */
  .top-logo .navbar-brand {
    max-width: 200px !important;
  }
}

.purple-search-icon-btn {
  background: #3b1f3b;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c9a8c9;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.purple-search-icon-btn:hover {
  background: #52275e;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(180, 120, 180, 0.25);
}

/* ---------- Full-page overlay ---------- */
#purple-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(25, 8, 25, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 80px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
}

#purple-search-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Close button */
.pso-close {
  position: fixed;
  top: 22px;
  right: 28px;
  background: none;
  border: none;
  color: #c9a8c9;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
  z-index: 100001;
}

.pso-close:hover {
  color: #fff;
  transform: rotate(90deg);
}

/* Overlay search input */
.pso-input-wrap {
  width: 100%;
  max-width: 680px;
  padding: 0 20px;
  position: relative;
  margin-bottom: 40px;
}

.pso-input-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(180, 120, 180, 0.5);
  color: #fff;
  font-size: 22px;
  padding: 12px 48px 12px 4px;
  outline: none;
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: border-color 0.3s;
}

.pso-input-wrap input::placeholder {
  color: rgba(200, 160, 200, 0.5);
}

.pso-input-wrap input:focus {
  border-bottom-color: #b478b4;
}

.pso-search-icon {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #b478b4;
  font-size: 22px;
  pointer-events: none;
}

/* Spinner */
.pso-spinner {
  display: none;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(180, 120, 180, 0.2);
  border-top-color: #b478b4;
  border-radius: 50%;
  animation: pso-spin 0.7s linear infinite;
  margin: 20px auto;
}

@keyframes pso-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Results container */
#purple-search-results {
  width: 100%;
  max-width: 960px;
  padding: 0 20px 60px;
  animation: pso-fadeup 0.3s ease;
}

@keyframes pso-fadeup {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Post-type group heading */
.pso-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #b478b4;
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(180, 120, 180, 0.2);
  /* span full grid width */
  grid-column: 1 / -1;
}

/* Grid wrapper that holds a group's cards */
.pso-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

/* Individual result card – horizontal tile */
.pso-result-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: #f0e6f0;
  background: rgba(180, 120, 180, 0.07);
  border: 1px solid rgba(180, 120, 180, 0.12);
  text-align: left;
  transition: background 0.2s, transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.pso-result-item:hover {
  background: rgba(180, 120, 180, 0.18);
  border-color: rgba(180, 120, 180, 0.35);
  box-shadow: 0 4px 20px rgba(180, 120, 180, 0.15);
  transform: translateY(-3px);
  color: #fff;
  text-decoration: none;
}

.pso-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(180, 120, 180, 0.15);
}

.pso-thumb-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(180, 120, 180, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b478b4;
  font-size: 24px;
}

.pso-result-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: capitalize;
}

/* No results / initial message */
.pso-no-results,
.pso-hint {
  text-align: center;
  color: rgba(200, 160, 200, 0.55);
  font-size: 15px;
  margin-top: 30px;
}

/* ---------- Responsive ---------- */

/* Tablet / small desktop */
@media (max-width: 991px) {
  .pso-input-wrap {
    max-width: 90%;
  }

  #purple-search-results {
    max-width: 90%;
  }

  .pso-results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Small tablet */
@media (max-width: 768px) {
  #purple-search-overlay {
    padding-top: 70px;
  }

  .pso-input-wrap input {
    font-size: 18px;
    padding: 10px 42px 10px 4px;
  }

  .pso-results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .pso-result-item {
    gap: 8px;
    padding: 10px 10px;
  }

  .pso-thumb,
  .pso-thumb-placeholder {
    width: 56px;
    height: 56px;
  }

  .pso-result-title {
    font-size: 14px;
  }

  .pso-group-title {
    font-size: 10px;
    letter-spacing: 1.5px;
    margin: 22px 0 10px;
  }
}

/* Mobile */
@media (max-width: 576px) {
  #purple-search-overlay {
    padding-top: 56px;
  }

  .pso-close {
    top: 14px;
    right: 16px;
    font-size: 26px;
  }

  .pso-input-wrap {
    max-width: 100%;
    padding: 0 14px;
  }

  .pso-input-wrap input {
    font-size: 16px;
    padding: 8px 38px 8px 2px;
  }

  .pso-search-icon {
    right: 18px;
    font-size: 18px;
  }

  #purple-search-results {
    max-width: 100%;
    padding: 0 14px 40px;
  }

  .pso-results-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pso-result-item {
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .pso-thumb,
  .pso-thumb-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 6px;
  }

  .pso-thumb-placeholder {
    font-size: 24px;
  }

  .pso-result-title {
    font-size: 12px;
  }

  .pso-group-title {
    font-size: 10px;
    margin: 18px 0 8px;
  }

  .pso-no-results,
  .pso-hint {
    font-size: 13px;
  }
}