/* General Body Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

/* Header Styles */
header {
    background-color: #2c3e50; /* Dark blue/grey */
    color: #ecf0f1; /* Light grey */
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #3498db; /* Blue for emphasis */
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 25px;
}

nav ul li a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    /* Add these two properties to make the positioning work correctly relative to the anchor */
    position: relative; /* This is key! It makes descendants positioned relative to this element */
    display: flex; /* Helps align icon and text/span */
    align-items: center; /* Vertically center them */
    gap: 5px; /* Adds a small gap between icon and number */
}

nav ul li a:hover {
    color: #3498db;
}

.cart-icon {
    /* Keep this largely as is, but remove position: relative if it was there */
    /* If you had position: relative here, remove it. The parent <a> tag now handles it. */
    color: #ecf0f1;
    font-size: 1.5rem;
    /* cursor: pointer; (optional, if you want the icon itself to be clickable) */
}

.cart-count {
    position: static; /* Change from absolute to static */
    top: auto; /* Reset top */
    right: auto; /* Reset right */
    background-color: #e74c3c; /* Red */
    color: white;
    border-radius: 50%;
    padding: 2px 7px;
    font-size: 0.8rem;
    font-weight: bold;
    /* Add display inline-block to allow padding and vertical alignment */
    display: inline-block;
    min-width: 15px; /* Ensures a circle even for single digits */
    text-align: center; /* Centers the number inside */
}

/* Main Content Styling */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Hero Section (Home Page) */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://source.unsplash.com/1600x900/?car-parts-engine') no-repeat center center/cover;
    color: white;
    text-align: center;
    padding: 100px 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hero p {
    font-size: 1.3rem;
    max-width: 700px;
    margin: 0 auto 30px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #2980b9;
}

/* About Section (Home Page) */
.about-section {
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.about-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

.about-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
}

.about-text {
    flex: 2;
    min-width: 300px;
}

.about-image {
    flex: 1;
    min-width: 250px;
    text-align: center;
}

.about-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Shop Page Specific Styles */
.shop-layout {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.filters {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content; /* Make sure it doesn't take full height unnecessarily */
    position: sticky; /* Keep filters visible when scrolling */
    top: 20px; /* Offset from the top */
}

.filters h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #555;
}

.filter-group input[type="text"],
.filter-group select {
    width: calc(100% - 20px); /* Adjust for padding */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box; /* Include padding in width */
}

.filter-group select {
    appearance: none; /* Remove default select arrow */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%204%205%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M2%200L0%202h4L2%200zM2%205L0%203h4L2%205z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
}

.apply-filters-btn {
    background-color: #28a745; /* Green */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    transition: background-color 0.3s ease;
}

.apply-filters-btn:hover {
    background-color: #218838;
}

.product-grid {
    flex: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.product-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    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 6px 15px rgba(0, 0, 0, 0.15);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

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

.product-info h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.3rem;
}

.product-info p {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 10px;
    flex-grow: 1; /* Allow description to take available space */
}

.product-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: #e67e22; /* Orange */
    margin-bottom: 15px;
}

.add-to-cart-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    width: 100%;
}

.add-to-cart-btn:hover {
    background-color: #2980b9;
}


/* Cart Page Specific Styles */
.cart-items-container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cart-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 20px;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-details h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 1.2rem;
}

.cart-item-details p {
    margin: 0;
    color: #666;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.cart-item-quantity button {
    background-color: #ddd;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1.1rem;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.cart-item-quantity button:hover {
    background-color: #ccc;
}

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

.cart-item-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e67e22;
    min-width: 90px;
    text-align: right;
}

.remove-item-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
}

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

.cart-summary {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
    text-align: right;
}

.cart-summary p {
    font-size: 1.4rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
}

.checkout-btn {
    background-color: #28a745;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

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

.empty-cart-message {
    text-align: center;
    font-size: 1.2rem;
    color: #777;
    padding: 50px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Footer Styles */
footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
    font-size: 0.9rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        padding: 0 15px;
    }

    nav ul {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    nav ul li {
        margin: 0 10px 10px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .about-content {
        flex-direction: column;
    }

    .shop-layout {
        flex-direction: column;
    }

    .filters {
        max-width: 100%;
        position: static; /* Remove sticky on small screens */
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .cart-item {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .cart-item img {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .cart-item-details,
    .cart-item-quantity,
    .cart-item-price,
    .remove-item-btn {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .cart-item-quantity {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    nav ul li {
        margin: 0 5px 10px;
    }

    .hero {
        padding: 60px 15px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* Featured Products Section */
.featured-products-section {
    background: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.8)), url('https://source.unsplash.com/1600x900/?car-factory') no-repeat center center/cover;
    color: white;
    padding: 60px 20px;
    margin-top: 30px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.featured-products-section h2 {
    font-size: 2.8rem;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.featured-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Re-using and slightly modifying .product-card for featured section */
.featured-products-grid .product-card {
    background-color: rgba(255, 255, 255, 0.95); /* Slightly transparent white */
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.featured-products-grid .product-card .product-info h3,
.featured-products-grid .product-card .product-info p,
.featured-products-grid .product-card .product-price {
    color: #333; /* Ensure text is readable on light card */
}

.featured-products-grid .add-to-cart-btn {
    background-color: #e67e22; /* Orange for call to action */
}

.featured-products-grid .add-to-cart-btn:hover {
    background-color: #d35400; /* Darker orange on hover */
}

.view-all-btn {
    background-color: #28a745; /* Green button */
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    display: inline-block; /* Make it respect padding/margin */
    margin-top: 20px;
}

.view-all-btn:hover {
    background-color: #218838;
}

.text-center {
    text-align: center;
}

/* General improvements/adjustments */
.product-card img {
    /* Existing styles */
    transition: transform 0.3s ease; /* Add transition for image hover effect */
}

.product-card:hover img {
    transform: scale(1.05); /* Zoom effect on image */
}

/* Existing .product-card and .product-info styles will also apply */

/* Responsive adjustments for featured section */
@media (max-width: 768px) {
    .featured-products-section h2 {
        font-size: 2rem;
    }

    .featured-products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 480px) {
    .featured-products-section {
        padding: 40px 15px;
    }
    .featured-products-section h2 {
        font-size: 1.8rem;
    }
}