/* ==========================================================================
   FEATURE: BEST SELLERS & PRODUCT CARD GRID
   ========================================================================== */

.products-section-website {
  max-width: var(--max-width, 1280px);
  margin: 30px auto 60px;
  padding: 0 16px;
  width: 100%;
  box-sizing: border-box;
}

.products-grid-korilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* 1. PRODUCT CARD */
.product-card-korilla {
  background: #FFFFFF;
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.product-card-korilla:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: #FFCDD2;
}

.p-card-thumb {
  position: relative;
  width: 100%;
  height: 160px;
  background: #F8FAFC;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
  padding: 24px 10px 8px;
  box-sizing: border-box;
}

.p-card-thumb img {
  max-width: 135px;
  max-height: 110px;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s ease;
  position: relative;
  z-index: 1;
}

.p-card-thumb img.img-loaded {
  opacity: 1 !important;
}

.product-card-korilla:hover .p-card-thumb img {
  transform: scale(1.05);
}

/* Product Thumbnail Loading Spinner & Placeholders */
.p-card-img-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F8FAFC;
  z-index: 1;
  pointer-events: none;
}

.p-card-img-loader.no-img {
  background: #F1F5F9;
}

.p-card-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(251, 62, 56, 0.16);
  border-top-color: #FB3E38;
  border-radius: 50%;
  animation: korillaSpin 0.75s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

@keyframes korillaSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.p-card-fallback-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #F8FAFC;
}

.p-card-fallback-icon {
  font-size: 28px;
  opacity: 0.45;
  filter: grayscale(30%);
}

/* Product Skeleton Loading Grid Cards */
.product-card-skeleton {
  pointer-events: none;
  cursor: default;
  opacity: 0.9;
}

.skeleton-line {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Badges: Offer, Discount, Frozen, Out of Stock */
.p-card-offer-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #FB3E38;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 6px;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(251, 62, 56, 0.3);
  white-space: nowrap;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

[dir="rtl"] .p-card-offer-badge {
  left: auto;
  right: 8px;
  border-radius: 6px;
}

.p-card-pickup-badge {
  position: absolute;
  top: 0;
  left: 0;
  background: #0284C7;
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-bottom-right-radius: 6px;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[dir="rtl"] .p-card-pickup-badge {
  left: auto;
  right: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 6px;
}

.p-card-stock-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #DC2626;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[dir="rtl"] .p-card-stock-tag {
  right: auto;
  left: 8px;
}

.product-card-korilla.is-out-of-stock {
  opacity: 0.85;
}

/* Wishlist Heart Button */
.p-card-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid #E2E8F0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

[dir="rtl"] .p-card-fav-btn {
  right: auto;
  left: 8px;
}

.p-card-fav-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(251, 62, 56, 0.2);
  border-color: var(--primary-red, #FB3E38);
}

.p-card-fav-btn.active {
  background: #FFF5F5;
  border-color: #FB3E38;
}

/* Card Titles & Prices */
.p-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #1E293B;
  line-height: 1.35;
  height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  margin-bottom: 6px;
}

.p-card-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 10px;
}

.p-card-price-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-navy, #000A46);
}

.p-card-price-unit {
  font-size: 12px;
  color: var(--primary-navy, #000A46);
}

.p-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.p-card-old-price {
  font-size: 12px;
  color: #9E9E9E;
  text-decoration: line-through;
}

/* Buttons & In-card Qty Control */
.p-card-add-btn {
  background: var(--primary-red, #FB3E38);
  color: #FFFFFF;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(251, 62, 56, 0.2);
}

.p-card-add-btn:hover {
  background: var(--hover-red, #E02822);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(251, 62, 56, 0.3);
}

.p-card-add-btn.p-card-add-frozen-btn {
  background: #0284C7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.p-card-add-btn.p-card-add-frozen-btn:hover {
  background: #0369A1;
}

.p-card-qty-control {
  display: inline-flex;
  align-items: center;
  background: #FFF5F5;
  border: 1.5px solid var(--primary-red, #FB3E38);
  border-radius: 8px;
  padding: 2px 4px;
  gap: 4px;
}

.p-card-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary-red, #FB3E38);
  color: #FFFFFF;
  border: none;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.p-card-qty-btn.minus {
  background: #FFFFFF;
  color: var(--primary-red, #FB3E38);
  border: 1px solid rgba(251, 62, 56, 0.4);
}

.p-card-qty-val {
  min-width: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-red, #FB3E38);
}

/* 2. PRODUCT DETAILS MODAL */
.p-modal-dialog {
  background: #FFFFFF;
  border-radius: 20px;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 60px -15px rgba(0, 10, 70, 0.25);
  overflow: hidden;
}

.p-modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F1F5F9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #475569;
  z-index: 20;
  transition: all 0.2s ease;
}

[dir="rtl"] .p-modal-close-btn {
  right: auto;
  left: 16px;
}

.p-modal-close-btn:hover {
  background: #E2E8F0;
  color: #0F172A;
  transform: scale(1.05);
}

.p-modal-scrollable {
  padding: 24px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.p-modal-top-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.p-modal-img-container {
  flex: 1;
  min-width: 240px;
  background: #F8FAFC;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #F1F5F9;
}

.p-modal-img-container img {
  max-height: 240px;
  max-width: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.p-modal-info-col {
  flex: 1.3;
  min-width: 260px;
}

.p-modal-qty-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.p-modal-qty-control {
  display: inline-flex;
  align-items: center;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 4px;
  gap: 8px;
}

.p-modal-qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #FFFFFF;
  color: #1E293B;
  border: 1px solid #CBD5E1;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.p-modal-qty-btn.plus {
  background: var(--primary-red, #FB3E38);
  color: #FFFFFF;
  border-color: var(--primary-red, #FB3E38);
}

.p-modal-qty-val {
  min-width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: #1E293B;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .products-grid-korilla {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .p-card-thumb {
    height: 125px;
  }
  .p-modal-scrollable {
    padding: 16px;
  }
}
