/* --- CSS Variables & Reset --- */
:root {
    --primary-color: #ff4757;
    --secondary-color: #2f3542;
    --bg-color: #f1f2f6;
    --white: #ffffff;
    --gray: #a4b0be;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Navigation Bar --- */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    text-decoration: none;
}

.logo span {
    color: var(--primary-color);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

nav ul li a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    transition: 0.3s;
    padding: 5px 10px;
    border-radius: 5px;
}

/* Hover Effect for Nav Links */
nav ul li a:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Mobile Menu Icon (Hidden on Desktop) */
.menu-icon {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* --- Main Content --- */
main {
    flex: 1;
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* --- Search Section --- */
.search-container {
    text-align: center;
    margin-bottom: 3rem;
}

.search-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 50px;
    outline: none;
    transition: 0.3s;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.2);
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
}

.search-box button:hover {
    background-color: #e04050;
}

/* --- Product Grid --- */
.products-title {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    border-left: 5px solid var(--primary-color);
    padding-left: 10px;
}

.product-grid {
    display: grid;
    /* Auto responsive grid: fits as many as possible, min width 250px */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

/* --- Product Card --- */
.product-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #eee;
}

.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.price-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.old-price {
    text-decoration: line-through;
    color: var(--gray);
    font-size: 0.9rem;
}

.discount-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Card Buttons */
.card-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    text-align: center;
}

.btn-add-cart {
    background-color: #dfe4ea;
    color: var(--secondary-color);
}

.btn-add-cart:hover {
    background-color: #ced6e0;
}

.btn-buy-now {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-buy-now:hover {
    background-color: #1e232d;
}

/* --- Footer --- */
footer {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 3rem 5%;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-column h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: #ccc;
    text-decoration: none;
}

.footer-column a:hover {
    color: var(--white);
}

.copyright {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
    color: #888;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px;
        right: 0;
        background-color: var(--white);
        width: 100%;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        padding: 1rem;
    }

    nav ul.active {
        display: flex;
    }

    .menu-icon {
        display: block;
    }

    .search-container h1 {
        font-size: 1.8rem;
    }
}