/**
 * Crowoo Product Bundle — Frontend Styles
 *
 * Styles for the bundle product page matching the design mockup:
 * - Pill-style variation selectors
 * - Clean product item layout
 * - Quantity stepper
 * - Add to Cart button
 *
 * @package Crowoo\ProductBundle
 */

/* ==========================================================================
   Bundle Items List
   ========================================================================== */

.wp-block-crowoo-product-bundle-bundle-selector {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.crowoo-bundle-item {
  padding: 0;
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Product Name
   ========================================================================== */

.crowoo-bundle-item-name {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.5rem 0;
  padding: 0;
  line-height: 1.4;
}

/* Hide the "attribute name" label WooCommerce generates (e.g. "Size")
   because the screenshot only shows product name + pills */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-name {
  display: none !important;
}

/* ==========================================================================
   Variation Pill Buttons (WooCommerce iAPI pills)
   ========================================================================== */

/* Pills container */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Each pill label */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  padding: 0.4375rem 1rem;
  border: 1.5px solid #d0d0d0;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 400;
  color: #333;
  background: #fff;
  transition: all 0.15s ease;
  line-height: 1.3;
  white-space: nowrap;
}

/* Hide the radio input */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Hover */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill:hover {
  border-color: #888;
  color: #111;
}

/* Active / Selected pill */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill:has(input:checked) {
  border-color: #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  font-weight: 500;
}

/* Focus */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill-input:focus-visible + span {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Disabled pill */
.crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill:has(input:disabled) {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Legacy Pill Buttons (custom crowoo pills)
   ========================================================================== */

.crowoo-bundle-variation-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.crowoo-bundle-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.crowoo-bundle-pill-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.crowoo-bundle-pill-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4375rem 1rem;
  border: 1.5px solid #d0d0d0;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 400;
  color: #333;
  background: #fff;
  transition: all 0.15s ease;
  line-height: 1.3;
  white-space: nowrap;
}

.crowoo-bundle-pill:hover .crowoo-bundle-pill-label {
  border-color: #888;
  color: #111;
}

.crowoo-bundle-pill-active .crowoo-bundle-pill-label,
.crowoo-bundle-pill-radio:checked + .crowoo-bundle-pill-label {
  border-color: #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  font-weight: 500;
}

.crowoo-bundle-pill-simple .crowoo-bundle-pill-label {
  border-color: #e0e0e0;
  background: #f5f5f5;
  color: #555;
  cursor: default;
}

.crowoo-bundle-pill-radio:focus-visible + .crowoo-bundle-pill-label {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ==========================================================================
   Bundle Children — Injected by JS in Mini Cart / Cart / Checkout Blocks
   ========================================================================== */

.crowoo-bundle-data {
  display: none !important;
}

.crowoo-bundle-children {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f0f0f0;
}

.crowoo-bundle-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crowoo-bundle-child__img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
}

.crowoo-bundle-child__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.crowoo-bundle-child__name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #1a1a1a;
  line-height: 1.35;
}

.crowoo-bundle-child__option {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.35;
}

.wc-block-components-order-summary-item__description .crowoo-bundle-children {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
}

/* Hide bundle-level inline price that appears below children list.
   The standard WooCommerce price column (outside the product cell) remains visible. */
.wc-block-cart-item__wrap:has( .crowoo-bundle-children ) .wc-block-cart-item__prices {
  display: none !important;
}

/* Hide the redundant price inside order summary DESCRIPTION (below children list).
   The top-right item total (.wc-block-components-order-summary-item__full-price)
   is a sibling of the description — not targeted here — so it stays visible. */
.wc-block-components-order-summary-item__description:has( .crowoo-bundle-children )
  .wc-block-components-order-summary-item__individual-prices {
  display: none !important;
}

/* ==========================================================================
   Bundle Form Container (legacy – classic template)
   ========================================================================== */

.crowoo-bundle-form {
  width: 100%;
  margin-top: 1.5rem;
}

.crowoo-bundle-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Error state */
.crowoo-bundle-item-error {
  background-color: #fff0f0;
  border-radius: 8px;
  padding: 1rem;
}

.crowoo-bundle-item-error .crowoo-bundle-item-name {
  color: #cc0000;
}

/* ==========================================================================
   Attribute row grouping
   ========================================================================== */

.crowoo-bundle-attribute {
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Simple Product Option
   ========================================================================== */

.crowoo-bundle-simple-option {
  margin-top: 0;
}

/* ==========================================================================
   No Options
   ========================================================================== */

.crowoo-bundle-no-options {
  font-size: 0.875rem;
  color: #888;
  font-style: italic;
}

/* ==========================================================================
   Bundle Actions (Quantity + Add to Cart) — legacy classic template
   ========================================================================== */

.crowoo-bundle-actions {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Quantity Stepper — legacy classic template
   ========================================================================== */

.crowoo-bundle-quantity {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #d0d0d0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  height: 3.125rem;
}

.crowoo-bundle-qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 400;
  color: #333;
  padding: 0;
  transition: background-color 0.15s ease;
  line-height: 1;
}

.crowoo-bundle-qty-btn:hover {
  background-color: #f0f0f0;
}

.crowoo-bundle-qty-btn:active {
  background-color: #e0e0e0;
}

.crowoo-bundle-qty-input {
  width: 2rem;
  text-align: center;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  color: #1a1a1a;
  background: transparent;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.crowoo-bundle-qty-input::-webkit-outer-spin-button,
.crowoo-bundle-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ==========================================================================
   Add to Cart Button — legacy classic template
   ========================================================================== */

.crowoo-bundle-add-to-cart {
  flex: 1;
  min-width: 200px;
  height: 3.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #1e3a5f;
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0 2rem;
  letter-spacing: 0.01em;
}

.crowoo-bundle-add-to-cart:hover {
  background-color: #15304f;
}

.crowoo-bundle-add-to-cart:active {
  background-color: #0f2540;
  transform: scale(0.99);
}

.crowoo-bundle-add-to-cart.disabled,
.crowoo-bundle-add-to-cart:disabled {
  background-color: #b0b0b0;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
  .crowoo-bundle-actions {
    flex-direction: row;
  }

  .crowoo-bundle-add-to-cart {
    min-width: 0;
  }

  .crowoo-bundle-pill-label {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  .crowoo-bundle-item .wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }
}
