/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Improve focus management for accessibility */
*:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000080;
    --text-dark: #000000;
    --text-light: #333333;
    --border-color: #000000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --primary-color: #4a6fa5;
  --primary-light: #6e9ad2;
  --primary-dark: #345681;
  --accent-color: #ff6b6b;
  --accent-light: #ff9e9e;
  --accent-dark: #e13e3e;
  --best-deal: #3cba54;
  --text-dark: #2d3748;
  --text-light: #718096;
  --bg-light: #f7fafc;
  --bg-white: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.08);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  text-decoration: none;
  color: var(--primary-color);
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

ul {
  list-style: none;
}

/* Header styles */
header {
  background-color: var(--bg-white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo h1 span {
  color: var(--accent-color);
}

nav ul {
  display: flex;
}

nav ul li {
  margin-left: 24px;
}

nav ul li a {
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

nav ul li a:hover::after {
  width: 100%;
}

/* Hero section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 80px 0;
  text-align: center;
}

.hero h2 {
  font-size: 2.8rem;
  margin-bottom: 24px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero p {
  font-size: 1.4rem;
  max-width: 700px;
  margin: 0 auto 32px;
  opacity: 0.9;
}

.cta-button {
  display: inline-block;
  background-color: var(--accent-color);
  color: white;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.cta-button:hover {
  background-color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: white;
  text-decoration: none;
}

/* Search section */
.search-section {
  padding: 48px 0;
  background-color: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
}

.search-header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-header h2 {
  font-size: 1.8rem;
  color: var(--primary-dark);
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.reset-filters {
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.reset-filters:hover {
  background-color: var(--border-color);
}

.filters {
  /* Mobile-first approach - single column by default */
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3vw, 24px);
  background-color: var(--bg-light);
  padding: clamp(16px, 3vw, 24px);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

/* Allow multi-column layout when we have enough width */
@media (min-width: 600px) {
  .filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .filters {
    grid-template-columns: repeat(3, 1fr);
  }
}

.filter-group h3 {
  margin-bottom: 16px;
  font-size: 1.15rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group h3::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 20px;
  background-color: var(--primary-color);
  border-radius: 3px;
}

.brand-list, .size-list, .retailer-list {
  display: flex;
  flex-wrap: nowrap; /* Default to horizontal scrolling for mobile */
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.brand-list::-webkit-scrollbar, 
.size-list::-webkit-scrollbar, 
.retailer-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Allow wrapping on larger screens */
@media (min-width: 600px) {
  .brand-list, .size-list, .retailer-list {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* Mobile-first styling - now properly organized */

.filter-item {
  background-color: var(--bg-white);
  padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 18px);
  border-radius: 50px;
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  
  /* Enhanced touch targets - minimum 44px for accessibility */
  min-height: 44px;
  min-width: 44px;
  
  /* Better touch feedback */
  -webkit-tap-highlight-color: rgba(74, 111, 165, 0.2);
  
  /* Improve touch interaction */
  touch-action: manipulation;
  user-select: none;
}

.filter-item:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.filter-item.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: visible;
}

.filter-item.active::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background-color: var(--accent-color);
  border-radius: 50%;
  border: 2px solid white;
}

/* Results section */
.results-section {
  padding: clamp(24px, 5vw, 48px) 0;
}

/* Items per page styling */
.items-per-page-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}

.items-per-page {
  background-color: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  width: 70px;
  transition: border-color 0.2s ease;
}

.items-per-page:focus {
  outline: none;
  border-color: var(--primary-color);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(16px, 3vw, 24px);
  flex-wrap: wrap;
  gap: clamp(12px, 2vw, 16px);
}

/* Mobile-first approach for results header */
.results-header {
  flex-direction: column;
  align-items: flex-start;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.sort-options {
  width: 100%;
}

.sort-options select {
  width: 100%;
}

@supports (width: min(250px, 100%)) {
  .sort-options {
    flex-basis: min(250px, 100%);
  }
  
  /* Only use row layout when we have enough space */
  @media (min-width: 600px) {
    .results-header {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }
    
    .results-actions {
      flex-direction: row;
      align-items: center;
      justify-content: flex-end;
      width: auto;
    }
    
    .sort-options {
      width: auto;
      max-width: 250px;
    }
  }
}

.results-count {
  font-size: 1.1rem;
  color: var(--text-light);
}

.results-count strong {
  color: var(--primary-color);
  font-weight: 600;
}

.sort-options {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.sort-options label {
  font-weight: 500;
  color: var(--text-light);
}

.sort-options select {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-white);
  font-size: 0.95rem;
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  min-width: 200px;
}

.diaper-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.diaper-card {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
  border: 1px solid var(--border-color);
  display: flex;
  /* Change direction based on container width rather than screen size */
  flex-direction: row;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  margin-bottom: clamp(16px, 5vw, 24px);
}

/* Mobile-first approach - stack by default, then use row layout for larger widths */
.diaper-card {
  flex-direction: column;
}

.diaper-info, .diaper-pricing {
  width: 100%;
}

/* Reset pricing section styles for mobile */
.diaper-pricing {
  border-left: none;
  border-top: 1px solid var(--border-color);
  padding: 16px;
  align-items: center;
  text-align: center;
}

/* Only use row layout when we have enough width */
@media (min-width: 600px) {
  .diaper-card {
    flex-direction: row;
  }
  
  .diaper-info {
    width: 65%;
  }
  
  .diaper-pricing {
    width: 35%;
    border-left: 1px solid var(--border-color);
    border-top: none;
  }
}

/* Switch to a grid layout when the content needs more space */
@media (min-width: 900px) {
  .diaper-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
  }
  
  .diaper-card {
    height: 100%;
    flex-direction: column;
    margin-bottom: 0;
    display: flex;
  }
  
  .diaper-info {
    width: 100%;
    flex: 1;
  }
  
  .diaper-pricing {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
  }
  
  /* Adjust savings tag position in grid layout */
  .savings-tag {
    top: 12px;
    right: 12px;
  }
  
  /* Ensure price container is properly centered */
  .price-container {
    margin: 10px 0 16px 0;
    align-items: center;
  }
}

/* For even larger screens, show more cards per row */
@media (min-width: 1400px) {
  .diaper-results {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
  }
  
  /* Ensure consistent card heights */
  .diaper-card {
    min-height: 280px;
  }
}

.diaper-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.best-deal-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: var(--best-deal);
  color: white;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.savings-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--best-deal);
  color: white;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  z-index: 10;
  box-shadow: var(--shadow-md);
  animation: pulse 2s infinite;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: help;
  position: relative;
}

/* Custom tooltip for savings tag - mobile first approach */
.savings-tag::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  right: -10px;
  width: 200px;
  background-color: rgba(40, 40, 40, 0.98);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
  line-height: 1.4;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  text-align: left;
  white-space: normal;
}

/* Tooltip arrow */
.savings-tag::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  right: 15px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(40, 40, 40, 0.98);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Responsively position tooltip at different breakpoints */
@media (min-width: 768px) {
  .savings-tag::after {
    bottom: auto;
    top: calc(100% + 10px);
    right: -10px;
  }
  
  .savings-tag::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top: none;
    border-bottom: 8px solid rgba(40, 40, 40, 0.98);
  }
}

