/* Family Filter Form Styles */
.family-filter-form {
  background: #f8f9fa;
  padding: 30px;
  margin: 20px 0;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group:last-child {
  flex: 0 0 auto;
  min-width: auto;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.filter-group select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  transition: border-color 0.3s ease;
}

.filter-group select:focus {
  outline: none;
  border-color: #6c5ce7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.filter-submit-btn {
  background: #6c5ce7;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 300;
  cursor: pointer;
  transition: background-color 0.3s ease;
  min-width: 120px;
}

.filter-submit-btn:hover {
  background: #5a4fcf;
}

.filter-submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Per-page dropdown specific styling */
#per-page-filter {
  min-width: 80px;
  text-align: center;
}

.filter-group:has(#per-page-filter) {
  min-width: 120px;
}

.filter-results-info {
  text-align: center;
  font-size: 16px;
  color: #666;
  font-weight: 500;
}

/* Family Cards Grid */
.families-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin: 30px 0;
}

/* No Results Message */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: #666;
  font-size: 20px;
  font-weight: 500;
  background: #f8f9fa;
  border-radius: 12px;
  margin: 30px 0;
  border: 2px dashed #ddd;
  width: 100%;
  max-width: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  grid-column: 1 / -1;
  display: block;
}

.no-results::before {
  content: "🔍";
  font-size: 48px;
  display: block;
  margin-bottom: 20px;
  opacity: 0.6;
}

.no-results:hover {
  background: #f0f2f5;
  border-color: #bbb;
  transition: all 0.3s ease;
}

/* WP Bakery Post Grid compatibility */
.vc_grid-container .families-grid,
.wpb_wrapper .families-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin: 0;
}

/* Ensure our grid replaces WP Bakery grid seamlessly */
.vc_grid-container,
.wpb_wrapper .vc_grid {
  position: relative;
}

/* Force grid layout for all family grids */
.families-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 30px !important;
  margin: 30px 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* Additional grid enforcement */
#families-grid,
div[id*="families"],
div[class*="families-grid"] {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 30px !important;
  margin: 30px 0 !important;
}

/* Nuclear option - override everything that might interfere */
.families-grid * {
  box-sizing: border-box !important;
}

.families-grid .family-card {
  display: block !important;
  width: auto !important;
  max-width: none !important;
  float: none !important;
  clear: none !important;
}

/* Ensure family cards maintain proper styling */
.family-card {
  background: white !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}


.family-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.family-image {
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
}

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

/* Family Image Link */
.family-image-link {
  display: block;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.family-image-link:hover {
  opacity: 0.9;
}

.family-image-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-image {
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

.family-info {
  padding: 20px;
}

.family-info h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #333;
  font-weight: 600;
}

.family-info p {
  margin: 0 0 8px 0;
  color: #666;
  font-size: 14px;
}

.family-link {
  display: inline-block;
  margin-top: 15px;
  padding: 10px 20px;
  background: #6c5ce7;
  color: white !important;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

/* More specific selector to override .scheme_default a */
.family-card .family-link,
.families-grid .family-link {
  color: white !important;
}

/* Even more specific to override .scheme_default a */
.scheme_default .family-card .family-link,
.scheme_default .families-grid .family-link {
  color: white !important;
}

.family-link:hover {
  background: #5a4fcf;
  color: white;
  text-decoration: none;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 18px;
  background: white;
  border-radius: 8px;
  margin: 30px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .filter-row {
    flex-direction: column;
    gap: 15px;
  }

  .filter-group {
    min-width: 100%;
  }

  .families-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .family-filter-form {
    padding: 20px;
  }

  /* Center the results per page and search button on mobile */
  .filter-group:nth-last-child(2),
  .filter-group:last-child {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-direction: row;
  }

  .filter-group:nth-last-child(2) label,
  .filter-group:last-child label {
    margin-bottom: 0;
    margin-right: 10px;
  }

  .filter-group:nth-last-child(2) select,
  .filter-group:last-child select {
    margin-bottom: 0;
  }

  .filter-submit-btn {
    margin-top: 0;
  }

  /* Ensure the button container is properly centered */
  .filter-group:last-child {
    width: 100%;
    justify-content: center !important;
  }
}

/* Clear Filters Button (if needed) */
.clear-filters {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 10px;
  transition: background-color 0.3s ease;
}

.clear-filters:hover {
  background: #c0392b;
}

/* Pagination Styles */
.family-pagination {
  margin: 30px 0;
  text-align: center;
}

.pagination-info {
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-btn {
  background: #f8f9fa;
  border: 2px solid #ddd;
  color: #333;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 40px;
}

.pagination-btn:hover {
  background: #6c5ce7;
  color: white;
  border-color: #6c5ce7;
}

.pagination-btn.loading {
  background: #999 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

.pagination-btn:disabled {
  background: #999 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

/* Pagination loading overlay */
.pagination-loading-overlay {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.pagination-btn.active {
  background: #6c5ce7;
  color: white;
  border-color: #6c5ce7;
}

.pagination-btn:disabled {
  background: #f0f0f0;
  color: #999;
  border-color: #e0e0e0;
  cursor: not-allowed;
}

.pagination-btn.prev-btn,
.pagination-btn.next-btn {
  font-weight: 600;
}

.pagination-ellipsis {
  color: #999;
  font-size: 16px;
  padding: 0 8px;
}

/* Responsive Pagination */
@media (max-width: 768px) {
  .pagination-controls {
    gap: 4px;
  }

  .pagination-btn {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 35px;
  }

  .pagination-info {
    font-size: 12px;
  }
}