/* Product Cart Actions Block - Frontend Styles */

.product-cart-actions-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.wp-block-button__link.is-disabled,
.wp-block-button__link[disabled],
.wp-block-button__link[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.wp-block-button:has(.wp-block-button__link.is-disabled),
.wp-block-button:has(.wp-block-button__link[disabled]),
.wp-block-button:has(.wp-block-button__link[aria-disabled="true"]) {
  cursor: not-allowed;
}

/* Row: price + quantity always side-by-side, buttons below in stacked */
.product-cart-actions-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.product-cart-actions-row__top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Horizontal layout: price + quantity inline, buttons beside */
.product-cart-actions-form--horizontal .product-cart-actions-row {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.product-cart-actions-form--horizontal .product-cart-actions-row__top {
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.75rem;
}

.product-cart-actions-form--horizontal .product-cart-actions-buttons {
  align-items: center;
  padding-top: 0;
  flex: 0 0 auto;
}

.product-cart-actions-form--horizontal
  .product-cart-actions-buttons
  .wp-element-button {
  flex: none;
  white-space: nowrap;
}

.product-cart-actions-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

/* Price sizes — set on the container, children scale with em */
.product-cart-actions-price--small {
  font-size: 1rem;
}
.product-cart-actions-price--medium {
  font-size: 1.25rem;
}
.product-cart-actions-price--large {
  font-size: 1.875rem;
}
.product-cart-actions-price--x-large {
  font-size: 2.5rem;
}

.product-cart-actions-price__value {
  font-size: 1em;
  font-weight: 700;
  font-family: var(--font-family-serif, serif);
}

.product-cart-actions-price__old {
  font-size: 0.7em;
  text-decoration: line-through;
  color: var(--muted-foreground, #999);
}

.product-cart-actions-stock {
  font-size: 0.45em;
  font-weight: 500;
}

.product-cart-actions-stock--in {
  color: #16a34a;
}
.product-cart-actions-stock--out {
  color: #dc2626;
}

.product-cart-actions-quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-cart-actions-quantity label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground, #999);
}

.product-cart-actions-quantity input[type="number"] {
  width: 4rem;
  height: 2.5rem;
  text-align: center;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0;
  font-size: 1rem;
}

.product-cart-actions-quantity button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border, #e5e7eb);
  background: transparent;
  cursor: pointer;
  font-size: 1.25rem;
}

.product-cart-actions-quantity button:first-of-type {
  border-radius: var(--radius, 0.375rem) 0 0 var(--radius, 0.375rem);
}

.product-cart-actions-quantity button:last-of-type {
  border-radius: 0 var(--radius, 0.375rem) var(--radius, 0.375rem) 0;
}

.product-cart-actions-subtotal {
  font-size: 0.875rem;
  color: var(--muted-foreground, #999);
  margin-left: 0.5rem;
}

.product-cart-actions-buttons {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.product-cart-actions-buttons .wp-element-button {
  flex: 1;
}

/* Button sizes */
.product-cart-actions-buttons--small .wp-element-button {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}
.product-cart-actions-buttons--medium .wp-element-button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}
.product-cart-actions-buttons--large .wp-element-button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.product-cart-actions-btn--outline {
  background: transparent !important;
  color: var(--primary, #1d3557) !important;
  border: 1px solid var(--border, #e5e7eb) !important;
}

.product-cart-actions-btn--sm {
  padding: 0.25rem 0.75rem !important;
  font-size: 0.875rem !important;
}

/* ---- Cart notices (toast style) ---- */

.cart-notice {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius, 0.375rem);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 24rem;
  animation: cart-notice-in 200ms ease-out;
}

@keyframes cart-notice-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cart-notice--success {
  background: color-mix(in oklab, #16a34a 10%, transparent);
  color: #16a34a;
  border: 1px solid color-mix(in oklab, #16a34a 25%, transparent);
}

.cart-notice--error {
  background: color-mix(in oklab, #dc2626 10%, transparent);
  color: #dc2626;
  border: 1px solid color-mix(in oklab, #dc2626 25%, transparent);
}

.cart-notice--info {
  background: color-mix(in oklab, var(--primary, #1d3557) 8%, transparent);
  color: var(--primary, #1d3557);
  border: 1px solid
    color-mix(in oklab, var(--primary, #1d3557) 20%, transparent);
}

.cart-notice__message {
  flex: 1;
}

.cart-notice__dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
  color: inherit;
}

.cart-notice__dismiss:hover {
  opacity: 1;
}

.product-cart-actions__notice {
  font-size: 0.875rem;
  color: var(--muted-foreground, #999);
  font-style: italic;
}

.product-cart-actions-name {
  font-size: 0.875rem;
  color: var(--muted-foreground, #999);
}

.product-cart-actions-attributes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-cart-actions-attribute {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.product-cart-actions-attribute__label {
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-family-serif, serif);
}

.product-cart-actions-attribute__options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.product-cart-actions-option {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.product-cart-actions-option input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--primary, #1d3557);
}

.product-cart-actions-option--selected {
  font-weight: 600;
}

.product-cart-actions-grouped-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.product-cart-actions-grouped-header__title {
  font-size: 1.25rem;
  font-weight: 600;
}

.product-cart-actions-grouped-header__count {
  font-size: 0.875rem;
  color: var(--muted-foreground, #999);
}

.product-cart-actions-grouped-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-cart-actions-grouped-item {
  padding: 1rem;
  background: color-mix(in oklab, var(--muted, #f0f0f0) 30%, transparent);
  border-radius: 0.5rem;
}

.product-cart-actions-grouped-item__name {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.product-cart-actions-grouped-item__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

/* -------------------------------------------------------------- */
/* Bundle layout — mirrors the redesign reference in              */
/* apps/woographql.com/redesign-refs/woographql-pro.html          */
/* (`.demo-bundle-row` / `.demo-bundle-img` / `.demo-check`).     */
/* Required items render with a checked + disabled checkbox so    */
/* the UI signals they're locked-in; optional items toggle.       */
/* -------------------------------------------------------------- */

.pca-bundle-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pca-bundle-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.5rem;
  background: var(--background, #fff);
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.pca-bundle-row--required {
  background: color-mix(in oklab, var(--accent, #7bbe91) 12%, transparent);
  border-color: color-mix(in oklab, var(--accent, #7bbe91) 35%, transparent);
}

.pca-bundle-row--checked {
  background: color-mix(in oklab, var(--accent, #7bbe91) 18%, transparent);
  border-color: color-mix(in oklab, var(--accent, #7bbe91) 45%, transparent);
}

.pca-bundle-row__image {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.375rem;
  overflow: hidden;
  background: color-mix(in oklab, var(--muted, #f0f0f0) 35%, transparent);
  display: grid;
  place-items: center;
  font-size: 1.375rem;
}

.pca-bundle-row__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pca-bundle-row__info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.pca-bundle-row__name {
  display: inline-flex;
  align-items: baseline;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pca-bundle-row__price {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted-foreground, #999);
}

.pca-bundle-row__discount {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #16a34a;
  letter-spacing: 0.02em;
}

/* Custom checkbox styling — appears as a circular check chip
 * matching the `.demo-check` look in the redesign reference. */
.pca-bundle-row__check {
  flex: 0 0 auto;
  appearance: none;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  border: 1.5px solid var(--border, #e5e7eb);
  background: var(--background, #fff);
  cursor: pointer;
  position: relative;
  transition:
    background 150ms ease,
    border-color 150ms ease;
}

.pca-bundle-row__check:hover:not(:disabled) {
  border-color: var(--primary, #1d3557);
}

.pca-bundle-row__check:checked {
  background: var(--primary, #1d3557);
  border-color: var(--primary, #1d3557);
}

.pca-bundle-row__check:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  /* Inline SVG checkmark — survives without external icon font. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8' fill='none'%3E%3Cpath d='M1 4l3 3 5-6' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.pca-bundle-row__check:disabled {
  cursor: default;
  opacity: 0.85;
}

.product-cart-actions-composite-component {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.product-cart-actions-composite-component__label {
  font-size: 0.875rem;
  font-weight: 600;
}

.product-cart-actions-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 0.375rem);
  font-size: 0.875rem;
  background: var(--background, #fff);
}

/* Dropdown style: selected option preview */
.product-cart-actions-composite-selection {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: color-mix(in oklab, var(--muted, #f0f0f0) 30%, transparent);
  border-radius: 0.5rem;
}

.product-cart-actions-composite-selection__image {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
  border-radius: var(--radius, 0.375rem);
}

.product-cart-actions-composite-selection__name {
  font-size: 1.125rem;
  font-weight: 700;
}

.product-cart-actions-composite-selection__price {
  font-size: 0.875rem;
}

/* ---- Cards style ---- */

.composite-options-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.composite-options-cards .composite-option-card {
  width: 10rem;
  flex: 0 1 10rem;
}

.composite-option-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 0.375rem);
  background: var(--background, #fff);
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
  text-align: left;
  padding: 0;
}

.composite-option-card:hover {
  border-color: var(--primary, #1d3557);
  box-shadow: 0 2px 8px
    color-mix(in oklab, var(--primary, #1d3557) 12%, transparent);
}

.composite-option-card--selected {
  border-color: var(--primary, #1d3557);
  box-shadow: 0 0 0 1px var(--primary, #1d3557);
}

.composite-option-card__image {
  aspect-ratio: 1;
  overflow: hidden;
  background: color-mix(in oklab, var(--muted, #f0f0f0) 30%, transparent);
}

.composite-option-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 200ms ease;
}

.composite-option-card:hover .composite-option-card__image img {
  transform: scale(1.05);
}

.composite-option-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.625rem 0.75rem;
  flex: 1;
}

.composite-option-card__name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

.composite-option-card__price {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground, #999);
}

.composite-option-card__action {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  background: color-mix(in oklab, var(--muted, #f0f0f0) 30%, transparent);
  color: var(--muted-foreground, #999);
  transition:
    background 150ms ease,
    color 150ms ease;
}

.composite-option-card__action--active {
  background: var(--primary, #1d3557);
  color: var(--primary-foreground, #fff);
}

.composite-option-card:hover
  .composite-option-card__action:not(.composite-option-card__action--active) {
  background: color-mix(in oklab, var(--primary, #1d3557) 10%, transparent);
  color: var(--primary, #1d3557);
}

/* ---- List style ---- */

.composite-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.composite-option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 0.375rem);
  background: var(--background, #fff);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease;
  text-align: left;
  width: 100%;
}

.composite-option-row:hover {
  border-color: var(--primary, #1d3557);
  background: color-mix(in oklab, var(--primary, #1d3557) 4%, transparent);
}

.composite-option-row--selected {
  border-color: var(--primary, #1d3557);
  background: color-mix(in oklab, var(--primary, #1d3557) 6%, transparent);
}

.composite-option-row__image {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: var(--radius, 0.375rem);
  flex-shrink: 0;
}

.composite-option-row__name {
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.composite-option-row__price {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.composite-option-row__action {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground, #999);
  white-space: nowrap;
  min-width: 3rem;
  text-align: right;
}

.composite-option-row__action--active {
  color: var(--primary, #1d3557);
}

/* ---- Composite stepper ---- */

.composite-stepper__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.composite-stepper__progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-width: 8rem;
}

.composite-stepper__progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border, #e5e7eb);
  border-radius: 2px;
  overflow: hidden;
}

.composite-stepper__progress-fill {
  height: 100%;
  background: var(--primary, #1d3557);
  border-radius: 2px;
  transition: width 300ms ease;
}

.composite-stepper__progress-text {
  font-size: 0.75rem;
  color: var(--muted-foreground, #999);
}

/* Step indicators */
.composite-stepper__indicators {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.composite-stepper__indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 0.375rem);
  background: transparent;
  cursor: pointer;
  min-width: 4rem;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.composite-stepper__indicator:hover {
  border-color: var(--primary, #1d3557);
}

.composite-stepper__indicator--active {
  border-color: var(--primary, #1d3557);
  background: color-mix(in oklab, var(--primary, #1d3557) 8%, transparent);
}

.composite-stepper__indicator--complete {
  border-color: #16a34a;
}

.composite-stepper__indicator--complete .composite-stepper__indicator-num {
  color: #16a34a;
}

.composite-stepper__indicator-num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted-foreground, #999);
}

.composite-stepper__indicator--active .composite-stepper__indicator-num {
  color: var(--primary, #1d3557);
}

.composite-stepper__indicator-label {
  font-size: 0.625rem;
  color: var(--muted-foreground, #999);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 5rem;
}

/* Step content */
.composite-stepper__step {
  padding: 1rem 0;
}

.composite-stepper__step-title {
  font-size: 1.125rem;
  font-weight: 600;
  font-family: var(--font-family-serif, serif);
  margin-bottom: 0.75rem;
}

/* Review step */
.composite-stepper__review {
  padding: 1rem 0;
}

.composite-stepper__review-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.composite-stepper__review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: color-mix(in oklab, var(--muted, #f0f0f0) 30%, transparent);
  border-radius: 0.5rem;
}

.composite-stepper__review-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground, #999);
}

.composite-stepper__review-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
}

.composite-stepper__review-value {
  font-size: 0.875rem;
  font-weight: 600;
}

.composite-stepper__review-price {
  font-size: 0.75rem;
  color: var(--muted-foreground, #999);
}

/* Navigation */
.composite-stepper__nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.composite-stepper__nav-spacer {
  flex: 1;
}

/* ----------------------------------------------------------------------
 * Buttons region — InnerBlocks-saved <core/buttons> containers.
 * The product-cart-actions block templates 8 button-group containers; at
 * runtime we hide the ones not relevant to the current product type and
 * cart state. In the editor the same rules drive the preview-state toolbar.
 * Component logic toggles [hidden] on individual buttons / containers via
 * useBindCartButton; the data-preview-state rules below override that for
 * the editor so designers can preview any state regardless of session.
 * --------------------------------------------------------------------*/

.pca-inner-region {
  display: flex;
  gap: 0.5rem;
}
.pca-inner-region--horizontal {
  flex-direction: row;
  flex-wrap: wrap;
}
.pca-inner-region--stacked {
  flex-direction: column;
}

/* Loader state. The static save markup contains both .pca-loading-indicator
 * and .pca-inner-region. We hide the inner region while it's a direct
 * child of the wrapper (i.e. before view.tsx mounts React and AdoptedNode
 * re-attaches it inside the form) so all 9 templates don't flash on first
 * paint. createRoot.render replaces the wrapper's children with the React
 * tree, removing the .pca-loading-indicator at the same time. */
.wp-block-woographql-product-cart-actions > .pca-inner-region {
  display: none;
}

.pca-loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 2.5rem;
}

.pca-loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0.5;
  animation: pca-loading-spin 0.8s linear infinite;
}

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

/* Product-type relevance — hide containers that don't apply to the current
 * product type. The data-product-type attribute may live on the cart-actions
 * wrapper itself (standalone usage) OR on any ancestor (e.g. a parent
 * product-card publishing its product type), so the selectors are anchored
 * on `[data-product-type=...]` without a host class. */
[data-product-type="simple"] .pca-bundle-empty,
[data-product-type="simple"] .pca-bundle-in-cart,
[data-product-type="simple"] .pca-grouped,
[data-product-type="simple"] .pca-external,
[data-product-type="simple"] .pca-composite-nav,
[data-product-type="simple"] .pca-composite-final,
[data-product-type="simple"] .pca-composite-in-cart,
[data-product-type="subscription"] .pca-bundle-empty,
[data-product-type="subscription"] .pca-bundle-in-cart,
[data-product-type="subscription"] .pca-grouped,
[data-product-type="subscription"] .pca-external,
[data-product-type="subscription"] .pca-composite-nav,
[data-product-type="subscription"] .pca-composite-final,
[data-product-type="subscription"] .pca-composite-in-cart,
[data-product-type="variable"] .pca-bundle-empty,
[data-product-type="variable"] .pca-bundle-in-cart,
[data-product-type="variable"] .pca-grouped,
[data-product-type="variable"] .pca-external,
[data-product-type="variable"] .pca-composite-nav,
[data-product-type="variable"] .pca-composite-final,
[data-product-type="variable"] .pca-composite-in-cart,
[data-product-type="variable-subscription"] .pca-bundle-empty,
[data-product-type="variable-subscription"] .pca-bundle-in-cart,
[data-product-type="variable-subscription"] .pca-grouped,
[data-product-type="variable-subscription"] .pca-external,
[data-product-type="variable-subscription"] .pca-composite-nav,
[data-product-type="variable-subscription"] .pca-composite-final,
[data-product-type="variable-subscription"] .pca-composite-in-cart,
[data-product-type="bundle"] .pca-simple-empty,
[data-product-type="bundle"] .pca-simple-in-cart,
[data-product-type="bundle"] .pca-grouped,
[data-product-type="bundle"] .pca-external,
[data-product-type="bundle"] .pca-composite-nav,
[data-product-type="bundle"] .pca-composite-final,
[data-product-type="bundle"] .pca-composite-in-cart,
[data-product-type="grouped"] .pca-simple-empty,
[data-product-type="grouped"] .pca-simple-in-cart,
[data-product-type="grouped"] .pca-bundle-empty,
[data-product-type="grouped"] .pca-bundle-in-cart,
[data-product-type="grouped"] .pca-external,
[data-product-type="grouped"] .pca-composite-nav,
[data-product-type="grouped"] .pca-composite-final,
[data-product-type="grouped"] .pca-composite-in-cart,
[data-product-type="external"] .pca-simple-empty,
[data-product-type="external"] .pca-simple-in-cart,
[data-product-type="external"] .pca-bundle-empty,
[data-product-type="external"] .pca-bundle-in-cart,
[data-product-type="external"] .pca-grouped,
[data-product-type="external"] .pca-composite-nav,
[data-product-type="external"] .pca-composite-final,
[data-product-type="external"] .pca-composite-in-cart,
[data-product-type="composite"] .pca-simple-empty,
[data-product-type="composite"] .pca-simple-in-cart,
[data-product-type="composite"] .pca-bundle-empty,
[data-product-type="composite"] .pca-bundle-in-cart,
[data-product-type="composite"] .pca-grouped,
[data-product-type="composite"] .pca-external {
  display: none;
}

/* Cart-state filter — published as `data-cart-state` on the React-rendered
 * <form> by each *CartOptions component (Simple / Variable / Bundle /
 * Composite). For composite, also published as `data-composite-step` so we
 * can distinguish the selection screen from the review screen. */
[data-cart-state="empty"] .pca-simple-in-cart,
[data-cart-state="empty"] .pca-bundle-in-cart,
[data-cart-state="empty"] .pca-composite-in-cart,
[data-cart-state="in-cart"] .pca-simple-empty,
[data-cart-state="in-cart"] .pca-bundle-empty,
[data-cart-state="in-cart"] .pca-composite-nav,
[data-cart-state="in-cart"] .pca-composite-final,
[data-composite-step="selection"] .pca-composite-final,
[data-composite-step="review"][data-cart-state="empty"] .pca-composite-nav {
  display: none;
}

/* Editor preview-state — drives which container/button is shown when a
 * product type has multiple states. Uses !important so the designer's
 * toolbar pick wins over the component-driven data-cart-state above. */
.wp-block-woographql-product-cart-actions[data-preview-state="empty"]
  .pca-simple-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="empty"]
  .pca-bundle-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="empty"]
  .pca-composite-final,
.wp-block-woographql-product-cart-actions[data-preview-state="empty"]
  .pca-composite-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="empty"]
  .pca-composite-nav
  .pca-review,
.wp-block-woographql-product-cart-actions[data-preview-state="in-cart"]
  .pca-simple-empty,
.wp-block-woographql-product-cart-actions[data-preview-state="in-cart"]
  .pca-bundle-empty,
.wp-block-woographql-product-cart-actions[data-preview-state="in-cart"]
  .pca-composite-nav,
.wp-block-woographql-product-cart-actions[data-preview-state="in-cart"]
  .pca-composite-final,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review-prep"]
  .pca-simple-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review-prep"]
  .pca-bundle-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review-prep"]
  .pca-composite-final,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review-prep"]
  .pca-composite-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review-prep"]
  .pca-composite-nav
  .pca-next,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review"]
  .pca-simple-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review"]
  .pca-bundle-in-cart,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review"]
  .pca-composite-nav,
.wp-block-woographql-product-cart-actions[data-preview-state="composite-review"]
  .pca-composite-in-cart {
  display: none !important;
}

/* -------------------------------------------------------------- */
/* Product Add-Ons — input + grid styling                          */
/* Mirrors the redesign reference's `.demo-options-label`,         */
/* `.demo-input`, `.demo-grid`, `.demo-option` from                */
/* apps/woographql.com/redesign-refs/woographql-pro.html.          */
/* The grid layout is intentionally shared with the composite     */
/* cards style so both surfaces feel like the same UI dialect.    */
/* -------------------------------------------------------------- */

.pca-addons {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.pca-addon {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pca-addons-label,
.pca-addons-heading {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted-foreground, #999);
  text-transform: uppercase;
  margin: 0;
}

.pca-addons-heading {
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--foreground, #1d3557);
}

/* `color` is pinned (not `inherit`) because cart-actions
 * frequently live on themed cards whose foreground is set to
 * a light-on-dark palette via `has-*-color` block-supports
 * classes — inheriting that into a white input field would
 * make the typed value invisible. Designers needing a dark-
 * themed input can override via the block's color controls. */
.pca-addon-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.5rem;
  background: var(--background, #fff);
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--foreground, #1d3557);
  transition: border-color 150ms ease;
  box-sizing: border-box;
}

.pca-addon-input::placeholder {
  color: var(--muted-foreground, #999);
}

.pca-addon-input:focus {
  outline: none;
  border-color: var(--primary, #1d3557);
}

.pca-addon-input--textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.pca-addon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 28rem) {
  .pca-addon-grid {
    grid-template-columns: 1fr;
  }
}

/* Pinned `color` for the same reason as `.pca-addon-input`
 * above — the white option-card background needs explicit
 * dark text rather than the parent card's light foreground. */
.pca-addon-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.5rem;
  background: var(--background, #fff);
  cursor: pointer;
  text-align: left;
  font-size: 0.78125rem;
  line-height: 1.3;
  color: var(--foreground, #1d3557);
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.pca-addon-option:hover {
  border-color: var(--primary, #1d3557);
  background: color-mix(in oklab, var(--primary, #1d3557) 5%, transparent);
}

.pca-addon-option--selected {
  border-color: var(--primary, #1d3557);
  background: color-mix(in oklab, var(--accent, #7bbe91) 22%, transparent);
}

.pca-addon-option--selected:hover {
  background: color-mix(in oklab, var(--accent, #7bbe91) 28%, transparent);
}

.pca-addon-option__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pca-addon-option__price {
  font-size: 0.6875rem;
  color: var(--muted-foreground, #999);
  white-space: nowrap;
}

.pca-addon--unsupported .product-cart-actions__notice {
  font-size: 0.75rem;
}

.pca-addon-currency {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 0.375rem;
  background: var(--background, #fff);
  overflow: hidden;
}

.pca-addon-currency:focus-within {
  border-color: var(--ring, #6366f1);
}

.pca-addon-currency__symbol {
  display: inline-flex;
  align-items: center;
  padding: 0 0.625rem;
  background: var(--muted, #f3f4f6);
  color: var(--muted-foreground, #6b7280);
  font-weight: 500;
}

.pca-addon-input--currency,
.pca-addon-input--quantity {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pca-addon-currency .pca-addon-input--currency {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pca-addon-input--file {
  padding: 0.5rem 0;
  background: transparent;
  border: 0;
}

.product-cart-actions__notice--error {
  color: var(--destructive, #b91c1c);
}
