/**
 * Universal Bundle Component CSS
 * A flexible, modern, and universally compatible stylesheet
 * that adapts to any e-commerce store's branding
 */

/* CSS Custom Properties for Easy Theming */
:root {
  /* Colors */
  --ub-primary: #2563eb;
  --ub-primary-hover: #1d4ed8;
  --ub-secondary: #f59e0b;
  --ub-background: #ffffff;
  --ub-surface: #f8fafc;
  --ub-border: #e2e8f0;
  --ub-text-primary: #1e293b;
  --ub-text-secondary: #64748b;
  --ub-text-muted: #94a3b8;
  --ub-success: #10b981;
  --ub-warning: #f59e0b;
  --ub-error: #ef4444;
  
  /* Typography */
  --ub-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ub-font-size-xs: 0.75rem;
  --ub-font-size-sm: 0.875rem;
  --ub-font-size-base: 1rem;
  --ub-font-size-lg: 1.125rem;
  --ub-font-size-xl: 1.25rem;
  --ub-font-size-2xl: 1.5rem;
  
  /* Spacing */
  --ub-spacing-xs: 0.25rem;
  --ub-spacing-sm: 0.5rem;
  --ub-spacing-md: 1rem;
  --ub-spacing-lg: 1.5rem;
  --ub-spacing-xl: 2rem;
  --ub-spacing-2xl: 3rem;
  
  /* Border Radius */
  --ub-radius-sm: 0.375rem;
  --ub-radius-md: 0.5rem;
  --ub-radius-lg: 0.75rem;
  --ub-radius-xl: 1rem;
  
  /* Shadows */
  --ub-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --ub-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --ub-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --ub-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --ub-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme Variations */
.universal-bundle[data-theme="minimal"] {
  --ub-primary: #000000;
  --ub-border: #f0f0f0;
  --ub-radius-md: 0;
}

.universal-bundle[data-theme="classic"] {
  --ub-primary: #8b5a3c;
  --ub-secondary: #d4af37;
  --ub-radius-md: 0.25rem;
}

/* Base Component Styles */
.universal-bundle {
  font-family: var(--ub-font-family);
  color: var(--ub-text-primary);
  background: var(--ub-background);
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-lg);
  padding: var(--ub-spacing-xl);
  margin: var(--ub-spacing-lg) 0;
  box-shadow: var(--ub-shadow-sm);
  transition: var(--ub-transition);
}

.universal-bundle:hover {
  box-shadow: var(--ub-shadow-md);
}

/* Header Styles */
.universal-bundle__header {
  margin-bottom: var(--ub-spacing-xl);
  text-align: center;
}

.universal-bundle__title {
  font-size: var(--ub-font-size-2xl);
  font-weight: 700;
  margin: 0 0 var(--ub-spacing-sm) 0;
  color: var(--ub-text-primary);
}

.universal-bundle__subtitle {
  font-size: var(--ub-font-size-base);
  color: var(--ub-text-secondary);
  margin: 0;
}

/* Desktop Layout */
.universal-bundle__desktop {
  display: block;
}

.universal-bundle__products {
  display: flex;
  align-items: flex-start;
  gap: var(--ub-spacing-lg);
  margin-bottom: var(--ub-spacing-xl);
  flex-wrap: wrap;
}

.universal-bundle[data-layout="grid"] .universal-bundle__products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--ub-spacing-lg);
}

.universal-bundle[data-layout="vertical"] .universal-bundle__products {
  flex-direction: column;
  align-items: stretch;
}

.universal-bundle__separator {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  font-size: var(--ub-font-size-xl);
  font-weight: 600;
  color: var(--ub-text-muted);
  min-width: 2rem;
  height: 2rem;
  background: var(--ub-surface);
  border-radius: 50%;
  border: 2px solid var(--ub-border);
  flex-shrink: 0;
}

/* Product Card Styles */
.universal-bundle__product {
  flex: 1;
  min-width: 200px;
  background: var(--ub-background);
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-md);
  padding: var(--ub-spacing-lg);
  transition: var(--ub-transition);
  position: relative;
  flex-direction: column;
  display: flex;
  justify-content: center;
}

.universal-bundle__product:hover {
  border-color: var(--ub-primary);
  box-shadow: var(--ub-shadow-md);
  transform: translateY(-2px);
}

