/*
 * The dog and cat listing pages (views/species-listings.php): hero stats,
 * filter form, breed chips, results header and grid, skeletons, empty state.
 * Linked from the <head> by the page ($boPageStylesheets).
 */
/* Hero Stats Inline */
.hero-stats-inline {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

.hero-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.hero-stat-item i {
  color: var(--primary);
  font-size: var(--text-lg);
}

/* Form Row */
.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-group-half {
  flex: 1;
}

/* Breeds Bar */
.breeds-bar {
  padding: var(--space-lg) 0;
  background: var(--primary-dark);
  overflow: hidden;
}

.breeds-bar-header {
  display: none;
}

.breeds-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.breeds-chips::-webkit-scrollbar {
  display: none;
}

.breed-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.breed-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.breed-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.breed-chip-link {
  text-decoration: none;
  color: #ffffff;
  background: transparent;
  border-color: #ffffff;
}

.breed-chip-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: #ffffff;
}

/* Results Header */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.results-info h2 {
  margin-bottom: var(--space-xs);
}

.results-info p {
  color: var(--text-muted);
  margin: 0;
}

.result-count.is-loading {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.result-count.is-loading::before {
  content: '';
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--primary);
  animation: loadingPulse 1s ease-in-out infinite;
}

#searchresults.is-loading {
  min-height: 420px;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.results-sort {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.results-sort label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.form-select-sm {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  /* 16px: anything smaller makes iPhones zoom in when the field is tapped. */
  font-size: 1rem;
}

/* No results: the box spans the grid and offers ways on. */
.listing-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
}

.listing-empty-state > .bi {
  display: block;
  font-size: 3rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.listing-empty-state p {
  color: var(--text-muted);
  max-width: 34rem;
  margin: 0 auto var(--space-lg);
}

.listing-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

/* Long breed names ("Read the Cavalier King Charles Spaniel guide") wrap
   instead of widening the page on phones. */
.listing-empty-actions .btn {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

/* Skeleton Loading Enhancements */
.skeleton-card .card-image {
  background: var(--bg-muted);
}

.skeleton-image {
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-title {
  height: 20px;
  width: 70%;
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-price {
  height: 24px;
  width: 40%;
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-text {
  height: 14px;
  width: 50%;
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-card .card-overlay {
  display: none;
}

/* Feature Buttons */
.feature-buttons {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Breed Preview Grid */
.breed-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  max-width: 400px;
}

.breed-preview-item {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.breed-preview-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-lg) var(--space-sm) var(--space-sm);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
}

.breed-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.breed-preview-item:hover img {
  transform: scale(1.05);
}

/* Listing Card Enhancements for this page */
.listing-card .card-price {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--primary);
  margin: var(--space-xs) 0;
}

.listing-card .card-meta {
  display: flex;
  gap: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.listing-card .card-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Skeleton grid - displays skeleton cards in a grid */
#searchresults.listings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* When search results load (container present), switch to block and let inner row be the grid */
#searchresults.listings-grid:has(> .container) {
  display: block;
}

#searchresults > .container {
  max-width: none;
  padding: 0;
  margin: 0;
}

/* Make the Bootstrap row a CSS grid instead of flexbox */
#searchresults .row {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: var(--space-lg) !important;
  margin: 0 !important;
  flex-wrap: nowrap !important;
}

/* Override all Bootstrap column classes */
#searchresults .col,
#searchresults .col-sm-6,
#searchresults .col-md-4,
#searchresults .col-lg-4,
#searchresults [class*="col"] {
  width: auto !important;
  max-width: none !important;
  flex: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Card styling */
#searchresults .card,
#searchresults .search-result-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

#searchresults .card:hover,
#searchresults .search-result-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

#searchresults .card-img-top {
  height: 220px !important;
  object-fit: cover;
}

#searchresults .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#searchresults .card-footer {
  margin-top: auto;
}

/* Responsive grid columns - for both skeletons and search results */
@media (max-width: 1200px) {
  #searchresults.listings-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  #searchresults .row {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 900px) {
  #searchresults.listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #searchresults .row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .hero-stat-item {
    flex-basis: 100%;
  }

  #searchresults.listings-grid {
    grid-template-columns: 1fr;
  }
  #searchresults .row {
    grid-template-columns: 1fr !important;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero.hero-ambient {
    padding: var(--space-lg) 0;
  }

  .hero-grid {
    gap: var(--space-lg);
  }

  .hero-content h1 {
    font-size: clamp(2rem, 10vw, 2.75rem);
    margin-bottom: var(--space-sm);
  }

  .hero-lead {
    font-size: 0.98rem;
    margin-bottom: var(--space-md);
  }

  .search-card {
    padding: var(--space-md);
  }

  .search-card-header {
    margin-bottom: var(--space-sm);
  }

  .breeds-bar {
    padding: var(--space-md) 0 0.75rem;
  }

  #resultsSection {
    padding-top: var(--space-xl);
  }

  .hero-stats-inline {
    gap: var(--space-sm);
    margin-top: var(--space-md);
  }

  .hero-stat-item {
    flex: 1 1 calc(50% - var(--space-sm));
    padding: 0.5rem 0.65rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-sort {
    width: 100%;
  }

  .results-sort .form-select {
    flex: 1;
  }

  .breed-preview-grid {
    max-width: 300px;
    margin: 0 auto;
  }

  .feature-buttons {
    flex-direction: column;
  }

  .feature-buttons .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Result cards: the markup engine/php/listing-search.php builds for the first
   page and search.php returns for filters, sort and "Load More". (These
   rules used to be sent inline with the page and again with every
   response.) */
.search-result-card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.search-result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.search-result-card .card-img-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.search-result-card .card-img-top {
    width: 100%;
    transition: transform 0.3s ease;
}

.search-result-card:hover .card-img-top {
    transform: scale(1.05);
}

.search-result-card .card-title {
    font-size: 1.0625rem;
}

.search-result-card .card-title a {
    color: #333;
    font-weight: 600;
    transition: color 0.3s;
}

.search-result-card .card-title a:hover {
    color: var(--primary, #1a5f4a);
}

/* The site gold: white on the old #C19A6B was 2.5:1. */
.search-result-card .price-tag {
    display: inline-block;
    background: var(--secondary, #8b6914);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.search-result-card .card-footer {
    border-top: 1px solid #f0f0f0;
}

.search-result-card .listing-card-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin: 0 0 8px;
    font-size: 0.8125rem;
    color: #4b5563;
}

.search-result-card .listing-card-type {
    background: #e8f3ee;
    color: var(--primary, #1a5f4a);
    border-radius: 999px;
    padding: 2px 10px;
    font-weight: 600;
    white-space: nowrap;
}

.search-result-card .listing-card-breed {
    font-weight: 600;
}

.search-result-card .listing-card-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.search-result-card .listing-card-facts .bi-geo-alt-fill {
    color: var(--primary, #1a5f4a);
}

.no-results-container {
    grid-column: 1 / -1;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 30px auto;
}

.no-results-container i {
    color: var(--primary, #1a5f4a);
}

.no-results-container h3 {
    color: #495057;
    margin-bottom: 10px;
}
