/* ═══════════════════════════════════════════
   STRIP PANEL
═══════════════════════════════════════════ */

.strip-panel {
  width: var(--strip-w);
  min-width: var(--strip-min-w);
  max-width: var(--strip-max-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.strip-panel__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.strip-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════
   THUMBNAIL SIZE TOGGLE
═══════════════════════════════════════════ */

.thumb-size-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.size-btn {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast);
}

.size-btn:hover {
  color: var(--text-secondary);
}

.size-btn.active {
  background: var(--bg-raised);
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   THUMBNAIL STRIP
═══════════════════════════════════════════ */

.thumbnail-strip {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;

  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--bg-active) transparent;
}

.thumbnail-strip::-webkit-scrollbar {
  width: 4px;
}

.thumbnail-strip::-webkit-scrollbar-track {
  background: transparent;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════
   THUMBNAIL ITEM
═══════════════════════════════════════════ */

.thumb-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  transition: transform var(--t-fast) var(--ease);
  flex-shrink: 0;
}

.thumb-item:hover .thumb-canvas-wrap {
  border-color: var(--bg-active);
}

.thumb-item.active .thumb-canvas-wrap {
  border-color: var(--bg-active);
  box-shadow: 0 0 0 2px var(--bg-active), var(--shadow-sm);
}

.thumb-item.selected .thumb-canvas-wrap {
  border-color: var(--selected-ring);
  box-shadow: 0 0 0 2px var(--selected-ring);
  background: var(--accent-glow);
}

.thumb-item.active.selected .thumb-canvas-wrap {
  border-color: var(--selected-ring);
  box-shadow: 0 0 0 2px var(--selected-ring);
  background: var(--accent-glow);
}

.thumb-item.grouped .thumb-canvas-wrap {
  border-color: var(--grouped-ring);
  box-shadow: 0 0 0 1px var(--grouped-ring);
  opacity: 0.5;   /* grouped pages dim — pill is the focus */
}

/* Hovered page for merge context */
.thumb-item.merge-target .thumb-canvas-wrap {
  border-color: var(--accent-dim);
}

/* ═══════════════════════════════════════════
   CANVAS WRAPPER
═══════════════════════════════════════════ */

.thumb-canvas-wrap {
  width: var(--thumb-w);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.thumb-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Loading placeholder — min-height holds space for scroll before canvas arrives */
.thumb-canvas-wrap.loading {
  min-height: calc(var(--thumb-w) * 1.35);
}

.thumb-canvas-wrap.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.06) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

/* Rotation indicator badge */
.thumb-rotation-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  pointer-events: none;
  display: none;
}

.thumb-item[data-rotation]:not([data-rotation="0"]) .thumb-rotation-badge {
  display: block;
}

/* ═══════════════════════════════════════════
   PAGE NUMBER LABEL
═══════════════════════════════════════════ */

.thumb-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  transition: color var(--t-fast);
}

.thumb-item.active .thumb-label {
  color: var(--text-secondary);
}

.thumb-item.active.selected .thumb-label {
  color: var(--accent);
}

.thumb-item.selected .thumb-label {
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   GROUP PILL
═══════════════════════════════════════════ */

.group-pill {
  width: calc(var(--thumb-w) + 16px);
  background: var(--bg-raised);
  border: 1.5px solid var(--grouped-ring);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: grab;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
  box-shadow: 0 0 0 1px var(--grouped-ring), var(--shadow-md);
  animation: scaleIn var(--t-mid) var(--ease) both;
  flex-shrink: 0;
}

.group-pill:hover {
  box-shadow: 0 0 0 1px var(--grouped-ring), 0 0 20px rgba(126, 200, 164, 0.15), var(--shadow-md);
}

.group-pill:active {
  cursor: grabbing;
}

.group-pill__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.group-pill__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--grouped-ring);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.group-pill__dismiss {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
}

.group-pill__dismiss:hover {
  background: var(--bg-hover);
  color: var(--danger);
}

.group-pill__pages {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
  word-break: break-all;
}

.group-pill__drag-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-align: center;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

/* SortableJS drag ghost */
.sortable-ghost {
  opacity: 0.3;
}

.sortable-drag {
  opacity: 1 !important;
}

/* Insertion indicator */
.sortable-chosen {
  outline: none;
}

/* ═══════════════════════════════════════════
   KEYFRAMES
═══════════════════════════════════════════ */

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
