/* นำเข้า Font Kanit */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;600;700&display=swap');

/* ส่วนปรับแต่งพื้นฐาน */
body {
    font-family: 'Kanit', sans-serif;
    margin: 0;
    background-color: #f0f8ff;
    color: #333;
}
.container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #007bff;
    text-decoration: none;
}
.menu-items {
    display: flex;
    align-items: center;
}
.cart-btn, .login-btn {
    text-decoration: none;
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    margin-right: 1rem;
    font-weight: 600;
}
.cart-btn:hover, .login-btn:hover {
    background-color: #e6f2ff;
}
.cart-btn #cart-count {
    background-color: #ff6347;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.8rem;
    position: relative;
    top: -5px;
}
.nav-links {
    display: flex;
    list-style: none;
    margin: 0 0 0 2rem;
    padding: 0;
}
.nav-links li a {
    color: #333;
    text-decoration: none;
    padding: 0.8rem 1.2rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}
.nav-links li a:hover {
    background-color: #e6f2ff;
    color: #007bff;
}

/* Hero Section และ Search Section (คงโค้ดเดิม) */
.hero-section {
    background-color: #e6f2ff;
    color: #333;
    text-align: center;
    padding: 4rem 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #007bff;
}
.hero-section p {
    font-size: 1.2rem;
    color: #666;
}
.search-section {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.search-box {
    display: flex;
    width: 100%;
    max-width: 600px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    background-color: #fff;
}
#searchInput {
    flex-grow: 1;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    outline: none;
}
#searchButton {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}
#searchButton:hover {
    background-color: #0056b3;
}

/* Product Grid (คงโค้ดเดิม) */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 2rem;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}
.product-card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}
.card-content {
    padding: 1.5rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.product-name {
    font-size: 1.5rem;
    color: #333;
    margin: 0 0 0.5rem;
}
.product-price {
    font-size: 1.2rem;
    color: #ff6347;
    font-weight: 600;
    margin-bottom: 1rem;
}
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block;
    cursor: pointer;
}
.btn-primary {
    background-color: #007bff;
    color: #ffffff;
}
.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}
.add-to-cart-btn {
    margin-top: 0.5rem;
}

/* Pagination (คงโค้ดเดิม) */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}
.page-btn {
    background-color: #fff;
    color: #007bff;
    border: 1px solid #cceeff;
    padding: 0.8rem 1rem;
    margin: 0 0.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.page-btn:hover {
    background-color: #e6f2ff;
}
.page-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Popup (ใหม่) */
.popup {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    padding: 2rem;
}
.popup-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 800px;
    width: 100%;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}
.popup-title {
    text-align: center;
    color: #333;
    font-size: 2rem;
    margin-bottom: 1rem;
}
.close-btn {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}
.close-btn:hover, .close-btn:focus {
    color: #333;
}

/* Detail Popup */
#popup-detail img, #popup-detail video {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.detail-gallery {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 1rem;
}
.detail-gallery img {
    height: 100px;
    width: auto;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}
.detail-gallery img:hover {
    border-color: #007bff;
}
#detail-description {
    line-height: 1.6;
    color: #555;
    margin-bottom: 1.5rem;
}

/* Cart Popup */
#cart-items {
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}
.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}
.cart-item-info {
    flex-grow: 1;
    margin-left: 1rem;
}
.remove-item {
    cursor: pointer;
    color: #ff6347;
    font-weight: bold;
}
.cart-total {
    text-align: right;
    font-size: 1.2rem;
    font-weight: 600;
}
.checkout-btn {
    width: 100%;
    text-align: center;
    margin-top: 1rem;
}

/* Login/Register Popup */
.login-content {
    max-width: 400px;
    text-align: center;
}
#login-form input, #register-form input {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}
.switch-form {
    font-size: 0.9rem;
    color: #555;
}
.switch-form a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .navbar { padding: 1rem; flex-wrap: wrap; }
    .logo, .menu-items { width: 100%; text-align: center; }
    .logo { margin-bottom: 0.5rem; }
    .menu-items { justify-content: center; }
    .cart-btn, .login-btn { margin: 0 0.5rem; }
    .menu-toggle { display: none; }
    .nav-links { display: none; }
    .search-box { flex-direction: column; }
    #searchButton { border-radius: 0 0 10px 10px; }
    .popup-content { padding: 1.5rem; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}