:root {
    --primary-color: #D32F2F;
    --secondary-color: #B71C1C;
    --accent-color: #D32F2F;
    --text-color: #333;
    --bg-color: #f4f4f4;
    --white: #fff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

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

h1 {
    font-size: 1.5rem;
}

#site-logo {
    cursor: pointer;
    transition: opacity 0.3s;
}

#site-logo:hover {
    opacity: 0.8;
}

.search-bar {
    display: flex;
    flex: 1;
    margin: 0 20px;
    max-width: 600px;
}

.search-bar input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.search-bar button {
    padding: 10px 20px;
    border: none;
    background-color: var(--secondary-color);
    color: var(--white);
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    transition: background 0.3s;
}

.search-bar button:hover {
    background-color: #219150;
}

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    cursor: pointer;
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-color);
    color: var(--white);
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
}

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

.product-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #eee;
}

.product-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title-cn {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #2c3e50;
}

.product-title-en {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.product-price {
    font-size: 1.2rem;
    color: var(--accent-color);
    font-weight: bold;
    margin-top: auto;
    margin-bottom: 10px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.add-to-cart-btn:hover {
    background-color: var(--secondary-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0 40px;
}

.pagination button {
    padding: 8px 16px;
    margin: 0 10px;
    border: 1px solid #ddd;
    background: var(--white);
    cursor: pointer;
    border-radius: 4px;
}

.pagination button:disabled {
    background: #f4f4f4;
    color: #aaa;
    cursor: not-allowed;
}

.pagination span {
    font-weight: bold;
}

/* Notice Board */
.notice-board {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
    line-height: 1.5;
}

.notice-board p {
    margin: 5px 0;
}

.notice-th {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Cart Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: flex-end; /* Sidebar style */
}

.modal-content {
    background-color: var(--white);
    width: 400px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 8px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 20px;
    background-color: var(--primary-color);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.cart-item-price {
    color: var(--accent-color);
    font-size: 0.9rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
}

.quantity-btn {
    background: #eee;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

.cart-item-quantity {
    margin: 0 10px;
    font-weight: bold;
}

.remove-btn {
    margin-left: 15px;
    color: var(--accent-color);
    cursor: pointer;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
}

.cart-total {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background-color: #c0392b;
}

.empty-cart-msg {
    text-align: center;
    color: #777;
    margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .search-bar {
        margin: 10px 0;
        width: 100%;
    }
    
    .modal-content {
        width: 100%;
    }
}
