/* Tomaco Loop Quantity 6.2.0
 * CSS funcional + presentación del componente.
 * Usa variables Tomaco/Blocksy cuando existen y fallbacks propios cuando no.
 */
.cqc-qty,
.cqc-qty *,
.cqc-qty *::before,
.cqc-qty *::after {
  box-sizing: border-box;
}

.cqc-qty {
  --cqc-accent: var(--tmc-green, var(--theme-palette-color-1, #62da78));
  --cqc-accent-hover: var(--tmc-green-hover, color-mix(in srgb, var(--cqc-accent) 83%, #fff));
  --cqc-bg: var(--tmc-bg, var(--theme-palette-color-7, #0e110f));
  --cqc-surface: var(--tmc-surface, var(--theme-palette-color-8, #242a24));
  --cqc-raised: var(--tmc-raised, var(--theme-palette-color-6, #191e1a));
  --cqc-border: var(--tmc-border, var(--theme-palette-color-5, #39423a));
  --cqc-text: var(--tmc-text, var(--theme-palette-color-4, #f7f6ef));
  --cqc-muted: var(--tmc-muted, var(--theme-palette-color-3, #b7c0b8));
  --cqc-radius: var(--tmc-radius-sm, 4px);

  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
  text-align: center;
}

.cqc-qty__add {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 138px;
  max-width: 100%;
  min-height: 32px;
  margin: 0 auto !important;
  padding: 8px 16px;
  border: 1px solid transparent !important;
  border-radius: var(--cqc-radius) !important;
  background: var(--cqc-accent) !important;
  color: var(--cqc-bg) !important;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .16s ease, opacity .16s ease, transform .16s ease;
}

.cqc-qty__add:hover {
  background: var(--cqc-accent-hover) !important;
  color: var(--cqc-bg) !important;
}

.cqc-qty__add:focus-visible,
.cqc-qty__btn:focus-visible,
.cqc-qty__input:focus-visible {
  outline: 2px solid var(--cqc-accent);
  outline-offset: 2px;
}

.cqc-qty__add.is-loading,
.cqc-qty__controls.is-loading {
  opacity: .55;
  pointer-events: none;
}

.cqc-qty__add[aria-disabled="true"] {
  pointer-events: none;
}

.cqc-qty__label {
  line-height: 1;
}

.cqc-qty__icon {
  flex: 0 0 auto;
}

.cqc-qty__controls {
  display: grid;
  grid-template-columns: 42px minmax(48px, 58px) 42px;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  height: 32px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--cqc-border);
  border-radius: var(--cqc-radius);
  background: var(--cqc-surface);
  transition: opacity .2s ease, border-color .2s ease;
}

.cqc-qty__controls--locked {
  opacity: .7;
}

.cqc-qty__btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--cqc-raised);
  color: var(--cqc-text);
  font-size: 1.125rem;
  line-height: 1;
  user-select: none;
  cursor: pointer;
}

.cqc-qty__btn:hover:not(:disabled) {
  background: var(--cqc-border);
  color: var(--cqc-accent);
}

.cqc-qty__btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.cqc-qty__input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-inline: 1px solid var(--cqc-border);
  border-radius: 0;
  outline: none;
  box-shadow: none;
  appearance: textfield;
  -moz-appearance: textfield;
  background: var(--cqc-surface);
  color: var(--cqc-text);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.cqc-qty__input::-webkit-outer-spin-button,
.cqc-qty__input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.cqc-qty__notice {
  display: block;
  width: min(100%, 260px);
  margin: 7px auto 0;
  padding: 6px 8px;
  border: 1px solid var(--tmc-danger-border, #fecdca);
  border-radius: var(--cqc-radius);
  background: var(--tmc-danger-soft, #fff4f2);
  color: var(--tmc-danger, #b42318);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

/* Producto de catálogo: precio y acción sobre el mismo eje central. */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.woocommerce ul.products li.product .price,
.woocommerce-page ul.products li.product .price {
  display: block;
  width: 100%;
  margin-inline: auto;
  text-align: center;
}

.woocommerce ul.products li.product .ct-woo-card-actions,
.woocommerce-page ul.products li.product .ct-woo-card-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.woocommerce ul.products li.product .ct-woo-card-actions > .button,
.woocommerce-page ul.products li.product .ct-woo-card-actions > .button,
.woocommerce ul.products li.product .ct-woo-card-actions > .cqc-qty,
.woocommerce-page ul.products li.product .ct-woo-card-actions > .cqc-qty {
  margin-inline: auto !important;
}

/* Tarjetas de los shortcodes propios de Tomaco. */
.tmc-best__card .tmc-best__price {
  width: 100%;
  text-align: center;
}

.tmc-best__card .tmc-best__actions {
  align-items: center;
  margin-top: 0;
  text-align: center;
}

.tmc-best__card .tmc-best__cartline,
.tmc-best__card .cqc-qty {
  width: 100%;
  min-width: 0;
}

.tmc-best__card .cqc-qty__add {
  margin-inline: auto !important;
}

/* Relacionados / upsells Blocksy. */
.single-product .related .products.flexy-items,
.single-product .upsells .products.flexy-items {
  align-items: stretch;
}

.single-product .related .products.flexy-items .flexy-item,
.single-product .upsells .products.flexy-items .flexy-item {
  display: flex;
  height: auto;
}

.single-product .related .products.flexy-items .flexy-item > .product,
.single-product .upsells .products.flexy-items .flexy-item > .product {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.single-product :is(.related, .upsells) .products.flexy-items .flexy-item > .product .ct-woo-card-actions {
  margin-top: 10px !important;
}

@media (max-width: 768px) {
  .cqc-qty__add {
    min-width: 100px;
    min-height: 32px;
    padding: 7px 13px;
  }

  .cqc-qty__controls {
    grid-template-columns: 36px minmax(46px, 54px) 36px;
    height: 32px;
  }

  .cqc-qty__btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .cqc-qty__input {
    height: 32px;
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cqc-qty__add,
  .cqc-qty__controls {
    transition-duration: .01ms !important;
  }
}
