/* General Styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #2c3e50;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

h1 {
    margin: 0;
    font-size: 2.5em;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
    gap: 25px;
    padding: 25px;
    max-width: 1200px;
    margin: 25px auto;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    cursor: pointer;
    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; /* Fixed height for consistency */
    object-fit: cover;
    display: block;
}

.product-info {
    padding: 15px;
    flex-grow: 1; /* Allow content to grow */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-info h3 {
    font-size: 1.3em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c3e50;
}

.product-info .price {
    font-size: 1.2em;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-info p {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    flex-grow: 1; /* Allow description to take space */
    overflow: hidden; /* Hide overflow for short descriptions */
    text-overflow: ellipsis; /* Add ellipsis for overflowed text */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Show only 2 lines */
    -webkit-box-orient: vertical;
}

/* Modal Styling */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 30px;
    border-radius: 10px;
    width: 90%; /* Could be more responsive */
    max-width: 700px;
    position: relative;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.4s forwards;
}

.modal-content img {
    width: 100%;
    max-height: 350px;
    object-fit: contain; /* Ensure the whole image is visible */
    border-radius: 5px;
    margin-bottom: 20px;
}

.modal-content h2 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

.modal-content .price {
    font-size: 1.5em;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 20px;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
}

.buy-button {
    background-color: #28a745;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: block;
    width: fit-content;
    margin-top: 20px;
}

.buy-button:hover {
    background-color: #218838;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
        padding: 15px;
    }

    .product-card {
        margin: 0; /* Remove margin for smaller screens */
    }

    .product-card img {
        height: 150px;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.5em;
    }

    .modal-content p {
        font-size: 1em;
    }

    .modal-content .price {
        font-size: 1.2em;
    }

    .close-button {
        font-size: 30px;
        top: 10px;
        right: 15px;
    }

    .buy-button {
        padding: 10px 20px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr; /* Single column for very small screens */
        padding: 10px;
        margin: 10px auto;
    }

    .product-card {
        height: auto; /* Allow height to adjust */
    }

    .product-card img {
        height: 180px; /* Slightly larger image for single column */
    }

    .product-info {
        padding: 10px;
    }

    .modal-content {
        margin: 5% auto; /* Bring modal higher */
        padding: 15px;
        width: 95%;
    }
}/* General Styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #2c3e50;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

h1 {
    margin: 0;
    font-size: 2.5em;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
    gap: 25px;
    padding: 25px;
    max-width: 1200px;
    margin: 25px auto;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    cursor: pointer;
    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; /* Fixed height for consistency */
    object-fit: cover;
    display: block;
}

.product-info {
    padding: 15px;
    flex-grow: 1; /* Allow content to grow */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-info h3 {
    font-size: 1.3em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c3e50;
}

.product-info .price {
    font-size: 1.2em;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-info p {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    flex-grow: 1; /* Allow description to take space */
    overflow: hidden; /* Hide overflow for short descriptions */
    text-overflow: ellipsis; /* Add ellipsis for overflowed text */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Show only 2 lines */
    -webkit-box-orient: vertical;
}

/* Modal Styling */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 30px;
    border-radius: 10px;
    width: 90%; /* Could be more responsive */
    max-width: 700px;
    position: relative;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.4s forwards;
}

.modal-content img {
    width: 100%;
    max-height: 350px;
    object-fit: contain; /* Ensure the whole image is visible */
    border-radius: 5px;
    margin-bottom: 20px;
}

.modal-content h2 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

.modal-content .price {
    font-size: 1.5em;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 20px;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
}

.buy-button {
    background-color: #28a745;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: block;
    width: fit-content;
    margin-top: 20px;
}

.buy-button:hover {
    background-color: #218838;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
        padding: 15px;
    }

    .product-card {
        margin: 0; /* Remove margin for smaller screens */
    }

    .product-card img {
        height: 150px;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.5em;
    }

    .modal-content p {
        font-size: 1em;
    }

    .modal-content .price {
        font-size: 1.2em;
    }

    .close-button {
        font-size: 30px;
        top: 10px;
        right: 15px;
    }

    .buy-button {
        padding: 10px 20px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr; /* Single column for very small screens */
        padding: 10px;
        margin: 10px auto;
    }

    .product-card {
        height: auto; /* Allow height to adjust */
    }

    .product-card img {
        height: 180px; /* Slightly larger image for single column */
    }

    .product-info {
        padding: 10px;
    }

    .modal-content {
        margin: 5% auto; /* Bring modal higher */
        padding: 15px;
        width: 95%;
    }
}