/* ✅ เพิ่มเพื่อให้ทุก element มีการคำนวณขนาดแบบปลอดภัย */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

h5 {
  font-size: 40px;
  text-align: center;
  max-width: 100%;
  margin: 0 auto 20px;
  padding: 0 15px;
}

.menu-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    /*min-height: 100vh;*/
}

.container2 {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
    text-align: center;
}

/* เมนูด้านซ้าย */
.menu {
    width: 250px;
    height: auto; 
    align-self: stretch; 
    background-color: #2c3e50;
    color: white;
    padding: 20px;
    box-shadow: none;
    z-index: 999 !important;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.menu a {
  text-decoration: none;
  color: #bdc3c7;
  padding: 10px;
  display: block;
  border-radius: 5px;
  transition: background-color 0.3s, color 0.3s;
  position: relative;
}

.menu a:hover,
.menu a.active {
  background-color: #FFD700;
  color: white;
  font-weight: bold;
}

.menu.active {
  display: block !important;
  opacity: 1;
}

.menu h2 {
    color: #ecf0f1;
    margin-bottom: 15px;
}

.menu ul {
    list-style: none;
    padding: 0;
}

.menu ul li {
    margin-bottom: 10px;
}

.menu ul li a.active::before {
    content: "▶";  /* หรือใช้ "➜" ได้ */
    font-size: 14px;
    color: #FFD700; /* ใช้สีเหลือง */
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
}
.menu ul li a.active::after {
    content: "";
    display: block;
    width: 100%;
    height: 3px;
    background-color: #FFD700;
    position: absolute;
    bottom: 0;
    left: 0;
}

/* ✅ ปรับขนาดปุ่มเมนูให้เหมาะกับมือถือ */
.menu-toggle {
  display: none;
  z-index: 9999 !important;
  background-color: #2c3e50;
  color: white;
  border: none;
  padding: 15px 20px;
  font-size: 20px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  position: relative !important;
}
 /* หัวข้อ Section และขีดเส้นใต้ */
.section_p-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #00274d;
  text-align: center;
  position: relative;
  margin-bottom: 10px;
  display: block;
  max-width: 100%;
  padding: 0 15px;
}

.underline {
    width: 200px;
    height: 4px;
    background-color: #FFD700;
    margin: 10px auto;
}
.underline2 {
    width: 400px;
    height: 4px;
    background-color: #FFD700;
    margin: 10px auto;
}
/*จัดการsection โปรโมชั่นและสินค้าต่อจากโปรฯ*/
.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    z-index: 1;

}

/* สำหรับกล่องโปรโมชั่น */
.promotions-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  max-width: 100%;
  margin: 0 auto;
}
.products-card-container{
    margin-top: 10px;
    /*text-align: center;*/
}

.promo-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    height: auto;
    box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    flex: 1 1 calc(25% - 20px); /* ให้แต่ละสินค้าแสดง 4 ต่อแถว */
    max-width: 400px;
}
.promotions-list,.products-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    max-width: 1600px;
}
.promo-card:hover, .products-card:hover {
    transform: scale(1.05);
}

.promo-card img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

.promo-content h3 {
    margin: 10px 0;
    color: #007bff;
}

.discount {
    font-size: 18px;
    font-weight: bold;
    color: #d9534f;
}
.date {
    font-size: 14px;
    color: #333;
}

.details-btn {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 10px;
    transition: background 0.3s;
}

.details-btn:hover {
    background-color: #218838;
}

.no-promo {
    font-size: 16px;
    color: #777;
}


/*สำหรับสินค้ารายการซุ่ม
.products-card {
    background: white;
    border-radius: 5px;
    padding-top: 7px;
    padding-left: 5px;
    padding-right: 5px;
    text-align: center;
    box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    flex: 1 1 calc(33.33% - 20px);
    max-width: 320px;
    height: 200px;
}

.products-card img {
    max-width: 100%;
    height: 180px;
    margin-top: 10px;
    border-radius: 5px;
    object-fit: cover;
}
    */

/* เนื้อหาด้านขวาสำหรับเลือกหมวกหมู่สินค้า */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

.category-products {
    width: 100%;
    max-width: 1600px;
    margin: auto;
    text-align: center;
    padding: 20px;
}

.product-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    padding: 10px;
    justify-content: center;
}

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* ปรับขนาดให้พอดีกับหน้าจอ */
    gap: 15px;
    justify-content: center;
    align-items: stretch;
    margin-top: 20px;
    
}

.product-card {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
    width: 300px;
    height: 430px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}
