/**
 * PLP Product Grid Styles
 * 
 * CSS styles for consistent product grid layout, service cards, 
 * sorting dropdown, and pagination across all PLP views.
 * 
 * @package Cuentamania_Header
 */

/* ==========================================================================
   WOOCOMMERCE OVERRIDE - Neutralize WooCommerce default product styles
   ========================================================================== */

/* Override WooCommerce product grid defaults when using our custom grid */
.woocommerce #service-grid,
.woocommerce-page #service-grid,
.woocommerce .grid.cards-4,
.woocommerce-page .grid.cards-4 {
  margin: 0 !important;
  padding: 0 !important;
  clear: both !important;
}

/* Neutralize WooCommerce li.product width when inside our grid */
.woocommerce #service-grid > *,
.woocommerce-page #service-grid > *,
.woocommerce .grid.cards-4 > *,
.woocommerce-page .grid.cards-4 > *,
.woocommerce ul.products li.product.cm-service-card,
.woocommerce-page ul.products li.product.cm-service-card {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  clear: none !important;
}

/* ==========================================================================
   PLP PRODUCT GRID - Consistent 4-column layout with minimum card width
   ========================================================================== */

#service-grid {
    padding: 0 !important;
    list-style: none !important;
}


/* Grid container: force 4 columns with min-width for cards */
.grid.cards-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: var(--sp-6, 24px);
  width: 100%;
}


/* Responsive: 3 columns on tablets */
@media (max-width: 1200px) {
  .grid.cards-4 {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
  }
}

/* Responsive: 2 columns on small tablets */
@media (max-width: 900px) {
  .grid.cards-4 {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

/* Responsive: 1 column on mobile */
@media (max-width: 600px) {
  .grid.cards-4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SERVICE CARD - Consistent sizing and styling
   ========================================================================== */

.cm-service-card,
.cm-service-card.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  background: var(--card-bg, rgba(30, 30, 50, 0.6));
  border-radius: var(--card-radius, 16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cm-service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.cm-service-card__inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--sp-4, 16px);
}

.cm-service-card__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3, 12px);
  margin-bottom: var(--sp-3, 12px);
}

.cm-service-card__logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--cm-radius-md, 8px);
}

.cm-service-card__logo svg,
.cm-service-card__logo img {
  width: 28px;
  height: 28px;
}

.cm-service-card__title {
  font-size: var(--fs-lg, 1.125rem);
  font-weight: 600;
  color: var(--c-heading, #fff);
  margin: 0;
  line-height: 1.2;
}

.cm-service-card__subtitle {
  font-size: var(--fs-sm, 0.875rem);
  color: var(--c-muted, rgba(255, 255, 255, 0.6));
  margin: 0;
}

.cm-service-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--cm-radius-md, 8px);
  overflow: hidden;
  margin-bottom: var(--sp-3, 12px);
}

.cm-service-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cm-service-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2, 8px);
  margin-bottom: var(--sp-3, 12px);
}

.cm-service-card__pricing {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2, 8px);
  margin-bottom: var(--sp-3, 12px);
}