.universal-bundle__product-image {
  position: relative;
  margin-bottom: var(--ub-spacing-md);
  text-align: center;
}

.universal-bundle__product-image img {
  width: 100%;
  max-width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: var(--ub-radius-sm);
  transition: var(--ub-transition);
  display: inline;
}

.universal-bundle__product:hover .universal-bundle__product-image img {
  transform: scale(1.05);
}

.universal-bundle__product-badge {
  position: absolute;
  top: var(--ub-spacing-sm);
  right: var(--ub-spacing-sm);
  padding: var(--ub-spacing-xs) var(--ub-spacing-sm);
  border-radius: var(--ub-radius-sm);
  font-size: var(--ub-font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.universal-bundle__product-badge--main {
  background: var(--ub-primary);
  color: white;
}

.universal-bundle__product-badge--discount {
  background: var(--ub-error);
  color: white;
}

.universal-bundle__product-badge--new {
  background: var(--ub-success);
  color: white;
}

/* Product Info */
.universal-bundle__product-info {
  text-align: center;
}

.universal-bundle__product-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-sm);
  margin-bottom: var(--ub-spacing-sm);
}

.universal-bundle__product-label {
  font-size: var(--ub-font-size-sm);
  font-weight: 600;
  color: var(--ub-text-secondary);
}

/* Custom Checkbox */
.universal-bundle__product-checkbox {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.universal-bundle__product-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.universal-bundle__checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--ub-border);
  border-radius: var(--ub-radius-sm);
  background: var(--ub-background);
  transition: var(--ub-transition);
  position: relative;
}

.universal-bundle__product-checkbox input:checked + .universal-bundle__checkbox-custom {
  background: var(--ub-primary);
  border-color: var(--ub-primary);
}

.universal-bundle__product-checkbox input:checked + .universal-bundle__checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: var(--ub-font-size-xs);
  font-weight: 700;
}

.universal-bundle__product-checkbox input:disabled + .universal-bundle__checkbox-custom {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Product Name and Link */
.universal-bundle__product-name {
  margin: 0 0 var(--ub-spacing-sm) 0;
  font-size: var(--ub-font-size-base);
  font-weight: 500;
  line-height: 1.4;
}

.universal-bundle__product-link {
  color: var(--ub-primary);
  text-decoration: none;
  transition: var(--ub-transition);
}

.universal-bundle__product-link:hover {
  color: var(--ub-primary-hover);
  text-decoration: underline;
}

/* Product Variants */
.universal-bundle__product-variants {
  margin-bottom: var(--ub-spacing-sm);
}

.universal-bundle__variant-select {
  width: 100%;
  padding: var(--ub-spacing-sm);
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-sm);
  background: var(--ub-background);
  font-size: var(--ub-font-size-sm);
  transition: var(--ub-transition);
}

.universal-bundle__variant-select:focus {
  outline: none;
  border-color: var(--ub-primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Product Pricing */
.universal-bundle__product-pricing {
  margin-bottom: var(--ub-spacing-sm);
}

.universal-bundle__product-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-sm);
  margin-bottom: var(--ub-spacing-xs);
}

.universal-bundle__price-original {
  font-size: var(--ub-font-size-sm);
  color: var(--ub-text-muted);
  text-decoration: line-through;
}

.universal-bundle__price-current {
  font-size: var(--ub-font-size-lg);
  font-weight: 600;
  color: var(--ub-text-primary);
}

/* Product Rating */
.universal-bundle__product-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-xs);
}

.universal-bundle__stars {
  display: flex;
  gap: 1px;
}

.universal-bundle__star {
  color: var(--ub-text-muted);
  font-size: var(--ub-font-size-sm);
}

.universal-bundle__star--filled {
  color: var(--ub-secondary);
}

.universal-bundle__rating-text {
  font-size: var(--ub-font-size-xs);
  color: var(--ub-text-muted);
}

/* Quantity Controls */
.universal-bundle__quantity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-sm);
  margin-top: var(--ub-spacing-sm);
}

.universal-bundle__quantity-label {
  font-size: var(--ub-font-size-sm);
  font-weight: 500;
}

.universal-bundle__quantity-controls {
  display: flex;
  align-items: center;
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-sm);
  overflow: hidden;
}

