/* ==========================
   Pizza Same Price Bundle
   Frontend Design
========================== */

.pspb-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.pspb-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.pspb-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pspb-desc {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 15px;
  line-height: 1.6;
}

.pspb-select {
  width: 100%;
  height: 50px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 0 15px;
  font-size: 15px;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pspb-select:focus {
  border-color: #f97316;
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.pspb-offer-badge {
  display: inline-block;
  background: #16a34a;
  color: #fff;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.pspb-free-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dcfce7;
  color: #166534;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.pspb-cart-note {
  margin-top: 5px;
  color: #16a34a;
  font-size: 13px;
  font-weight: 600;
}

.pspb-summary {
  margin-top: 15px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 10px;
}

.pspb-summary strong {
  color: #111827;
}

.pspb-price {
  color: #f97316;
  font-weight: 700;
}

.pspb-success {
  margin-top: 15px;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 12px;
  border-radius: 10px;
}

.pspb-error {
  margin-top: 15px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px;
  border-radius: 10px;
}

/* Mobile */

@media (max-width: 768px) {
  .pspb-box {
    padding: 15px;
  }

  .pspb-title {
    font-size: 18px;
  }

  .pspb-select {
    height: 46px;
    font-size: 14px;
  }
}

/* ==========================
   BOGO Modal Popup Styles
   ========================== */

.pspb-select-btn, button.pspb-select-btn {
  width: 100%;
  height: 50px !important;
  background: #f97316 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  text-shadow: none !important;
  line-height: 1 !important;
}

.pspb-select-btn:hover:not(.pspb-btn-disabled), button.pspb-select-btn:hover:not(.pspb-btn-disabled) {
  background: #ea580c !important;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4) !important;
}

.pspb-select-btn:active:not(.pspb-btn-disabled), button.pspb-select-btn:active:not(.pspb-btn-disabled) {
  transform: translateY(0);
}

.pspb-btn-disabled {
  background: #e5e7eb !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Modal Overlay (Glassmorphism) */
body.pspb-modal-open {
  overflow: hidden !important;
  height: 100vh !important;
}

.pspb-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Modern class-driven transitions to prevent 1ms blink rendering bugs */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pspb-modal.pspb-modal-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.pspb-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85); /* Sleek high-contrast dark overlay to eliminate blinking */
  /* Hardware acceleration to prevent blinking/flickering */
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Modal Content Container */
.pspb-modal-content {
  position: relative;
  width: 90%;
  max-width: 680px;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  z-index: 2;
  
  /* Initial hidden state to prevent any browser unstyled frame flashes */
  opacity: 0;
  transform: translateY(30px) scale(0.98) translate3d(0, 0, 0);
  -webkit-transform: translateY(30px) scale(0.98) translate3d(0, 0, 0);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.pspb-modal.pspb-modal-active .pspb-modal-content {
  opacity: 1;
  transform: translateY(0) scale(1) translate3d(0, 0, 0);
  -webkit-transform: translateY(0) scale(1) translate3d(0, 0, 0);
}

/* Close Button */
.pspb-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #f3f4f6;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: bold;
  color: #4b5563;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pspb-modal-close:hover {
  background: #e5e7eb;
  color: #111827;
  transform: rotate(90deg);
}

.pspb-modal-header {
  margin-bottom: 25px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 15px;
}

.pspb-modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px 0;
}

.pspb-modal-header p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Card Grid Layout */
.pspb-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

/* Pizza Item Card */
.pspb-card {
  background: #ffffff;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 16px;
}

.pspb-card:hover {
  border-color: #f97316;
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(249, 115, 22, 0.1);
}

.pspb-card-image {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 12px;
  background: #f9fafb;
  border: 2px solid #f3f4f6;
  transition: all 0.3s ease;
}

.pspb-card:hover .pspb-card-image {
  border-color: #f97316;
  transform: scale(1.05);
}

.pspb-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pspb-card-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
}

.pspb-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 6px 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}

.pspb-card-price {
  font-size: 14px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 12px;
}

.pspb-card-select-btn, button.pspb-card-select-btn {
  width: 100%;
  padding: 8px 12px !important;
  background: #f9fafb !important;
  color: #374151 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: none !important;
  line-height: 1.2 !important;
  display: inline-block !important;
}

.pspb-card:hover .pspb-card-select-btn, .pspb-card:hover button.pspb-card-select-btn {
  background: #f97316 !important;
  color: #ffffff !important;
  border-color: #f97316 !important;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.2) !important;
}

.pspb-card-select-btn:active, button.pspb-card-select-btn:active {
  transform: scale(0.96);
}

/* Premium Selection Preview */
.pspb-preview-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: 16px;
  margin-top: 15px;
  animation: pspbPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pspbPopIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.pspb-preview-image {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #86efac;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.pspb-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pspb-preview-info {
  flex-grow: 1;
}

.pspb-preview-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #166534;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.pspb-preview-name {
  font-size: 15px;
  font-weight: 600;
  color: #14532d;
}

.pspb-preview-change-btn, button.pspb-preview-change-btn {
  padding: 6px 12px !important;
  background: #ffffff !important;
  color: #166534 !important;
  border: 1px solid #bbf7d0 !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: none !important;
  line-height: 1.2 !important;
  display: inline-block !important;
}

.pspb-preview-change-btn:hover, button.pspb-preview-change-btn:hover {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}

.pspb-preview-change-btn:active, button.pspb-preview-change-btn:active {
  transform: scale(0.95);
}
