/* 🛒 Upsell Modal Styles */

:root {
  --upsell-brand: #009fe3;
  --upsell-text: #1e293b;
  --upsell-muted: #64748b;
  --upsell-line: #e2e8f0;
  --upsell-bg: #ffffff;
  --upsell-overlay: rgba(15, 23, 42, 0.6);
  --upsell-radius: 16px;
  --upsell-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#upsell-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--upsell-overlay);
  display: flex;
  align-items: flex-end; /* Mobile default: slide from bottom */
  justify-content: center;
  z-index: 999999;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#upsell-modal-overlay.active {
  opacity: 1;
}

#upsell-modal {
  background: var(--upsell-bg);
  width: 100%;
  max-width: 500px;
  border-radius: var(--upsell-radius) var(--upsell-radius) 0 0;
  box-shadow: var(--upsell-shadow);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden; /* Prevent content from leaking outside */
  font-family: 'Montserrat', sans-serif;
}

#upsell-modal-overlay.active #upsell-modal {
  transform: translateY(0);
}

/* Header */
.upsell-header {
  padding: 22px 25px;
  border-bottom: 1px solid var(--upsell-line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.upsell-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upsell-added-status {
  font-size: 14px;
  font-weight: 600;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.upsell-added-status i {
  font-size: 12px;
}

.upsell-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--upsell-muted);
  cursor: pointer;
  padding: 0;
  margin-top: -5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

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

.upsell-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--upsell-text);
  margin: 0;
  line-height: normal;
}

/* Body */
.upsell-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.upsell-body {
  padding: 5px 0 15px;
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* Allow the body to shrink inside the flex container */
}

.upsell-section-title {
  padding: 20px 25px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--upsell-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Product Item */
.upsell-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 25px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s;
}

.upsell-item:last-child {
  border-bottom: none;
}

.upsell-item-img-wrapper {
  width: 72px;
  height: 72px;
  background: #f1f5f9;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 10px;
}

.upsell-item-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.upsell-item-info {
  flex: 1;
}

.upsell-item-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--upsell-text);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.upsell-item-price {
  font-size: 15px;
  font-weight: 800;
  color: #003679;
}

.upsell-item-price small {
  font-size: 12px;
  color: var(--upsell-muted);
  font-weight: 600;
  margin-left: 5px;
}

.free-badge {
    display: inline-block;
    background-color: #e8f5e9;
    color: #16a34a;
    font-size: 13px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 20px;
}

/* Add Button */
.upsell-add-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: 100px;
}

.upsell-add-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.upsell-add-btn.added {
  background: #16a34a;
  color: #fff;
}

/* Footer */
.upsell-footer {
  padding: 25px;
  border-top: 1px solid var(--upsell-line);
  background: #fff;
}

.upsell-view-cart {
  width: 100%;
  background: #003679;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 18px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  transition: all 0.2s ease;
  white-space: nowrap; /* Prevent ugly wrapping in the middle of parentheses */
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 📱 Mobile Specific Refinements */
@media (max-width: 480px) {
  .upsell-title {
    font-size: 17px;
  }
  
  .upsell-view-cart {
    padding: 15px 10px;
    font-size: 15px;
    gap: 8px;
  }

  .upsell-view-cart .upsell-count {
      min-width: 1.2em;
      text-align: center;
  }
}

.upsell-view-cart:hover {
  background: #002b60;
  box-shadow: 0 4px 12px rgba(0, 54, 121, 0.25);
}

.upsell-view-cart:active {
  transform: scale(0.98);
}

/* Tablet / Desktop */
@media (min-width: 600px) {
  #upsell-modal-overlay {
    align-items: center;
  }
  
  #upsell-modal {
    border-radius: var(--upsell-radius);
    max-height: 80vh;
    transform: scale(0.9) translateY(20px);
  }
  
  #upsell-modal-overlay.active #upsell-modal {
    transform: scale(1) translateY(0);
  }
}

/* Chatbot Specific */
#upsell-modal.upsell-modal-lg {
  max-width: 900px;
  width: 95%;
  height: 90vh;
}

.upsell-chatbot-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}

.upsell-chatbot-iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}
