/**
 * ONE RESIZER — Tool 20: PDF Crop Stylesheet
 * Interactive Visual Cropping Studio with 8-Handle Resizing,
 * Aspect Ratio Presets, Live Numeric Dimensions, and Responsive 2-Column Layout.
 */

/* ========================================================
   CONTAINER & WORKSPACE VIEWS
   ======================================================== */
.pdfcr-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.pdfcr-view {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.pdfcr-view.hidden {
  display: none !important;
}

/* ========================================================
   UPLOAD HERO SCREEN
   ======================================================== */
.upload-hero-card {
  background: var(--bg-card);
  border: 2px dashed var(--primary-cyan);
  border-radius: var(--radius-xl);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.upload-hero-card:hover, .upload-hero-card.dragover {
  background: rgba(22, 135, 245, 0.08);
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.upload-icon-wrapper {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: rgba(22, 135, 245, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-cyan);
}
.upload-icon-wrapper svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
}

.upload-heading {
  font-size: 20px;
  font-weight: 850;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.upload-subheading {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.upload-btn-fake {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-cyan);
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  padding: 9px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px var(--primary-glow);
  margin-bottom: 14px;
  transition: var(--transition);
}
.upload-btn-fake:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.upload-formats-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

/* ========================================================
   WORKSPACE 2-COLUMN STUDIO LAYOUT
   ======================================================== */
.pdfcr-studio-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 950px) {
  .pdfcr-studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Crop Controls Panel */
.pdfcr-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* Mini File Bar */
.pdfcr-file-mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.pdfcr-mini-info {
  min-width: 0;
}
.pdfcr-mini-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.pdfcr-mini-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.pdfcr-btn-change {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 750;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.pdfcr-btn-change:hover {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* Aspect Ratio Buttons */
.pdfcr-form-group {
  margin-bottom: 16px;
}
.pdfcr-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pdfcr-ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pdfcr-ratio-btn {
  padding: 8px 6px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.pdfcr-ratio-btn:hover {
  color: var(--text-heading);
}
.pdfcr-ratio-btn.active {
  background: var(--bg-card);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  box-shadow: var(--shadow-sm);
}

/* Live Numeric Dimensions Box */
.pdfcr-dims-box {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.pdfcr-dims-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pdfcr-dim-item {
  display: flex;
  flex-direction: column;
}
.pdfcr-dim-title {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.pdfcr-dim-val {
  font-size: 14px;
  font-weight: 900;
  color: var(--text-heading);
}

/* Scope & Reset Controls */
.pdfcr-scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
}
.pdfcr-scope-btn {
  padding: 8px 6px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.pdfcr-scope-btn:hover {
  color: var(--text-heading);
}
.pdfcr-scope-btn.active {
  background: var(--bg-card);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

.pdfcr-btn-reset-crop {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 18px;
  transition: var(--transition);
}
.pdfcr-btn-reset-crop:hover {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* Primary Action Button */
.pdfcr-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: var(--transition);
}
.pdfcr-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px var(--primary-glow);
}
.pdfcr-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Progress Bar */
.pdfcr-progress-card {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: none;
}
.pdfcr-progress-card.active {
  display: block;
}
.pdfcr-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.pdfcr-progress-track {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.pdfcr-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-cyan), #10b981);
  transition: width 0.2s ease;
}

/* Results Card */
.pdfcr-results-card {
  margin-top: 20px;
  padding: 22px;
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.06);
  border-radius: var(--radius-xl);
  display: none;
}
.pdfcr-results-card.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
.pdfcr-results-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16.5px;
  font-weight: 900;
  color: #10b981;
  margin-bottom: 14px;
}
.pdfcr-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 600px) {
  .pdfcr-metrics-grid {
    grid-template-columns: 1fr;
  }
}
.pdfcr-metric-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
}
.pdfcr-metric-label {
  font-size: 10.5px;
  font-weight: 750;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}
.pdfcr-metric-value {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-heading);
}

.pdfcr-download-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: #10b981;
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
  margin-bottom: 10px;
}
.pdfcr-download-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}
.pdfcr-btn-secondary {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 750;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.pdfcr-btn-secondary:hover {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* ========================================================
   RIGHT COLUMN: INTERACTIVE VISUAL CROPPING STAGE
   ======================================================== */
.pdfcr-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdfcr-preview-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pdfcr-preview-title {
  font-size: 14px;
  font-weight: 850;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdfcr-preview-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pdfcr-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--text-heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition);
}
.pdfcr-nav-btn:hover:not(:disabled) {
  background: var(--primary-cyan);
  color: #fff;
  border-color: var(--primary-cyan);
}
.pdfcr-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pdfcr-nav-counter {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

/* Stage & Document Wrapper */
.pdfcr-canvas-stage {
  width: 100%;
  max-width: 480px;
  min-height: 480px;
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.08);
  position: relative;
}

.pdfcr-page-wrapper {
  position: relative;
  display: inline-block;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  border-radius: 2px;
  background: #fff;
  line-height: 0;
  user-select: none;
  touch-action: none;
}
.pdfcr-preview-canvas {
  display: block;
  max-width: 100%;
  max-height: 480px;
}

/* Darkened Outside Dimmer Overlay */
.pdfcr-dimmer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  pointer-events: none;
}

/* Interactive Crop Box */
.pdfcr-crop-box {
  position: absolute;
  border: 2px solid var(--primary-cyan);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45), 0 0 14px rgba(22, 135, 245, 0.4);
  box-sizing: border-box;
  cursor: move;
  z-index: 10;
  touch-action: none;
}

/* 8 Resizing Handles */
.pdfcr-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary-cyan);
  border: 1.5px solid #ffffff;
  border-radius: 2px;
  box-sizing: border-box;
  z-index: 12;
}

.pdfcr-handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.pdfcr-handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.pdfcr-handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.pdfcr-handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }

.pdfcr-handle-n { top: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.pdfcr-handle-s { bottom: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.pdfcr-handle-w { top: calc(50% - 5px); left: -5px; cursor: ew-resize; }
.pdfcr-handle-e { top: calc(50% - 5px); right: -5px; cursor: ew-resize; }