.product-card-container {
    display: grid;
    flex-direction: column; /* จัดเรียงตามแนวตั้ง */
    align-items: center; /* จัดกึ่งกลางแนวแกน X */
    justify-content: center; /* จัดกึ่งกลางแนวแกน Y */
    max-width: 1600px;
    margin: 0 auto; /* จัดกึ่งกลางหน้าเว็บ */
    padding: 20px;
    text-align: center;
}
.product-card:hover {
    transform: translateY(-5px);
}

.product-name {
    font-size: 16px;
    font-weight: bold;
    margin: 2px 0;
    text-align: left;
    padding: 10px;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    /*margin-bottom: 10px;*/
    margin-top: 5px;
}

.product-price {
    color: #e91e63;
    font-size: 16px;
    margin: 5px 5px;
    padding: 8px 15px;
}

.product-description {
    font-size: 14px;
    color: #555;
    padding: 5px 5px;
    margin-bottom: 5px;
    text-align: left;
}
.product-btn {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.product-btn:hover {
    background-color: #0056b3;
}

/* ========== WIDE DESKTOP (≥ 1200px) ========== */
@media (min-width: 1200px) {
  .promo-card, .products-card {
    max-width: 600px;
  }
}

/* ========== DESKTOP (≥ 769px) ========== */
@media (min-width: 769px) {
  .menu {
    width: 250px;
    position: static !important;
    opacity: 1 !important;
    display: block !important;
    height: auto;
  }

  .menu.active {
    display: block !important;
    opacity: 1;
  }

  .menu-toggle {
    display: none !important;
  }

  .menu-container {
    flex-direction: row !important;
    display: flex;
    align-items: flex-start;
  }

  .content {
    flex: 1;
    padding: 20px;
    position: relative;
  }

  .promo-card, .products-card {
    width: 100%;
    max-width: 300px;
    margin: 10px;
  }

  .promotions-list, .products-list {
    justify-content: flex-start;
  }
}

/* ========== MOBILE (≤ 768px) ========== */
@media (max-width: 768px) {

  .promo-card img,
  .products-image {
    height: 150px;
  }

   .promotions-container {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .promo-card .products-card {
    max-width: 100%;
  }
  .products-title {
    font-size: 16px;
  }

  .products-description {
    font-size: 13px;
  }

  .products-btn,
  .details-btn {
    padding: 8px 12px;
    font-size: 14px;
  }

  .section-title {
    font-size: 1.2rem;
  }

  h5 {
    font-size: 28px;
  }

  .menu-container {
    flex-direction: column !important;
    position: relative !important;
  }

  .menu {
    position: absolute !important;
    top: 50px;
    left: 0;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    background-color: #2c3e50;
    z-index: 999;
    display: none;
    transition: opacity 0.3s ease !important;
  }

  .menu.active {
    display: block !important;
    opacity: 1;
  }

  .menu a {
    padding: 12px 20px;
    font-size: 16px;
  }
  .menu::-webkit-scrollbar {
    width: 6px;
  }

  .menu::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }

  .menu-toggle {
    display: block !important;
    z-index: 1000 !important;
  }

  .content {
    padding: 10px !important;
    position: relative !important;
    z-index: 1 !important;
  }

  
}

/** เพิ่มใหม่*/

/* ===== PROMOTIONS SECTION: Wrapper for layout control ===== */
.promotions-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== PROMOTIONS CONTAINER: Grid layout for promo cards ===== */
.promotions-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  width: 100%;
}

/* ===== PROMO CARD STYLING ===== */
.promo-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  max-width: 100%;
}

.promo-card:hover {
  transform: scale(1.03);
}

.promo-card img {
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

.promo-content h3 {
  margin: 10px 0;
  color: #007bff;
}

.discount {
  font-size: 18px;
  font-weight: bold;
  color: #d9534f;
}

.date {
  font-size: 14px;
  color: #333;
}

.details-btn {
  display: inline-block;
  background-color: #28a745;
  color: white;
  padding: 8px 15px;
  text-decoration: none;
  border-radius: 5px;
  margin-top: 10px;
  transition: background 0.3s;
}

.details-btn:hover {
  background-color: #218838;
}

.no-promo {
  font-size: 16px;
  color: #777;
  text-align: center;
  padding: 20px;
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 768px) {
  .promo-card img {
    height: 150px;
  }
  .promotions-container {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .promo-card {
    max-width: 100%;
  }
  .promo-content h3 {
    font-size: 16px;
  }
  .details-btn {
    font-size: 14px;
    padding: 6px 12px;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .promo-card {
    max-width: 100%;
  }
}

@media (min-width: 1200px) {
  .promo-card {
    max-width: 800px;
  }
}

