*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* CSS */
body {
    font-family: Arial, sans-serif;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
}

.categories-container {
    padding: 2rem;

}


.search-container {
    position: relative; /* ใช้ fixed เพื่อให้อยู่ติดขวา แม้จะเลื่อนหน้า */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-items: stretch;
    gap: 5px;
}

.search-container input {
    padding: 5px 10px;
    border-radius: 5px 0 0 5px;
    outline: none;
    width: 200px;
}

.search-container button {
    padding: 5px 10px;
    border: none;
    border-radius: 0 5px 5px 0;
    background-color: #555;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-container button:hover {
    background-color: #777;
}



section {
    padding: 2rem;
}

.category-list {
    display: grid;
    gap: 1rem;
    justify-items: center;
    margin-top: 2rem;
    grid-template-columns: repeat(2, 1fr); /* Default for smaller screens */
}

/* Product Card Styling */
.categories {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.2rem;
    width: 100%;
    max-width: 280px;
    background-color: #fff;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0 auto;  /* Center the product card */
    overflow: hidden; /* Prevent content from overflowing */
    justify-content: space-between;
}

.categories:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.categories img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 1rem;
    transition: transform 0.3s ease;
}

.categories img:hover {
    transform: scale(1.05); /* Add slight zoom effect on image hover */
}

/* Product Title and Description */
.categories h3 {
    font-size: 1.3em;
    color: #333;
    margin: 1rem 0 0.5rem;
}

.categories p {
    color: #666;
    font-size: 1em;
    margin: 0.5rem 0;
    line-height: 1.5;
}

/* Product Price Styling */
.categories .price {
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff;
    margin: 0.8rem 0;
}

.categories-link {
    text-decoration: none !important;
}
        

/* Add to Cart Button */
.categories button {
    padding: 12px 20px;
    font-size: 1.1em;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    width: 100%;
}

.categories button:hover {
    background-color: #218838;
    transform: translateY(-2px);
}


/* Pagination Styling */
.pagination {
    text-align: center;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pagination button {
    padding: 10px 20px;
    font-size: 1em;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.pagination button:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
}

.pagination .disabled {
    background-color: #ddd;
    cursor: not-allowed;
}

/* Pagination arrows */
.pagination .prev,
.pagination .next {
    font-size: 1.2em;
    font-weight: bold;
}

/* สไตล์หมวดหมู่และแท็ก */
#categories { /* Adds space around the section */
    padding: 2rem;
}

.feelter{
    display: grid;
    grid-template-columns: repeat(auto-fill,
                           minmax(300px,1fr));
    width: 100%;
}


.categories {
    display: flex;
    flex-direction: column;
    align-items: baseline;
    padding: 2rem;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    gap: 10px; /* Space between items inside the category */
}

.categories h2 {
    margin: 0;
    font-size: 1rem; /* Reduced font size for the header */
    color: #333;
}



/* Tag filter buttons */
.tag-filters {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between tag filter buttons */
}

.tag-filter {
    display: flex;
    gap: 10px;
    padding: 8px 15px; /* Larger padding for better click area */
    background-color: #fff;
    color: #555;
    border: 1.5px solid #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.tag-icon {
    width: 20px;
    height: 20px;
    object-fit: cover;
}

.tag-filter:hover {
    background-color: #f0f0f0;
}

.tag-filter.selected {
    background-color: #555;
    color: white;
}

.tag-clear-all {
    background-color: #f8d7da;
    color: #721c24;
    border: 1.5px solid #f5c6cb;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    padding: 10px 20px;
    transition: background-color 0.3s, color 0.3s;
}

.tag-clear-all:hover {
    background-color: #f1b0b7;
}

.filter-toggle {
    background-color: #d4edda;
    color: #155724;
    border: 1.5px solid #c3e6cb;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    padding: 10px 20px;
    transition: background-color 0.3s, color 0.3s;
}

.filter-toggle:hover {
    background-color: #c3e6cb;
}