.cm-service-card__price {
  font-size: var(--fs-xl, 1.5rem);
  font-weight: 700;
  color: var(--c-heading, #fff);
}

.cm-service-card__period {
  font-size: var(--fs-sm, 0.875rem);
  color: var(--c-muted, rgba(255, 255, 255, 0.6));
}

.cm-service-card__compare {
  font-size: var(--fs-sm, 0.875rem);
  color: var(--c-muted, rgba(255, 255, 255, 0.5));
  text-decoration: line-through;
}

.cm-service-card__bullets {
  list-style: disc inside;
  padding: 0;
  margin: 0 0 var(--sp-4, 16px);
  font-size: var(--fs-sm, 0.875rem);
  color: var(--c-text, rgba(255, 255, 255, 0.85));
}

.cm-service-card__bullets li {
  margin-bottom: var(--sp-1, 4px);
}

.cm-service-card__actions {
  display: flex;
  gap: var(--sp-3, 12px);
  margin-top: auto;
}

.cm-service-card__actions .cm-btn {
  flex: 1;
  justify-content: center;
}

/* Tag badges on cards */
.cm-service-card .tag {
  position: absolute;
  top: var(--sp-3, 12px);
  right: var(--sp-3, 12px);
  background: var(--c-primary, #7c3aed);
  color: #fff;
  font-size: var(--fs-xs, 0.75rem);
  font-weight: 600;
  padding: var(--sp-1, 4px) var(--sp-3, 12px);
  border-radius: var(--cm-radius-full, 100px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
}

.cm-service-card .tag.best {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Product chip on media */
.product-chip {
  position: absolute;
  top: var(--sp-2, 8px);
  left: var(--sp-2, 8px);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--cm-radius-full, 100px);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  z-index: 2;
}

.product-chip--promo {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

.product-chip--rebaja {
  background: linear-gradient(135deg, #10b981, #06b6d4);
}

.product-chip--nuevo {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

/* Quick view button on cards */
.cm-qv-iconbtn {
  position: absolute;
  bottom: var(--sp-2, 8px);
  right: var(--sp-2, 8px);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.cm-service-card:hover .cm-qv-iconbtn {
  opacity: 1;
}

.cm-qv-iconbtn:hover {
  background: var(--c-primary, #7c3aed);
}

/* ==========================================================================
   PLP SORTING SELECT - Modern styled dropdown
   ========================================================================== */

.cm-sorting {
  position: relative;
  display: inline-block;
}

.cm-sort-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--btn-radius, 8px);
  color: var(--c-heading, #fff);
  font-size: var(--fs-sm, 0.875rem);
  font-family: inherit;
  padding: var(--sp-2, 8px) var(--sp-6, 24px) var(--sp-2, 8px) var(--sp-3, 12px);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  min-width: 160px;
}

.cm-sort-select:hover,
.cm-sort-select:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.cm-sort-select:focus-visible {
  box-shadow: var(--focus-ring);
}

.cm-sorting::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  pointer-events: none;
  opacity: 0.7;
}

/* Filterbar wrapper improvements */
.filterbar-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4, 16px);
  margin-bottom: var(--sp-6, 24px);
}

.filterbar-sorting {
  margin-left: auto;
}

@media (max-width: 768px) {
  .filterbar-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filterbar-sorting {
    margin-left: 0;
    width: 100%;
  }
  
  .cm-sort-select {
    width: 100%;
  }
}

/* ==========================================================================
   PLP PAGINATION - Consistent styling
   ========================================================================== */

.cm-pagination-container {
  margin-top: var(--sp-8, 32px);
  text-align: center;
}

.cm-pagination {
  display: inline-flex;
  gap: var(--sp-2, 8px);
  flex-wrap: wrap;
  justify-content: center;
}

.cm-pagination a,
.cm-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--sp-3, 12px);
  border-radius: var(--btn-radius, 8px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--c-heading, #fff);
  font-size: var(--fs-sm, 0.875rem);
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}

.cm-pagination a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.cm-pagination .current,
.cm-pagination span.current {
  background: var(--c-primary, #7c3aed);
  border-color: var(--c-primary, #7c3aed);
  color: #fff;
}

/* ==========================================================================
   PLP SHELL - Container styling for taxonomy pages
   ========================================================================== */

.cm-plp-shell {
  width: 100%;
}

.cm-page--plp {
  padding-top: var(--sp-8, 32px);
  padding-bottom: var(--sp-12, 48px);
}

.cm-page--plp h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--c-heading, #fff);
  text-transform: uppercase;
  margin-bottom: var(--sp-4, 16px);
}

/* Filterbar styling */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2, 8px);
  align-items: center;
}

.filterbar .chip {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-2, 8px) var(--sp-4, 16px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--cm-radius-full, 100px);
  color: var(--c-heading, #fff);
  font-size: var(--fs-sm, 0.875rem);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.filterbar .chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.filterbar .chip.is-active {
  background: var(--c-primary, #7c3aed);
  border-color: var(--c-primary, #7c3aed);
  color: #fff;
}

/* Empty state */
.cm-plp-empty {
  text-align: center;
  padding: var(--sp-12, 48px) var(--sp-6, 24px);
  color: var(--c-muted, rgba(255, 255, 255, 0.6));
  font-size: var(--fs-lg, 1.125rem);
}

/* ==========================================================================
   PLP FILTERS & SORTING - Added for robustness
   ========================================================================== */

/* Filter Bar Container */
.filterbar-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4, 16px);
  margin-bottom: var(--sp-6, 24px);
  padding-bottom: var(--sp-4, 16px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.filterbar-sorting {
  margin-left: auto; /* Push sorting to right */
}

/* Category Chips */
.cm-filter-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2, 8px);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08); /* Subtle bg */
  color: rgba(255,255,255,0.8);
  font-size: var(--fs-sm, 0.875rem);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover,
.chip:focus {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}

.chip.is-active {
  background: var(--c-primary, #00d4ff);
  color: #0d1b2a; /* Dark text for contrast */
  font-weight: 600;
  border-color: var(--c-primary, #00d4ff);
}

/* Dropdown Support for "More" Categories */
.cm-filter-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.cm-dropdown-trigger {
  padding-right: 12px;
  gap: 6px;
}

.cm-dropdown-trigger svg {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.cm-dropdown-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.cm-filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; 
  z-index: 100;
  background: #1e1e24; /* Ensure contrast against page bg */
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 8px;
  min-width: 220px;
  max-width: 300px;
  max-height: 320px; /* Scroll for many items */
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Anim setup */
  opacity: 0;
  transform: translateY(-8px);
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}

/* Show state handled by JS removing hidden, applying class */
.cm-filter-dropdown-wrapper.cm-is-open .cm-filter-dropdown-menu,
.cm-filter-dropdown-menu:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  display: flex !important; /* Force flex display when shown */
}

/* Scrollbar styling for dropdown */
.cm-filter-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}
.cm-filter-dropdown-menu::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
}
.cm-filter-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.cm-filter-dropdown-menu .chip {
  width: 100%;
  justify-content: flex-start;
  border-radius: 6px; /* Less rounded inside dropdown list */
  background: transparent;
  border: none;
  height: auto;
  padding: 8px 12px;
}

.cm-filter-dropdown-menu .chip:hover {
  background: rgba(255,255,255,0.1);
}

.cm-filter-dropdown-menu .chip.is-active {
  background: rgba(0, 212, 255, 0.15); /* Light primary bg */
  color: var(--c-primary, #00d4ff);
}

/* ============================================
 * Megamenu Support for Hierarchical Categories
 * ============================================ */

.cm-megamenu-wrapper {
  position: relative;
  display: inline-block;
}

.cm-megamenu-trigger {
  padding-right: 12px;
  gap: 6px;
}

.cm-megamenu-trigger svg {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.cm-megamenu-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.cm-megamenu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 100;
  background: #1e1e24;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 16px;
  min-width: 400px;
  max-width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
  display: none; /* Add explicit display none for hidden state */
}

.cm-megamenu-panel[hidden] {
  display: none !important;
}

.cm-megamenu-wrapper.cm-is-open .cm-megamenu-panel,
.cm-megamenu-panel:not([hidden]) {
  display: block !important; /* Override hidden attribute */
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.cm-megamenu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.cm-megamenu-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cm-megamenu-parent {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.cm-megamenu-parent:hover {
  background: rgba(255,255,255,0.12);
}

.cm-megamenu-parent.is-active {
  background: rgba(0, 212, 255, 0.15);
  color: var(--c-primary, #00d4ff);
}

.cm-megamenu-children {
  list-style: none;
  margin: 0;
  padding: 0 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cm-megamenu-children li {
  margin: 0;
  padding: 0;
}

.cm-megamenu-child {
  display: block;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.cm-megamenu-child:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.cm-megamenu-child.is-active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--c-primary, #00d4ff);
}

/* Scrollbar styling for megamenu */
.cm-megamenu-panel::-webkit-scrollbar {
  width: 6px;
}
.cm-megamenu-panel::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
}
.cm-megamenu-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

/* Responsive: Mobile Bottom Sheet */
@media (max-width: 768px) {
  .cm-megamenu-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: translateY(100%);
    max-width: 100%;
    min-width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px 32px;
  }
  
  .cm-megamenu-wrapper.cm-is-open .cm-megamenu-panel,
  .cm-megamenu-panel:not([hidden]) {
    transform: translateY(0);
  }
  
  .cm-megamenu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* Sorting Select Styling */
.cm-sorting {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cm-sorting label {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.6);
}

.cm-sort-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #fff;
  padding: 8px 36px 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%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;
  transition: all 0.2s ease;
  min-width: 180px;
}

.cm-sort-select:hover {
  background-color: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.cm-sort-select:focus {
  outline: none;
  border-color: var(--c-primary, #00d4ff);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.cm-sort-select option {
  background-color: #1e1e24; /* Ensure options are readable standard select */
  color: #fff;
  padding: 8px;
}

/* ==========================================================================
   LOADING STATES - Visual feedback during filter/sort operations
   ========================================================================== */

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

/* Loading state on PLP root */
.cm-plp-is-loading {
  position: relative;
  pointer-events: none;
}

/* Blur overlay during loading */
.cm-plp-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cm-fade-in 0.2s ease forwards;
}

@keyframes cm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading spinner */
.cm-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--c-primary, #543BF5);
  border-radius: 50%;
  animation: cm-spin 0.8s linear infinite;
}

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

/* Cards fade during loading */
.cm-plp-is-loading .cm-product-card,
.cm-plp-is-loading .cm-service-card {
  opacity: 0.5;
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Skeleton shimmer animation */
@keyframes cm-skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.cm-skeleton {
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.04) 25%, 
    rgba(255,255,255,0.1) 50%, 
    rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: cm-skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}

/* ==========================================================================
   GRID TRANSITIONS - Smooth content swap animations
   ========================================================================== */

/* Exit animation before content swap */
.cm-plp-grid-exit {
  opacity: 0;
  transform: scale(0.98) translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Enter animation after content swap */
.cm-plp-grid-enter {
  animation: cm-grid-enter 0.35s ease forwards;
}

@keyframes cm-grid-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Product card entrance animation with stagger */
.cm-product-card,
.cm-service-card {
  opacity: 0;
  transform: translateY(16px);
  animation: cm-card-enter 0.4s ease forwards;
}

@keyframes cm-card-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered entrance delays (up to 12 items) */
.cm-product-card:nth-child(1), .cm-service-card:nth-child(1) { animation-delay: 0ms; }
.cm-product-card:nth-child(2), .cm-service-card:nth-child(2) { animation-delay: 40ms; }
.cm-product-card:nth-child(3), .cm-service-card:nth-child(3) { animation-delay: 80ms; }
.cm-product-card:nth-child(4), .cm-service-card:nth-child(4) { animation-delay: 120ms; }
.cm-product-card:nth-child(5), .cm-service-card:nth-child(5) { animation-delay: 160ms; }
.cm-product-card:nth-child(6), .cm-service-card:nth-child(6) { animation-delay: 200ms; }
.cm-product-card:nth-child(7), .cm-service-card:nth-child(7) { animation-delay: 240ms; }
.cm-product-card:nth-child(8), .cm-service-card:nth-child(8) { animation-delay: 280ms; }
.cm-product-card:nth-child(9), .cm-service-card:nth-child(9) { animation-delay: 320ms; }
.cm-product-card:nth-child(10), .cm-service-card:nth-child(10) { animation-delay: 360ms; }
.cm-product-card:nth-child(11), .cm-service-card:nth-child(11) { animation-delay: 400ms; }
.cm-product-card:nth-child(12), .cm-service-card:nth-child(12) { animation-delay: 440ms; }

/* ==========================================================================
   MICRO-INTERACTIONS - Global polish for interactive elements
   ========================================================================== */

/* Enhanced chip/button interactions */
.chip,
.filterbar a {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.chip:hover,
.filterbar a:hover {
  transform: translateY(-2px);
}

.chip:active,
.filterbar a:active {
  transform: scale(0.97);
}

/* Active filter chip glow */
.chip.is-active,
.filterbar a.is-active {
  box-shadow: 0 0 16px rgba(84, 59, 245, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Accessible focus ring */
.chip:focus-visible,
.filterbar a:focus-visible,
.cm-megamenu-trigger:focus-visible,
.cm-sort-select:focus-visible {
  outline: 2px solid var(--c-primary, #543BF5);
  outline-offset: 2px;
}

/* ==========================================================================
   REDUCED MOTION - Accessibility for users who prefer reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .cm-product-card,
  .cm-service-card,
  .cm-plp-grid-enter,
  .cm-plp-grid-exit,
  .cm-loading-spinner,
  .cm-skeleton {
    animation: none !important;
    transition: none !important;
  }
  
  .cm-product-card,
  .cm-service-card {
    opacity: 1;
    transform: none;
  }
  
  .cm-plp-loading-overlay {
    animation: none;
    opacity: 1;
  }
  
  .chip:hover,
  .filterbar a:hover {
    transform: none;
  }
}

