.ppg-grid {
  display: grid;
  gap: 24px;
  /* Grid template columns are now set directly in the PHP-generated CSS */
  /* This allows for proper responsive behavior with custom column counts */
}

/* Note: Responsive breakpoints are now handled dynamically via PHP-generated CSS */
/* This allows for custom breakpoints per shortcode instance */

.ppg-grid.loading .product-card {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ppg-loading-indicator {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
  grid-column: 1 / -1;
}

.ppg-skeleton-card {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.ppg-skeleton-element {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: ppg-skeleton-shimmer 2s infinite;
}

.ppg-skeleton-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 12px;
  border-radius: 4px;
}

.ppg-skeleton-title {
  height: 20px;
  margin-bottom: 8px;
  border-radius: 4px;
  width: 80%;
}

.ppg-skeleton-price {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
  width: 60%;
}

.ppg-skeleton-categories {
  height: 14px;
  margin-bottom: 12px;
  border-radius: 4px;
  width: 70%;
}

.ppg-skeleton-button {
  height: 36px;
  border-radius: 4px;
  margin-top: auto;
}

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

/* Enhanced pulsing effect for the entire skeleton card */
.ppg-skeleton-card {
  animation: ppg-skeleton-pulse 3s ease-in-out infinite;
}

@keyframes ppg-skeleton-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.01);
    opacity: 0.95;
  }
}

/* Enhanced product card styles with higher specificity */
.ppg-grid .product-card,
.ppg-grid a.product-card {
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
  cursor: pointer !important;
  text-decoration: none !important;
  color: inherit !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  font-family: inherit !important;
  line-height: normal !important;
}

.ppg-grid .product-card:hover,
.ppg-grid a.product-card:hover {
  text-decoration: none !important;
  color: inherit !important;
  background: transparent !important;
}

.ppg-grid .product-card:visited,
.ppg-grid a.product-card:visited {
  color: inherit !important;
}

.ppg-grid .product-image-wrapper {
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  margin-bottom: 12px !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #f4f4f4 !important;
  border: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.ppg-grid .product-image-wrapper img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.ppg-grid .product-title,
.ppg-grid h2.product-title {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #2f2604 !important;
  margin-bottom: 8px !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  border: none !important;
  background: transparent !important;
}

.ppg-grid .product-price {
  font-size: 16px !important;
  color: #2f2604 !important;
  margin-bottom: 8px !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
  font-weight: normal !important;
  line-height: 1.3 !important;
  text-transform: none !important;
  border: none !important;
  background: transparent !important;
}

.ppg-grid .product-categories {
  margin-bottom: 12px !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
}

.ppg-grid .product-categories span {
  font-size: 14px !important;
  margin-right: 6px !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  color: #2f2604 !important;
  opacity: 0.7 !important;
  padding: 0 !important;
  font-weight: normal !important;
  text-transform: none !important;
  border: none !important;
  background: transparent !important;
}

/* Enhanced button styles with maximum specificity */
.ppg-grid .button.add-to-cart,
.ppg-grid .product-card .button.add-to-cart,
.ppg-grid a.product-card .button.add-to-cart,
.ppg-grid span.button.add-to-cart {
  margin-top: auto !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  background-color: #807960 !important;
  color: white !important;
  padding: 10px 16px !important;
  text-align: center !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  font-size: 14px !important;
  display: inline-block !important;
  transition: transform 0.2s !important;
  border: none !important;
  box-sizing: border-box !important;
  width: auto !important;
  height: auto !important;
  line-height: normal !important;
  font-weight: normal !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer !important;
  font-family: inherit !important;
}

.ppg-grid .button.add-to-cart:hover,
.ppg-grid .product-card .button.add-to-cart:hover,
.ppg-grid a.product-card .button.add-to-cart:hover,
.ppg-grid span.button.add-to-cart:hover {
  transform: scale(1.02) !important;
  background-color: #807960 !important;
  color: white !important;
  text-decoration: none !important;
}

.ppg-grid .button.add-to-cart:focus,
.ppg-grid .product-card .button.add-to-cart:focus,
.ppg-grid a.product-card .button.add-to-cart:focus,
.ppg-grid span.button.add-to-cart:focus {
  background-color: #807960 !important;
  color: white !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(128, 121, 96, 0.3) !important;
}

.ppg-grid .button.add-to-cart:active,
.ppg-grid .product-card .button.add-to-cart:active,
.ppg-grid a.product-card .button.add-to-cart:active,
.ppg-grid span.button.add-to-cart:active {
  background-color: #807960 !important;
  color: white !important;
  transform: scale(0.98) !important;
}

.ppg-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

.ppg-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ppg-search-field {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background-color: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  height: 36px;
  box-sizing: border-box;
}

.ppg-search-field:focus {
  outline: none;
  border-color: #2f2604;
  box-shadow: 0 0 0 1px #2f2604;
}

.ppg-search-field:hover {
  border-color: #999;
}

.ppg-search-field::placeholder {
  color: #999;
}

.ppg-clear-all-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  height: 36px;
  box-sizing: border-box;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.ppg-clear-all-btn:hover {
  background: #c82333;
}

.ppg-clear-all-btn.disabled {
  background: #e9ecef !important;
  color: #6c757d !important;
  cursor: not-allowed !important;
  opacity: 0.65 !important;
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .ppg-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .ppg-search-field {
    min-width: auto;
    margin-bottom: 8px;
  }

  .ppg-control-group {
    justify-content: space-between;
  }
}

.ppg-category-multiselect {
  position: relative;
  display: inline-block;
  width: 240px;
}

.ppg-dropdown-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  height: 36px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ppg-dropdown-display:hover {
  border-color: #999;
}

.ppg-dropdown-display.active {
  border-color: #2f2604;
  box-shadow: 0 0 0 1px #2f2604;
}

.ppg-selected-text {
  flex: 1;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ppg-selected-text.placeholder {
  color: #999;
}

.ppg-dropdown-arrow {
  margin-left: 8px;
  transition: transform 0.2s;
  color: #666;
  font-size: 12px;
}

.ppg-dropdown-display.active .ppg-dropdown-arrow {
  transform: rotate(180deg);
}

.ppg-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ppg-dropdown-list.show {
  display: block;
}

.ppg-clear-all {
  padding: 8px 12px;
  font-size: 12px;
  color: #2f2604;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-weight: 600;
}

.ppg-clear-all:hover {
  background-color: #f5f5f5;
}

.ppg-checkbox-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.ppg-checkbox-item:hover {
  background-color: #f5f5f5;
}

.ppg-checkbox-item input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

.ppg-checkbox-item span {
  flex: 1;
}

#ppg-sort-order {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background-color: white;
  cursor: pointer;
  height: 36px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 160px;
}

#ppg-sort-order:hover {
  border-color: #999;
}

