:root {
    --primary-color: #5389fe;
    --secondary-color: #4a46cc;
    --hover-color: #d6bcfa;
    --success-color: #4CAF50;
    --danger-color: #ff4d4d;
    --background-color: #f7f3fc;
    --text-color: #2d3748;
    --border-color: #e2e8f0;
    --shadow-color: rgba(107, 70, 193, 0.15);
}

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

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
}

.container {
    max-width: 1420px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
nav {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--hover-color);
}

.logo {
    font-size: 30px;
    font-weight: bold;
    text-decoration: none;
    color: white;
    margin-right: 30px;
}

.cart-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.cart-link:hover {
    background: #838ffd;
}

/* Product Grid */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.product-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: scale(1.05);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.product-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.product-card .price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.product-card form {
    display: flex;
    gap: 0.5rem;
}

.product-card input[type="number"] {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.product-card button {
    flex: 1;
    padding: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.product-card button:hover {
    background: var(--secondary-color);
}

/* Shopping Cart */
.cart {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    margin: 2rem 0;
}

.cart h2 {
    margin-bottom: 1.5rem;
    color: #4a5568;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.cart-summary {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    text-align: right;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.button-primary {
    background: var(--primary-color);
}

.button-primary:hover {
    background: var(--secondary-color);
}

.button-success {
    background: var(--success-color);
}

.button-success:hover {
    background: #45a049;
}

.button-danger {
    background: var(--danger-color);
}

.button-danger:hover {
    background: #e60000;
}

.checkout-button, .order-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #3beab0;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 1rem;
    transition: background 0.3s ease;
}

.place-order-button {
    background-color: #4CAF50; /* สีเขียว */
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.remove-button {
    background-color: #ff4d4d; /* สีแดงสดสำหรับลบ */
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

/* Shipping Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group textarea, .shipping-address-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d2d6dc;
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group textarea:focus, .shipping-address-input:focus {
    border-color: var(--success-color);
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    outline: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .products {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Footer */
footer {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

/* Login & Register Styles */
.auth-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 400px;
    text-align: center;
    margin: 50px auto; /* Center the container */
}

.auth-container h1 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.auth-container .form-group {
    margin-bottom: 20px;
}

.auth-container label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    color: var(--text-color);
}

.auth-container input[type="text"],
.auth-container input[type="email"],
.auth-container input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

.auth-container button {
    background-color: var(--primary-color);
    color: rgb(255, 255, 255);
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.auth-container button:hover {
    background-color: var(--secondary-color);
}

.auth-container p {
    margin-top: 20px;
    font-size: 0.9rem;
}

.auth-container a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-container a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        width: 90%; /* ปรับขนาดให้เหมาะสมกับหน้าจอเล็ก */
        padding: 15px; /* ลด Padding */
        margin-top: 20px; /* ลดระยะห่างด้านบน */
        margin-bottom: 20px; /* เพิ่มระยะห่างด้านล่าง */
        box-shadow: none; /* ลบเงาในหน้าจอเล็ก */
        border-radius :5%
}};

.logout-button {
    display: block;
    margin-top: 10px;
    background-color: #ff4d4d; /* สีแดง */
    color: rgb(255, 255, 255);
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.logout-button:hover {
    background-color: #c63636; /* สีแดงเข้มขึ้นเมื่อ Hover */
}

/* ช่องค้นหา */
.search-form {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
}

.search-form input {
    padding: 10px;
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    width: 800px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.search-form input:focus {
    border-color: var(--hover-color);
    box-shadow: 0px 0px 8px var(--shadow-color);
}

.search-form button {
    padding: 10px 15px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.3s ease;
}

.search-form button:hover {
    background-color: #3d38b1;
}