/* Resetting default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body styles */
body {
    font-family: 'Kanit', 'Prompt', sans-serif;
    background-color: #f5f5f5;
    background-image: linear-gradient(#e5e5e5 1px, transparent 1px), 
                      linear-gradient(90deg, #e5e5e5 1px, transparent 1px);
    background-size: 20px 20px;
    color: #333;
}

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #fff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid #FF8C00;
}

/* Logo styles */
.logo {
    width: 50px;
    height: 50px;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Navigation styles */
nav {
    display: flex;
    align-items: center;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin: 0 1.5rem;
}

nav ul li a {
    text-decoration: none;
    color: #FF8C00;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.5rem 0;
    position: relative;
    transition: all 0.3s ease;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: #8B4513;
    bottom: 0;
    left: 0;
    transition: width 0.3s ease;
}

nav ul li a:hover {
    color: #8B4513;
}

nav ul li a:hover::after {
    width: 100%;
}

nav ul li a.active {
    color: #8B4513;
}

nav ul li a.active::after {
    width: 100%;
}

/* Mobile Menu Toggle Styles */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    width: 30px;
}

.mobile-menu-toggle span {
    height: 3px;
    width: 100%;
    background-color: #FF8C00;
    margin: 4px 0;
    transition: 0.4s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* User actions styles */
.user-actions {
    display: flex;
    align-items: center;
}

.user-actions a {
    margin-left: 1.5rem;
    color: #FF8C00;
    font-size: 1.2rem;
    position: relative;
}

.user-actions a img {
    width: 24px;
    height: auto;
    vertical-align: middle;
}

/* Cart notification badge */
.cart-icon-new {
    position: relative;
}

/* Main content styles */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Section title styles */
.section-title {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #333;
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: #FF8C00;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #FF8C00;
}

.btn:hover {
    background-color: #8B4513;
    border-color: #8B4513;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Footer styles */
footer {
    background-color: #333;
    padding: 2rem;
    text-align: center;
    color: #fff;
    margin-top: 3rem;
    border-top: 3px solid #FF8C00;
}

/* Search container styles */
.search-container {
    display: flex;
    align-items: center;
    max-width: 300px;
}

#searchInput {
    flex-grow: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
}

.search-button {
    background-color: #FF8C00;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button i {
    color: white;
}

.search-button:hover {
    background-color: #8B4513;
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    gap: 10px;
}

.pagination button {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background-color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button.active {
    background-color: #FF8C00;
    color: white;
    border-color: #FF8C00;
}

/* Alert styles */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    display: none;
}

.alert-info {
    color: #31708f;
    background-color: #d9edf7;
    border-color: #bce8f1;
}

.alert-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}

.alert-danger {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}

/* Loading indicator styles */
#loadingIndicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #FF8C00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Products grid and list views */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 100%;
    margin: 20px 0 0 0;
    padding: 0;
    box-sizing: border-box;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.grid-view .product-card {
    display: flex;
    flex-direction: column;
}

.list-view .product-card {
    display: flex;
    flex-direction: row;
}

/* Product card styles */
.product-card {
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0;
    padding: 0;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.product-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    z-index: 1;
}

.product-tag.hot {
    background-color: #3498db;
}

.product-tag.sale {
    background-color: #e74c3c;
}

/* Product image styles */
.product-image {
    height: 180px;
    width: 100%;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.grid-view .product-image {
    height: 180px;
    width: 100%;
}

.list-view .product-image {
    min-width: 180px;
    max-width: 180px;
    height: 180px;
}

/* Product info styles */
.product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.product-sku {
    font-size: 12px;
    color: #777;
    margin-bottom: 8px;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #FF8C00;
    margin-top: auto;
    padding-top: 10px;
}

.product-stock {
    font-size: 14px;
    margin-top: 5px;
    color: #555;
}

.product-weight {
    font-size: 14px;
    margin-top: 5px;
    color: #555;
    display: flex;
    align-items: center;
}

.product-weight:before {
    content: '\f522';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    font-size: 12px;
    color: #777;
}

.product-categories {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.product-category {
    font-size: 12px;
    background-color: #f0f0f0;
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.stock-high {
    color: #27ae60;
}

.stock-medium {
    color: #f39c12;
}

.stock-low {
    color: #e74c3c;
}

/* Product actions styles */
.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.product-actions button {
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.add-to-cart {
    display: block;
    width: 100%;
    background-color: #FF8C00;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    margin-top: 10px;
}

.add-to-cart:hover {
    background-color: #8B4513;
}

.add-to-cart.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.buy-now-btn {
    width: fit-content;
    font-size: 1rem;
    padding: 0.7rem 1.2rem;
    margin-top: 1rem;
}

/* Product filters styles */
.product-filters {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.filter-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.filter-group select, 
.filter-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.filter-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.filter-buttons button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.reset-button {
    background-color: #f5f5f5;
    color: #666;
}

.apply-button {
    background-color: #FF8C00;
    color: white;
}

.apply-button:hover {
    background-color: #8B4513;
}

/* Product list header styles */
.product-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.product-count {
    font-size: 1.1rem;
    color: #666;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-options label {
    color: #666;
}

.sort-options select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.view-options {
    display: flex;
    gap: 0.5rem;
}

.view-option {
    padding: 0.5rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-option.active {
    background-color: #FF8C00;
    color: white;
    border-color: #FF8C00;
}

.view-option:hover {
    background-color: #e5e5e5;
}

.view-option.active:hover {
    background-color: #FF8C00;
}

/* Responsive design */
@media screen and (max-width: 992px) {
    .filter-row {
        flex-direction: column;
    }
    
    .product-list-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .sort-options {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-container {
        max-width: 100%;
        margin-top: 1rem;
    }
}

@media screen and (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    nav {
        justify-content: space-between;
    }

    .mobile-menu-toggle {
        display: flex;
        z-index: 1000;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        height: 100vh;
        padding-top: 80px;
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 2.5rem 0;
    }

    .nav-menu li a {
        font-size: 1.5rem;
    }

    .user-actions {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
    }
}

@media screen and (max-width: 576px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-count, .sort-options {
        width: 100%;
        justify-content: center;
    }
    
    .product-list-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    nav ul li {
        margin: 0 0.7rem;
    }
}
/* ปุ่มแสดงตัวกรองในโหมดมือถือ */
.filter-toggle-btn {
    display: none; /* ซ่อนในโหมดปกติ */
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #FF8C00;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
    cursor: pointer;
    align-items: center;
    gap: 8px;
}

/* แถบตัวกรองด้านซ้าย */
.mobile-filter-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 300px;
    height: 100%;
    background-color: #fff;
    z-index: 1001;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
    padding: 20px;
}

.mobile-filter-sidebar.active {
    left: 0;
}

/* ส่วนหัวของตัวกรอง */
.filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.filter-sidebar-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.close-filter {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

/* พื้นหลังทึบ */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.filter-overlay.active {
    display: block;
}

/* การแสดงผลในโหมดมือถือ */
@media screen and (max-width: 768px) {
    .filter-toggle-btn {
        display: flex; /* แสดงปุ่มเฉพาะในโหมดมือถือ */
    }
    
    .product-filters {
        display: none; /* ซ่อนตัวกรองปกติในโหมดมือถือ */
    }
}
/* ปรับปรุงการแสดงผลกริดในโหมดมือถือ */
@media screen and (max-width: 768px) {
    /* ปรับความกว้างของคอนเทนเนอร์หลัก */
    main {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* จัดการการแสดงผลกริด */
    .products-grid {
        display: grid;
        grid-template-columns: 1fr; /* แสดง 1 คอลัมน์ในโหมดมือถือ */
        gap: 1rem;
        width: 100%;
    }
    
    /* ปรับแต่งการ์ดสินค้า */
    .product-card {
        width: 100%;
        margin: 0 0 1rem 0;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }
    
    /* จัดการขนาดรูปภาพ */
    .product-image {
        height: 160px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .product-image img {
        max-height: 140px;
        max-width: 80%;
        object-fit: contain;
    }
    
    /* ปรับแต่งส่วนข้อมูลสินค้า */
    .product-info {
        padding: 0.8rem;
    }
    
    .product-name {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }
    
    .product-sku {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    /* ปรับแต่งปุ่มและการแสดงผลราคา */
    .product-price {
        font-size: 1.2rem;
        margin: 0.7rem 0;
    }
    
    .add-to-cart {
        width: 100%;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    /* ปรับการแสดงผลตัวกรองและส่วนหัวของรายการสินค้า */
    .product-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .search-container {
        width: 100%;
        margin: 0;
    }
    
    .sort-options {
        width: 100%;
        justify-content: space-between;
        margin: 0;
    }
    
    /* ปรับปุ่มสลับมุมมอง */
    .view-options {
        margin-left: auto;
    }
    
    /* ปรับระยะห่างของหมวดหมู่สินค้า */
    .product-categories {
        flex-wrap: wrap;
        margin-top: 0.5rem;
        gap: 0.3rem;
    }
    
    .product-category {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* สำหรับหน้าจอที่เล็กมาก (มือถือขนาดเล็ก) */
@media screen and (max-width: 375px) {
    .product-name {
        font-size: 0.9rem;
    }
    
    .product-sku {
        font-size: 0.7rem;
    }
    
    .product-price {
        font-size: 1.1rem;
    }
}
/* โครงสร้างใหม่สำหรับหน้าจอมือถือ */
@media screen and (max-width: 768px) {
    .mobile-row, .search-row, .sort-row {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.8rem;
    }
    
    .search-row .search-container {
        width: 100%;
    }
    
    .sort-row .sort-options {
        width: 100%;
    }
}
/* ปรับปรุงการแสดงผลหมวดหมู่สินค้าในโหมดมือถือ */
@media screen and (max-width: 768px) {
    /* ซ่อนหมวดหมู่ทั้งหมดยกเว้นหมวดหมู่แรก */
    .product-card .product-categories {
        display: flex;
        flex-wrap: nowrap;
        overflow: hidden;
        max-width: 100%;
    }
    
    .product-card .product-category:not(:first-child) {
        display: none;
    }
    
    /* แสดงจุดไข่ปลาหลังหมวดหมู่แรกถ้ามีหมวดหมู่อื่นๆ */
    .product-card .product-category:first-child::after {
        content: "...";
        display: inline-block;
        margin-left: 2px;
    }
}
/* ปรับปรุงการแสดงผลกริดในโหมดมือถือ */
@media screen and (max-width: 768px) {
    /* แก้ไขกริดเป็น 2 คอลัมน์ */
    .products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* แสดง 2 สินค้าต่อแถว */
        gap: 10px;
        width: 100%;
    }
    
    /* ปรับแต่งการ์ดสินค้าให้กระชับขึ้น */
    .product-card {
        width: 100%;
        margin: 0;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }
    
    /* ปรับขนาดรูปภาพให้เล็กลง */
    .product-image {
        height: 140px;
    }
    
    .product-image img {
        max-height: 120px;
        max-width: 90%;
    }
    
    /* ปรับขนาดข้อความให้เล็กลง */
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 0.9rem;
        margin-bottom: 5px;
        line-height: 1.2;
        height: 2.4em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .product-sku {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }
    
    .product-stock {
        font-size: 0.8rem;
    }
    
    .product-weight {
        font-size: 0.8rem;
    }
    
    /* ปรับหมวดหมู่สินค้า */
    .product-categories {
        margin-top: 5px;
        gap: 3px;
    }
    
    .product-category {
        font-size: 0.65rem;
        padding: 2px 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    /* ปรับขนาดราคา */
    .product-price {
        font-size: 1rem;
        margin: 5px 0;
    }
    
    /* ปรับขนาดปุ่ม */
    .add-to-cart {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    /* ซ่อนบางส่วนที่ไม่จำเป็นบนมือถือ */
    .product-card .product-weight {
        display: none;
    }
}

/* สำหรับหน้าจอที่เล็กมาก (มือถือขนาดเล็ก) */
@media screen and (max-width: 375px) {
    .product-name {
        font-size: 0.8rem;
    }
    
    .product-categories {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 3px;
    }
    
    .product-price {
        font-size: 0.9rem;
    }
}


/* แก้ไขเพื่อให้แสดงหมวดหมู่ทั้งหมด - ใช้ specificity สูงและ !important */
.products-grid .product-card .product-categories {
    display: flex !important;
    flex-wrap: wrap !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  .products-grid .product-card .product-category {
    display: inline-block !important;
    font-size: 0.65rem !important;
    padding: 2px 5px !important;
    margin: 0 3px 3px 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: 100% !important;
  }
  
  /* ลบการตัดหรือซ่อนหมวดหมู่ที่อาจมีอยู่ */
  .products-grid .product-card .product-category:nth-child(n) {
    display: inline-block !important;
  }
  
  /* ลบจุดไข่ปลาหรือเครื่องหมายอื่นๆ ที่อาจเพิ่มด้วย CSS */
  .products-grid .product-card .product-category::after,
  .products-grid .product-card .product-category::before {
    display: none !important;
    content: none !important;
  }
/* แก้ไขตำแหน่งและเพิ่มขอบให้รูปภาพสินค้าในมุมมองแบบลิสต์ */
.products-list .product-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start; /* เปลี่ยนจาก center เป็น flex-start เพื่อให้รูปอยู่ด้านบนของการ์ด */
    padding: 20px;
    margin-bottom: 15px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.products-list .product-image {
    flex: 0 0 150px; /* ลดขนาดลงเล็กน้อยจาก 180px */
    max-width: 150px;
    height: 150px;
    margin-right: 20px;
    margin-top: 10px; /* เพิ่มระยะห่างด้านบน */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eaeaea; /* เพิ่มขอบบางๆ */
    padding: 10px; /* เพิ่ม padding ให้รูปภาพไม่ชิดขอบ */
}

.products-list .product-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.products-list .product-image img:hover {
    transform: scale(1.05); /* เพิ่มเอฟเฟกต์เมื่อวางเมาส์บนรูป */
}

.products-list .product-info {
    flex: 1;
    padding-top: 5px; /* เพิ่มระยะห่างด้านบนของข้อมูลสินค้า */
}

/* ปรับตำแหน่งของ categories */
.products-list .product-categories {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* ปรับแต่งสไตล์ของตัวเลือกหมวดหมู่ */
.products-list .product-category {
    font-size: 12px;
    background-color: #f5f5f5;
    color: #666;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}

/* ปรับแต่งการแสดงราคา */
.products-list .product-price {
    margin-top: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #FF8C00;
}

/* ปรับแต่งปุ่มใส่ตะกร้า */
.products-list .product-actions {
    margin-top: 15px;
}

.products-list .add-to-cart {
    background-color: #FF8C00;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.products-list .add-to-cart:hover {
    background-color: #E67E00;
}

/* ปรับแต่งสำหรับโหมดมือถือ */
@media screen and (max-width: 768px) {
    .products-list .product-card {
        flex-direction: column;
        align-items: center;
        padding: 15px;
    }
    
    .products-list .product-image {
        margin-right: 0;
        margin-bottom: 15px;
        width: 100%;
        max-width: 200px;
        height: 200px;
    }
    
    .products-list .product-info {
        width: 100%;
        text-align: center;
    }
    
    .products-list .product-categories {
        justify-content: center;
    }
    
    .products-list .product-actions {
        display: flex;
        justify-content: center;
    }
}
/* ปรับปรุงวิธีการแสดงหมวดหมู่สินค้าใน product-styles.css */

/* สไตล์พื้นฐานสำหรับหมวดหมู่สินค้า */
.product-categories {
    display: flex;
    flex-wrap: wrap;
    margin: 10px 0;
    gap: 5px;
}

.product-category {
    display: inline-block;
    background-color: #f0f0f0;
    color: #555;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

/* ทำให้แน่ใจว่าหมวดหมู่สินค้าแสดงทั้งในมุมมองกริดและลิสต์ */
.products-grid .product-category,
.products-list .product-category {
    display: inline-block !important;
    visibility: visible !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
}

/* ปรับแต่งการแสดงหมวดหมู่ในมุมมองกริด */
.products-grid .product-categories {
    margin-top: 8px;
    margin-bottom: 8px;
}

/* ปรับแต่งการแสดงหมวดหมู่ในมุมมองลิสต์ */
.products-list .product-categories {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* แก้ไขที่อาจซ่อนหมวดหมู่ในโหมดมือถือ */
@media screen and (max-width: 768px) {
    .product-category {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .product-categories {
        flex-wrap: wrap;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .product-card .product-category:not(:first-child) {
        display: inline-block !important; /* ทำให้แน่ใจว่าแสดงหมวดหมู่ทั้งหมด */
    }
    
    /* ลบจุดไข่ปลาหลังหมวดหมู่แรก */
    .product-card .product-category:first-child::after {
        content: none !important;
    }
}
.product-card .product-image,
.product-card .product-name {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: block;
}

.product-card .product-name:hover {
    color: #FF8C00; /* สีเมื่อ hover ที่ชื่อสินค้า */
    text-decoration: underline;
}
.cart-icon-new {
    position: relative;
    display: inline-block;
}

.cart-icon-new.has-items:after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #FF0000;
    color: white;
    border-radius: 50%;
    padding: 4px;
    font-size: 10px;
    min-width: 15px;
    height: 15px;
    line-height: 15px;
    text-align: center;
}
/* แก้ไขการจัดวางรูปภาพให้อยู่ตรงกลางเสมอ */
.product-card .product-image {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px !important;
    height: 180px !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
}

.product-card .product-image img {
    max-width: 85% !important;
    max-height: 85% !important;
    object-fit: contain !important;
    margin: auto !important;
    display: block !important;
}

/* จัดการกับ Grid View เฉพาะ */
.products-grid .product-card .product-image {
    height: 180px !important;
}

/* จัดการกับ List View เฉพาะ */
.products-list .product-card .product-image {
    min-width: 180px !important;
    height: 180px !important;
    margin-right: 15px !important;
}
/* ปรับปรุงการแสดงรูปภาพบนอุปกรณ์มือถือ */
@media screen and (max-width: 768px) {
    .product-card .product-image {
        height: 150px !important;
        padding: 5px !important;
    }
    
    .product-card .product-image img {
        max-width: 90% !important;
        max-height: 90% !important;
    }
    
    .products-list .product-card .product-image {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        margin-right: 0 !important;
        margin-bottom: 10px !important;
    }
}

/* ====== การแจ้งเตือนเพิ่มสินค้าลงตะกร้า ====== */
/* เพิ่ม/แก้ไข CSS ในไฟล์ product-styles.css สำหรับใช้ร่วมกันทั้งสองหน้า */

.cart-notification {
    position: fixed;
    bottom: -100px;
    right: 20px;
    z-index: 9999;
    background-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid #FF8C00;
    display: flex;
    width: 320px;
    max-width: 90%;
    opacity: 0;
    transition: all 0.5s ease;
    overflow: hidden;
    padding: 0;
}

.cart-notification.show {
    bottom: 20px;
    opacity: 1;
}

.cart-notification-image {
    flex: 0 0 60px;
    min-width: 60px;
    width: 60px;
    padding: 8px;
    background-color: #FFF5E6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-notification-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-notification-content {
    flex: 1;
    width: calc(100% - 60px);
    padding: 8px;
    overflow: hidden;
}

.cart-notification-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.cart-notification-header i {
    color: #4CAF50;
    margin-right: 4px;
    font-size: 12px;
}

.cart-notification-header span {
    color: #4CAF50;
    font-weight: 600;
    font-size: 12px;
}

.cart-notification-product {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 36px;
    line-height: 1.4;
}

.cart-notification-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.cart-notification-actions span {
    font-size: 11px;
    color: #777;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 45%;
}

.checkout-button {
    background-color: #FF8C00;
    color: white !important;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none !important;
    font-weight: 600;
}

.checkout-button:hover {
    background-color: #E67E00;
}

/* เพิ่ม media query สำหรับมือถือที่หน้าจอเล็กมาก */
@media screen and (max-width: 375px) {
    .cart-notification {
        width: 280px; /* ลดความกว้างลงอีกบนหน้าจอเล็ก */
    }
    
    .cart-notification-image {
        flex: 0 0 50px;
        min-width: 50px;
        width: 50px;
        padding: 6px;
    }
    
    .cart-notification-content {
        width: calc(100% - 50px);
        padding: 6px;
    }
    
    .cart-notification-product {
        font-size: 12px;
        -webkit-line-clamp: 1; /* บนหน้าจอเล็กแสดงเพียง 1 บรรทัด */
        max-height: 18px;
    }
    
    .cart-notification-actions span {
        font-size: 10px;
    }
    
    .checkout-button {
        font-size: 10px;
        padding: 3px 6px;
    }
}
/* ====== ปรับปรุงส่วนตัวกรองสินค้า ====== */

/* คอนเทนเนอร์ตัวกรองหลัก */
.product-filters {
    background-color: #fff;
    padding: 1.2rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    border: 1px solid #eee;
}

/* หัวข้อตัวกรอง */
.filter-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    position: relative;
}

.filter-title:after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: #FF8C00;
    border-radius: 2px;
}

/* แถวตัวกรอง */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-end;
}

/* กลุ่มตัวกรอง */
.filter-group {
    flex: 1;
    min-width: 180px;
}

/* ป้ายชื่อในตัวกรอง */
.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

/* เพิ่มไอคอนสำหรับแต่ละหมวดหมู่ */
.filter-group label[for="category-filter"]:before {
    content: '\f0c9'; /* รหัสไอคอน Font Awesome */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    color: #FF8C00;
}

.filter-group label[for="material-filter"]:before {
    content: '\f1b3';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    color: #FF8C00;
}

.filter-group label[for="thread-filter"]:before {
    content: '\f021';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    color: #FF8C00;
}

.filter-group label[for="size-filter"]:before {
    content: '\f546';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    color: #FF8C00;
}

.filter-group label[for="quantity-filter"]:before {
    content: '\f468';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    color: #FF8C00;
}

/* ปรับแต่ง select และ input */
.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #f9f9f9;
    font-size: 0.95rem;
    color: #333;
    transition: all 0.2s ease;
    appearance: none; /* ลบลูกศรเริ่มต้น */
}

/* เพิ่มลูกศรสำหรับ select */
.filter-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FF8C00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 30px;
}

.filter-group select:hover,
.filter-group input:hover {
    border-color: #FF8C00;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: #FF8C00;
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.1);
    outline: none;
}

/* ช่วงราคา */
.filter-group div[style="display: flex; gap: 10px;"] {
    display: flex;
    gap: 8px !important;
}

/* ปุ่มในตัวกรอง */
.filter-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.reset-button, .apply-button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.reset-button {
    background-color: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
}

.apply-button {
    background-color: #FF8C00;
    color: white;
}

.reset-button:hover {
    background-color: #e0e0e0;
    color: #555;
}

.apply-button:hover {
    background-color: #E67E00;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.2);
}

/* ปรับแต่ง placeholder สำหรับช่องกรอกราคา */
.filter-group input::placeholder {
    color: #aaa;
    font-size: 0.9rem;
}

/* รับรองการแสดงผลบนอุปกรณ์มือถือ */
@media screen and (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .reset-button, .apply-button {
        flex: 1;
        max-width: 150px;
        text-align: center;
    }
}

/* ปรับแต่งสำหรับหน้าจอขนาดเล็กมาก */
@media screen and (max-width: 375px) {
    .product-filters {
        padding: 1rem;
    }
    
    .filter-title {
        font-size: 1.2rem;
    }
    
    .filter-group label {
        font-size: 0.9rem;
    }
    
    .filter-group select,
    .filter-group input {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    .reset-button, .apply-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* ===== ส่วนของตัวกรองมือถือ ===== */
.mobile-filter-sidebar {
    background-color: #fff;
    padding: 1.2rem;
    border-radius: 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #FF8C00;
}

.filter-sidebar-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 700;
}

.close-filter {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-filter:hover {
    background-color: #f0f0f0;
    color: #333;
}

.filter-toggle-btn {
    background-color: #FF8C00;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.filter-toggle-btn:hover {
    background-color: #E67E00;
    transform: translateY(-2px);
}

.filter-toggle-btn i {
    font-size: 14px;
}
/* ====== ปรับปรุงส่วนแจ้งเตือนการกรองสินค้า ====== */

/* ปรับปรุงกล่องแจ้งเตือนทั่วไป */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

/* กล่องแจ้งเตือนประเภทข้อมูล (สีฟ้า) */
.alert-info {
    color: #0c5460;
    background-color: #e2f4f9;
    border-color: #bee5eb;
    border-left: 4px solid #17a2b8;
}

/* กล่องแจ้งเตือนประเภทสำเร็จ (สีเขียว) */
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
    border-left: 4px solid #28a745;
}

/* กล่องแจ้งเตือนประเภทอันตราย (สีแดง) */
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
    border-left: 4px solid #dc3545;
}

/* กล่องแจ้งเตือนประเภทเตือน (สีเหลือง) */
.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
    border-left: 4px solid #ffc107;
}

/* เพิ่มไอคอนสำหรับแต่ละประเภทการแจ้งเตือน */
.alert-info::before {
    content: '\f05a'; /* รหัสไอคอน Font Awesome สำหรับ info-circle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 10px;
    color: #17a2b8;
    font-size: 1.1rem;
}

.alert-success::before {
    content: '\f058'; /* รหัสไอคอน Font Awesome สำหรับ check-circle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 10px;
    color: #28a745;
    font-size: 1.1rem;
}

.alert-danger::before {
    content: '\f057'; /* รหัสไอคอน Font Awesome สำหรับ times-circle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 10px;
    color: #dc3545;
    font-size: 1.1rem;
}

.alert-warning::before {
    content: '\f06a'; /* รหัสไอคอน Font Awesome สำหรับ exclamation-circle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 10px;
    color: #ffc107;
    font-size: 1.1rem;
}

/* สไตล์สำหรับ strong ภายในแจ้งเตือน */
.alert strong {
    font-weight: 700;
    margin-right: 4px;
    margin-left: 4px;
    display: inline-block;
}

/* ปุ่มปิดการแจ้งเตือน */
.alert .close-alert {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.5);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.alert .close-alert:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.7);
}

/* เอฟเฟกต์เรืองแสงเมื่อมีการกรองใหม่ */
@keyframes alertGlow {
    0% { box-shadow: 0 0 5px rgba(23, 162, 184, 0); }
    50% { box-shadow: 0 0 10px rgba(23, 162, 184, 0.5); }
    100% { box-shadow: 0 0 5px rgba(23, 162, 184, 0); }
}

.alert-info.new-filter {
    animation: alertGlow 1.5s ease-in-out;
}

/* การตอบสนองบนอุปกรณ์มือถือ */
@media screen and (max-width: 768px) {
    .alert {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .alert::before {
        font-size: 1rem;
        margin-right: 8px;
    }
}