@import url('../pdf-tools-design.css');

/* ===== Page Remover/Reorder — tool specific overrides ===== */

.rotate-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  margin-bottom: 10px;
}

.rotate-toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rotate-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rotate-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-dark);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.rotate-all-btn:hover {
  border-color: var(--primary);
  background: rgba(204,0,0,0.06);
}

.thumb-hint {
  font-size: 0.74rem;
  color: var(--dim);
  margin: 0 2px 12px;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 16px;
  margin-bottom: 14px;
  max-height: 560px;
  overflow-y: auto;
}

.page-thumb-card {
  position: relative;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s, transform 0.15s, border-color 0.2s;
}

.page-thumb-card.is-dragging {
  opacity: 0.45;
  border-color: var(--primary);
  transform: scale(0.97);
  z-index: 5;
}

.page-thumb-card.is-removed {
  opacity: 0.45;
  filter: grayscale(1);
}

/* Blank inserted pages — dashed border, subtle tint */
.page-thumb-card.is-blank {
  border-style: dashed;
  border-color: rgba(204,0,0,0.35);
  background: rgba(204,0,0,0.03);
}

/* Pages imported from another PDF — accent border */
.page-thumb-card.is-imported {
  border-color: rgba(99,102,241,0.45);
  background: rgba(99,102,241,0.04);
}

/* Drag handle — the only draggable trigger point on the card */
.thumb-drag-handle {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--dim);
  cursor: grab;
  touch-action: none;
  user-select: none;
  z-index: 2;
}

.thumb-drag-handle:active {
  cursor: grabbing;
  color: var(--primary);
  border-color: var(--primary);
}

/* Position badge — shows final page order number */
.thumb-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.thumb-badge.is-removed {
  background: #9ca3af;
  font-size: 0.58rem;
  padding: 0 7px;
}

.page-thumb-canvas-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  margin-top: 22px;
}

.page-thumb-canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
}

.page-thumb-num {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--dim);
}

.thumb-remove-btn {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #dc2626;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.thumb-remove-btn:hover {
  border-color: #dc2626;
  background: rgba(220,38,38,0.08);
}

.thumb-remove-btn.is-restore {
  color: #059669;
}

.thumb-remove-btn.is-restore:hover {
  border-color: #059669;
  background: rgba(5,150,105,0.08);
}

.thumb-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  font-size: 0.85rem;
  color: var(--dim);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}