.savings-tag:hover::after,
.savings-tag:hover::before,
.savings-tag:focus::after,
.savings-tag:focus::before {
  opacity: 1;
  visibility: visible;
}

.savings-info-icon {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.9);
  stroke-width: 2.5px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(60, 186, 84, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(60, 186, 84, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(60, 186, 84, 0);
  }
}

.diaper-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1.5;
  position: relative;
}

.diaper-pricing {
  padding: 20px;
  background-color: var(--bg-light);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  border-left: 1px solid var(--border-color);
  position: relative;
  flex: 1;
}

.diaper-card-body {
  padding: 24px;
}

.diaper-card h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.3;
}

.diaper-card .retailer {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
}

.retailer-icon {
  width: 16px;
  height: 16px;
  color: var(--text-light);
  margin-right: 4px;
}

.price-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 20px 0 16px 0;
}

.diaper-card .price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1.2;
}

.diaper-card .price-per-diaper {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--best-deal);
  background: rgba(60, 186, 84, 0.1);
  padding: 4px 10px;
  border-radius: 4px;
  margin-top: 5px;
  display: inline-block;
}

.details {
  margin-bottom: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.diaper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.diaper-meta-item {
  background-color: var(--bg-light);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 4px;
}

.retailer-info {
  font-size: 0.8rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 5px;
}

.details p {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-light);
}

.details p span {
  color: var(--text-dark);
  font-weight: 500;
}

.buy-button {
  display: block;
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  transition: var(--transition);
}

.buy-button:hover {
  background-color: var(--primary-dark);
  text-decoration: none;
  color: white;
}

/* Info section */
.info-section {
  background-color: var(--bg-white);
  padding: 60px 0;
  border-top: 1px solid var(--border-color);
}

.info-section h2 {
  font-size: 2rem;
  margin-bottom: 24px;
  color: var(--primary-dark);
  text-align: center;
}

