/**
 * Estilos para el visor de PDF
 * 
 * @package Astra Child
 * @since 1.0.0
 */

/* Contenedor principal del visor de PDF */
.pdf-viewer-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 20px 0;
  background: #f9f9f9;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Barra de herramientas */
.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #333;
  color: white;
  padding: 10px 15px;
  border-bottom: 1px solid #555;
}

.pdf-controls-left,
.pdf-controls-center,
.pdf-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdf-controls-center {
  flex: 1;
  justify-content: center;
}

/* Botones de la barra de herramientas */
.pdf-btn {
  background: #555;
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
}

.pdf-btn:hover {
  background: #777;
  color: white;
  text-decoration: none;
}

.pdf-btn:disabled {
  background: #333;
  cursor: not-allowed;
  opacity: 0.5;
}

.pdf-btn i {
  font-size: 14px;
}

/* Información de página */
.pdf-page-info {
  color: #ccc;
  font-size: 14px;
  margin: 0 10px;
}

.pdf-zoom-level {
  color: #ccc;
  font-size: 14px;
  margin: 0 10px;
  min-width: 40px;
  text-align: center;
}

/* Wrapper del visor */
.pdf-viewer-wrapper {
  position: relative;
  width: 100%;
  height: calc(100% - 50px);
  overflow: auto;
  background: #e0e0e0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

/* Canvas del PDF */
.pdf-canvas {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: block;
}

/* Loading spinner */
.pdf-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #666;
}

.pdf-loading i {
  font-size: 24px;
  margin-bottom: 10px;
  display: block;
}

.pdf-loading.hidden {
  display: none;
}

/* Contenedor automático de PDF */
.auto-pdf-container {
  margin: 20px 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.pdf-link-info {
  background: #f8f9fa;
  padding: 15px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdf-link-info i.fa-file-pdf {
  color: #dc3545;
  font-size: 20px;
}

.pdf-link-info span {
  flex: 1;
  font-weight: 500;
}

.pdf-download-link {
  background: #007cba;
  color: white !important;
  padding: 8px 15px;
  border-radius: 4px;
  text-decoration: none !important;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.pdf-download-link:hover {
  background: #005a87;
  color: white !important;
}

.pdf-download-link i {
  margin-right: 5px;
}

/* PDFs adjuntos */
.post-pdf-attachments {
  margin-top: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.post-pdf-attachments h3 {
  margin-top: 0;
  color: #333;
  border-bottom: 2px solid #007cba;
  padding-bottom: 10px;
}

.pdf-attachment-item {
  margin-bottom: 30px;
}

.pdf-attachment-item:last-child {
  margin-bottom: 0;
}

.pdf-attachment-item h4 {
  margin-bottom: 15px;
  color: #555;
}

/* Pantalla completa */
.pdf-viewer-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  border-radius: 0;
  margin: 0;
}

.pdf-viewer-container.fullscreen .pdf-viewer-wrapper {
  height: calc(100vh - 50px);
}

.pdf-viewer-container.fullscreen .pdf-btn.pdf-fullscreen i:before {
  content: "\f066";
  /* fa-compress */
}

/* Responsive */
@media (max-width: 768px) {
  .pdf-toolbar {
    flex-direction: column;
    gap: 10px;
    padding: 15px 10px;
  }

  .pdf-controls-left,
  .pdf-controls-center,
  .pdf-controls-right {
    width: 100%;
    justify-content: center;
  }

  .pdf-controls-center {
    order: -1;
  }

  .pdf-btn {
    padding: 10px 15px;
    font-size: 16px;
  }

  .pdf-viewer-wrapper {
    padding: 10px;
  }

  .pdf-link-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .pdf-link-info span {
    order: -1;
  }
}

@media (max-width: 480px) {
  .pdf-viewer-container {
    margin: 10px -15px;
    border-radius: 0;
  }

  .pdf-toolbar {
    padding: 10px;
  }

  .pdf-controls-left,
  .pdf-controls-center,
  .pdf-controls-right {
    gap: 5px;
  }

  .pdf-btn {
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* Error messages */
.pdf-error {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  margin: 20px 0;
}

/* Metabox en el admin */
#pdf-viewer-metabox .form-table th {
  width: 150px;
}

#pdf-viewer-metabox .form-table input[type="url"] {
  width: 70%;
}

#upload_pdf_button {
  margin-left: 10px;
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.pdf-canvas {
  animation: fadeIn 0.3s ease-in-out;
}

/* Scroll personalizado para el visor */
.pdf-viewer-wrapper::-webkit-scrollbar {
  width: 12px;
}

.pdf-viewer-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.pdf-viewer-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}

.pdf-viewer-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}