/* =============  GLOBAL LAYOUT + FULL-PAGE BACKGROUND  ============= */

/* html เป็นคนถือ BG (เพื่อให้ยาวได้ไม่จำกัด) */
html {
  min-height: 100%;
  background: linear-gradient(180deg, #e8f7ff 0%, #bfe7ff 45%, #93d2ff 100%);
  background-attachment: fixed;        /* 🔥 ทำให้ BG ต่อเนื่องไม่ว่าหน้าจะยาวแค่ไหน */
  background-repeat: no-repeat;
  background-size: cover;              /* 🔥 ป้องกันเกิดเส้นตัด */
}

/* body เป็น flex container สำหรับ sticky footer */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  font-family: "Noto Sans Thai", system-ui, sans-serif;
  color: #000;
  background: transparent !important;  /* 🔥 กันไม่ให้ body ทับ BG ของ html */
}

/* sticky footer */
#footer {
  margin-top: auto;
}





/* ---------------- Navbar (หลักหน้าเว็บ) ---------------- */
.site-navbar {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  z-index: 1020;
}

.site-navbar .navbar-brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  color: #0284c7 !important;
}

.site-navbar .navbar-nav > .nav-item {
  margin: 0 0.25rem;
}

.site-navbar .site-nav-link {
  position: relative;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #0f172a;
  opacity: 0.85;
  transition: background 0.16s ease, color 0.16s ease, opacity 0.16s ease,
              transform 0.12s ease, box-shadow 0.12s ease;
}

.site-navbar .site-nav-link:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #0284c7;
  opacity: 1;
  transform: translateY(-1px);
}

.site-navbar .site-nav-link.active {
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
  color: #ffffff !important;
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.45);
  opacity: 1;
}

.site-navbar .cart-link {
  padding-right: 0.6rem;
  padding-left: 0.6rem;
}

.site-navbar .cart-link i {
  position: relative;
}

@media (max-width: 991.98px) {
  .site-navbar .site-nav-link {
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
  }
}


/* ---------------- Banner ---------------- */
.banner-wrapper {
  position: relative;
  width: 100%;
  max-width: 2000px;
  margin: 1rem auto;
  overflow: hidden;
  border-radius: 15px;
}
.banner-wrapper img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 1;
  object-fit: contain;
  display: block;
}

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* ===== Product Card ===== */
.product-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  text-align: center;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ===== Image Box ===== */
.img-box {
  background: #f5faff;
  width: 100%;
  /*height: 170px;*/
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* ✅ ให้รูปเต็มกล่องพอดีแบบตัวอย่าง */
  border-bottom: 1px solid #eee;
}

/* ===== Info ===== */
.product-info {
  padding: 10px 10px 12px;
}
.product-info h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  min-height: 40px;
}

/* ===== Button Buy ===== */
.btn-buy {
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 6px 0;
  transition: all 0.25s ease;
  box-shadow: 0 3px 6px rgba(0, 150, 199, 0.25);
}
.btn-buy:hover:not(.disabled) {
  background: linear-gradient(135deg, #00b4d8, #0096c7);
  transform: translateY(-2px);
}
.btn-buy.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #ccc !important;
  box-shadow: none;
}

/* ===== Stock Text ===== */
.stock-text {
  font-size: 0.85rem;
  color: #666;
  margin-top: 4px;
}

footer {
  text-align: center;
  padding: 1rem;
  color: #555;
  margin-top: 3rem;
}


/* บังคับให้กรอบรูปปกสินค้าเป็นสี่เหลี่ยมจัตุรัส */
.product-card .img-box {
  width: 100%;
  aspect-ratio: 1 / 1;      /* 🔥 ทำให้กรอบเป็นสี่เหลี่ยมจัตุรัส */
  overflow: hidden;
  border-radius: 10px;
  background: #f5f5f5;
}

/* ทำให้รูปครอบพอดีสี่เหลี่ยม */
.product-card .img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* 🔥 ครอปแบบเต็มกรอบ */
  object-position: center;  /* 🔥 อิงตรงกลาง */
  display: block;
}

/* ---------------- Responsive ---------------- */
/*@media (max-width: 1200px) {*/
  /*.product-card { width: 230px; }*/
  /*.product-card .img-box { height: 230px; }*/
/*}*/

/*@media (max-width: 992px) {
  .product-card { width: 30%; }
}

@media (max-width: 768px) {
  .product-card { width: 45%; }
}

@media (max-width: 576px) {
  .product-card { width: 90%; max-width: 350px; }
}*/





/* ===== ฟองอากาศพื้นหลังสุด ===== */
.bubbles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.bubble {
  position: absolute;
  bottom: -100px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  filter: blur(1px);
  animation: rise 12s infinite ease-in-out;
}

@keyframes rise {
  0% { transform: translateY(0) scale(1); opacity: .8; }
  100% { transform: translateY(-120vh) scale(1.4); opacity: 0; }
}

/* ฟองหลากหลายขนาดแบบสุ่ม */
.bubble:nth-child(1) { left: 10%; width: 45px; height: 45px; animation-duration: 11s; }
.bubble:nth-child(2) { left: 25%; width: 25px; height: 25px; animation-duration: 15s; animation-delay: 2s; }
.bubble:nth-child(3) { left: 40%; width: 60px; height: 60px; animation-duration: 18s; animation-delay: 1s; }
.bubble:nth-child(4) { left: 55%; width: 35px; height: 35px; animation-duration: 14s; animation-delay: 3s; }
.bubble:nth-child(5) { left: 70%; width: 20px; height: 20px; animation-duration: 12s; animation-delay: 4s; }
.bubble:nth-child(6) { left: 85%; width: 50px; height: 50px; animation-duration: 20s; animation-delay: 0s; }


/* ===== Preloader ===== */
#page-loader {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;

  opacity: 1;
  transition: opacity 0.4s ease-out;
}


.loader-circle {
  width: 80px;
  height: 80px;
  border: 6px solid rgba(0, 153, 255, 0.2);
  border-top-color: #00b8ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-text {
  margin-top: 12px;
  font-size: 1.1rem;
  color: #0284c7;
  font-weight: 600;
}

@keyframes spin {
  from { transform: rotate(0deg);}
  to   { transform: rotate(360deg);}
}
