/**
 * PicDriver Perspective Correction Tool - Tool Specific Styling
 */

.perspective-stage {
  position: relative;
  min-height: 440px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  user-select: none;
}

#perspective-canvas-box {
  position: relative;
  display: inline-block;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}

#perspective-canvas {
  display: block;
  max-width: 100%;
  max-height: 500px;
  border-radius: 4px;
}

/* SVG Quad Polygon & Guidelines */
.perspective-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* 4 Draggable Corner Handles */
.corner-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  background: #a855f7;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  cursor: grab;
  z-index: 20;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.corner-pin:hover {
  transform: scale(1.25);
  background: #c084fc;
}

.corner-pin:active, .corner-pin.dragging {
  cursor: grabbing;
  transform: scale(1.35);
  background: #ec4899;
}

.corner-pin-label {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
}

/* Perspective Grid Guides */
.perspective-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: grid;
  z-index: 8;
}

.perspective-grid-overlay.density-thirds {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.perspective-grid-overlay.density-fine {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
}

.perspective-grid-cell {
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.keystone-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