.info-section p {
  max-width: 800px;
  margin: 0 auto 20px;
  font-size: 1.1rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.8;
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.info-card {
  background-color: var(--bg-light);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.info-card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--primary-color);
}

.info-card h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--primary-dark);
}

.info-card p {
  color: var(--text-light);
  text-align: left;
  margin-bottom: 0;
  font-size: 1rem;
}

/* Price comparison explanation section - mobile first */
.pricing-explanation {
  background-color: var(--bg-light);
  padding: 25px 0;
  margin-top: 20px;
}

.pricing-explanation h3 {
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  margin-bottom: 16px;
  color: var(--primary-color);
  text-align: center;
}

.explanation-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.explanation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background-color: var(--bg-white);
  padding: 15px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.explanation-icon {
  color: var(--primary-color);
  min-width: 24px;
  stroke-width: 2px;
}

.explanation-item h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text-dark);
  font-weight: 600;
}

.explanation-item p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

/* Content-driven breakpoint when we have enough space for side-by-side layout */
@media (min-width: 768px) {
  .explanation-content {
    flex-direction: row;
  }
  
  .explanation-item {
    flex: 1;
  }
  
  .explanation-item h4 {
    font-size: 1rem;
  }
  
  .explanation-item p {
    font-size: 0.9rem;
  }
}

/* Footer */
footer {
  background-color: var(--primary-dark);
  color: white;
  padding: 48px 0 24px;
}

footer .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}

.footer-column h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  position: relative;
}

.footer-column h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background-color: var(--accent-color);
}

.footer-column ul li {
  margin-bottom: 12px;
}

