<style>* {
    box-sizing: border-box;
}

body {
    // font-family: 'Segoe UI', sans-serif;
    font-family: 'Sarabun', sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f4f4;
    font-size: 2rem;
}

header {
    background-color: #007bff;
    color: white;
    padding: 20px;
    text-align: center;
}

.container {
    max-width: auto; // 1200
    margin: auto;
    padding: 20px;

}

.top-bar {
    // สวัสดี
    text-align: right;
    margin-bottom: 20px;
    font-size: 0.9rem;

}

.top-bar a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
    margin-left: 10px;
}

form.filter {
    margin-bottom: 20px;
    text-align: left;
}


.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    font-size: 1rem;
}


.product-card {
    position: relative;
    overflow: hidden;
}

/* ทำให้ภาพจาง */
.product-card.sold img {
    opacity: 0.4;
    /* หรือใช้ filter: grayscale(100%); */
    pointer-events: none;
    /* ป้องกัน hover หรือคลิกซ้ำซ้อน */
}

/* ป้าย ขายแล้ว */
.sold-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    font-weight: bold;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 5px;
    z-index: 10;
}




//.product-grid {
//  display: grid;
//  grid-template-columns: repeat(5, 1fr); /* 5 คอลัมน์ */
//  gap: 20px;
//  padding: 10px;
//}

.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s;
    font-size: 1rem;
}

.product-card:hover {
    transform: translateY(-5px);
}

//   .product-card img {
//     width: 100%;
//     height: 200px;
//     object-fit: cover;
//   }

.product-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    /* บังคับเป็นสี่เหลี่ยมจัตุรัส */
    object-fit: cover;
    border-radius: 6px;
}


.product-card .content {
    padding: 15px;
    font-size: 0.6rem;
}

.product-card h3 {
    margin: 0 0 10px;
    //font-size: 12px;
    font-size: 0.6rem;
    color: #333;
}

.product-card p {
    margin: 0;

    color: black;
    font-size: 0.6rem;
}

footer {
    background-color: #222;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 40px;
    font-size: 1rem;
}



.site-header {
    position: relative;
    color: white;
    text-align: center;
    padding: 120px 20px;
    font-size: 4rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.header-bg {
    background-image: url('images/hd2.png');
    /* ← ตั้งชื่อรูปว่า header4.jpg แล้วเซฟไว้ในโฟลเดอร์ images */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: brightness(0.8);
}

@media (max-width: 1000px) {

    // 768
    .site-header {
        padding: 80px 15px;
    }

    .site-header h1 {
        font-size: 3rem;
    }

    .site-header p {
        font-size: 1rem;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'sarabun', sans-serif;
    font-size: 1.5rem;
}

/* Header Styles */
header {
    position: relative;
    color: yellow;
    text-align: center;
    font-size: 2rem;
    height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-image: url('images/hd5.png');
    /* ← ใส่ภาพ header */
    background-size: cover;
    background-position: left;
    background-repeat: no-repeat;
    /* ✨ เพิ่มบรรทัดนี้ */
    background-size: contain;
}

header::before {
    content: "ตลาดซื้อขายออนไลน์";
    position: left;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    //  background: rgba(0, 0, 0, 0.3);
    font-size: 1.5rem;
    z-index: 0;
}

.nav-container {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1;
    font-size: 1.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

nav a {
    // บน ขวา
    color: white;
    margin-left: 20px;
    margin-right: 20px;
    text-decoration: none;
    font-weight: 500;
    //font-size: 1rem;
    font-size: 1.5rem;
}

.header-content {
    z-index: 1;
    padding: 20px;

}

.header-content h1 {
    font-size: 3rem; // มีของเหลือใช้
    margin-bottom: 10px;
}

.header-content p {
    font-size: 2rem; // โทรศัพท แท็ปเลท
    margin-bottom: 20px;
}

.post-button {

    padding: 12px 15px;
    background: #ffc107;
    color: black;
    border: none;
    border-radius: 5px; // ปุ่มเหลือง
    font-size: 2.2rem;
    text-decoration: none;
    transition: background 0.3s;
}

.post-button:hover {
    background: #e0a800;
}

@media (max-width: 1000px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }

    nav a {
        margin-left: 0;
        margin-top: 8px;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-content p {
        font-size: 1.5rem;
    }
}



@media (max-width: 1000px) {

    body {
        font-size: 15px;
        font-family: 'Mitr', sans-serif;
    }

    h1,
    h2,
    h3 {
        font-size: 1.2rem;
    }

    .header-menu {
        font-size: 1.2rem;
    }

    .price-label {
        font-size: 0.6rem;
    }
}



html {
    font-size: 16px;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card-link:hover .product-card {
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.4);
    transform: scale(1.01);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

</style><style>.glow-text {
    font-size: 3rem;
    text-align: center;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff;
    }

    to {
        text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    }
}

</style><style>header {
    text-align: center;
    padding: 50px 20px;
}

.glow-text {
    font-size: 3rem;
    color: #00ffff;
    text-shadow:
        0 0 5px #00ffff,
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 40px #00ffff;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from {
        text-shadow:
            0 0 5px #00ffff,
            0 0 10px #00ffff;
    }

    to {
        text-shadow:
            0 0 20px #00ffff,
            0 0 40px #00ffff;
    }
}

header img {
    margin-top: 20px;
    max-width: 300px;
}



.slide-in {
    font-size: 3rem;
    animation: slideIn 1s ease-out forwards;
    opacity: 0;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}


.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        color: orange;
    }

    100% {
        transform: scale(1);
    }
}