#ppg-sort-order:focus {
  outline: none;
  border-color: #2f2604;
  box-shadow: 0 0 0 1px #2f2604;
}

.ppg-load-more-container {
  text-align: center;
  margin-top: 20px;
}

#ppg-load-more {
  background: #2f2604;
  color: white;
  border: none;
  padding: 10px 24px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
}

/* Additional defensive styles for WordPress/WooCommerce theme compatibility */
/* These rules ensure consistency across different page contexts */

/* Override common WooCommerce and theme styles */
.woocommerce .ppg-grid .product-card,
.woocommerce-page .ppg-grid .product-card,
body.shop .ppg-grid .product-card,
body.archive .ppg-grid .product-card,
.shop-page .ppg-grid .product-card,
.archive-page .ppg-grid .product-card {
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure product titles are consistent across all contexts */
.woocommerce .ppg-grid .product-title,
.woocommerce-page .ppg-grid .product-title,
body.shop .ppg-grid .product-title,
body.archive .ppg-grid .product-title,
.woocommerce .ppg-grid h2.product-title,
.woocommerce-page .ppg-grid h2.product-title,
body.shop .ppg-grid h2.product-title,
body.archive .ppg-grid h2.product-title {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #2f2604 !important;
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  border: none !important;
  background: transparent !important;
}

/* Ensure price styling is consistent */
.woocommerce .ppg-grid .product-price,
.woocommerce-page .ppg-grid .product-price,
body.shop .ppg-grid .product-price,
body.archive .ppg-grid .product-price,
.woocommerce .ppg-grid .price,
.woocommerce-page .ppg-grid .price,
body.shop .ppg-grid .price,
body.archive .ppg-grid .price {
  font-size: 16px !important;
  color: #2f2604 !important;
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
  font-weight: normal !important;
  line-height: 1.3 !important;
  text-transform: none !important;
  border: none !important;
  background: transparent !important;
}

/* Override WooCommerce button styles completely */
.woocommerce .ppg-grid .button,
.woocommerce-page .ppg-grid .button,
body.shop .ppg-grid .button,
body.archive .ppg-grid .button,
.woocommerce .ppg-grid .add_to_cart_button,
.woocommerce-page .ppg-grid .add_to_cart_button,
body.shop .ppg-grid .add_to_cart_button,
body.archive .ppg-grid .add_to_cart_button,
.woocommerce .ppg-grid .button.add-to-cart,
.woocommerce-page .ppg-grid .button.add-to-cart,
body.shop .ppg-grid .button.add-to-cart,
body.archive .ppg-grid .button.add-to-cart {
  margin-top: auto !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  background-color: #807960 !important;
  background: #807960 !important;
  color: white !important;
  padding: 10px 16px !important;
  text-align: center !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  font-size: 14px !important;
  display: inline-block !important;
  transition: transform 0.2s !important;
  border: none !important;
  box-sizing: border-box !important;
  width: auto !important;
  height: auto !important;
  line-height: normal !important;
  font-weight: normal !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer !important;
  font-family: inherit !important;
  box-shadow: none !important;
  text-shadow: none !important;
  min-height: auto !important;
  max-width: none !important;
}

/* Hover states for all contexts */
.woocommerce .ppg-grid .button:hover,
.woocommerce-page .ppg-grid .button:hover,
body.shop .ppg-grid .button:hover,
body.archive .ppg-grid .button:hover,
.woocommerce .ppg-grid .add_to_cart_button:hover,
.woocommerce-page .ppg-grid .add_to_cart_button:hover,
body.shop .ppg-grid .add_to_cart_button:hover,
body.archive .ppg-grid .add_to_cart_button:hover,
.woocommerce .ppg-grid .button.add-to-cart:hover,
.woocommerce-page .ppg-grid .button.add-to-cart:hover,
body.shop .ppg-grid .button.add-to-cart:hover,
body.archive .ppg-grid .button.add-to-cart:hover {
  transform: scale(1.02) !important;
  background-color: #807960 !important;
  background: #807960 !important;
  color: white !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

/* Reset any theme-specific product card modifications */
.ppg-grid .product-card * {
  box-sizing: border-box !important;
}

/* Ensure images maintain aspect ratio in all contexts */
.woocommerce .ppg-grid .product-image-wrapper,
.woocommerce-page .ppg-grid .product-image-wrapper,
body.shop .ppg-grid .product-image-wrapper,
body.archive .ppg-grid .product-image-wrapper {
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  margin-bottom: 12px !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #f4f4f4 !important;
  border: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Force consistent link styling */
.ppg-grid a,
.ppg-grid a:hover,
.ppg-grid a:visited,
.ppg-grid a:focus,
.ppg-grid a:active {
  color: inherit !important;
  text-decoration: none !important;
}

/* Prevent theme typography from affecting product cards */
.ppg-grid .product-card,
.ppg-grid .product-card * {
  font-family: inherit !important;
  line-height: inherit !important;
}

/* Override any theme-specific grid modifications */
.ppg-grid {
  display: grid !important;
  gap: 24px !important;
  /* Grid template columns are set in the PHP-generated CSS */
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Debug Panel Styles */
.ppg-debug-panel {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 300px !important;
  background-color: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
  z-index: 999999 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  color: #333 !important;
  overflow: hidden !important;
  transition: all 0.3s ease !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
}

.ppg-debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background-color: #f0f0f0;
  border-bottom: 1px solid #ddd;
}

.ppg-debug-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.ppg-debug-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.ppg-debug-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #333;
}

.ppg-debug-content {
  padding: 15px;
}

.ppg-debug-item {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ppg-debug-item:last-child {
  margin-bottom: 0;
}

.ppg-debug-label {
  font-weight: 500;
  color: #666;
}

.ppg-debug-value {
  font-weight: 600;
  color: #333;
  padding: 2px 6px;
  border-radius: 3px;
  background-color: #f5f5f5;
}

/* Breakpoint indicator colors */
.debug-desktop {
  color: #2196f3;
}

.debug-tablet {
  color: #ff9800;
}

.debug-mobile {
  color: #4caf50;
}

/* Debug toggle button */
.ppg-debug-toggle {
  position: relative !important;
  margin-bottom: 10px !important;
  padding: 6px 12px !important;
  background-color: #f0f0f0 !important;
  border: 1px solid #ddd !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #666 !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  display: inline-block !important;
  text-align: center !important;
  text-decoration: none !important;
  line-height: normal !important;
  box-sizing: border-box !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.ppg-debug-toggle:hover {
  background-color: #e0e0e0 !important;
  color: #333 !important;
}

/* Make debug button stand out more */
.ppg-wrapper .ppg-debug-toggle {
  background-color: #007bff !important;
  color: white !important;
  font-weight: bold !important;
  border: none !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.ppg-wrapper .ppg-debug-toggle:hover {
  background-color: #0069d9 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
}

/* Make debug panel responsive */
@media (max-width: 768px) {
  .ppg-debug-panel {
    width: calc(100% - 40px);
    bottom: 10px;
    right: 10px;
    left: 10px;
  }
}
