/* CropMyPDF — matches the Deecliq Data Transfer shape exactly. */
.cmp-fit.cmp-scope {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 1600px; margin: 0 auto;
  padding: 90px 4vw 60px;
}

.cmp-hero { text-align: center; flex-shrink: 0; }
.cmp-hero h1 {
  font-size: 1.5rem !important; font-weight: 800 !important;
  color: var(--brand, #a855f7) !important;
  margin: 0 0 4px !important;
}
#cmpScope .cmp-hero p {
  font-size: .85rem !important; color: var(--txt-2, #64748b) !important;
  margin: 0 !important;
}

#cmpScope .cmp-card {
  max-width: 100% !important; width: 100%;
  padding: 24px 32px !important;
  background: var(--page-bg, #f8fafc) !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  box-shadow: none !important;
  margin: 0 auto !important;
}
.cmp-input-view { display: flex; flex-direction: column; }

.cmp-input-section { display: flex; min-height: 320px; }
.cmp-scope .cmp-dropzone {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  padding: 26px 20px;
  border: 2px dashed var(--brand, #a855f7);
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  color: var(--txt, #0f172a);
  background: transparent;
  transition: border-color .2s ease, background .2s ease;
}
.cmp-scope .cmp-dropzone:hover,
.cmp-scope .cmp-dropzone.cmp-dragover {
  border-color: var(--brand-dark, #9333ea);
  background: rgba(168,85,247,.05);
}
.cmp-scope .cmp-dropzone i {
  color: var(--brand, #a855f7);
  font-size: 2.2rem;
  display: inline-block;
  animation: cmpIconFloat 2.4s ease-in-out infinite;
}
@keyframes cmpIconFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .cmp-scope .cmp-dropzone i { animation: none; }
}
.cmp-drop-title { font-weight: 700; margin-top: 10px; font-size: .95rem; color: var(--txt, #0f172a); }
.cmp-drop-sub { font-size: .8rem; opacity: .65; margin-top: 4px; color: var(--txt-2, #64748b); }

.cmp-file-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--page-bg, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
}
.cmp-file-row i.fa-file-pdf { font-size: 1.4rem; color: var(--brand, #a855f7); }
.cmp-file-name { font-weight: 700; font-size: .88rem; color: var(--txt, #0f172a); word-break: break-all; }
.cmp-file-size { font-size: .76rem; color: var(--txt-2, #64748b); }
.cmp-remove {
  background: none; border: none; cursor: pointer;
  color: var(--txt-2, #64748b); font-size: 1rem;
  padding: 6px;
}
.cmp-remove:hover { color: var(--brand, #a855f7); }

.cmp-memory-status {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px;
  background: rgba(245,158,11,.1); border: 1px solid var(--warning, #f59e0b);
  color: #92400e; font-size: .82rem;
}
.cmp-shake { animation: cmpShake .4s ease; }
@keyframes cmpShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .cmp-shake { animation: none; }
}

.cmp-error {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px;
  background: var(--page-bg, #f8fafc);
  border: 1px dashed var(--brand, #a855f7);
  color: var(--txt, #0f172a); font-size: .85rem;
}

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }

#cmpScope #cmpApplyCropBtn,
#cmpScope #cmpSettingsConfirmBtn,
#cmpScope #cmpDownloadBtn,
#cmpScope #cmpUploadBtn {
  background: linear-gradient(135deg, var(--brand, #a855f7), var(--brand-dark, #9333ea));
  border: none;
  padding: 13px 26px;
  font-weight: 700;
  font-size: .95rem;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(168,85,247,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
#cmpScope #cmpApplyCropBtn:hover,
#cmpScope #cmpSettingsConfirmBtn:hover,
#cmpScope #cmpDownloadBtn:hover,
#cmpScope #cmpUploadBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(168,85,247,.45);
}
#cmpScope #cmpApplyCropBtn:active,
#cmpScope #cmpSettingsConfirmBtn:active,
#cmpScope #cmpDownloadBtn:active,
#cmpScope #cmpUploadBtn:active { transform: translateY(0); }
#cmpScope .btn-secondary, #cmpScope .btn-warning {
  padding: 13px 26px; font-weight: 700; font-size: .95rem; border-radius: 12px;
}

/* ── Crop view: a near-full-page canvas + bottom toolbar on the left, and
   a fixed "Crop PDF" panel on the right — page nav, zoom and the crop
   button are always in reach, no scrolling past the preview needed. ── */
#cmpScope .cmp-crop-view {
  display: flex; align-items: flex-start; gap: 18px;
  flex-wrap: wrap;
}
.cmp-crop-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.cmp-crop-sidebar {
  width: 260px; flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 110px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 20px 18px;
}
.cmp-sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cmp-sidebar-top h3 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--txt, #0f172a); }
.cmp-sidebar-close {
  background: var(--page-bg, #f8fafc); border: 1px solid var(--border, #e2e8f0);
  border-radius: 50%; width: 30px; height: 30px;
  color: var(--txt-2, #64748b); cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.cmp-sidebar-close:hover { background: var(--border, #e2e8f0); color: var(--txt, #0f172a); }

.cmp-info-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(168,85,247,.08); border: 1px solid rgba(168,85,247,.25);
  border-radius: 12px; padding: 12px 14px;
  font-size: .82rem; line-height: 1.4; color: var(--txt, #0f172a);
  margin-bottom: 14px;
}
.cmp-info-box i { color: var(--brand, #a855f7); margin-top: 2px; flex-shrink: 0; }

.cmp-reset-row { text-align: right; margin-bottom: 10px; }
.cmp-reset-link { color: var(--brand, #a855f7); font-size: .82rem; font-weight: 700; text-decoration: none; }
.cmp-reset-link:hover { text-decoration: underline; }

.cmp-checkbox-item {
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; font-weight: 600; color: var(--txt, #0f172a);
  cursor: pointer; user-select: none; margin-bottom: 6px;
}
.cmp-checkbox-item input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.cmp-checkbox-box {
  width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
  border: 2px solid var(--border, #e2e8f0);
  display: inline-block; position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.cmp-checkbox-item input[type="checkbox"]:checked + .cmp-checkbox-box {
  border-color: var(--brand, #a855f7); background: var(--brand, #a855f7);
}
.cmp-checkbox-item input[type="checkbox"]:checked + .cmp-checkbox-box::after {
  content: '\2713'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .68rem; font-weight: 800;
}
.cmp-checkbox-item input[type="checkbox"]:focus-visible + .cmp-checkbox-box {
  box-shadow: 0 0 0 3px rgba(168,85,247,.25);
}
.cmp-split-toggle-row { margin-top: 4px; }
.cmp-hint { font-size: .78rem; color: var(--txt-2, #64748b); margin: 0 0 16px; line-height: 1.4; }

.cmp-split-flow {
  background: rgba(168,85,247,.08); border: 1px solid rgba(168,85,247,.25);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 16px;
}
.cmp-split-step { font-size: .82rem; line-height: 1.5; color: var(--txt, #0f172a); }
.cmp-split-step strong { color: var(--brand, #a855f7); }

.cmp-pages-label { font-weight: 700; font-size: .85rem; color: var(--txt, #0f172a); margin-bottom: 8px; }
.cmp-pages-radio-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.cmp-radio-item {
  display: flex; align-items: center; gap: 10px;
  font-size: .88rem; color: var(--txt, #0f172a);
  cursor: pointer; user-select: none;
}
.cmp-radio-item input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.cmp-radio-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border, #e2e8f0);
  display: inline-block; position: relative;
  transition: border-color .15s ease;
}
.cmp-radio-item input[type="radio"]:checked + .cmp-radio-dot {
  border-color: var(--brand, #a855f7);
}
.cmp-radio-item input[type="radio"]:checked + .cmp-radio-dot::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%;
  background: var(--brand, #a855f7);
}
.cmp-radio-item input[type="radio"]:focus-visible + .cmp-radio-dot {
  box-shadow: 0 0 0 3px rgba(168,85,247,.25);
}

.cmp-crop-pdf-btn {
  background: linear-gradient(135deg, var(--brand, #a855f7), var(--brand-dark, #9333ea));
  border: none; color: #fff;
  padding: 14px 20px; width: 100%;
  font-weight: 700; font-size: .98rem;
  border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px rgba(168,85,247,.35);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.cmp-crop-pdf-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(168,85,247,.45); }
.cmp-crop-pdf-btn:active:not(:disabled) { transform: translateY(0); }
.cmp-crop-pdf-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ── Bottom toolbar under the canvas: page nav, zoom, fit-width, settings. ── */
.cmp-bottom-toolbar {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px; padding: 8px 14px; flex-wrap: wrap;
}
.cmp-tb-btn {
  background: none; border: none; cursor: pointer;
  color: var(--txt-2, #64748b); font-size: .85rem;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.cmp-tb-btn:hover:not(:disabled) { background: var(--page-bg, #f8fafc); color: var(--brand, #a855f7); }
.cmp-tb-btn:disabled { opacity: .35; cursor: not-allowed; }
.cmp-tb-page-input {
  width: 38px; text-align: center; padding: 5px 0;
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px;
  background: var(--page-bg, #f8fafc); color: var(--txt, #0f172a);
  font-size: .85rem;
}
.cmp-tb-sep { font-size: .85rem; color: var(--txt-2, #64748b); margin: 0 6px; }
.cmp-tb-divider { width: 1px; height: 22px; background: var(--border, #e2e8f0); margin: 0 8px; }
.cmp-tb-zoom { font-size: .82rem; color: var(--txt, #0f172a); font-weight: 600; min-width: 42px; text-align: center; }

/* width: fit-content keeps the container exactly the size of the rendered
   canvas (not the wider flex column) — needed because the crop-selection
   overlay below is positioned relative to *this* container's top-left, so
   it must never be larger than the canvas or the crop box drifts off. */
.cmp-canvas-container {
  position: relative; margin: 0 auto; border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px; overflow: auto; background: var(--surface, #fff);
  width: fit-content; max-width: 100%;
  max-height: calc(100vh - 290px); min-height: 360px;
}
#cmpPdfCanvas { display: block; max-width: 100%; height: auto; }

@media (max-width: 900px) {
  #cmpScope .cmp-crop-view { flex-direction: column; }
  .cmp-crop-sidebar { width: 100%; position: static; }
  .cmp-canvas-container { max-height: 60vh; }
}

.cmp-crop-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.cmp-crop-selection {
  position: absolute; border: 2px solid var(--brand, #a855f7); background: rgba(168,85,247,.1);
  cursor: move;
  touch-action: none;
}
.cmp-crop-handle {
  position: absolute; width: 10px; height: 10px; background: var(--brand, #a855f7);
  border: 2px solid #fff; border-radius: 50%; cursor: pointer;
  touch-action: none;
}
.cmp-crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.cmp-crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.cmp-crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.cmp-crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.cmp-crop-handle.n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.cmp-crop-handle.s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.cmp-crop-handle.w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
.cmp-crop-handle.e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }

/* ── Settings popup (matches the bulk-file-renamer modal exactly). ── */
.cmp-modal {
  position: fixed; inset: 0; z-index: 100001;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.cmp-modal.cmp-modal-open { display: flex; }
.cmp-modal-backdrop {
  position: absolute; inset: 0; background: rgba(15,23,42,.6);
  animation: cmpFadeIn .15s ease;
}
.cmp-modal-box {
  position: relative; z-index: 1;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  padding: 28px 30px;
  border-radius: 18px;
  max-width: 480px; width: 100%;
  max-height: 86vh; overflow-y: auto;
  animation: cmpPopIn .2s ease;
  box-shadow: 0 30px 60px rgba(0,0,0,.3);
}
.cmp-modal-box h3 {
  display: flex; align-items: center; gap: 8px;
  color: var(--txt, #0f172a); margin: 0 0 16px; padding-right: 36px;
}
.cmp-modal-box h3 i { color: var(--brand, #a855f7); }
.cmp-modal-file-info { font-size: .82rem; color: var(--txt-2, #64748b); margin: 0 0 16px; }
.cmp-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--page-bg, #f8fafc); color: var(--txt-2, #64748b); border: 1px solid var(--border, #e2e8f0);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.cmp-modal-close:hover { background: var(--brand, #a855f7); color: #fff; border-color: var(--brand, #a855f7); }
@keyframes cmpFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmpPopIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .cmp-modal-backdrop, .cmp-modal-box { animation: none; }
}
#cmpSettingsModal .form-group { margin-bottom: 14px; }
#cmpSettingsModal .controls { margin-top: 6px; }

/* ── Processing screen — identical ring + step pattern as Transfer. ── */
.cmp-processing { padding: 10px 0 4px; }

.cmp-ring-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto 18px; }
.cmp-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.cmp-ring-track { fill: none; stroke: var(--border, #e2e8f0); stroke-width: 8; }
.cmp-ring-fill {
  fill: none; stroke: var(--brand, #a855f7); stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset .2s ease;
  filter: drop-shadow(0 0 6px rgba(168,85,247,.45));
}
.cmp-ring-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--txt, #0f172a);
}
.cmp-ring-count { font-size: 2.1rem; line-height: 1; }
.cmp-ring-percent { font-size: 1.1rem; opacity: .7; margin-left: 2px; }

.cmp-process-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 22px;
}
.cmp-process-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700;
  color: var(--txt-2, #64748b);
  opacity: .55;
  transition: opacity .2s ease;
}
.cmp-process-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface, #fff);
  border: 2px solid var(--border, #e2e8f0);
  color: var(--txt-2, #64748b);
  font-size: .9rem;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.cmp-process-line { width: 36px; height: 2px; background: var(--border, #e2e8f0); }
.cmp-process-step.cmp-step-active { opacity: 1; }
.cmp-process-step.cmp-step-active .cmp-process-icon {
  border-color: var(--brand, #a855f7);
  color: var(--brand, #a855f7);
  box-shadow: 0 0 0 4px rgba(168,85,247,.12);
  animation: cmpPulseStep 1.3s ease-in-out infinite;
}
.cmp-process-step.cmp-step-done { opacity: 1; }
.cmp-process-step.cmp-step-done .cmp-process-icon {
  border-color: #16a34a; color: #fff; background: #16a34a;
}
@keyframes cmpPulseStep {
  0%, 100% { box-shadow: 0 0 0 4px rgba(168,85,247,.12); }
  50%      { box-shadow: 0 0 0 8px rgba(168,85,247,.04); }
}
@media (prefers-reduced-motion: reduce) {
  .cmp-process-step.cmp-step-active .cmp-process-icon { animation: none; }
}

.cmp-progress-text { font-size: .85rem; margin-top: 10px; color: var(--txt, #0f172a); font-weight: 600; text-align: center; }

/* ── Result screen ── */
.cmp-result-icon { text-align: center; font-size: 2.6rem; color: #16a34a; margin-bottom: 6px; }
.cmp-autosave { margin-top: 10px; text-align: center; font-size: .82rem; color: var(--txt-2, #64748b); }

.hidden { display: none !important; }
#cmpScope .controls.hidden { display: none !important; }
#cmpSettingsModal .form-group.hidden { display: none !important; }
