/* Basic Setup & Variables */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --background-color: #4bb0c9;
    --card-bg-color: #ffffff;
    --font-color: #34495e;
    --shadow: 0 4px 8px rgba(0,0,0,0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--font-color);
}

/* Header & Cart Icon */
header {
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.cart-icon-wrapper {
    position: relative;
    cursor: pointer;
}

#cart-icon {
    width: 32px;
    height: 32px;
    filter: invert(1);
}

#cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Product Grid */
main {
    padding: 2rem 5%;
}

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

/* Product Card */
.product-card {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

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

.product-info h3 {
    margin: 0 0 0.5rem 0;
}

.product-info p {
    font-size: 0.9rem;
    flex-grow: 1;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 1rem 0;
}

.add-to-cart-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

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

/* Modal Styling */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.close-button {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* Cart Item Styling */
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item-info {
    flex-grow: 1;
    margin-left: 1rem;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.cart-item-quantity input {
    width: 50px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 1rem;
}

/* Modal Footer */
.modal-footer {
    margin-top: 1.5rem;
    text-align: right;
}

#checkout-btn, #clear-cart-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

#checkout-btn {
    background-color: #2ecc71;
    color: white;
}
#clear-cart-btn {
    background-color: #e74c3c;
    color: white;
    margin-right: 1rem;
}