h1 {
  padding:1rem 0;
}
.thumbnails-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumbnail-min-width, 120px), 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.5rem;
}

.thumbnails-container.size-large {
  --thumbnail-min-width: 240px;
}

.thumbnail-item {
  position: relative;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  padding: 0.5rem;
  background-color: white;
  box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: grab;
}

.thumbnail-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.thumbnail-item.dragging-multi {
  opacity: 0.5;
  cursor: grabbing;
  border: 2px solid #3273dc;
}

.thumbnail-item.selected {
  border: 2px solid #3273dc;
  background-color: #e8f4f8;
  box-shadow: 0 0 0 2px rgba(50, 115, 220, 0.2);
}

.thumbnail-item.selected.dragging {
  opacity: 0.7;
}

.thumbnail-item.drag-over {
  border: 2px dashed #3273dc;
  background-color: #e8f4f8;
}

.thumbnail-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(10, 10, 10, 0.2);
}

.thumbnail-item canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #f5f5f5;
  border-radius: 2px;
}

.thumbnail-item p {
  margin-top: 0.5rem;
  font-weight: 600;
  color: #363636;
}

.thumbnail-item .file-name-label {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #4a4a4a;
  word-break: break-word;
  text-align: left;
}

.thumbnail-item .page-number-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7a7a7a;
  margin: 0;
  text-align: right;
}

.file-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.upload-area {
  border: 2px dashed #dbdbdb;
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
  background-color: #fafafa;
  transition: all 0.3s ease;
  min-width: 300px;
}

.upload-area:hover {
  border-color: #3273dc;
  background-color: #f5f8fa;
}

.upload-area.drag-over {
  background-color: #e8f4f8;
  border-color: #3273dc;
  border-width: 2px;
}

.upload-label {
  margin-bottom: 1rem;
  font-weight: 500;
  color: #4a4a4a;
}

#pdfInput {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

#downloadBtn {
  height: 100%;
  min-height: 2.5rem;
  padding: 0 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#deleteSelectedBtn {
  height: 100%;
  min-height: 2.5rem;
  padding: 0 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Page menu button (three dots) */
.page-menu-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 24px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  color: rgba(128, 128, 128, 0.8);
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: background-color 0.2s, color 0.2s;
  z-index: 10;
  padding: 0;
}

.page-menu-btn:hover {
  background-color: rgba(255, 255, 255, 1);
  color: rgba(80, 80, 80, 1);
}

.page-menu-btn.menu-open {
  background-color: rgba(255, 255, 255, 1);
  color: rgba(50, 115, 220, 1);
}

/* Dropdown menu */
.page-menu-dropdown {
  position: absolute;
  top: 2rem;
  right: 0.25rem;
  background-color: white;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(10, 10, 10, 0.15);
  z-index: 20;
  min-width: 150px;
  display: none;
}

.page-menu-dropdown.show {
  display: block;
}

.page-menu-item {
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #363636;
  transition: background-color 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.page-menu-item:hover {
  background-color: #f5f5f5;
}

.page-menu-item:first-child {
  border-radius: 4px 4px 0 0;
}

.page-menu-item:last-child {
  border-radius: 0 0 4px 4px;
}

.page-menu-item .icon {
  font-size: 1rem;
}

/* Lightbox styles */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox-content {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  color: #333;
  font-size: 32px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.2s;
  z-index: 1001;
  padding: 0;
}

.lightbox-close:hover {
  background-color: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

#lightboxCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Make page number label clickable */
.thumbnail-item .page-number-label {
  cursor: pointer;
  transition: color 0.2s;
}

.thumbnail-item .page-number-label:hover {
  color: #3273dc;
  text-decoration: underline;
}

/* Page label styles */
.thumbnail-item .page-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #4a4a4a;
  text-align: left;
  word-break: break-word;
}

/* Page size control */
.page-size-control {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
