/* ============================================================
   TRAPTOWN — Product Popup & Card Enhancements
   ============================================================ */

/* ── Card Glow Effect ──────────────────────────────── */
.product-card {
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 20px 60px rgba(212, 168, 67, 0.2), 0 0 40px rgba(212, 168, 67, 0.08);
}

.card-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.08) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 0;
}

.product-card:hover .card-glow {
  opacity: 1;
}

.product-img-wrap {
  position: relative;
  overflow: hidden;
}

/* ── Badges ────────────────────────────────────────── */
.badge-hot {
  background: linear-gradient(135deg, #ff6b35, #ff2e63) !important;
  animation: badge-pulse 2s ease-in-out infinite;
}

.badge-top {
  background: linear-gradient(135deg, #d4a843, #f0d078) !important;
  color: #0a0a0a !important;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 46, 99, 0.4); }
  50% { box-shadow: 0 0 25px rgba(255, 46, 99, 0.7); }
}

.price-from {
  font-size: 0.75rem;
  color: #a0a9b4;
  margin-left: 4px;
}

/* ── Product Popup ─────────────────────────────────── */
#product-popup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#product-popup.open {
  opacity: 1;
  visibility: visible;
}

.pp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.pp-content {
  position: relative;
  width: 95%;
  max-width: 900px;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(145deg, #111820 0%, #0a0e14 100%);
  border: 1px solid rgba(212, 168, 67, 0.15);
  border-radius: 28px;
  padding: 0;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.6), 0 0 80px rgba(212, 168, 67, 0.06);
  transform: scale(0.9) translateY(30px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#product-popup.open .pp-content {
  transform: scale(1) translateY(0);
}

.pp-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a0a9b4;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
}

.pp-close:hover {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.3);
}

/* ── Popup Grid ────────────────────────────────────── */
.pp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.pp-image-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
  border-radius: 28px 0 0 28px;
  background: radial-gradient(circle at center, rgba(212, 168, 67, 0.04) 0%, transparent 70%);
  min-height: 400px;
}

.pp-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  animation: pp-glow-pulse 4s ease-in-out infinite;
}

@keyframes pp-glow-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.pp-product-img {
  position: relative;
  width: 85%;
  max-width: 320px;
  height: auto;
  border-radius: 16px;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(212, 168, 67, 0.15));
  animation: pp-float 6s ease-in-out infinite;
  z-index: 2;
}

@keyframes pp-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

/* ── Particles ─────────────────────────────────────── */
.pp-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.pp-particle {
  position: absolute;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.8), transparent);
  border-radius: 50%;
  animation: pp-particle-float linear infinite;
}

@keyframes pp-particle-float {
  0% { opacity: 0; transform: translateY(0) scale(0); }
  20% { opacity: 1; transform: translateY(-20px) scale(1); }
  80% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-120px) scale(0.3); }
}

/* ── Info Section ──────────────────────────────────── */
.pp-info-section {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pp-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ff6b35, #ff2e63);
  color: #fff;
  width: fit-content;
}

.pp-category {
  font-family: 'Kanit', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: #d4a843;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.pp-name {
  font-family: 'Kanit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #f5f5f5;
  line-height: 1.2;
  margin: 0;
}

.pp-rating {
  display: flex;
  gap: 2px;
}

.pp-star {
  color: #d4a843;
  font-size: 1.1rem;
}

.pp-star.empty {
  color: #333;
}

.pp-desc {
  color: #a0a9b4;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 4px 0 8px;
}

/* ── Tier Selection ────────────────────────────────── */
.pp-tier-label {
  font-family: 'Kanit', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d4a843;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}

.pp-tier-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pp-tier-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(212, 168, 67, 0.12);
  border-radius: 14px;
  color: #a0a9b4;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pp-tier-btn:hover {
  border-color: rgba(212, 168, 67, 0.4);
  background: rgba(212, 168, 67, 0.06);
}

.pp-tier-btn.active {
  border-color: #d4a843;
  background: rgba(212, 168, 67, 0.1);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.15);
}

.pp-tier-amount {
  font-family: 'Kanit', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: #f5f5f5;
}

.pp-tier-btn.active .pp-tier-amount { color: #d4a843; }

.pp-tier-unit {
  font-size: 0.7rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pp-tier-price {
  font-family: 'Kanit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d4a843;
  margin-top: 2px;
}

/* ── Price Display ─────────────────────────────────── */
.pp-price-display {
  background: rgba(212, 168, 67, 0.06);
  border: 1px solid rgba(212, 168, 67, 0.12);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: center;
}

.pp-current-price {
  font-family: 'Kanit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #d4a843;
  text-shadow: 0 0 30px rgba(212, 168, 67, 0.3);
}

.pp-price-calc {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 4px;
}

/* ── Qty Stepper ───────────────────────────────────── */
.pp-qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pp-qty-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid rgba(212, 168, 67, 0.15);
  border-radius: 14px;
  overflow: hidden;
}

.pp-qty-btn {
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: #d4a843;
  font-size: 1.1rem;
  font-weight: 700;
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pp-qty-btn:hover {
  background: rgba(212, 168, 67, 0.15);
}

.pp-qty-input {
  width: 44px;
  text-align: center;
  background: transparent;
  border: none;
  color: #f5f5f5;
  font-family: 'Kanit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

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

/* ── Actions ───────────────────────────────────────── */
.pp-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.pp-btn-cart {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #d4a843, #f0d078);
  color: #0a0a0a;
  font-family: 'Kanit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 25px rgba(212, 168, 67, 0.35);
}

.pp-btn-cart:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 40px rgba(212, 168, 67, 0.5);
}

.pp-btn-buy {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: transparent;
  border: 2px solid #d4a843;
  color: #d4a843;
  font-family: 'Kanit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

.pp-btn-buy:hover {
  background: rgba(212, 168, 67, 0.1);
  transform: translateY(-2px);
}

/* ── Fly to Cart Animation ─────────────────────────── */
.fly-dot {
  position: fixed;
  width: 12px;
  height: 12px;
  background: #d4a843;
  border-radius: 50%;
  z-index: 99999;
  pointer-events: none;
  box-shadow: 0 0 15px rgba(212, 168, 67, 0.6);
}

.fly-dot.fly {
  animation: fly-to-cart 0.6s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

@keyframes fly-to-cart {
  0% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(0.3); opacity: 0; }
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .pp-grid {
    grid-template-columns: 1fr;
  }

  .pp-image-section {
    min-height: 250px;
    padding: 30px;
    border-radius: 28px 28px 0 0;
  }

  .pp-product-img {
    max-width: 220px;
  }

  .pp-info-section {
    padding: 24px 20px 32px;
  }

  .pp-name {
    font-size: 1.4rem;
  }

  .pp-tier-options {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .pp-tier-btn {
    padding: 10px 4px;
  }

  .pp-tier-amount {
    font-size: 1.1rem;
  }

  .pp-current-price {
    font-size: 1.6rem;
  }

  .pp-actions {
    flex-direction: column;
  }

  .pp-content {
    border-radius: 20px;
    max-height: 95vh;
  }
}

@media (max-width: 480px) {
  .pp-content {
    width: 98%;
    border-radius: 16px;
  }

  .pp-image-section {
    min-height: 200px;
    padding: 20px;
  }

  .pp-info-section {
    padding: 20px 16px 28px;
    gap: 10px;
  }
}

/* Scrollbar for popup */
.pp-content::-webkit-scrollbar {
  width: 4px;
}

.pp-content::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 67, 0.3);
  border-radius: 4px;
}
