/* Pinturom - Tabla de colores */
.pct-wrap {
  --pct-radius: 4px;
  --pct-border: #2b2b2b;
  --pct-row-h: 44px;
  --pct-accent: #e2001a;
  margin: 2rem 0;
  clear: both;
}
/* Evita el parpadeo mientras el JS la coloca en su sitio */
.pct-wrap[data-target]:not([data-target=""]):not(.pct-ready) { visibility: hidden; }
.pct-compact { margin: 1.25rem 0; }
.pct-compact .pct-title { font-size: 1.2rem; }
.pct-compact .pct-search, .pct-compact .pct-search-input { width: 100%; }
.pct-compact .pct-footer { justify-content: space-between; padding: .6rem .75rem; }
.pct-compact .pct-add { min-width: 0; flex: 1 1 auto; }
.pct-compact .pct-price-old { display: inline; margin-right: .3rem; }

.pct-wrap { scroll-margin-top: 140px; position: relative; }

/* --- Vista previa flotante del color elegido --- */
.pct-preview {
  position: absolute;
  z-index: 20;
  width: 200px;
  padding: 10px 10px 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .08);
  text-align: center;
  pointer-events: auto;
}
.pct-preview[hidden] { display: none; }
/* Flecha hacia la fila */
.pct-preview::before {
  content: "";
  position: absolute;
  top: var(--pct-arrow-top, 50%);
  left: -8px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: -2px 2px 3px rgba(0, 0, 0, .08);
}
.pct-preview-in { animation: pct-pop .18s ease-out; }
@keyframes pct-pop {
  from { opacity: 0; transform: translateX(-6px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.pct-preview-img {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: 6px;
  background: #f6f6f6;
  overflow: hidden;
}
.pct-preview-img img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; }
.pct-preview-loading .pct-preview-img img { opacity: 0; }
.pct-preview-loading .pct-preview-img::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #ddd;
  border-top-color: var(--pct-accent);
  border-radius: 50%;
  animation: pct-spin .7s linear infinite;
}
@keyframes pct-spin { to { transform: rotate(360deg); } }
.pct-preview-name {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  background: var(--pct-preview-bg, #e6e6e6);
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
  line-height: 1.2;
  text-shadow:
    -1px -1px 0 #000, 0 -1px 0 #000, 1px -1px 0 #000,
    -1px 0 0 #000, 1px 0 0 #000,
    -1px 1px 0 #000, 0 1px 0 #000, 1px 1px 0 #000;
}
.pct-preview-close {
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 1;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 18px;
  line-height: 28px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.pct-preview-close:hover { background: var(--pct-accent); }

/* Móvil / columna estrecha: tarjeta fija en la esquina, encima del pie */
.pct-compact .pct-preview {
  position: fixed;
  top: auto;
  left: 12px;
  right: auto;
  bottom: 96px;
  width: 124px;
  padding: 8px 8px 10px;
}
.pct-compact .pct-preview::before { display: none; }
.pct-compact .pct-preview.pct-preview-up { bottom: auto; }
.pct-compact .pct-preview-img img { max-height: 150px; }
.pct-compact .pct-preview-close { right: auto; left: calc(100% - 18px); }
.pct-compact .pct-preview-name { font-size: .8rem; }
.pct-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 700;
}

/* --- Pasos numerados --- */
.pct-step { margin-bottom: 1.5rem; }
.pct-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1rem;
  margin-bottom: .9rem;
}
.pct-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--pct-accent);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}
.pct-step-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.pct-step-chosen {
  padding: .25rem .8rem;
  border-radius: 14px;
  background: #222;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
}
.pct-step-chosen[hidden] { display: none; }
.pct-step-head .pct-search { margin-left: auto; }
/* El paso 2 queda atenuado hasta elegir envase */
.pct-has-sizes:not(.pct-size-chosen) .pct-step-color .pct-step-num { background: #b5b5b5; }
.pct-has-sizes:not(.pct-size-chosen) .pct-step-color .pct-step-title { color: #9a9a9a; }
.pct-waiting {
  margin: 0;
  padding: 1.25rem;
  border: 2px dashed #cfcfcf;
  border-radius: var(--pct-radius);
  text-align: center;
  color: #777;
  font-size: 1rem;
}
.pct-waiting[hidden], .pct-table[hidden] { display: none; }

/* --- Botones de envasado --- */
.pct-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.pct-size {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 130px;
  padding: .8rem 1.25rem;
  border: 2px solid #c8c8c8;
  border-radius: 8px;
  background: #fff;
  color: #222;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.pct-size:hover { border-color: #222; }
.pct-size:focus-visible { outline: 3px solid var(--pct-accent); outline-offset: 2px; }
.pct-size-active {
  border-color: var(--pct-accent);
  box-shadow: 0 0 0 2px var(--pct-accent) inset;
  background: #fff5f6;
}
.pct-size-label { font-size: 1.3rem; font-weight: 800; line-height: 1.15; }
.pct-size-price { margin-top: .2rem; font-size: .85rem; color: #666; }
.pct-size-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--pct-accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  line-height: 24px;
}
.pct-size-badge[hidden] { display: none; }

/* --- Botón "Seleccionar colores" junto al precio --- */
.pct-cta-wrap { margin: .9rem 0 1.1rem; }
.pct-cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.4rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.pct-cta, .pct-cta:hover, .pct-cta:focus { color: #fff; text-decoration: none; }
.pct-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.pct-search-input {
  width: 260px;
  max-width: 100%;
  height: 38px;
  padding: 0 .8rem;
  border: 1px solid #cfcfcf;
  border-radius: 19px;
  font-size: .95rem;
}
.pct-search-input:focus { outline: 2px solid var(--pct-accent); outline-offset: 1px; border-color: transparent; }

.pct-table {
  border: 1px solid var(--pct-border);
  border-radius: var(--pct-radius);
  overflow: hidden;
}

/* --- Fila --- */
.pct-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 130px 130px;
  align-items: center;
  min-height: var(--pct-row-h);
  padding: 0 .75rem;
  background-color: var(--pct-bg, #e6e6e6);
  background-image: none;
  font-weight: 700;
  letter-spacing: .02em;
  transition: filter .15s ease, box-shadow .15s ease;
}
.pct-row + .pct-row { box-shadow: inset 0 1px 0 rgba(0, 0, 0, .06); }
.pct-row:hover { filter: brightness(1.04); }
.pct-row.pct-selected { box-shadow: inset 5px 0 0 #111, inset 0 1px 0 rgba(0, 0, 0, .06); }
.pct-row.pct-dark.pct-selected { box-shadow: inset 5px 0 0 #fff, inset 0 1px 0 rgba(0, 0, 0, .06); }
.pct-row[hidden] { display: none; }
.pct-row { cursor: pointer; }
.pct-row:focus-visible { outline: none; }
/* Fila elegida (al pulsarla): marco blanco y negro, visible sobre cualquier color */
.pct-row.pct-active,
.pct-row:focus-visible {
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #111;
  position: relative;
  z-index: 1;
}
.pct-row.pct-active.pct-selected { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #111, inset 9px 0 0 #111; }

/* Textura en mosaico a su tamaño real (sin estirar) */
.pct-row.pct-tile {
  background-image: var(--pct-texture);
  background-repeat: repeat;
  background-size: auto;
  background-position: left center;
}

/* Miniatura de la textura junto al nombre */
.pct-name { display: flex; align-items: center; gap: .65rem; }
.pct-swatch {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .55);
  background-color: #fff;
  background-size: cover;
  background-position: center;
}

/* Brillo metalizado para Oro / Plata / Cobre */
.pct-row.pct-metal {
  background-image: linear-gradient(100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .45) 30%,
    rgba(255, 255, 255, 0) 55%,
    rgba(0, 0, 0, .12) 100%);
}

.pct-cell { padding: .5rem .25rem; }
.pct-name { min-width: 0; }
.pct-label { overflow-wrap: anywhere; }
.pct-ref { display: block; flex-basis: 100%; font-size: .75rem; font-weight: 500; opacity: .8; }
.pct-stock { white-space: nowrap; }
.pct-price { text-align: right; white-space: nowrap; padding-right: 1.25rem; }
.pct-price-old { display: block; font-size: .75rem; font-weight: 500; opacity: .75; }
.pct-qty { display: flex; justify-content: flex-end; }

/* --- Color del texto --- */
.pct-text-auto .pct-light { color: #1d1d1d; text-shadow: 0 0 2px rgba(255, 255, 255, .55); }
.pct-text-auto .pct-dark { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); }
.pct-text-white .pct-row {
  color: #fff;
  font-weight: 800;
  text-shadow:
    -1px -1px 0 #000, 0 -1px 0 #000, 1px -1px 0 #000,
    -1px 0 0 #000, 1px 0 0 #000,
    -1px 1px 0 #000, 0 1px 0 #000, 1px 1px 0 #000;
}
.pct-text-white .pct-label { font-size: 1.05rem; letter-spacing: .03em; }
.pct-text-white .pct-stepper,
.pct-text-white .pct-soldout { text-shadow: none; }

/* --- Stock --- */
.pct-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: .45rem;
  border-radius: 50%;
  vertical-align: 1px;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85);
}
.pct-dot-in { background: #2ecc40; }
.pct-dot-order { background: #ff9f1a; }
.pct-dot-out { background: #e2001a; }

/* --- Selector de cantidad --- */
.pct-stepper {
  display: inline-flex;
  align-items: center;
  width: 108px;
  height: 32px;
  background: #fff;
  border: 1px solid #333;
  border-radius: 16px;
  overflow: hidden;
  text-shadow: none;
}
.pct-stepper button {
  flex: 0 0 32px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #111;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.pct-stepper button:hover { background: #f1f1f1; }
.pct-stepper button:focus-visible { outline: 2px solid var(--pct-accent); outline-offset: -2px; }
.pct-stepper button:disabled { color: #bbb; cursor: default; background: transparent; }
.pct-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #111;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pct-input::-webkit-outer-spin-button,
.pct-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pct-input:focus { outline: none; background: #fafafa; }

.pct-soldout {
  display: inline-block;
  padding: .2rem .7rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .8rem;
  text-shadow: none;
}
.pct-unavailable .pct-name,
.pct-unavailable .pct-price { opacity: .65; }

.pct-empty { margin: 0; padding: 1rem; text-align: center; background: #fafafa; }

/* --- Pie: resumen + botón --- */
.pct-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem 1.25rem;
  margin-top: .75rem;
  padding: .75rem 1rem;
  background: #fff;
  border-radius: var(--pct-radius);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .08);
}
.pct-summary { font-size: 1rem; }
.pct-summary-sep { margin: 0 .35rem; opacity: .5; }
.pct-add {
  min-width: 220px;
  padding: .8rem 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
}
.pct-add i { margin-right: .4rem; }
.pct-add[disabled] { opacity: .5; cursor: not-allowed; }
.pct-add.pct-loading { pointer-events: none; opacity: .7; }

.pct-msg {
  margin-top: .5rem;
  padding: .75rem 1rem;
  border-radius: var(--pct-radius);
  font-size: .95rem;
}
.pct-msg.pct-ok { background: #e8f7ec; color: #17602b; border: 1px solid #b9e3c5; }
.pct-msg.pct-ko { background: #fdecee; color: #8a0f1c; border: 1px solid #f3b8bf; }
.pct-msg ul { margin: .35rem 0 0 1.1rem; padding: 0; }

/* Columna estrecha (.pct-compact, la pone el JS) y móvil: dos líneas por color */
.pct-compact .pct-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "name name qty" "stock price qty";
  padding: .35rem .6rem;
}
.pct-compact .pct-name { grid-area: name; padding-bottom: 0; }
.pct-compact .pct-stock { grid-area: stock; font-size: .85rem; padding-top: 0; }
.pct-compact .pct-price { grid-area: price; font-size: .85rem; padding-top: 0; text-align: left; padding-left: .75rem; }
.pct-compact .pct-qty { grid-area: qty; }

@media (max-width: 767px) {
  .pct-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "name name qty" "stock price qty";
    padding: .4rem .6rem;
  }
  .pct-name { grid-area: name; padding-bottom: 0; }
  .pct-stock { grid-area: stock; font-size: .85rem; padding-top: 0; }
  .pct-price { grid-area: price; font-size: .85rem; padding-top: 0; text-align: left; padding-left: .75rem; }
  .pct-qty { grid-area: qty; }
  .pct-price-old { display: inline; margin-right: .3rem; }
  .pct-stepper { width: 100px; height: 34px; }
  .pct-step-num { width: 38px; height: 38px; font-size: 1.25rem; }
  .pct-step-title { font-size: 1.2rem; }
  .pct-step-head .pct-search { margin-left: 0; flex: 1 1 100%; }
  .pct-sizes { gap: .5rem; }
  .pct-size { min-width: calc(50% - .25rem); flex: 1 1 calc(50% - .25rem); padding: .65rem .5rem; }
  .pct-size-label { font-size: 1.1rem; }
  .pct-search, .pct-search-input { width: 100%; }
  .pct-footer { justify-content: space-between; }
  .pct-add { min-width: 0; flex: 1 1 auto; }
}
