/* =========================================================
   CARRUSEL ÚLTIMOS PRODUCTOS - DESGUACES ARMONÍA
   Hook: displayCarruselProductosSeinto
   Diseño de tarjeta adaptado a miniaturas de catálogo.
   ========================================================= */

.cps-wrapper {
  --cps-primary: #0b6fae;
  --cps-primary-hover: #085f96;
  --cps-success: #19bf61;
  --cps-success-hover: #12a953;
  --cps-text: #080c10;
  --cps-muted: #5e6670;
  --cps-border: #e1e4e8;
  --cps-soft: #f5f6f7;
  --cps-white: #fff;

  width: 100%;
  margin: 0;
  font-family: "Carlito", Arial, sans-serif;
}

.cps-wrapper,
.cps-wrapper *,
.cps-wrapper *::before,
.cps-wrapper *::after {
  box-sizing: border-box;
}

.cps-carousel {
  position: relative;
  width: 100%;
}

/* Track: 6 tarjetas en pantallas grandes, como la referencia */
.cps-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 70px) / 6);
  gap: 14px;
  width: 100%;
  padding: 4px 2px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}

.cps-track::-webkit-scrollbar {
  display: none;
}

/* Tarjeta */
.cps-card,
.armonia-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  background: var(--cps-white);
  border: 1px solid var(--cps-border);
  border-radius: 14px;
  box-shadow: none;
  scroll-snap-align: start;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .cps-card:hover,
  .cps-card:focus-within {
    border-color: #d3d8dd;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .07);
    transform: translateY(-2px);
  }
}

/* Imagen: grande, a sangre y con altura estable */
.cps-thumb,
.armonia-product-card__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f4f3f3;
  border-bottom: 1px solid var(--cps-border);
  text-decoration: none;
}

.cps-product-image {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: cover;
  object-position: center;
  transition: transform .25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .cps-card:hover .cps-product-image {
    transform: scale(1.015);
  }
}

/* Descuento */
.cps-badge--discount {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  background: #cf4637;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

/* Calidad: se mantiene, pero como distintivo superpuesto */
.cps-quality-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 4;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .09);
}

.cps-quality-badge > img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.cps-quality-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 220px;
  padding: 10px 11px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  border: 1px solid var(--cps-border);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  color: var(--cps-text);
  font-size: 12px;
  line-height: 1.3;
  transform: translateY(-3px);
  transition: opacity .15s ease, visibility .15s ease, transform .15s ease;
}

.cps-quality-tooltip strong,
.cps-quality-tooltip span {
  display: block;
}

.cps-quality-tooltip strong {
  margin-bottom: 4px;
}

.cps-quality-badge:hover .cps-quality-tooltip,
.cps-quality-badge:focus .cps-quality-tooltip,
.cps-quality-badge:focus-within .cps-quality-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Contenido */
.cps-body,
.armonia-product-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 13px 12px 11px;
}

.cps-name,
.armonia-product-card__name {
  min-height: 43px;
  margin: 0 0 5px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--cps-text);
  font-size: 16px;
  line-height: 1.32;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none !important;
}

.cps-name:hover {
  color: var(--cps-primary);
}

.cps-short-desc {
  min-height: 35px;
  margin: 0 0 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #4d555d;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 400;
}

.cps-short-desc p {
  margin: 0;
}

.cps-short-desc br + br {
  display: none;
}

/* Ref / OEM */
.cps-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin-bottom: 8px;
}

.cps-pill {
  max-width: 100%;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  overflow: hidden;
  color: #31373d;
  background: #f6f7f8;
  border: 1px solid #e3e5e8;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.cps-pill-k {
  color: #0e1216;
  font-weight: 700;
}

.cps-pill-v {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Precio */
.cps-prices,
.armonia-product-card__prices {
  display: block;
  margin-top: 0;
}

.cps-price-tax {
  color: #05090d;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.015em;
}

.cps-price-note {
  margin-top: 5px;
  color: #68717a;
  font-size: 12px;
  line-height: 1.3;
}

.cps-price-badge:empty {
  display: none;
}

.cps-price-badge {
  margin-top: 4px;
}

/* Acciones */
.cps-actions,
.armonia-product-card__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 44px;
  gap: 8px;
  margin-top: auto;
  padding-top: 11px;
  align-items: stretch;
}