.universal-bundle__quantity-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--ub-surface);
  color: var(--ub-text-primary);
  cursor: pointer;
  transition: var(--ub-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.universal-bundle__quantity-btn:hover {
  background: var(--ub-primary);
  color: white;
}

.universal-bundle__quantity-input {
  width: 50px;
  height: 32px;
  border: none;
  text-align: center;
  font-size: var(--ub-font-size-sm);
  background: var(--ub-background);
}

.universal-bundle__quantity-input:focus {
  outline: none;
  background: var(--ub-surface);
}

/* Pricing Summary */
.universal-bundle__summary {
  background: var(--ub-surface);
  border-radius: var(--ub-radius-md);
  padding: var(--ub-spacing-lg);
  text-align: center;
}

.universal-bundle__pricing {
  margin-bottom: var(--ub-spacing-lg);
}

.universal-bundle__total {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-sm);
  margin-bottom: var(--ub-spacing-sm);
}

.universal-bundle__total-label {
  font-size: var(--ub-font-size-lg);
  font-weight: 500;
  color: var(--ub-text-secondary);
}

.universal-bundle__total-amount {
  font-size: var(--ub-font-size-2xl);
  font-weight: 700;
  color: var(--ub-text-primary);
}

.universal-bundle__savings {
  display: inline-block;
  padding: var(--ub-spacing-xs) var(--ub-spacing-sm);
  background: var(--ub-success);
  color: white;
  border-radius: var(--ub-radius-sm);
  font-size: var(--ub-font-size-sm);
  font-weight: 600;
}

/* Call to Action Button */
.universal-bundle__cta {
  width: 100%;
  padding: var(--ub-spacing-md) var(--ub-spacing-lg);
  background: linear-gradient(135deg, var(--ub-primary) 0%, var(--ub-primary-hover) 100%);
  color: white;
  border: none;
  border-radius: var(--ub-radius-md);
  font-size: var(--ub-font-size-lg);
  font-weight: 600;
  cursor: pointer;
  transition: var(--ub-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-sm);
  margin-bottom: var(--ub-spacing-lg);
  box-shadow: var(--ub-shadow-sm);
}

.universal-bundle__cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--ub-shadow-lg);
}

.universal-bundle__cta:active {
  transform: translateY(0);
}

.universal-bundle__cta-icon {
  border: none;
  margin: 0px !important;
}

/* Additional Info */
.universal-bundle__additional-info {
  display: flex;
  flex-direction: column;
  gap: var(--ub-spacing-sm);
  font-size: var(--ub-font-size-sm);
  color: var(--ub-text-secondary);
}

.universal-bundle__shipping-info,
.universal-bundle__guarantee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-xs);
}

.universal-bundle__info-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  color: var(--ub-success);
}

/* Mobile Styles */
.universal-bundle__mobile {
  display: none;
}

.universal-bundle__compact-products {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ub-spacing-sm);
  margin-bottom: var(--ub-spacing-lg);
}

.universal-bundle__compact-image {
  width: 60px;
  height: 60px;
  border-radius: var(--ub-radius-sm);
  overflow: hidden;
  border: 1px solid var(--ub-border);
}

.universal-bundle__compact-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.universal-bundle__compact-separator {
  font-size: var(--ub-font-size-lg);
  font-weight: 600;
  color: var(--ub-text-muted);
}

.universal-bundle__expand-btn {
  width: 100%;
  padding: var(--ub-spacing-md);
  background: var(--ub-background);
  border: 2px solid var(--ub-border);
  border-radius: var(--ub-radius-md);
  cursor: pointer;
  transition: var(--ub-transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--ub-font-size-base);
  font-weight: 500;
}

.universal-bundle__expand-btn:hover {
  border-color: var(--ub-primary);
  background: var(--ub-surface);
}

.universal-bundle__expand-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  color: var(--ub-text-muted);
  transition: var(--ub-transition);
}

.universal-bundle__expand-btn:hover .universal-bundle__expand-icon {
  color: var(--ub-primary);
  transform: translateX(4px);
}

/* Modal Styles */
.universal-bundle__modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  padding: var(--ub-spacing-lg);
}

.universal-bundle__modal.universal-bundle__modal--open {
  display: flex; /* Show when open */
  animation: fadeIn 0.3s ease-out;
}

