/* Mobile PDF Viewer - Magazine Style */

.mobile-pdf-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.mobile-pdf-viewer.active {
  display: flex;
}

/* Header del visor */
.pdf-viewer-header {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-viewer-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  text-align: center;
  padding: 0 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-viewer-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.pdf-viewer-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Contenedor principal del PDF */
.pdf-viewer-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas del PDF */
.pdf-canvas-container {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-x pan-y pinch-zoom;
  cursor: grab;
}

.pdf-canvas-container.dragging {
  cursor: grabbing;
}

.pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  touch-action: none;
}

/* Controles de navegación */
.pdf-navigation {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.pdf-navigation.visible {
  transform: translateY(0);
}

.pdf-nav-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
  touch-action: manipulation;
}

.pdf-nav-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.pdf-nav-button:active {
  transform: scale(0.95);
}

.pdf-nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pdf-page-info {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Controles de zoom flotantes */
.pdf-zoom-controls {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pdf-zoom-controls.visible {
  opacity: 1;
}

.pdf-zoom-button {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
  backdrop-filter: blur(10px);
}

.pdf-zoom-button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

.pdf-zoom-button:active {
  transform: scale(0.95);
}

/* Indicador de carga */
.pdf-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-align: center;
  z-index: 10;
}

.pdf-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Gestos táctiles */
.pdf-gesture-hint {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 10;
}

.pdf-gesture-hint.visible {
  opacity: 1;
}

/* Swipe indicators */
.pdf-swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 2rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.pdf-swipe-indicator.left {
  left: 1rem;
}

.pdf-swipe-indicator.right {
  right: 1rem;
}

.pdf-swipe-indicator.visible {
  opacity: 1;
  animation: swipe-pulse 1s ease-in-out infinite;
}

@keyframes swipe-pulse {
  0%, 100% { opacity: 0.6; transform: translateY(-50%) scale(1); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.1); }
}

/* Modo pantalla completa */
.pdf-viewer-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
}

.pdf-viewer-fullscreen .pdf-viewer-header {
  background: rgba(0, 0, 0, 0.5);
}

.pdf-viewer-fullscreen .pdf-navigation {
  background: rgba(0, 0, 0, 0.5);
}

/* Animaciones de transición de página */
.pdf-page-transition {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-page-transition.slide-left {
  transform: translateX(-100%);
}

.pdf-page-transition.slide-right {
  transform: translateX(100%);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .pdf-viewer-header {
    padding: 0.5rem;
  }
  
  .pdf-viewer-title {
    font-size: 0.9rem;
  }
  
  .pdf-navigation {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .pdf-nav-button {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }
  
  .pdf-page-info {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    min-width: 100px;
  }
  
  .pdf-zoom-controls {
    right: 0.5rem;
  }
  
  .pdf-zoom-button {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 600px) {
  .pdf-viewer-header {
    min-height: 50px;
    padding: 0.5rem 1rem;
  }
  
  .pdf-navigation {
    padding: 0.75rem 1rem;
  }
  
  .pdf-zoom-controls {
    top: 60%;
  }
}

/* Dark theme adjustments */
[data-theme="dark"] .mobile-pdf-viewer {
  background: #000;
}

[data-theme="dark"] .pdf-viewer-container {
  background: #0a0a0a;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .pdf-nav-button,
  .pdf-zoom-button {
    border: 2px solid white;
  }
  
  .pdf-page-info {
    border: 2px solid white;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pdf-canvas,
  .pdf-navigation,
  .pdf-zoom-controls,
  .pdf-gesture-hint,
  .pdf-swipe-indicator {
    transition: none !important;
    animation: none !important;
  }
  
  .pdf-page-transition {
    transition: none !important;
  }
}

/* Print styles */
@media print {
  .mobile-pdf-viewer {
    display: none !important;
  }
}

/* Accessibility improvements */
.pdf-nav-button:focus,
.pdf-zoom-button:focus,
.pdf-viewer-close:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
  .pdf-nav-button:active,
  .pdf-zoom-button:active,
  .pdf-viewer-close:active {
    background: rgba(255, 255, 255, 0.3);
  }
}

/* Error state */
.pdf-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 10;
}

.pdf-error-icon {
  font-size: 3rem;
  color: #dc3545;
  margin-bottom: 1rem;
}

.pdf-error-message {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.pdf-error-retry {
  background: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.pdf-error-retry:hover {
  background: #0056b3;
}

