/* General Styles */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f8f8;
    color: #333;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3 {
    color: #333;
    margin-bottom: 0.5em;
}

a {
    color: #007BFF;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header */
header {
    background-color: #343a40;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
    border-bottom: 2px solid #222;
}

nav {
    margin-top: 10px;
}

nav a {
    color: #fff;
    margin: 0 15px;
    transition: color 0.3s;
}

nav a:hover {
    color: #ddd;
    text-decoration: none;
}

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

/* Product List */
#products-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s;
}

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

.product img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.product h3 {
    margin-bottom: 0.5em;
}

.product p {
    margin-bottom: 1em;
}

/* Product Details */
#product-details {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

#product-details img {
    max-width: 50%;
    height: auto;
    margin-bottom: 10px;
}

/* Cart */
#cart-items {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

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

.cart-item img {
    max-width: 80px;
    height: auto;
    margin-right: 15px;
}

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

.cart-item .item-actions {
    text-align: right;
}

/* Admin Panel */
#admin-panel {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.admin-panel h2 {
    margin-bottom: 1em;
}

#existingProducts {
    margin-top: 20px;
}

.product-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
}

/* Buttons */
button {
    background-color: #007BFF;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0056b3;
}

/* Forms */
form label {
    display: block;
    margin-bottom: 0.5em;
}

form input[type="text"],
form input[type="number"],
form textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

/* Footer */
footer {
    background-color: #343a40;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    border-top: 2px solid #222;
    position: fixed; /* Keep at bottom */
    bottom: 0;
    left: 0;
    width: 100%;
}

/* Media Queries (Responsive Design) */
@media (max-width: 768px) {
    /* Adjust grid for smaller screens */
    #products-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    /* Make product detail image smaller */
    #product-details img {
        max-width: 100%;
    }

    .cart-item {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .cart-item .item-actions {
        text-align: left;
    }

    .cart-item .item-details {
      width: 100%; /* Occupy full width on smaller screens */
    }
}

/* Error Messages */
.error-message {
    color: #dc3545;
    margin-top: 10px;
}