
.masonry-grid {
  display: flex;
  justify-content: center;   /* จัดตรงกลางแนวนอน */
  align-items: flex-start;    /* ดันภาพขึ้นจากบน (หรือใช้ center ถ้าอยากกลางแนวตั้ง) */
  flex-wrap: wrap;            /* ให้ขึ้นบรรทัดใหม่อัตโนมัติ */
  gap: 20px;                  /* ระยะห่างระหว่างภาพ */
  margin-top: 40px;           /* ระยะห่างจากปุ่ม */
  min-height: 200px;          /* ให้มีพื้นที่รองรับก่อนโหลดภาพ */
  transition: all 0.3s ease;  /* นุ่มนวลตอนขยาย */
}
 

.grid-item img {
  max-width: 200px; 
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  object-fit: contain;
}

.grid-item:hover img {
  transform: scale(1.08);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.blog-post.single {
    border-bottom: 0px solid #e8e3e3; 
}
#btnSelect[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-default i.fa-spinner {
	top:5px !important;
}

.grid-item {
  position: relative !important;
  display: inline-block;
  margin: 10px;
}

.select-btn {
  position: absolute;
  top: 8px;
  right: 8px; /* ✅ อยู่มุมขวาบนของรูป */
  z-index: 5;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.25s ease-in-out;
}

/* แสดงปุ่มเมื่อ hover */
.grid-item:hover .select-btn {
  opacity: 1;
}

/* เมื่อเลือกแล้ว */
.grid-item.selected .select-btn {
  background: #28a745;
  opacity: 1;
}

.grid-item.selected img {
  outline: 3px solid #28a745;
  outline-offset: -3px;
  opacity: 0.9;
}

.cart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0056b3;
  color: white;
  font-weight: 600;
  border: none;
  border-radius: 30px;
  padding: 6px 14px;
  margin-left: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.25s ease-in-out, transform 0.2s;
}

.cart-btn:hover {
  background: #003f88;
  transform: scale(1.05);
}

.btn-cart {
    background-color: #ffffff !important;
    border: solid 1px #cbcbcb !important;
	margin-top:10px;
    color: #919191;
}
.btn-cart:hover { 
    color: #919191 !important;
}

.btn-default {
	background-color:#1e1e1e;
}
/* ✅ Responsive สำหรับหน้าจอมือถือ */
@media (max-width: 768px) {
  .masonry-grid {
    justify-content: center;
    gap: 12px;
  }

  #result-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .cart-btn {
    margin-left: 0;
  }

  .grid-item {
    width: 100%;              /* ✅ เต็มความกว้าง */
    max-width: 100%;
    display: block;
  }

  .grid-item img {
    width: 100% !important;              /* ✅ รูปเต็มกรอบมือถือ */
    height: auto !important;
    max-width: none;
    border-radius: 10px;
  }

  .select-btn {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 20px;
	opacity: 1;
  }
}