/* Slideshow Narrativo - Stili ottimizzati per visualizzazione fullscreen */

/* Override della limitazione di larghezza del main per slideshow */
main:has(.slideshow-container) {
  max-width: 100% !important;
  width: 100%;
  padding: 0 !important;
}

/* Reset per garantire che il body possa scrollare e occupare tutta la larghezza */
body:has(.slideshow-container) {
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 0 !important;
  margin: 0 !important;
}

/* Nasconde il site-header nelle pagine slideshow */
body:has(.slideshow-container) .site-header {
  display: none;
}

.slideshow-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.slideshow-header {
  text-align: center;
  margin: 0.3rem 0.5rem 0.3rem 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #ddd;
}

.slideshow-header h1 {
  font-size: 1.3rem;
  color: #2c3e50;
  margin-bottom: 0.2rem;
  margin-top: 0.2rem;
}

.slideshow-subtitle {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  margin: 0;
}

.slideshow-player {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  margin: 0;
  width: 100%;
}

.slideshow-image-container {
  position: relative;
  width: 100%;
  background: #000;
  min-height: 350px;
  max-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#slide-image {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  display: block;
}

.slideshow-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
}

#slide-progress-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0078d7, #00bcf2);
  transition: width 0s linear;
}

.slideshow-caption-container {
  padding: 0.5rem 0.75rem;
  min-height: 50px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

#slide-caption {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #333;
  margin: 0;
  text-align: justify;
}

.slideshow-controls {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.5rem;
  background: #fff;
}

.slideshow-controls button {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.slideshow-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.slideshow-controls button:active {
  transform: translateY(0);
}

.slideshow-controls button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

#play-pause-slide {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

#play-pause-slide:hover {
  background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.slideshow-counter {
  text-align: center;
  padding: 0.4rem;
  font-size: 0.8rem;
  color: #666;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  font-weight: 600;
}

/* Responsive Mobile */
@media (max-width: 768px) {
  .slideshow-container {
    padding: 0;
  }

  .slideshow-header {
    margin: 0.25rem 0.25rem 0.25rem 0.25rem;
  }

  .slideshow-header h1 {
    font-size: 1.3rem;
  }

  .slideshow-subtitle {
    font-size: 0.85rem;
  }

  .slideshow-image-container {
    min-height: 250px;
    max-height: 45vh;
  }

  #slide-image {
    max-height: 45vh;
  }

  .slideshow-caption-container {
    padding: 0.5rem 0.75rem;
    min-height: 50px;
  }

  #slide-caption {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .slideshow-controls {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .slideshow-controls button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  /* Nascondi testo dei pulsanti su mobile, lascia solo icone */
  #prev-slide span:not([aria-hidden]),
  #next-slide span:not([aria-hidden]) {
    display: none;
  }

  #play-pause-text {
    display: none;
  }

  .slideshow-counter {
    font-size: 0.8rem;
    padding: 0.4rem;
  }
}

/* Animazione fade per cambio slide */
@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#slide-image {
  animation: slideFadeIn 0.4s ease-in-out;
}
