#page-preview-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  min-height: 200px;
}

.page-thumbnail {
  position: relative;
  width: 140px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-thumbnail:hover {
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.page-thumbnail.selected {
  border-color: #28a745;
  background: #e8f5e9;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
}

.page-thumbnail canvas {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 8px;
  border-radius: 4px;
}

.page-label {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
}

.rotate-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: #28a745;
  color: white;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 28px;
  text-align: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease;
}

.page-thumbnail.selected .rotate-indicator {
  opacity: 1;
  transform: scale(1);
}

#controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

#controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #333;
}

#controls select {
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

#controls select:hover {
  border-color: #007bff;
}

#download-section {
  margin-top: 24px;
  text-align: center;
}

#action-buttons {
  margin-top: 24px;
  text-align: center;
}

#download-button {
  background-color: #28a745;
}

#download-button:hover {
  background-color: #218838;
}

/* Responsive */
@media (max-width: 600px) {
  .page-thumbnail {
    width: 120px;
    padding: 6px;
  }
  
  #controls {
    gap: 8px;
  }
  
  #controls .control {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
}