/* ==========================================================================
   Search results page (search.html)
   Handles both the postcode/text search results and the SSR'd category +
   location landing pages that share this same template.
   ========================================================================== */

/* height/display/flex-direction and .footer's sticky-footer treatment
   now live site-wide in style.css -- max-width here is a page-specific
   horizontal-overflow guard, unrelated to that. */
html,
body {
  max-width: 100vw;
}

/* ==========================================================================
   SEO intro (SSR'd H1/paragraphs in the blue strip)
   ========================================================================== */
.seo-intro {
  max-width: 1100px;
  margin: 18px auto 10px auto;
  padding: 0 16px;
  position: relative;
  z-index: 2;
}

.seo-intro h1 {
  color: #fff;
  font-size: 28px;
  margin: 0 0 10px 0;
  line-height: 1.2;
}

.seo-intro p {
  margin: 0 0 10px 0;
  line-height: 1.6;
}

#seoP1,
#seoP2 {
  line-height: 1.2;
  text-align: left;
}

#seoP1 {
  margin: 0 0 10px;
}

#seoP2 {
  margin: 0;
}

.category-heading-h2 {
  position: relative;
  color: #ffffff;
}

.search-bar-container {
  max-width: 900px;
  margin: 0 auto;
}

.search-input-wrapper {
  position: relative;
  flex: 2;
  min-width: 300px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* input[type="text"] in style.css (element+attribute selector) outranks a
   plain .search-input class, so it was silently winning here -- collapsing
   left padding down to var(--space-3) (12px) and radius down to
   var(--radius-sm) (6px), which put typed text right under the icon and
   flattened the intended pill shape. Scoped under the wrapper for enough
   specificity to actually win. */
.search-input-wrapper .search-input {
  width: 100%;
  padding: 10px 35px;
  border-radius: var(--radius-full);
  border: none;
}

#clear-search {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  display: none;
  padding: 10px;
  touch-action: manipulation;
}

#clear-search img {
  width: 28px;
  height: 28px;
  display: block;
}

.seo-intro .hint {
  font-size: 14px;
  opacity: 0.75;
}

.about-section {
  background: linear-gradient(180deg, #d6e4ffb5 80%, #ffffff 100%);
  color: var(--text-body);
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  z-index: 2;
}

/* Section title (category/location heading in the blue strip) */
#category-heading,
#seoH1 {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.75px;
  margin-bottom: 1.5rem;
  line-height: 1.2;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
  background: linear-gradient(45deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  color: #fff;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  text-align: center;
}

@media (max-width: 768px) {
  #category-heading,
  #seoH1 {
    font-size: 2rem;
  }

  #seo-block {
    margin-left: 30px;
  }
}

.mobile-h1-break {
  display: none;
}

@media (max-width: 768px) {
  .mobile-h1-break {
    display: block;
  }
}

/* ==========================================================================
   Home button (mobile navbar)
   ========================================================================== */
.home-btn {
  width: 56px;
  height: 56px;
  background: #dedfe0;
  border-radius: 50%;
  color: #000;
  text-decoration: none;
  margin-left: -5px;
  transition: all 0.2s ease;
}

.home-btn:hover {
  background-color: #e9ecef;
  color: #000;
  transform: scale(1.05);
}

.home-btn:active {
  transform: scale(0.95);
}

.home-btn i {
  font-size: 1.5rem;
  line-height: 1;
}

.home-text {
  font-size: 10px;
  line-height: 1;
  margin-top: 2px;
  color: #1f2937;
}

/* ==========================================================================
   Results container
   ========================================================================== */
#results-container {
  overflow-anchor: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 -1rem;
}

.results-container1,
#results-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

#results-container::after {
  content: "";
  display: block;
  height: 50px;
}

.no-results {
  text-align: center;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 2rem;
}

.result-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-align: center;
}

/* Google Places Autocomplete isn't used on this page's search input --
   suppress the dropdown it otherwise injects. */
