/* 🔥 Overlay fisso sotto la barra di ricerca */
#search-overlay {
    position: fixed;
    top: 60px; /* 🔥 Parte da sotto la barra di ricerca */
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px); /* 🔥 Occupa tutto lo spazio sotto la barra */
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 9999999;
    padding-top: 20px;
    overflow-y: auto;
}

/* 🔥 Contenitore dei risultati - parte esattamente sotto la barra */
#search-results-container {
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    width: 90%;
    max-width: 1200px;
    padding: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-height: 70vh;
    color: white;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    position: relative;
    margin-top: 10px; /* 🔥 Parte esattamente sotto la barra */
}

/* 🔥 Grid dei prodotti */
.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 55vh;
}

/* 🔥 Card prodotto - Dimensioni fisse per evitare problemi */
.product-card {
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    padding: 15px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: white;
    width: 260px;
    height: 400px;
}

/* 🔥 Nome prodotto */
.product-card h3 {
    font-size: 22px;
    font-weight: bold;
    margin: 10px 0;
    color: white;
    text-align: center;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 🔥 Prezzo */
.product-price {
    font-size: 20px;
    color: #fff;
    font-weight: bold;
    margin-top: 10px;
}

/* 🔥 Immagini */
.product-img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 12px;
}

/* 🔥 Effetti al passaggio del mouse */
.product-card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* 🔥 Responsive Layout */
@media (min-width: 1024px) {
    .search-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1023px) {
    .search-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-card {
        width: 240px;
        height: 380px;
    }

    .product-img {
        height: 180px;
    }

    .product-card h3 {
        font-size: 20px;
        height: 45px;
    }

    .product-price {
        font-size: 18px;
    }
}

@media (max-width: 767px) {
    .search-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-card {
        width: 220px;
        height: 360px;
    }

    .product-img {
        height: 160px;
    }

    .product-card h3 {
        font-size: 18px;
        height: 40px;
    }

    .product-price {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .search-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .product-card {
        width: 90%;
        max-width: 280px;
        height: 350px;
    }

    .product-img {
        height: 140px;
    }

    .product-card h3 {
        font-size: 18px;
        height: 40px;
    }

    .product-price {
        font-size: 16px;
    }
}
