/* ==========================================================================
   Apon Store — Product Plans & Catalogue Styling
   ========================================================================== */

#products {
  scroll-margin-top: 5.5rem;
  margin-top: 2.5rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 1.75rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: clamp(1.25rem, 3.5vw, 2.5rem);
  box-shadow: 0 20px 45px -15px rgba(15, 23, 42, 0.05), 0 0 0 1px rgba(241, 245, 249, 0.8);
}

@media (min-width: 640px) {
  #products {
    scroll-margin-top: 6.5rem;
  }
}

#products:focus {
  outline: none;
}

#products > div:first-child {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  padding-bottom: 1.5rem;
}

#products > div:nth-child(2) {
  margin-top: 1.5rem;
}

#products-grid {
  align-items: stretch;
}

#products-grid .product-card {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 1.35rem;
  background: #ffffff;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.03), 0 10px 25px -5px rgba(15, 23, 42, 0.04);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

#products-grid .product-card:hover {
  transform: translateY(-4px);
  border-color: #93c5fd;
  box-shadow: 0 20px 35px -8px rgba(37, 99, 235, 0.12), 0 0 0 1px #bfdbfe;
}

#products-grid .product-card .product-card-media {
  position: relative !important;
  overflow: hidden !important;
  background: #f1f5f9 !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 0 !important;
  height: clamp(170px, 20vw, 210px) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
}

#products-grid .product-card .product-card-media img,
#products-grid .product-card > img,
#products-grid .product-card .special-image-wrap img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  background: #f1f5f9 !important;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#products-grid .product-card:hover .product-card-media img,
#products-grid .product-card:hover > img,
#products-grid .product-card:hover .special-image-wrap img {
  transform: scale(1.03) !important;
}

#products-grid .product-card > div.product-card-body {
  display: flex !important;
  flex: 1 !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 1.25rem !important;
  min-height: 240px !important;
}

#products-grid .product-card .category-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.95);
  color: #334155;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#products-grid .product-card h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

#products-grid .product-card h3 {
  margin-top: 0.75rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

#products-grid .product-card .product-card-price {
  font-size: 1.45rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
}

#products-grid .product-card p.text-slate-500 {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
}

#products-grid .product-card p.bg-emerald-50 {
  margin-top: 0.75rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4) !important;
  border: 1px solid #bbf7d0;
  color: #15803d !important;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.65rem 0.85rem;
}

#products-grid .product-card .buy-plan {
  min-height: 2.85rem;
  border-radius: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 14px -1px rgba(37, 99, 235, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#products-grid .product-card .buy-plan:hover {
  box-shadow: 0 8px 22px -3px rgba(37, 99, 235, 0.45);
  transform: translateY(-1.5px);
}

#products-grid select {
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background: #ffffff;
  color: #0f172a;
  font-weight: 500;
}

@media (max-width: 640px) {
  #products {
    margin-top: 1.25rem;
    border-radius: 1.25rem;
    padding: 1.25rem;
  }
  #products > div:first-child {
    display: block;
  }
  #products > div:first-child h2 {
    font-size: 1.75rem;
  }
  #products-grid {
    gap: 1.25rem;
  }
}

@media (max-width: 480px) {
  #products {
    padding: 0.85rem;
    border-radius: 1rem;
  }
  #products-grid .product-card > div.product-card-body {
    padding: 1rem;
  }
}

/* ==========================================================================
   Product Detail Modal & Long-Press Interactions
   ========================================================================== */

@media (pointer: coarse) {
  #products-grid .product-card {
    -webkit-touch-callout: none;
    user-select: none;
  }
  #products-grid .product-card img {
    -webkit-user-drag: none;
  }
}

#products-grid .product-card {
  cursor: pointer;
}
#products-grid .product-card:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

body.detail-open {
  overflow: hidden !important;
}

.product-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1rem;
}

.product-detail-modal {
  position: relative;
  width: min(44rem, 100%);
  max-height: min(90vh, 52rem);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 1.35rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.3);
  animation: product-detail-modal-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

@keyframes product-detail-modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.product-detail-modal img.hero {
  width: 100%;
  max-height: 20rem;
  object-fit: cover;
  background: #f1f5f9;
  border-top-left-radius: 1.35rem;
  border-top-right-radius: 1.35rem;
}

.product-detail-close-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}
.product-detail-close-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  transform: scale(1.05);
}

.product-detail-body {
  padding: 1.5rem;
  flex: 1 1 auto;
}

.product-detail-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  border-bottom-left-radius: 1.35rem;
  border-bottom-right-radius: 1.35rem;
  z-index: 10;
}