.pac-container {
  position: relative;
  display: none !important;
}

/* ==========================================================================
   Result cards
   ========================================================================== */
.result-card-modern {
  margin-bottom: 10px !important;
  display: flex;
  flex-direction: row;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
  width: auto;
}

.result-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

@media (min-width: 992px) {
  .result-card-modern {
    width: 990px;
    flex: 0 0 auto;
    margin: 12px;
  }

  #results-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .result-card-modern {
    width: 100%;
    flex: 1 1 auto;
    margin: 0;
    flex-direction: column;
  }

  .card-center {
    padding: 10px 8px;
  }

  .card-right {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ---- Image / logo badge ---- */
.card-image {
  flex: 0 0 45%;
  height: 250px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  min-height: 120px;
  font-size: 5rem;
  overflow: hidden;
}

@media (max-width: 768px) {
  .card-image {
    flex: 0 0 auto;
    width: 100%;
    height: 240px;
  }
}

.card-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.logo-badge {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 60px;
  background: #fff;
  border-radius: 0 0 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

.logo-badge img {
  object-fit: contain;
}

/* ---- Info section ---- */
.card-center {
  flex: 1 1 70%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title  title"
    "type   type"
    "google google"
    "pill   pill"
    "desc   desc"
    "addr   addr"
    "dist   dist"
    "posted posted";
  column-gap: 14px;
  row-gap: 6px;
  align-items: start;
  padding: 12px 16px 0 16px;
  position: relative;
}

.card-name-type {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.result-title-modern {
  grid-area: title;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  margin-left: -2px;
  font-weight: 600;
  letter-spacing: -0.5px;
  font-size: 1.6rem;
  color: var(--dark);
}

.result-type-modern {
  grid-area: type;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.result-services-modern {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-distance-modern {
  font-size: 1.1rem;
}

.category-pill {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.needshelp-label {
  font-size: 0.9rem;
  color: var(--text-body);
  font-weight: 500;
}

.needshelp-category {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 600;
}

.needshelp-looking-line {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  white-space: nowrap;
}

.needshelp-looking-line .needshelp-category {
  white-space: nowrap;
}

@media (max-width: 420px) {
  .needshelp-looking-line {
    white-space: normal;
    flex-wrap: wrap;
  }

  .needshelp-looking-line .needshelp-category {
    white-space: nowrap;
  }
}

.result-desc-modern {
  grid-area: desc;
  color: var(--text-body);
  font-size: 0.92rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .result-desc-modern {
    margin-bottom: 15px;
  }
}

.result-address-modern {
  grid-area: addr;
  font-size: 1rem;
  line-height: 1.15;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  align-self: end;
}

.result-distance-only {
  grid-area: dist;
  font-size: 0.78rem;
  line-height: 1.1;
  opacity: 0.85;
}

.result-posted-age {
  grid-area: posted;
  font-size: 0.78rem;
  line-height: 1.1;
  color: var(--text-muted);
  opacity: 0.95;
  margin-top: 2px;
}

.result-contact-modern {
  font-size: 0.85rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* "Reviews & photos on Google" trust line */
.card-google-inline {
  margin-left: -3px;
}

/* ---- Status pill ---- */
.status-pill {
  grid-area: pill;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #f2f5f952;
  width: fit-content;
  max-width: 100%;
  white-space: normal;
}

.status-pill span:first-child {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
}

.status-pill span:nth-child(2) {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

.status-pill span:nth-child(3) {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}

@media (max-width: 768px) {
  .status-pill {
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
  }
}

/* ---- "Live" pill ---- */
.live-pill {
  font-size: 0.85rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
  line-height: 1;
}

.live-pill > span:last-child {
  line-height: 1.2;
}

.live-dot {
  margin-left: 4px;
  width: 10px;
  height: 10px;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  background: var(--cta-green);
  position: relative;
  display: inline-block;
  flex: 0 0 10px;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: livePulse 1.8s infinite ease-out;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.35);
  animation: liveRipple 1.8s infinite ease-out;
}

@keyframes livePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

@keyframes liveRipple {
  0% {
    transform: scale(1);
    opacity: 0.65;
  }
  70% {
    transform: scale(2.2);
    opacity: 0;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* ---- Bottom row (map button etc.) ---- */
.card-right {
  margin-top: 0.75rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---- Image slider (multi-image cards) ---- */
.card-img-slider {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.card-img-slider-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.25s ease;
}

.card-img-slide {
  min-width: 100%;
  height: 100%;
  flex: 0 0 100%;
}

.card-slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 72px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.card-slider-prev {
  left: 4px;
}

.card-slider-next {
  right: 4px;
}

.card-slider-arrow:hover {
  background: rgba(0, 0, 0, 0.7);
}

@media (hover: none) {
  .card-slider-arrow {
    opacity: 0.85;
  }
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
}

.results-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.pagination-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 8px 15px;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.3s;
}

.pagination-btn:disabled {
  background-color: var(--border-color);
  cursor: not-allowed;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--primary-dark);
}

/* ==========================================================================
   Sort dropdown (currently hidden, kept for a future sort feature)
   ========================================================================== */
.sorter-wrapper {
  display: none;
  justify-content: center;
  align-items: center;
  margin-left: -2rem;
}

.sorter-wrapper label {
  margin-right: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--dark);
}

#sortSelect {
  padding: 4px 12px;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--primary);
  background-color: #fff;
  color: var(--dark);
  cursor: pointer;
  min-width: 140px;
  transition: all 0.2s ease-in-out;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

#sortSelect:hover,
#sortSelect:focus {
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
  outline: none;
}

#seoBullets {
  font-size: 1rem;
}

@media (max-width: 768px) {
  #seoBullets {
    font-size: 0.8rem;
  }
}

/* Slightly darker BT-postcode pill tray than the shared style.css default,
   to stand out against this page's lighter background gradient. */
.bt-grid {
  border: none !important;
  background: linear-gradient(to bottom, #a9aec6, #dfdfdf) !important;
}

/* ==========================================================================
   Filters & search buttons (hero blue strip)
   ========================================================================== */
.about-heading-strip {
  width: 100%;
  margin: 0;
  padding: 3rem 0;
  text-align: center;
  color: #fff;
  background:
    linear-gradient(rgb(0 0 0 / 77%), rgb(0 0 0 / 27%)),
    url(/img/hw.jpg) center center / cover no-repeat;
}

.about-heading-strip .highlight {
  font-family: "Stapel", sans-serif;
  font-weight: 700;
  color: #ffffff;
}

@media (max-width: 768px) {
  .about-heading-strip {
    background-position: 25% center;
    padding: 4rem 0;
  }
}

.filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#type-select {
  flex: 1 1 auto;
  min-width: 120px;
  max-width: 250px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--surface-alt);
  font-size: 0.9rem;
  box-sizing: border-box;
}

#buttons-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
  z-index: 2;
}

#search-list-btn,
#search-map-btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  padding: 12px 20px;
  flex: 0 1 auto;
}

#search-list-btn {
  background: var(--cta-green-dark);
  color: #fff;
  border: 1px solid #ffffffcc;
  padding: 0 50px;
  font-size: 1.3rem;
}

#search-list-btn:hover {
  background: linear-gradient(135deg, var(--cta-green), var(--cta-green-dark));
}

#search-map-btn {
  background: var(--dark);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

#search-map-btn:hover {
  background: rgba(23, 34, 77, 0.9);
}

#search-map-btn .map-icon {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-image: url("/img/mh_map.png");
  background-repeat: no-repeat;
  background-size: 220px 220px;
  background-position: center;
  vertical-align: middle;
  margin-right: 6px;
}

@media (max-width: 768px) {
  #buttons-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  #search-list-btn,
  #search-map-btn {
    width: 100%;
    max-width: 100%;
    padding: 6px 0;
  }
}
