#popup-libro {
  position: fixed;
  z-index: 9999;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#popup-libro .popup-content {
  background: white;
  border-radius: 0.7rem;
  padding: 1rem;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  position: relative;
  box-sizing: border-box;
}

/* ✅ Colonna sinistra (testo) */
.popup-text {
  flex: 1 1 60%;
  font-size: 1.2rem;
}

.popup-text h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #04211A;
}

.popup-button {
  display: inline-block;
  margin-top: 0.2rem;
  background: #c2380c;
  color: #ffffff !important;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.3s ease;
}

.popup-button:hover {
  background: #084537;
  color: #ffffff !important;
}

/* ✅ Colonna destra (immagine a filo) */
.popup-img {
  flex: 0 0 auto;
  max-width: 220px;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-top: auto;
  margin-bottom: auto;
}

.popup-img img {
  width: 100%;
  height: auto;
  display: block;
}

.popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1rem;           /* ✅ più piccola */
  cursor: pointer;
  line-height: 1;
  z-index: 2;
  width: 1rem;             /* ✅ bottone più contenuto */
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.popup-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
}


/* ✅ Responsive mobile e tablet */
@media (max-width: 768px) {
  #popup-libro {
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  #popup-libro .popup-content {
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem 1rem;
    gap: 1rem;
    max-width: 92%;
  }

.popup-close {
  position: absolute;
  top: 0.1rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1rem;       
  cursor: pointer;
  line-height: 1;
  z-index: 2;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

  .popup-img {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    border-radius: 0.5rem; 
    overflow: hidden;
  }

  .popup-img img {
    height: auto;
    display: block;
    margin: 0 auto;
  }

  .popup-text {
    font-size: 1rem;
    text-align: center;
  }

  .popup-text h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    margin-top: 0;
  }

  .popup-button {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
  }
}

