/* GroPulse Product Bundler Styles - Following Volume Discount Widget Pattern */

/* CSS Custom Properties for Theming */
:root {
  --gpb-primary-color: #1e293b;
  --gpb-accent-color: #0369a1;
  --gpb-success-color: #15803d;
  --gpb-warning-color: #92400e;
  --gpb-background-color: #ffffff;
  
  /* Additional colors for complete light mode support */
  --gpb-hover-bg-color: #f8fafc;
  --gpb-selected-bg-color: var(--gpb-hover-bg-color);
  --gpb-badge-bg-color: #1e293b;
  --gpb-badge-text-color: #ffffff;
  --gpb-input-bg-color: #ffffff;
  --gpb-input-border-color: #d1d5db;
  --gpb-input-text-color: #374151;
  --gpb-section-bg-color: #f8faff;
  --gpb-divider-color: #f1f5f9;
  --gpb-muted-text-color: #64748b;
  --gpb-add-to-cart-bg-color: #1e293b;
  --gpb-add-to-cart-text-color: #ffffff;
  --gpb-offer-text-color: #64748b;
}

/* Container */
.gpb-bundle-widget {
  max-width: 100%;
  background: var(--gpb-background-color);
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  position: relative;
  min-width: 300px;
  animation: fadeInUp 0.4s ease-out;
  font-family: inherit, sans-serif;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.gpb-bundle-discount-banner {
  background: var(--gpb-discount-banner-bg-color, #1e293b);
  color: var(--gpb-discount-banner-text-color, #ffffff);
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

.gpb-bundle-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gpb-divider-color);
}

.gpb-bundle-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--gpb-primary-color);
  margin-bottom: 4px;
  margin-top: 0px;
}

.gpb-bundle-subtitle {
  font-size: 14px;
  color: var(--gpb-offer-text-color);
  line-height: 1.4;
  margin-top: 9px;
  margin-bottom: 0px;
}

/* Products Section */
.gpb-bundle-products {
  padding: 0px;
}

/* Product Row */
.gpb-product-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  border-bottom: 1px solid var(--gpb-divider-color);
  cursor: pointer;
}

.gpb-product-row:last-child {
  border-bottom: none;
}

.gpb-product-row.current-item {
  background: var(--gpb-section-bg-color);
  padding: 12px 16px;
  border-radius: 6px;
  cursor: default;
}

.gpb-product-row:not(.current-item):hover {
  background: var(--gpb-hover-bg-color);
}

/* Checkbox Area */
.gpb-selection-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 24px;
}

.gpb-product-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gpb-input-border-color);
  border-radius: 4px;
  background: var(--gpb-input-bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.gpb-product-checkbox.checked {
  background: var(--gpb-primary-color);
  border-color: var(--gpb-primary-color);
}

.gpb-product-checkbox.checked::after {
  content: '';
  width: 6px;
  height: 10px;
  border: 2px solid var(--gpb-background-color);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  margin-top: -1px;
}

.gpb-product-checkbox.disabled {
  background: #d0d0d0;
  border-color: #d0d0d0;
  opacity: 0.5;
  cursor: not-allowed;
}

.gpb-product-checkbox.disabled::after {
  content: '';
  width: 6px;
  height: 10px;
  border: 2px solid var(--gpb-background-color);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  margin-top: -1px;
}


/* Product Image */
.gpb-product-image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid var(--gpb-input-border-color);
  flex-shrink: 0;
}

.gpb-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Product Details */
.gpb-product-details {
  flex: 1;
  min-width: 0;
}

/* Quantity Display */
.gpb-product-quantity {
  position: absolute;
  top: 60%;
  right: 16px;
  transform: translateY(-50%);
  background: var(--gpb-primary-color);
  color: var(--gpb-background-color);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
  line-height: 1;
  z-index: 5;
}

h4.gpb-product-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--gpb-primary-color);
  margin-bottom: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpb-product-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--gpb-offer-text-color);
}

.gpb-variant-selector {
  margin-bottom: 8px;
}

.gpb-variant-select {
  appearance: none;
  background: var(--gpb-input-bg-color);
  border: 1px solid var(--gpb-input-border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--gpb-input-text-color);
  cursor: pointer;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 100px;
}

.gpb-variant-select:hover {
  border-color: #9ca3af;
}

.gpb-variant-select:focus {
  outline: none;
  border-color: var(--gpb-primary-color);
  box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.1);
}

.gpb-price-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gpb-price-original {
  font-size: 12px;
  color: var(--gpb-offer-text-color);
  text-decoration: line-through;
}

.gpb-price-current {
  font-size: 14px;
  font-weight: 600;
  color: var(--gpb-primary-color);
}

/* Status Badge */
.gpb-product-badge {
  position: absolute;
  top: -1px;
  right: 10px;
  background: var(--gpb-badge-bg-color);
  color: var(--gpb-badge-text-color);
  padding: 2px 8px;
  border-radius: 0 0 4px 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
  pointer-events: none;
}

/* Summary Section */
.gpb-bundle-summary {
  background: var(--gpb-section-bg-color);
  padding: 18px 20px;
  border-top: 1px solid var(--gpb-divider-color);
}

.gpb-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}


.gpb-summary-label {
  font-size: 14px;
  color: var(--gpb-input-text-color);
}

.gpb-summary-value-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gpb-summary-value {
  font-size: 14px;
  color: var(--gpb-primary-color);
}

.gpb-summary-value.strikethrough {
  color: var(--gpb-offer-text-color);
  text-decoration: line-through;
  font-weight: 400;
}

.gpb-required-notice {
  background: color-mix(in srgb, var(--gpb-warning-color) 10%, transparent);
  color: var(--gpb-warning-color);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  margin: 12px 0;
  border: 1px solid color-mix(in srgb, var(--gpb-warning-color) 20%, transparent);
}

/* CTA Button */
.gpb-bundle-cta {
  width: 100%;
  background: var(--gpb-add-to-cart-bg-color);
  color: var(--gpb-add-to-cart-text-color);
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 16px;
}

.gpb-bundle-cta:hover {
  background: #0f172a;
  color: var(--gpb-background-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 41, 59, 0.4);
}

.gpb-bundle-cta:active {
  transform: translateY(0);
}

.gpb-bundle-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gpb-bundle-cta:disabled:hover {
  background: var(--gpb-primary-color);
  transform: none;
  box-shadow: none;
}

.gpb-bundle-cta.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gpb-bundle-cta.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

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

/* Responsive Design */
@media (max-width: 480px) {
  .gpb-bundle-widget {
    max-width: 100%;
  }

  .gpb-bundle-header,
  .gpb-bundle-summary {
    padding-left: 20px;
    padding-right: 20px;
  }

  .gpb-product-content {
    padding: 16px 20px;
    gap: 12px;
  }

  .gpb-product-row.current-item {
    padding-left: 16px;
  }

  .gpb-product-image {
    width: 50px;
    height: 50px;
  }

  .gpb-variant-select {
    min-width: 80px;
    font-size: 13px;
    padding: 8px 10px;
    padding-right: 32px;
  }
} 