/* ═══════════════════════════════════════
   PrintingPeach Cart Styles
   Mobile-first, conversion-focused
   ═══════════════════════════════════════ */

/* ─── Loading ─── */
.pp-cart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #888;
  font-size: 15px;
  gap: 12px;
}

.pp-cart-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #eee;
  border-top-color: #f37028;
  border-radius: 50%;
  animation: pp-spin 0.7s linear infinite;
}

@keyframes pp-spin {
  to { transform: rotate(360deg); }
}

/* ─── Empty Cart ─── */
.pp-cart-empty {
  text-align: center;
  padding: 60px 20px;
}

.pp-cart-empty-icon {
  margin-bottom: 20px;
}

.pp-cart-empty h2 {
  font-size: 22px;
  color: #333;
  margin: 0 0 8px;
}

.pp-cart-empty p {
  color: #777;
  margin: 0 0 24px;
  font-size: 15px;
}

/* ─── Buttons ─── */
.pp-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  line-height: 1.4;
}

.pp-cart-btn:active {
  transform: scale(0.97);
}

.pp-cart-btn-primary {
  background: #f37028;
  color: #fff;
}

.pp-cart-btn-primary:hover {
  background: #e0621e;
  color: #fff;
  text-decoration: none;
}

.pp-cart-btn-outline {
  background: #fff;
  color: #555;
  border: 1px solid #ddd;
}

.pp-cart-btn-outline:hover {
  background: #f8f8f8;
  border-color: #bbb;
}

/* ─── Cart Wrapper ─── */
.pp-cart-wrapper {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

/* ─── Cart Header ─── */
.pp-cart-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid #eee;
}

.pp-cart-heading {
  font-size: 26px;
  font-weight: 700;
  color: #222;
  margin: 0;
  line-height: 1.2;
}

.pp-cart-item-count {
  font-size: 15px;
  color: #888;
  font-weight: 400;
}

/* ─── Cart Items ─── */
.pp-cart-items {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pp-cart-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid #eee;
}

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

/* Preview / thumbnail */
.pp-cart-item-preview {
  flex: 0 0 110px;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9f9f9;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.pp-cart-item-preview[style*="cursor"] {
  border: 1px solid #e0e0e0;
}

.pp-cart-item-preview[style*="cursor"]:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.pp-cart-item-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Info */
.pp-cart-item-info {
  flex: 1;
  min-width: 0;
}

.pp-cart-item-name {
  font-weight: 700;
  font-size: 15px;
  color: #222;
  margin-bottom: 4px;
  line-height: 1.3;
}

.pp-cart-item-details {
  font-size: 12px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pp-cart-detail-line {
  white-space: nowrap;
}

.pp-cart-detail-label {
  color: #999;
  font-weight: 500;
}

.pp-cart-detail-value {
  color: #444;
}

.pp-cart-item-design-name {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pp-cart-item-edit-design {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #f37028;
  text-decoration: none;
  font-weight: 600;
  margin-top: 4px;
}

.pp-cart-item-edit-design:hover {
  color: #d45e1b;
  text-decoration: underline;
}

.pp-cart-item-create-design {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, #f37028 0%, #e05a10 100%);
  text-decoration: none;
  font-weight: 600;
  margin-top: 8px;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(243,112,40,0.2);
}

.pp-cart-item-create-design:hover {
  background: linear-gradient(135deg, #e05a10 0%, #c84d0a 100%);
  box-shadow: 0 2px 8px rgba(243,112,40,0.3);
  text-decoration: none;
  color: #fff;
}

/* Actions / qty / price */
.pp-cart-item-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 140px;
}

.pp-cart-item-price {
  font-size: 12px;
  color: #888;
}

.pp-cart-item-total {
  font-weight: 700;
  font-size: 16px;
  color: #222;
}

.pp-cart-item-qty-label {
  font-size: 14px;
  color: #555;
}

/* Qty row: stepper + delete inline */
.pp-cart-qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Quantity stepper */
.pp-cart-qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.pp-cart-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  color: #333;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.pp-cart-qty-btn:hover {
  background: #e8e8e8;
}

.pp-cart-qty-input {
  width: 40px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  font-size: 14px;
  font-weight: 600;
  -moz-appearance: textfield;
  appearance: textfield;
}

.pp-cart-qty-input::-webkit-inner-spin-button,
.pp-cart-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove button */
.pp-cart-remove-btn {
  background: none;
  border: none;
  color: #cc3333;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.pp-cart-remove-btn:hover {
  opacity: 1;
}

/* ─── Add Another Set ─── */
.pp-cart-dupe-wrap {
  position: relative;
  margin-top: 4px;
}

.pp-cart-dupe-btn {
  background: none;
  border: 1px dashed #f37028;
  color: #f37028;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.pp-cart-dupe-btn:hover {
  opacity: 1;
  background: rgba(243, 112, 40, 0.08);
}

.pp-cart-dupe-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 250px;
  padding: 10px 12px;
  background: #333;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10;
  pointer-events: none;
  white-space: normal;
}

.pp-cart-dupe-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 16px;
  border: 6px solid transparent;
  border-top-color: #333;
}