.attention {
    animation: wiggle 0.5s ease-in-out infinite;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}


.product-grid.latest-products {
    background-color: #bad7f3;
    border: 1px solid #041a29;
    padding: 12px;
    border-radius: 8px;
}


.menu-link,
.menu-btn,
.menu-greeting {
    font-size: 2rem;
    margin-right: 10px;
    text-decoration: none;
}

.menu-link.highlight {
    color: red;
    font-weight: bold;
}

.menu-btn {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

/* ขนาดใหญ่ขึ้นบนหน้าจอใหญ่ */
@media (min-width: 768px) {

    .menu-link,
    .menu-btn,
    .menu-greeting {
        font-size: 1rem;
    }
}

/* ขนาดใหญ่พิเศษสำหรับ desktop กว้างมาก */
@media (min-width: 1200px) {

    .menu-link,
    .menu-btn,
    .menu-greeting {
        font-size: 1.2rem;
        text-align: center;
    }
}

.menu-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 2rem;
    margin: 5px;
    background: #ffffff;
    color: #333;
    border: 2px solid #007BFF;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.menu-btn:hover {
    background: #007BFF;
    color: #fff;
}

/* ปุ่มพิเศษ เช่น ลงขายสินค้า */
.menu-btn.highlight {
    background: #ff4d4f;
    background: #1174a6;
    color: white;
    border-color: #130101;
}

.menu-btn.highlight:hover {
    background: #432bdc;
}

/* ปุ่ม logout */
.menu-btn.logout {
    border-color: #999;
    background: #f4f4f4;
}

.menu-btn.logout:hover {
    background: #ddd;
    color: black;
}

@media (max-width: 600px) {
    .menu-btn {
        display: block;
        width: 100%;
        margin: 6px 0;
        text-align: center;
        font-size:1rem;
    }
}

.swal-custom {
    font-size: 1.3rem !important;
    font-family: 'Segoe UI', sans-serif;
}


  .menu-btn {
    font-size: 1.2rem;
    padding: 8px 16px;
    text-decoration: none;
    color: #333;
  }

  .highlight {
    background-color: #e0f0ff;
    border-radius: 6px;
  }

  /* ✅ ขนาดสำหรับจอมือถือ */
  @media (max-width: 600px) {
    .menu-btn {
      font-size: 1rem;
      padding: 6px 12px;
    }
  }

  /* ✅ ขนาดสำหรับจอใหญ่ (PC) */
  @media (min-width: 601px) {
    .menu-btn {
      font-size: 1.2rem;
    }
  }


</style>