/*
 * The all-pets listings page (/listings, pedigree.php): filters, result cards, skeletons, pagination.
 * Linked from the <head> by the page ($boPageStylesheets).
 */
/* ============================================
   PEDIGREE SEARCH PAGE - PREMIUM DESIGN
   ============================================ */

/* Page Container */
.search-page {
  min-height: 100vh;
  background: #f8faf9;
  padding-top: 0;
}

/* Green Hero Bar */
.search-hero-bar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: var(--space-lg) 0;
  position: relative;
  overflow: hidden;
}

.search-hero-bar::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.search-hero-bar::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.search-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.search-hero-content h1 {
  color: white;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 var(--space-xs);
  font-weight: 700;
}

.search-hero-content p {
  color: rgba(255,255,255,0.9);
  margin: 0;
  font-size: 1rem;
}

/* ----------------------------------------
   Page Header - Compact & Clean
   ---------------------------------------- */
.page-header {
  background: white;
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-lg) 0;
  position: sticky;
  top: 80px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.page-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.page-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}


.results-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-subtle);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
}

.results-badge i {
  font-size: 0.875rem;
}

/* Quick Filter Tabs */
.quick-filters {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.filter-tab {
  padding: 8px 18px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.filter-tab i {
  margin-right: 6px;
}

/* ----------------------------------------
   Filter Bar
   ---------------------------------------- */
.filter-bar {
  background: white;
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-md) 0;
}

.filter-bar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

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

.filter-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  /* 16px: anything smaller makes iPhones zoom in when the field is tapped. */
  font-size: 1rem;
  color: var(--text-primary);
  background: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
  appearance: none;
}

.filter-select:hover {
  border-color: var(--primary);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.filter-actions {
  margin-left: auto;
  display: flex;
  gap: var(--space-sm);
}

.btn-filter {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-filter-primary {
  background: var(--primary);
  color: white;
}

.btn-filter-primary:hover {
  background: var(--primary-dark);
}

.btn-filter-secondary {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-filter-secondary:hover {
  background: var(--bg-muted);
}

/* ----------------------------------------
   Results Grid
   ---------------------------------------- */
.results-container {
  padding: var(--space-xl) 0 var(--space-3xl);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-lg);
}

/* ----------------------------------------
   Pet Card - Refined Design
   ---------------------------------------- */
.pet-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-light);
}

.pet-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  border-color: transparent;
}

.pet-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f7f6 0%, #e8ebe9 100%);
}

.pet-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.pet-card:hover .pet-card-image img {
  transform: scale(1.08);
}

.pet-card-price {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.85) 100%);
  backdrop-filter: blur(8px);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
}

.pet-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--space-lg);
}

.pet-card:hover .pet-card-overlay {
  opacity: 1;
}

.view-btn {
  background: white;
  color: var(--primary);
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  transform: translateY(10px);
  transition: transform 0.3s ease;
}

.pet-card:hover .view-btn {
  transform: translateY(0);
}

.pet-card-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pet-card-breed {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.3;
}

.pet-card-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pet-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: auto;
}

.pet-card-meta i {
  color: var(--primary);
  font-size: 0.75rem;
}

/* ----------------------------------------
   Skeleton Loader
   ---------------------------------------- */
.skeleton-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.skeleton-image {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, #f0f2f1 25%, #e8eae9 50%, #f0f2f1 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.skeleton-title {
  height: 18px;
  width: 75%;
  background: linear-gradient(90deg, #f0f2f1 25%, #e8eae9 50%, #f0f2f1 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 10px;
}

.skeleton-text {
  height: 14px;
  width: 50%;
  background: linear-gradient(90deg, #f0f2f1 25%, #e8eae9 50%, #f0f2f1 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; }
}

/* ----------------------------------------
   Empty State
   ---------------------------------------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  background: white;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
}

.empty-state-icon i {
  font-size: 2rem;
  color: var(--primary);
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
}

.empty-state p {
  color: var(--text-muted);
  margin: 0 0 var(--space-lg);
}

/* ----------------------------------------
   Pagination
   ---------------------------------------- */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-light);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.pagination-info strong {
  color: var(--text-primary);
}

.pagination-btns {
  display: flex;
  gap: var(--space-xs);
}

.page-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-btn.nav-btn {
  padding: 0 var(--space-md);
}

/* ----------------------------------------
   Responsive Design
   ---------------------------------------- */
@media (max-width: 1400px) {
  .results-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1100px) {
  .results-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .page-header {
    position: relative;
    top: 0;
  }

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

  .quick-filters {
    width: 100%;
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
  }

  .filter-bar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
  }

  .filter-select {
    flex: 1;
  }

  .filter-actions {
    margin-left: 0;
    width: 100%;
  }

  .btn-filter {
    flex: 1;
    justify-content: center;
  }

  .results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

@media (max-width: 600px) {
  .page-title-group {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .pagination-container {
    flex-direction: column;
  }
}

/* ----------------------------------------
   Loading State
   ---------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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