/* =========================================
   modal.css — Modal visor de PDFs
   ========================================= */

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pdf-modal--show {
  opacity: 1;
  pointer-events: all;
}

/* Fondo oscuro */
.pdf-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Contenedor de la ventana */
.pdf-modal__content {
  position: relative;
  z-index: 1;
  width: min(95vw, 900px);
  height: min(90vh, 85vh);
  background: #1e293b;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pdf-modal--show .pdf-modal__content {
  transform: scale(1) translateY(0);
}

/* Barra superior */
.pdf-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  gap: 12px;
}

.pdf-modal__title {
  color: #f8fafc;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-modal__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Botón abrir en nueva pestaña */
.pdf-modal__open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary, #2091f9);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.pdf-modal__open-btn:hover {
  background: #1876d2;
  transform: translateY(-1px);
  color: #fff;
}

/* Botón cerrar */
.pdf-modal__close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #f8fafc;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.pdf-modal__close:hover {
  background: rgba(255, 61, 129, 0.25);
  transform: rotate(90deg);
  color: #ff3d81;
}

/* Iframe / zona de carga */
.pdf-modal__body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.pdf-modal__frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* Spinner de carga */
.pdf-modal__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #1e293b;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  transition: opacity 0.4s ease;
}

.pdf-modal__loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.pdf-modal__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary, #2091f9);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile — ajuste de tamaño */
@media (max-width: 640px) {
  .pdf-modal__content {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .pdf-modal__header {
    padding: 12px 16px;
  }
}