.button-group {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced gap between buttons */
    margin-bottom: 15px; /* Reduced margin from other elements */
    justify-content: flex-end;
}

sidebar{
    padding: 2rem;
}

.sidebar-container {
    display: flex;
    justify-content: center; /* จัดให้อยู่ตรงกลาง */
    align-items: center;
    height: 300px; /* ความสูงของโซน sidebar */
    padding: 2rem;
    z-index: 1;
}

.rectangle {
    width: 100%;
    height: 250px; /* ความสูงของสี่เหลี่ยม */
    background-color: #ec6767; /* สีของสี่เหลี่ยม */
    border-radius: 20px 20px 5px 5px; /* โค้งเฉพาะมุมบนซ้ายและมุมบนขวา */
    transition: all 0.3s ease;
}

/* ให้แน่ใจว่า sidebar มีการจัดการตำแหน่งให้เหมาะสม */
.sidebar {
    width: 100%; /* หรือกำหนดขนาดที่ต้องการ */
    padding: 0;
    margin: 0;
}

.sidebar-container {
    width: auto; /* ให้พื้นที่ใช้งานเพียงพอสำหรับเนื้อหาภายใน */
}

.rectangle {
    display: flex; /* ใช้ Flexbox เพื่อจัดเรียงแนวนอน */
    justify-content: space-between; /* เพิ่มระยะห่างระหว่างสองรูป */
    gap: 2rem; /* ระยะห่างระหว่างรูป */
    align-items: center
}

.welcome-image {
    display: flex;
    justify-content: center; /* จัดให้อยู่ตรงกลาง */
    align-items: center;
    position: relative; /* สำหรับการเพิ่มเอฟเฟกต์เฉพาะ */
}

.welcome-image img {
    width: 765px; /* กำหนดความกว้างของภาพ */
    height: auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* เพิ่ม Transition */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3)); /* เพิ่มมิติ */
}

/* เอฟเฟกต์เมื่อ Hover */
.welcome-image img:hover {
    transform: translateY(-10px) scale(1.02); /* ยกและขยายภาพเล็กน้อย */
}


.Mascot {
    display: flex;
    justify-content: flex-start; /* จัดให้อยู่ทางซ้าย */
    align-items: center;
}

.Mascot img {
    width: 235px; /* ขนาดของภาพ */
    height: auto;
    margin-top: -61px; /* ลบ margin-top ที่เคยใช้ */
    z-index: 2; /* เพื่อไม่ให้ภาพซ้อน */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* เพิ่ม Transition */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3)); /* เพิ่มมิติ */
}

.original-price {
    text-decoration: line-through;
    color: #999; /* เปลี่ยนสีให้ดูจางๆ */
}

.product {
    position: relative; /* กำหนดให้ productCard มีการจัดตำแหน่งแบบสัมพัทธ์ */
}

.discount-box, .fixed-discount-box {
    background-color: #33d3d7; /* พื้นหลังสีแดง */
    color: white !important; /* ตัวอักษรสีขาว */
    padding: 5px 10px; /* ขนาดของช่อง */
    border: 3px solid #2a2a2a;
    border-radius: 5px; /* มุมโค้ง */
    font-weight: bold; /* ตัวอักษรหนา */
    display: inline-block; /* ให้เป็นบล็อกในบรรทัดเดียว */
    margin-top: 10px; /* ระยะห่างระหว่างข้อความและองค์ประกอบอื่นๆ */
    position: absolute; /* ตั้งตำแหน่งแบบสัมพัทธ์ */
    top: 10px; /* ตั้งให้ชิดด้านบนของ productCard */
    right: 10px; /* ตั้งให้ชิดขวาของ productCard */
}

.total-quantity::before {
    content: attr(data-quantity) " items"; /* แสดงจำนวนสินค้า */
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.total-quantity {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
}



.original-price {
    text-decoration: line-through;
    color: #999; /* เปลี่ยนสีให้ดูจางๆ */
}


/* Product Card Styling */
.category-content {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    background-color: #fff;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    font-family: "Mitr", serif;
    font-weight: 400;
}

.category-content img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    aspect-ratio: 1 / 1;
    transition: transform 0.3s ease-in-out;
}