.universal-bundle__modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.universal-bundle__modal-content {
  position: relative;
  background: var(--ub-background);
  border-radius: var(--ub-radius-lg);
  box-shadow: var(--ub-shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

.universal-bundle__modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ub-spacing-md);
  border-bottom: 1px solid var(--ub-border);
}

.universal-bundle__modal-title {
  margin: 0;
  font-size: var(--ub-font-size-xl);
  font-weight: 600;
}

.universal-bundle__modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--ub-radius-sm);
  transition: var(--ub-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.universal-bundle__modal-close:hover {
  background: var(--ub-surface);
}

.universal-bundle__modal-close svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.universal-bundle__modal-body {
  padding: var(--ub-spacing-lg);
  max-height: calc(90vh - 120px);
  overflow-y: auto;
}

.universal-bundle__modal-products {
  margin-bottom: var(--ub-spacing-lg);
}

.universal-bundle__modal-products .s-product-options-option-label {
  display: none;
}

.universal-bundle__modal-products .universal-bundle__product-badge {
  line-height: normal;
  top: -12px;
  right: -12px;
  padding: var(--ub-spacing-xs) var(--ub-spacing-xs);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
  


.universal-bundle__product--mobile {
  display: flex;
  align-items: center;
  gap: var(--ub-spacing-md);
  padding: var(--ub-spacing-md);
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-md);
  margin-bottom: var(--ub-spacing-md);
  text-align: right;
}

.product-options .s-product-options-wrapper salla-conditional-fields {
  flex: 1;
}

.universal-bundle__product--mobile .universal-bundle__product-image {
  margin: 0;
  flex: 1;
}

.universal-bundle__product--mobile .universal-bundle__product-image img {
  width: 80px;
  height: 80px;
  max-width: none;
  object-fit: cover;
}

.universal-bundle__product--mobile .universal-bundle__product-info {
  flex: 2;
  text-align: right;
}

.universal-bundle__product--mobile .universal-bundle__product-header {
  justify-content: flex-start;
  margin-bottom: var(--ub-spacing-xs);
}

.universal-bundle__product--mobile .universal-bundle__product-name {
  margin-bottom: var(--ub-spacing-xs);
}

.universal-bundle__product--mobile .universal-bundle__product-pricing {
  margin-bottom: 0;
}

.universal-bundle__product--mobile .universal-bundle__product-rating {
  justify-content: flex-start;
}

/* Responsive Design */
@media (max-width: 768px) {
  .universal-bundle {
    padding: var(--ub-spacing-lg);
    margin: var(--ub-spacing-md) 0;
  }
  
  .universal-bundle__desktop {
    display: none;
  }
  
  .universal-bundle__mobile {
    display: block;
  }
  
  .universal-bundle__products {
    flex-direction: column;
    gap: var(--ub-spacing-md);
  }
  
  .universal-bundle__product {
    min-width: auto;
    flex-direction: row;
  }
  
  .universal-bundle__separator {
    transform: rotate(90deg);
    margin: var(--ub-spacing-sm) 0;
  }
  
  .universal-bundle__additional-info {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .universal-bundle {
    padding: var(--ub-spacing-md);
  }
  
  .universal-bundle__title {
    font-size: var(--ub-font-size-xl);
  }
  
  .universal-bundle__modal-content {
    margin: var(--ub-spacing-sm);
    max-height: calc(100vh - 2rem);
  }
  
  .universal-bundle__compact-image {
    width: 50px;
    height: 50px;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .universal-bundle,
  .universal-bundle__product,
  .universal-bundle__cta,
  .universal-bundle__expand-btn,
  .universal-bundle__modal-content {
    transition: none;
    animation: none;
  }
  
  .universal-bundle__product:hover {
    transform: none;
  }
  
  .universal-bundle__cta:hover {
    transform: none;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .universal-bundle {
    border-width: 2px;
  }
  
  .universal-bundle__product {
    border-width: 2px;
  }
  
  .universal-bundle__cta {
    border: 2px solid var(--ub-primary);
  }
}

/* Print Styles */
@media print {
  .universal-bundle__mobile,
  .universal-bundle__modal,
  .universal-bundle__cta {
    display: none !important;
  }
  
  .universal-bundle {
    box-shadow: none;
    border: 1px solid #000;
  }
}



