/**
 * Upsells Bolt - Frontend Styles
 */

/* Cart Upsells Section */
.cart-upsells {
  margin: 24px 0;
  padding: 20px;
  background: #f9fafb;
  border-radius: 12px;
}

.cart-upsells h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upsell-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* Upsell Product Card */
.upsell-card {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: all 0.2s;
}

.upsell-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.upsell-card-image {
  position: relative;
  margin-bottom: 10px;
}

.upsell-card-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #f3f4f6;
}

.upsell-discount-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #dc2626;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.upsell-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upsell-card-price {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.upsell-price-current {
  font-weight: 700;
  color: #059669;
}

.upsell-price-original {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 0.85rem;
}

.upsell-add-btn {
  width: 100%;
  padding: 10px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.upsell-add-btn:hover {
  background: #047857;
}

.upsell-add-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.upsell-add-btn.added {
  background: #d1fae5;
  color: #065f46;
}

/* Product Page Upsells */
.product-upsells {
  margin: 32px 0;
  padding: 24px;
  background: #f9fafb;
  border-radius: 12px;
}

.product-upsells h3 {
  margin: 0 0 20px;
  font-size: 1.2rem;
}

.product-upsells .upsell-products {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Bundle Style (Frequently Bought Together) */
.upsell-bundle {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
}

.upsell-bundle-item {
  text-align: center;
  max-width: 120px;
}

.upsell-bundle-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e5e5e5;
}

.upsell-bundle-item.selected img {
  border-color: #059669;
}

.upsell-bundle-item input[type="checkbox"] {
  display: none;
}

.upsell-bundle-item label {
  cursor: pointer;
}

.upsell-bundle-item .item-name {
  font-size: 0.8rem;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upsell-bundle-item .item-price {
  font-weight: 600;
  color: #059669;
  font-size: 0.85rem;
}

.upsell-bundle-plus {
  font-size: 1.5rem;
  color: #9ca3af;
}

.upsell-bundle-total {
  background: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.upsell-bundle-total .total-label {
  font-size: 0.85rem;
  color: #6b7280;
}

.upsell-bundle-total .total-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #059669;
}

.upsell-bundle-total .total-savings {
  font-size: 0.85rem;
  color: #dc2626;
}

.upsell-bundle-total button {
  margin-top: 12px;
  padding: 12px 24px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

/* Post-Purchase Upsell Modal */
.post-purchase-upsell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.post-purchase-upsell.active {
  display: flex;
}

.post-purchase-content {
  background: #fff;
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  overflow: hidden;
  animation: slideIn 0.3s ease;
}

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

.post-purchase-header {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  padding: 20px 24px;
  text-align: center;
}

.post-purchase-header h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.post-purchase-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.post-purchase-body {
  padding: 24px;
}

.post-purchase-product {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.post-purchase-product img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}

.post-purchase-product .product-info h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.post-purchase-product .product-price {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-purchase-product .price-current {
  font-size: 1.25rem;
  font-weight: 700;
  color: #059669;
}

.post-purchase-product .price-original {
  text-decoration: line-through;
  color: #9ca3af;
}

.post-purchase-product .discount-label {
  background: #fee2e2;
  color: #dc2626;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.post-purchase-timer {
  text-align: center;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #6b7280;
}

.post-purchase-timer span {
  font-weight: 700;
  color: #dc2626;
}

.post-purchase-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-purchase-actions .btn-accept {
  padding: 14px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.post-purchase-actions .btn-accept:hover {
  background: #047857;
}

.post-purchase-actions .btn-decline {
  padding: 12px;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.9rem;
}

.post-purchase-actions .btn-decline:hover {
  color: #374151;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .upsell-products {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .upsell-bundle {
    flex-direction: column;
  }
  
  .upsell-bundle-plus {
    transform: rotate(90deg);
  }
  
  .post-purchase-product {
    flex-direction: column;
    text-align: center;
  }
}
