@media (max-width: 768px) {
  /* Regole dal file desktop con ID modificati */
  #psdopedfinder-results-mobile {
    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-mobile .psdopedfinder-right-column {
    display: flex;
    flex-direction: column;
    width: 75%; /* Right column width */
    box-sizing: border-box;
    background-color: #f9f9f9;
  }

  #psdopedfinder-results-mobile .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-mobile .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-mobile .search-result-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  #psdopedfinder-results-mobile .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-mobile .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-mobile .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-mobile .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-mobile .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-mobile .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-mobile .no-results {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #888;
    padding: 20px;
  }

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

  /* Media Queries aggiuntive dal desktop CSS con ID modificati */
  @media screen and (min-width: 1600px) {
    #psdopedfinder-results-mobile {
      width: 64vw;
      margin-left: calc((100vw - 76.5vw) / -2);
    }
  }

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

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

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

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

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

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

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

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

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

  /* Regole dal file mobile con ID modificati */
  #psdopedfinder-results-mobile {
    margin-left: 0;
    position: fixed;
    top: 130px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 130px);
    z-index: 999;
    overflow-y: auto;
    background: #fff;
    border: 0px;
    box-sizing: border-box;
    padding: 0px;
  }

  #psdopedfinder-results-mobile .results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
    border-left: 0px;
  }

  #psdopedfinder-results-mobile .psdopedfinder-header {
    font-size: 14px;
    padding: 10px;
    text-align: center;
    background-color: #f0f0f0;
    border-bottom: 0px;
    border-left: 0px;
  }

  #psdopedfinder-results-mobile .search-result-item {
    min-height: 220px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  #psdopedfinder-results-mobile .search-result-title {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  #psdopedfinder-results-mobile .search-result-price {
    font-size: 14px;
    bottom: 5px;
  }

  #psdopedfinder-results-mobile .psdopedfinder-right-column {
    width: 100%;
  }

  #psdopedfinder-results-mobile .psdopedfinder-results-header {
    text-align: left; /* Align text to the left */
    flex: 1; /* Allow the element to take available space */
  }

  #psdopedfinder-results-mobile .psdopedfinder-filter-header {
    display: block; /* Ensure the filter header is visible */
    text-align: right; /* Align text to the right */
  }

  #psdopedfinder-results-mobile .psdopedfinder-header {
    flex-direction: row; /* Ensure elements stay on the same line */
  }

  /* Separator between primary and related results - visible line on mobile */
  #psdopedfinder-results-mobile .results-separator {
    grid-column: 1 / -1;
    height: 2px;
    background-color: #ddd;
    margin: 10px 0;
    min-height: 2px;
  }
}
