 body {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 0;
      overflow: hidden;
      background: #f0f0f0;
    }

    /* Contenedor principal con padding simétrico arriba y abajo */
    #viewerContainer {
      display: flex;
      justify-content: center;
      align-items:flex-start;
      gap: 20px;
      height: calc(100vh - 80px); /* 40px para barra inferior + 40px para la superior */
      padding: 15px 10px 15px;
      box-sizing: border-box;
      cursor: grab;
      overflow: auto;
    }



    #viewerContainer.dragging {
      cursor: grabbing;
      scroll-behavior: auto; /* desactiva scroll suave mientras se arrastra */
    }


    canvas {
      border: 1px solid #ccc;
      box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
      background: white;
      transition: opacity 0.5s ease;
      width: auto;
      height: auto;
      cursor: default;
    }


    .fade-out {
      transform: translateX(-30px);
      opacity: 0;
    }

    .fade-in {
      transform: translateX(0);
      opacity: 1;
    }

    @media (max-width: 768px) {
      #viewerContainer {
        flex-direction: column;
        overflow-x: hidden; /* Evita scroll lateral en móviles */
        height: calc(100vh - 100px);
        padding: 10px 5px 20px;
      }

      canvas {
        width: 100% !important;
        height: auto !important;
      }
    }

    /* Barra flotante superior */
    #topFloatingBar {
      position: fixed;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(0, 0, 0, 0.7);
      color: white;
      border-radius: 0 0 8px 8px;
      padding: 8px 15px;
      z-index: 1002;
      font-size: 14px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
      display: flex;
      align-items: center;
      gap: 10px;
    }

    /* Barra flotante inferior */
    #floatingNav {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(0, 0, 0, 0.7);
      color: white;
      border-radius: 8px 8px 0 0;
      padding: 8px 15px;
      z-index: 1000;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    /* Botones toggles */
    #navToggle,
    #topBarToggle {
      background-color: #333;
      color: white;
      border: none;
      padding: 8px 15px;
      font-size: 18px;
      cursor: pointer;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 36px;
      line-height: 36px;
      user-select: none;
      transition: opacity 0.3s ease;
      z-index: 1003;
      position: fixed;
      left: 50%;
      transform: translateX(-50%);
    }

    #navToggle {
      border-radius: 8px 8px 0 0;
      bottom: 0;
      top: auto;
    }

    #topBarToggle {
      border-radius: 0 0 8px 8px;
      top: 0;
      bottom: auto;
    }

    #navPanel {
      display: none;
      align-items: center;
      gap: 5px;
      padding: 5px;
    }

    #floatingNav:hover #navPanel {
      display: flex;
    }

    #floatingNav:hover #navToggle {
      display: none;
    }

    #topBarPanel {
      display: none;
      align-items: center;
      gap: 15px;
      padding: 5px;
      margin-left: 10px;
    }

    #topFloatingBar:hover #topBarPanel {
      display: flex;
    }

    #topFloatingBar:hover #topBarToggle {
      opacity: 0;
      pointer-events: none;
    }

    /* Botones dentro de barras */
    #topFloatingBar button,
    #navPanel button {
      background: none;
      border: none;
      color: white;
      font-size: 1em;
      cursor: pointer;
      padding: 5px 10px;
      border-radius: 5px;
      transition: background 0.3s ease;
      display: flex;
      align-items: center;
      gap: 5px;
      height: 30px;
      line-height: 30px;
    }

    #topFloatingBar button:hover,
    #navPanel button:hover {
      background: rgba(255, 255, 255, 0.2);
    }

    #pageInput {
      width: 50px;
      padding: 2px;
      border-radius: 4px;
      border: none;
      font-size: 14px;
      text-align: center;
    }

    /* Botones laterales de navegación */
    #leftArrow,
    #rightArrow {
      position: fixed;
      top: 50%;
      transform: translateY(-50%);
      width: 60px;
      height: 60px;
      background: rgba(0, 0, 0, 0.5);
      color: white;
      font-size: 30px;
      text-align: center;
      line-height: 60px;
      border-radius: 50%;
      cursor: pointer;
      z-index: 1001;
      transition: background 0.3s ease;
      user-select: none;
    }

    #leftArrow:hover,
    #rightArrow:hover {
      background: rgba(0, 0, 0, 0.7);
    }

    #leftArrow {
      left: 15px;
    }

    #rightArrow {
      right: 15px;
    }

    /* Botones laterales simplificados en móvil */
@media (max-width: 768px) {
  #leftArrow,
  #rightArrow {
    background: rgba(50, 50, 50, 0.8); /* gris oscuro neutro */
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 6px;
    box-shadow: none;
  }

  #leftArrow:hover,
  #rightArrow:hover {
    background: rgba(0, 0, 0, 0.8);
  }
}


@media (max-width: 768px) {
  #zoomControls {
    display: none !important;
  }
}

@media only screen and (max-width: 768px) {
  .btn-print {
    display: none !important;
  }
}

    

    #zoomControls {
      position: fixed;
      bottom: 10px;
      right: 10px;
      background: rgba(0, 0, 0, 0.7);
      padding: 8px;
      border-radius: 8px;
      z-index: 1002;
      display: flex;
      gap: 5px;
    }

    #zoomControls button {
      background: none;
      border: none;
      color: white;
      font-size: 18px;
      cursor: pointer;
      padding: 5px 10px;
      border-radius: 5px;
    }