/* Product Title and Description */
.category-content h3 {
    font-size: 1.4em;
    color: #222;
    margin: 10px;
    text-align: left;
    font-family: "Mitr", serif;
    font-weight: 500;
    font-style: normal;
}

.category-content p {
    color: #555;
    font-size: 1em;
    margin: 0.6rem 0;
    line-height: 1.6;
}

/* Product Price Styling */
.category-content .price {
    font-size: 1.3em;
    font-weight: bold;
    color: #007bff;
    margin: 1rem 0;
}

.category-content:hover {
    transform: translateY(-5px); /* ขยับขึ้นเล็กน้อย */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* เงาเข้มขึ้น */
    background-color: #f9f9f9; /* เปลี่ยนสีพื้นหลังเล็กน้อย */
}

/* Add to Cart Button */
.category-content button {
    padding: 12px 22px;
    font-size: 1.1em;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 100%;
    cursor: pointer;
}

.category-content button:hover {
    background-color: #218838;
    transform: translateY(-3px);
}


.category-link {
    display: block;
    margin-top: 10px;
    padding: 5px 10px;
    background-color: #51a3f3; /* ปรับเป็นสีเขียว */
    color: white;
    text-decoration: none;
    border-radius: 5px;
    border: 2px solid #51a3f3;
}

.category-link:hover {
    background-color: white; /* เปลี่ยนเป็นเขียวเข้มเมื่อโฮเวอร์ */
    color: #51a3f3;
    border: 2px solid #51a3f3; /* กรอบสีเทาดำ */
}

.edit-button {
    display: block;
    margin-top: 10px;
    padding: 5px 10px;
    background-color: rgb(255, 255, 255); /* ปรับเป็นสีเหลือง */
    color: black;
    text-decoration: none;
    border-radius: 5px;
    border: 2px solid rgb(45, 45, 45); /* กรอบสีเทาดำ */
}

.edit-button:hover {
    background-color: rgb(45, 45, 45); /* เปลี่ยนเป็นสีทองเมื่อโฮเวอร์ */
    border: 2px solid rgb(45, 45, 45); /* กรอบสีเทาดำ */
    color: rgb(255, 255, 255);
}


.add-category {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    border: 2px dashed #bbb;
    color: #777;
}

.plus-icon {
    font-size: 3rem;
    color: #666;
}

.category-image {
    width: 100%;
    height: auto;
    display: block;
}

.overlay-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
}


/* Adjust the styling for .extra-product to fit into the grid layout */
.extra-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%; /* ให้ขนาดเต็มกรอบ Grid */
    height: auto; /* ปรับความสูงให้สมดุล */
    background-color: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    padding: 1.2rem; /* เพิ่ม padding ให้เหมือน .product */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); /* เพิ่มเงาให้เหมือนสินค้า */
    text-decoration: none;/* ลบเส้นใต้ */
}


.extra-product a {
    text-decoration: none; /* ใช้ !important เพื่อบังคับ */
}



@media only screen and(max-width: 360px) {
    

}
@media (max-width: 768px) {


    .search-container {
        order: -1;
        flex: 1;
    }

    #auth-section button {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
    .rectangle {
        width: 100%;
        height: 200px; /* ความสูงของสี่เหลี่ยม */
        background-color: #333; /* สีของสี่เหลี่ยม */
        border-radius: 50px 50px 5px 5px; /* โค้งเฉพาะมุมบนซ้ายและมุมบนขวา */
        transition: all 0.3s ease;
        padding: 2rem;
    }
    .welcome-image img {
        width: 100%;
        height: auto;
    }

    .Mascot img {
        width: 122%;
        height: auto;
        margin-top: -60px;

    }
    
    
}

@media (min-width: 768px) {
    .category-list {
        grid-template-columns: repeat(4, 1fr);
    } 
}