.pp-cart-dupe-wrap:hover .pp-cart-dupe-tooltip {
  display: block;
}

/* ─── Name Prompt Dialog (Add Another Set) ─── */
.pp-cart-prompt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pp-cart-prompt-dialog {
  background: #fff;
  border-radius: 10px;
  padding: 28px 28px 22px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.pp-cart-prompt-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: #333;
}
.pp-cart-prompt-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 18px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.pp-cart-prompt-input:focus {
  border-color: #f37028;
}
.pp-cart-prompt-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.pp-cart-prompt-cancel {
  padding: 9px 18px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
}
.pp-cart-prompt-cancel:hover {
  background: #f5f5f5;
}
.pp-cart-prompt-submit {
  padding: 9px 22px;
  border: none;
  background: #f37028;
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pp-cart-prompt-submit:hover {
  background: #e0611c;
}

/* Highlight animation for newly duplicated item */
.pp-cart-item.pp-item-highlight {
  animation: ppHighlight 1.5s ease;
}
@keyframes ppHighlight {
  0% { background-color: rgba(243, 112, 40, 0.15); }
  100% { background-color: transparent; }
}

/* ─── Totals ─── */
.pp-cart-totals {
  padding: 20px 0;
  border-top: 2px solid #eee;
  margin-top: 10px;
}

.pp-cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 14px;
  color: #444;
}

.pp-cart-total-label {
  font-weight: 600;
}

.pp-cart-total-discount .pp-cart-total-value {
  color: #28a745;
}

.pp-cart-total-free-shipping .pp-cart-total-value {
  color: #28a745;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.pp-cart-total-final {
  font-size: 18px;
  color: #222;
  border-top: 1px solid #ddd;
  margin-top: 8px;
  padding-top: 12px;
}

.pp-cart-total-final .pp-cart-total-label,
.pp-cart-total-final .pp-cart-total-value {
  font-weight: 700;
}

.pp-cart-peachbucks-earned {
  display: flex;
  justify-content: space-between;
  padding: 8px 0 0;
  font-size: 12px;
  color: #888;
}

/* ─── Coupon ─── */
.pp-cart-coupon-section {
  padding: 16px 0;
}

.pp-cart-coupon-input-group {
  display: flex;
  gap: 0;
  max-width: 360px;
}

.pp-cart-coupon-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-right: none;
  border-radius: 6px 0 0 6px;
  font-size: 14px;
  outline: none;
}

.pp-cart-coupon-input:focus {
  border-color: #f37028;
}

.pp-cart-coupon-btn {
  border-radius: 0 6px 6px 0 !important;
  background: #555;
  color: #fff;
}

.pp-cart-coupon-btn:hover {
  background: #444;
}

.pp-cart-coupon-success {
  color: #28a745;
  font-size: 13px;
  padding: 6px 0;
}

.pp-cart-coupon-error {
  color: #dc3545;
  font-size: 13px;
  padding: 6px 0;
}

/* ─── Action Bar ─── */
.pp-cart-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  flex-wrap: wrap;
}

.pp-cart-checkout-btn {
  font-size: 16px;
  padding: 14px 28px;
  margin-left: auto;
}

