/* ========================================
   Cart Popup + Supplies Upsell Modal
   ======================================== */

/* Overlay */
.upsell-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: var(--space-4);
}

.upsell-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Modal */
.upsell-modal {
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: var(--radius-xl, 16px);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
}

.upsell-overlay.visible .upsell-modal {
  transform: scale(1) translateY(0);
}

/* Header */
.upsell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.upsell-header-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.upsell-title {
  font-weight: 600;
  font-size: var(--text-md, 1rem);
  color: var(--text-primary);
}

.upsell-title-success {
  color: var(--success-600, #059669);
}

.upsell-close {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #666);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: 9999px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.upsell-close:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

/* ── Added Product Section ── */
.upsell-added {
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.04), transparent);
}

.upsell-added-product {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.upsell-product-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--cyan-500, #06b6d4), var(--violet-500, #8b5cf6));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-lg, 1.125rem);
  color: white;
  flex-shrink: 0;
}

.upsell-product-info {
  flex: 1;
  min-width: 0;
}

.upsell-product-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-md, 1rem);
  line-height: 1.3;
}

.upsell-product-price {
  font-weight: 700;
  color: var(--cyan-400, #0e7490);
  font-size: var(--text-lg, 1.125rem);
  margin-top: 2px;
}

/* Quantity controls */
.upsell-qty {
  display: flex;
  align-items: center;
  background: var(--surface-elevated, #f8fafc);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  flex-shrink: 0;
}

.upsell-qty-btn {
  background: transparent;
  border: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.upsell-qty-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.upsell-qty-val {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-md, 1rem);
}

/* View cart link */
.upsell-viewcart {
  display: block;
  text-align: center;
  padding: var(--space-3) var(--space-5);
  margin: 0 var(--space-5) var(--space-4);
  background: var(--cyan-500, #0891b2);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.2s ease;
}

.upsell-viewcart:hover {
  background: var(--cyan-600, #0e7490);
}

/* ── Supplies Divider ── */
.upsell-divider {
  padding: var(--space-4) var(--space-5);
  background: var(--surface-elevated, #f8fafc);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.upsell-divider-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.upsell-divider-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ── Supply Items ── */
.upsell-body {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.upsell-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 12px);
  transition: border-color 0.2s ease;
}

.upsell-item:hover {
  border-color: var(--cyan-500, #06b6d4);
}

.upsell-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md, 8px);
  background: linear-gradient(135deg, var(--cyan-500, #06b6d4), var(--violet-500, #8b5cf6));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.upsell-item-info {
  flex: 1;
  min-width: 0;
}

.upsell-item-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
  margin-bottom: 1px;
}

.upsell-item-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.3;
}

.upsell-item-price {
  font-weight: 700;
  color: var(--cyan-400, #0e7490);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.upsell-item-add {
  background: rgba(8, 145, 178, 0.1);
  border: 1px solid rgba(8, 145, 178, 0.3);
  color: var(--cyan-500, #0891b2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md, 8px);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.upsell-item-add:hover {
  background: rgba(8, 145, 178, 0.2);
  border-color: var(--cyan-500, #0891b2);
}

.upsell-item-add.added {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
  color: var(--success-600, #059669);
  pointer-events: none;
}

/* Footer */
.upsell-footer {
  padding: 0 var(--space-5) var(--space-4);
  display: flex;
  justify-content: center;
}

.upsell-skip {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.upsell-skip:hover {
  color: var(--text-secondary);
  background: var(--surface-hover);
}

/* Responsive */
@media (max-width: 480px) {
  .upsell-overlay { padding: var(--space-2); }

  .upsell-modal {
    max-width: 100%;
  }

  .upsell-added-product {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .upsell-qty {
    margin-left: auto;
  }

  .upsell-item {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .upsell-item-add {
    width: 100%;
    text-align: center;
    padding: var(--space-3);
  }
}
