/* ==========================================================================
   PDF SLIDESHOW SPECIFIC STYLES FOR RA3
   ========================================================================== */

/* Ensure footer stays below slideshow */
.footer {
  position: relative;
  z-index: 0;
}

.slideshow-container {
  width: 100%;
  height: 95vh;
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.slideshow-fallback {
  position: relative;
  width: 100%;
  height: 100%;
}

.slide-display {
  width: 100%;
  height: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-wrapper {
  position: relative;
  display: inline-block;
}

#current-slide-img {
  max-width: 100%;
  max-height: 85vh;
  min-height: 600px;
  object-fit: contain;
  display: none;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
}

#pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  display: block;
  object-fit: contain;
  aspect-ratio: 16/9;
  pointer-events: none;
  transform-origin: top left;
}

.pdf-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 80vh;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  display: none;
  object-fit: contain;
}

/* Target PDF viewer internal elements to force horizontal layout */
#pdf-iframe #viewerContainer {
  writing-mode: horizontal-tb !important;
  direction: ltr !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

/* Global CSS to target viewerContainer in any PDF iframe */
iframe #viewerContainer,
iframe [id="viewerContainer"] {
  writing-mode: horizontal-tb !important;
  direction: ltr !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Force all PDF pages to display horizontally */
iframe .page,
iframe [class*="page"] {
  display: inline-block !important;
  width: auto !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  aspect-ratio: 16/9 !important;
}

#loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  border-radius: 10px;
  display: none;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.slide-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(0, 0, 0, 0.8);
  padding: 12px 20px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  z-index: 100;
}

.slide-controls button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.slide-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#slide-info {
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  min-width: 120px;
  text-align: center;
}

.ra-content {
  max-width: 1900px;
  margin: 0 auto;
  padding: 0.5rem;
}

.ra-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 1rem;
}

.ra-subtitle {
  font-size: 1.2rem;
  color: #666;
  text-align: center;
  margin-bottom: 2rem;
}

/* Responsive improvements */
@media (max-width: 1023px) {
  .slideshow-container {
    height: auto;
    min-height: 60vh;
    margin: 0.5rem 0;
  }

  .slide-display {
    height: auto;
    min-height: 60vh;
  }

  .slide-controls {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 15px;
    gap: 10px;
  }

  .slide-controls button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  #slide-info {
    font-size: 12px;
    min-width: 100px;
  }

  .ra-content {
    padding: 0.25rem;
  }

  .ra-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
  }

  .ra-subtitle {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  #current-slide-img {
    max-height: 65vh;
    min-height: auto;
    width: 100%;
    height: auto;
  }

  .pdf-container {
    height: 60vh;
    min-height: 60vh;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #pdf-canvas {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
  }

  #pdf-iframe {
    height: 100%;
    min-height: 60vh;
    width: 100%;
    object-fit: contain;
  }
}

@media (max-width: 530px) {
  .slideshow-container {
    height: auto;
    min-height: 50vh;
    margin: 0.25rem 0;
  }

  .slide-display {
    min-height: 50vh;
  }

  .slide-controls {
    padding: 6px 12px;
    gap: 8px;
  }

  .slide-controls button {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  #slide-info {
    font-size: 11px;
    min-width: 80px;
  }

  .ra-title {
    font-size: 1.5rem;
  }

  .ra-subtitle {
    font-size: 0.9rem;
  }

  #current-slide-img {
    max-height: 55vh;
    min-height: auto;
    width: 100%;
    height: auto;
  }

  .pdf-container {
    height: 50vh;
    min-height: 50vh;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #pdf-canvas {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
  }

  #pdf-iframe {
    height: 100%;
    min-height: 50vh;
    width: 100%;
    object-fit: contain;
  }
}
