/* Styling for desktop view */
@media (min-width: 768px) {
  /* Adjust breakpoint as needed */
  .psdopedfinder-results-header {
    flex: 1; /* Allow the element to take available space */
  }
  .psdopedfinder-filter-header {
    display: none; /* Hide filter header on desktop */
  }
}

#psdopedfinder-results {
  position: absolute;
  top: 100%;
  margin-left: calc((100vw - 78vw) / -2);
  z-index: 1000;
  max-height: 80vh;
  overflow: hidden;
  background: #fff;
  border: 1px solid #ccc;
  display: none;
}

#psdopedfinder-results .psdopedfinder-right-column {
  display: flex;
  flex-direction: column;
  width: 75%; /* Right column width */
  box-sizing: border-box;
  background-color: #f9f9f9;
}

#psdopedfinder-results .psdopedfinder-header {
  display: flex;
  justify-content: space-between; /* Ensures elements are aligned horizontally */
  align-items: center; /* Vertically centers the elements */
  font-size: 14px;
  text-align: center;
  font-weight: normal;
  color: #333;
  background-color: #e9e9e9;
  border-bottom: 1px solid #ccc;
  border-left: 1px solid #ccc;
  padding: 5px;
  margin: 0; /* Reset margin */
}

#psdopedfinder-results .results-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: calc(80vh - 40px); /* Adjusted height */
}

#psdopedfinder-results .search-result-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
#psdopedfinder-results .search-result-item {
  display: flex; /* Utilizza Flexbox */
  flex-direction: column; /* Disposizione verticale */
  justify-content: flex-start; /* Allinea il contenuto all'inizio */
  align-items: stretch; /* Allinea gli elementi alla larghezza del contenitore */
  text-align: center;
  background-color: #fff;
  min-height: 250px;
  max-width: 250px; /* Prevent single item from expanding too wide */
  color: inherit;
  padding: 0.8em;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%; /* Forza altezza uniforme */
  box-sizing: border-box;
  position: relative; /* Necessario per posizionamento assoluto del prezzo */
}

#psdopedfinder-results .search-result-image {
  height: 120px; /* Altezza fissa per l'immagine */
  width: 100%;
  object-fit: cover; /* Assicura che l'immagine si adatti senza distorsioni */
  margin-bottom: 15px;
}

#psdopedfinder-results .out-of-stock-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 50px 50px 0;
  border-color: transparent #dc3545 transparent transparent;
  z-index: 10;
}

#psdopedfinder-results .out-of-stock-badge::after {
  content: "N.D.";
  position: absolute;
  top: 8px;
  right: -42px;
  color: white;
  font-size: 10px;
  font-weight: bold;
  transform: rotate(45deg);
  text-align: center;
  line-height: 1;
}

#psdopedfinder-results .search-result-title {
  font-size: 13px;
  line-height: 19px;
  font-weight: normal;
  display: -webkit-box; /* Utilizza box layout flessibile */
  -webkit-box-orient: vertical; /* Imposta l'orientamento verticale */
  -webkit-line-clamp: 3; /* Numero massimo di righe visibili */
  overflow: hidden; /* Nasconde il testo eccedente */
  text-overflow: ellipsis; /* Mostra tre puntini per indicare il testo tagliato */
  color: #333;
  text-align: center;
  word-wrap: break-word; /* Permette al testo di andare a capo */
  margin-bottom: auto; /* Permette al titolo di crescere senza influenzare il prezzo */
  flex-grow: 1; /* Occupa tutto lo spazio disponibile verticalmente */
}

#psdopedfinder-results .search-result-price {
  font-size: 15px;
  font-weight: bold;
  color: #444;
  text-align: center;
  position: absolute; /* Posizionamento assoluto */
  bottom: 10px; /* Sempre a 10px dal fondo */
  left: 50%; /* Centrato orizzontalmente */
  transform: translateX(-50%); /* Corregge il centraggio */
  width: 100%; /* Assicura larghezza uniforme */
}

#psdopedfinder-results .no-results {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: #888;
  padding: 20px;
}

#psdopedfinder-results .dopedfinder-bold {
  font-weight: bold;
}

/* Separator between primary and related results */
#psdopedfinder-results .results-separator {
  grid-column: 1 / -1;
  height: 1px;
  background-color: #ddd;
  margin: 15px 0;
}

@media screen and (min-width: 1600px) {
  #psdopedfinder-results {
    width: 64vw;
    margin-left: calc((100vw - 76.5vw) / -2);
  }
}

@media screen and (min-width: 1700px) {
  #psdopedfinder-results {
    width: 62vw;
    margin-left: calc((100vw - 82.5vw) / -2);
  }
}

@media screen and (min-width: 1800px) {
  #psdopedfinder-results {
    width: 59vw;
  }
}

@media screen and (min-width: 1920px) {
  #psdopedfinder-results {
    width: 56vw;
  }
}

@media screen and (min-width: 2048px) {
  #psdopedfinder-results {
    width: 54vw;
  }
}

@media screen and (min-width: 2200px) {
  #psdopedfinder-results {
    width: 50vw;
    margin-left: calc((100vw - 82.5vw) / -2);
  }
}

@media screen and (min-width: 2400px) {
  #psdopedfinder-results {
    width: 45vw;
    margin-left: calc((100vw - 85.5vw) / -2);
  }
}

@media screen and (min-width: 2600px) {
  #psdopedfinder-results {
    width: 42vw;
    margin-left: calc((100vw - 85.5vw) / -2);
  }
}

@media screen and (min-width: 3840px) {
  #psdopedfinder-results {
    width: 28vw;
    margin-left: calc((100vw - 91.5vw) / -2);
  }
}

@media screen and (min-width: 4096px) {
  #psdopedfinder-results {
    width: 26vw;
  }
}
