/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

header h1 {
    color: #333;
    font-weight: 700;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #ff6b6b;
}

nav ul li a.active {
    color: #ff6b6b;
    font-weight: 600;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 60px 0;
    background-color: #f5f5f5;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #333;
}

.hero p {
    font-size: 1.2rem;
    color: #666;
}

/* Products section */
.products, .products-section {
    padding: 40px 0;
}

.products h2, .products-section h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: #333;
}

.product-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    gap: 10px;
}

.filter-btn {
    background-color: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.filter-btn:hover {
    background-color: #e0e0e0;
}

.filter-btn.active {
    background-color: #ff6b6b;
    color: white;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: #fff;
    padding: 20px;
}

.product-info {
    padding: 20px;
}

.product-title {
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
    height: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-category {
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.product-rating {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.stars {
    color: #ffb100;
    margin-right: 5px;
}

.count {
    color: #666;
    font-size: 0.8rem;
}

.product-search {
    margin-bottom: 20px;
    text-align: center;
}

.product-search input {
    width: 60%;
    max-width: 400px;
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.add-to-cart:hover {
    background-color: #ff5252;
}

/* Footer */
footer {
    background-color: #333;
    color: #fff;
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    grid-column: 1 / -1;
    color: #666;
}

/* Error/No products messages */
.error, .no-products {
    text-align: center;
    padding: 40px;
    grid-column: 1 / -1;
    color: #ff6b6b;
}

/* Responsive styles */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
    }
    
    nav ul {
        margin-top: 15px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .hero h2 {
        font-size: 2rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    nav ul li {
        margin-left: 15px;
    }
}

/* Cart styles */
.cart-section {
    padding: 40px 0;
}

.cart-section h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: #333;
}

.cart-items {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.cart-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    background-color: #f5f5f5;
    padding: 15px 20px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.cart-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    padding: 15px 20px;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-product {
    display: flex;
    align-items: center;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 15px;
}

.cart-item-title {
    font-weight: 500;
}

.cart-item-price, .cart-item-quantity, .cart-item-total {
    text-align: center;
}

.cart-item-action {
    text-align: center;
}

.remove-from-cart {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.remove-from-cart:hover {
    background-color: #ff5252;
}

.cart-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.cart-total {
    display: flex;
    align-items: center;
    margin-right: 20px;
    font-size: 1.2rem;
}

.total-amount {
    font-weight: 700;
    margin-left: 10px;
}

.checkout-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.checkout-btn:hover {
    background-color: #45a049;
}

.empty-cart {
    text-align: center;
    padding: 40px;
    color: #666;
}

.cart-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s, fadeOut 0.5s 2.5s forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive cart */
@media (max-width: 768px) {
    .cart-header, .cart-item {
        grid-template-columns: 1fr;
        padding: 10px;
    }
    
    .header-item {
        display: none;
    }
    
    .cart-item-product {
        margin-bottom: 10px;
    }
    
    .cart-item > div {
        margin-bottom: 5px;
    }
    
    .cart-summary {
        flex-direction: column;
        align-items: flex-end;
    }
    
    .cart-total {
        margin-right: 0;
        margin-bottom: 10px;
    }
}