.footer-column ul li a {
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.footer-column ul li a:hover {
  color: white;
}

.copyright {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

/* Loading state */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
  color: var(--text-light);
  font-size: 1.2rem;
}

.loading::before {
  content: '';
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  margin-right: 12px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* No results */
.no-results {
  background-color: var(--bg-light);
  padding: 40px;
  border-radius: var(--border-radius);
  text-align: center;
  margin: 20px 0;
  border: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.no-results-icon {
  width: 48px;
  height: 48px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.no-results h3 {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.no-results p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.reset-link {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: 1rem;
  padding: 0;
}

.reset-link:hover {
  color: var(--primary-dark);
}

/* Content-first responsive styles - mobile-friendly approach */
@media (max-width: 800px) {
  /* Basic components */
  .container {
    padding: 0 clamp(12px, 4vw, 24px);
  }

  /* Typography */
  .hero h2 {
    font-size: 2rem;
    line-height: 1.3;
  }
  
  .hero p {
    font-size: 1.1rem;
    line-height: 1.5;
  }
  
  /* Filters */
  .filters {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 20px;
  }
  
  .filter-group h3 {
    margin-bottom: 12px;
    position: sticky;
    left: 0;
    background: var(--bg-light);
    padding: 4px 0;
  }
  
  /* Filter item styling handled by clamp() in the base styles */
  
  /* Results section */
  .results-section {
    padding: 20px 0;
  }
  
  /* Results header now uses container queries instead of media queries */
  
  /* Diaper cards - mobile-first layout */
  .diaper-card {
    flex-direction: column;
    padding-bottom: 0;
    margin-bottom: 20px;
  }
  
  /* Ensure savings tag is positioned correctly on mobile */
  .savings-tag {
    top: 8px;
    right: 8px;
    font-size: 0.75rem;
    padding: 3px 8px;
  }
  
  .diaper-info, .diaper-pricing {
    width: 100%;
    flex: none;
  }
  
  .diaper-info {
    padding: 16px;
  }
  
  .diaper-pricing {
    padding: 16px;
    align-items: center;
    text-align: center;
    position: relative;
  }

  .price-container {
    align-items: center;
    margin: 12px 0 16px 0;
  }
  
  .diaper-card .price {
    font-size: 1.5rem;
    line-height: 1.2;
  }
  
  .diaper-card .price-per-diaper {
    font-size: 1rem;
  }
  
  .savings-tag {
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    font-size: 0.8rem;
  }
  
  .diaper-meta {
    margin: 10px 0;
    gap: 6px;
  }
  
  .diaper-meta-item {
    padding: 3px 8px;
    font-size: 0.75rem;
  }
  
  .buy-button {
    padding: 10px 0;
    width: 100%;
    font-size: 0.95rem;
  }
  
  /* Info cards */
  .info-section {
    padding: 30px 0;
  }
  
  .info-cards {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .info-card {
    padding: 20px;
  }
  
  /* Footer */
  .footer .container {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 500px) {
  /* Header and navigation */
  header {
    padding: 12px 0;
  }

  header .container {
    flex-direction: column;
    gap: 12px;
  }
  
  .logo {
    font-size: 1.3rem;
  }

  nav ul {
    justify-content: center;
    gap: 16px;
  }
  
  nav ul li {
    margin: 0;
  }

  nav ul li a {
    font-size: 0.9rem;
  }
  
  /* Hero section */
  .hero {
    padding: 40px 0;
  }
  
  .hero h2 {
    font-size: 1.6rem;
    margin-bottom: 12px;
  }

  .hero p {
    font-size: 1rem;
    margin-bottom: 20px;
  }
  
  .cta-button {
    padding: 10px 20px;
    font-size: 0.95rem;
  }

  /* Filters section */
  .filters-section {
    padding: 20px 0;
  }

  .filters-section h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
  }

  .filter-item {
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  .filter-group {
    width: 100%;
  }

  /* Results */
  .results-count {
    font-size: 0.9rem;
  }

  .sort-options label {
    font-size: 0.9rem;
  }

  .sort-options select {
    font-size: 0.9rem;
    padding: 8px 10px;
  }
  
  /* Diaper cards */
  .diaper-card {
    border-radius: 8px;
  }

  .diaper-card h3 {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 6px;
  }

  .diaper-meta {
    flex-wrap: wrap;
    margin: 8px 0;
  }

  .diaper-meta-item {
    font-size: 0.75rem;
    padding: 2px 6px;
  }

  .retailer-info {
    font-size: 0.75rem;
  }

  .retailer-icon {
    width: 14px;
    height: 14px;
  }

  .savings-tag {
    font-size: 0.75rem;
    padding: 3px 8px;
  }

  .price {
    font-size: 1.3rem;
  }

  .price-per-diaper {
    font-size: 0.85rem;
    padding: 3px 8px;
  }

  .buy-button {
    padding: 8px 0;
    font-size: 0.9rem;
  }

  /* Info section */
  .info-section h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    text-align: center;
  }

  .info-section p {
    font-size: 0.9rem;
    margin-bottom: 16px;
  }

  .info-card h3 {
    font-size: 1.1rem;
  }

  .info-card p {
    font-size: 0.85rem;
  }

  /* Footer */
  footer {
    padding: 30px 0;
  }

  .footer-column h3 {
    font-size: 1.1rem;
  }

  .footer-column ul li a {
    font-size: 0.9rem;
  }

  .copyright p {
    font-size: 0.8rem;
  }
}

.diaper-card .details {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 15px;
}

.diaper-card .buy-button {
  display: block;
  width: 100%;
  padding: 10px;
  background-color: #e84855;
  color: white;
  text-align: center;
  border-radius: 4px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.diaper-card .buy-button:hover {
  background-color: #d73747;
  text-decoration: none;
}

.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #888;
}

/* Info section */
.info-section {
  padding: 60px 0;
  background-color: #f5f5f5;
}

.info-section h2 {
  margin-bottom: 20px;
}

.info-section p {
  margin-bottom: 15px;
  max-width: 800px;
}

/* Pagination controls - mobile first approach */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
  padding-top: 16px;
  width: 100%;
}

.pagination-control,
.pagination-number {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  background-color: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-number.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  font-weight: 600;
}

.pagination-control:hover:not([disabled]),
.pagination-number:hover {
  background-color: var(--bg-light);
  border-color: var(--primary-color);
}

.pagination-control[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 4px;
  color: var(--text-light);
}

/* Mobile-first adjustments for pagination */
@media (max-width: 480px) {
  .pagination {
    gap: 4px;
  }
  
  .pagination-control,
  .pagination-number {
    min-width: 32px;
    height: 32px;
    font-size: 0.85rem;
    padding: 0 4px;
  }
  
  /* Show fewer pagination items on very small screens */
  .pagination-number:not(.active):not(:first-child):not(:last-child) {
    display: none;
  }
  
  .pagination-ellipsis {
    display: none;
  }
}

/* Adjust for larger screens */
@media (min-width: 600px) {
  .pagination {
    margin: 32px 0;
    gap: 10px;
  }
  
  .pagination-control,
  .pagination-number {
    min-width: 40px;
    height: 40px;
  }
}

/* Footer */
footer {
  background-color: #222;
  color: #aaa;
  padding: 30px 0;
  text-align: center;
}

footer p {
  margin-bottom: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    text-align: center;
  }

  nav ul {
    margin-top: 15px;
    justify-content: center;
  }

  nav ul li {
    margin: 0 10px;
  }

  .hero h2 {
    font-size: 2rem;
  }

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