.pp-cart-trust {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #28a745;
  width: 100%;
  justify-content: flex-end;
}

/* ─── Shipping Note ─── */
.pp-cart-shipping-note {
  text-align: center;
  padding: 30px 20px;
  font-size: 16px;
  color: #555;
  line-height: 1.6;
}

/* ─── Checkout Summary tweaks ─── */
.pp-cart-checkout-summary .pp-cart-item {
  padding: 12px 0;
}

.pp-cart-checkout-summary .pp-cart-item-preview {
  flex: 0 0 70px;
  width: 70px;
  height: 70px;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 600px) {
  .pp-cart-item {
    flex-wrap: wrap;
    gap: 10px;
  }

  .pp-cart-item-preview {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
  }

  .pp-cart-item-info {
    flex: 1;
    min-width: calc(100% - 100px);
  }

  .pp-cart-item-actions {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-width: unset;
    padding-left: 96px;
  }

  .pp-cart-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pp-cart-checkout-btn {
    margin-left: 0;
    text-align: center;
    justify-content: center;
    order: -1;
  }

  .pp-cart-trust {
    justify-content: center;
  }

  .pp-cart-coupon-input-group {
    max-width: 100%;
  }
}

/* ─── Animations ─── */

/* Item enter animation */
@keyframes pp-slide-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pp-cart-item {
  animation: pp-slide-in 0.3s ease-out;
}

/* Item removing animation */
@keyframes pp-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
    max-height: 200px;
  }
  to {
    opacity: 0;
    transform: translateX(40px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    border: none;
  }
}

.pp-cart-item.pp-removing {
  animation: pp-slide-out 0.35s ease-in forwards;
  overflow: hidden;
  pointer-events: none;
}

/* Quantity update flash */
@keyframes pp-flash-update {
  0% { background-color: transparent; }
  30% { background-color: rgba(243, 112, 40, 0.1); }
  100% { background-color: transparent; }
}

.pp-cart-item.pp-updating {
  animation: pp-flash-update 0.6s ease-out;
}

/* Total value update pulse */
@keyframes pp-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.pp-cart-total-final .pp-cart-total-value.pp-updated {
  animation: pp-pulse 0.3s ease-out;
  color: #f37028;
}

/* Loading overlay for item being acted on */
.pp-cart-item.pp-loading {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s;
}

/* Busy state — blocks all cart interaction while an API call is in-flight */
.pp-cart-busy {
  position: relative;
}

.pp-cart-busy .pp-cart-items,
.pp-cart-busy .pp-cart-action-bar,
.pp-cart-busy .pp-cart-coupon-form {
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.15s;
}

/* Cart content fade transition */
@keyframes pp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pp-cart-totals {
  animation: pp-fade-in 0.3s ease-out;
}

/* Coupon message slide-in */
.pp-cart-coupon-success,
.pp-cart-coupon-error {
  animation: pp-slide-in 0.25s ease-out;
}

/* ─── Sticky checkout on mobile ─── */
@media (max-width: 768px) {
  .pp-cart-wrapper {
    padding-bottom: 80px;
  }

  .pp-cart-action-bar .pp-cart-checkout-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-radius: 0;
    padding: 16px;
    font-size: 17px;
    text-align: center;
    justify-content: center;
  }
}

/* ─── Preview Lightbox ─── */
.pp-cart-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.pp-cart-lightbox.pp-active {
  opacity: 1;
}

.pp-cart-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.pp-cart-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.pp-cart-lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  border-radius: 6px;
}

.pp-cart-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.pp-cart-lightbox-close:hover {
  background: #f37028;
}

/* Lightbox pagination nav */
.pp-cart-lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 12px;
}

.pp-cart-lightbox-prev,
.pp-cart-lightbox-next {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.pp-cart-lightbox-prev:hover,
.pp-cart-lightbox-next:hover {
  background: #f5f5f5;
  border-color: #bbb;
}

.pp-cart-lightbox-prev:disabled,
.pp-cart-lightbox-next:disabled {
  opacity: 0.3;
  cursor: default;
}

.pp-cart-lightbox-page {
  font-size: 13px;
  color: #666;
  font-weight: 600;
  min-width: 90px;
  text-align: center;
}