.cps-action,
.cps-action.btn.btn-primary {
  min-height: 44px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  padding: 0 11px;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.cps-action--whatsapp {
  color: #fff !important;
  background: var(--cps-success) !important;
  border-color: var(--cps-success) !important;
  white-space: nowrap;
}

.cps-action--whatsapp:hover {
  color: #fff !important;
  background: var(--cps-success-hover) !important;
  border-color: var(--cps-success-hover) !important;
}

.cps-action--view {
  color: #fff !important;
  background: var(--cps-primary) !important;
  border-color: var(--cps-primary) !important;
}

.cps-action--view:hover {
  color: #fff !important;
  background: var(--cps-primary-hover) !important;
  border-color: var(--cps-primary-hover) !important;
}

.cps-add-to-cart-form {
  width: 44px;
  margin: 0;
}

.cps-action--cart,
.cps-action--cart.btn.btn-primary {
  width: 44px;
  padding: 0;
  color: #fff !important;
  background: var(--cps-primary) !important;
  border-color: var(--cps-primary) !important;
}

.cps-action--cart:hover,
.cps-action--cart.btn.btn-primary:hover {
  color: #fff !important;
  background: var(--cps-primary-hover) !important;
  border-color: var(--cps-primary-hover) !important;
}

/* Flechas */
.cps-nav {
  position: absolute;
  top: 34%;
  z-index: 10;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #20262c;
  background: rgba(255, 255, 255, .97);
  border: 1px solid #e1e4e7;
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .11);
  cursor: pointer;
  transform: translateY(-50%);
  transition: opacity .18s ease, background .18s ease;
}

.cps-nav--prev {
  left: -13px;
}

.cps-nav--next {
  right: -13px;
}

.cps-nav:hover:not(:disabled) {
  background: #fff;
}

.cps-nav:disabled {
  opacity: 0;
  pointer-events: none;
}

.cps-empty {
  margin: 0;
  padding: 18px;
  color: var(--cps-muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 1599px) {
  .cps-track {
    grid-auto-columns: calc((100% - 56px) / 5);
  }
}

@media (max-width: 1240px) {
  .cps-track {
    grid-auto-columns: calc((100% - 42px) / 4);
  }
}

@media (max-width: 991px) {
  .cps-track {
    grid-auto-columns: calc((100% - 28px) / 3);
  }

  .cps-nav {
    display: none;
  }
}

@media (max-width: 767px) {
  .cps-track {
    grid-auto-columns: minmax(245px, 78vw);
    gap: 12px;
    padding-bottom: 8px;
  }

  .cps-body,
  .armonia-product-card__body {
    padding: 12px 11px 10px;
  }

  .cps-name,
  .armonia-product-card__name {
    font-size: 15px;
  }

  .cps-actions,
  .armonia-product-card__actions {
    grid-template-columns: minmax(0, 1fr) 50px 44px;
  }
}

@media (max-width: 380px) {
  .cps-track {
    grid-auto-columns: 86vw;
  }
}

/* =========================================================
   DEFENSIVE THEME RESET
   Evita que estilos globales del theme desmonten las tarjetas.
   ========================================================= */
.cps-wrapper .cps-carousel,
.cps-wrapper .cps-track,
.cps-wrapper .cps-card,
.cps-wrapper .cps-thumb,
.cps-wrapper .cps-body,
.cps-wrapper .cps-pills,
.cps-wrapper .cps-prices,
.cps-wrapper .cps-actions {
  float: none !important;
  clear: none !important;
}

.cps-wrapper .cps-card {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
}

.cps-wrapper .cps-thumb,
.cps-wrapper .cps-name,
.cps-wrapper .cps-action {
  text-decoration: none !important;
}

.cps-wrapper .cps-product-image,
.cps-wrapper .cps-quality-badge img {
  max-width: 100% !important;
}

.cps-wrapper button.cps-nav,
.cps-wrapper button.cps-action {
  appearance: none;
  -webkit-appearance: none;
}
