/* ========================================
   FILE: modal.css
   DESCRIZIONE: Gestisce lo stile del visualizzatore di immagini (modale).
   Include lo sfondo sfocato, i pulsanti di controllo (frecce e chiusura)
   e la gestione delle proporzioni dell'immagine su desktop e mobile.
   ======================================== */

/* ========================================
   MODAL OVERLAY (LO SFONDO)
   ======================================== */
.image-modal-overlay {
  display: none; /* Attivato dinamicamente via JS (display: flex) */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7); 
  backdrop-filter: blur(16px); 
  -webkit-backdrop-filter: blur(16px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

/* Tasto di chiusura (X) in alto a destra */
.modal-close-top {
  position: absolute;
  color: #666;
  top: 2rem;
  right: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10000;
  padding: 8px;
  transition: color 0.2s ease;
}

.modal-close-top:hover {
    color: #111;
}

/* ========================================
   MODAL CONTENT WRAPPER & CONTAINER
   ======================================== */
/* Contenitore generale (Prende l'80% dello schermo su desktop) */
.modal-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 80vw;  
  height: 80vh; 
  max-width: 1400px; 
  justify-content: center;
}

/* Card Immagine (Riquadro bianco contenitore) */
.modal-viewer-container {
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  width: 90%;
  flex: 1; 
  display: flex;
  overflow: hidden;
}

/* Wrapper interno dell'immagine */
.modal-image-wrapper {
  width: 100%;
  height: 100%;
  background-color: #fcfcfc;
  display: flex;
  justify-content: center;
  align-items: center;
}

#modal-current-image {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Mantiene le proporzioni originali senza tagliare l'immagine */
  display: block;
}

/* ========================================
   CONTROLLI IN BASSO (FRECCE)
   ======================================== */
.modal-controls-bottom {
  display: flex;
  gap: 16px;
}

/* I tondini delle frecce */
.arrow-btn {
  background-color: #ffffff;
  border: 1px solid #e5e5e5;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  color: #000;
  transition: all 0.2s ease;
}

.arrow-btn:hover {
  border-color: #d1d1d1;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.arrow-btn:active {
  transform: translateY(0);
}

/* ========================================
   RESPONSIVE (MOBILE)
   ======================================== */
@media (max-width: 768px) {
    .modal-content-wrapper {
        width: 95vw; /* Prende quasi tutto lo spazio orizzontale */
        height: auto; /* Si adatta al contenuto per evitare rettangoli bianchi vuoti */
        max-height: 90vh;
        gap: 16px; 
    }

    .modal-viewer-container {
        height: auto; 
        max-height: 70vh; 
    }

    .modal-image-wrapper {
        height: auto;
    }

    #modal-current-image {
        height: auto; 
        max-height: 70vh; 
    }

    .modal-close-top {
        top: 1rem;   
        right: 1rem; /* Sposta la X in un angolo più stretto per non sovrapporsi alle foto */
    }

    .arrow-btn {
        width: 44px;  /* Bottoni leggermente più compatti su mobile */
        height: 44px;
    }
}