/* ==========================================================================
   Page Access Lock Screen (Passcode Gate)
   Default password: 0205
   ========================================================================== */

body.is-page-locked {
  overflow: hidden !important;
}

body.is-page-locked > :not(.page-lock-overlay):not(#page-loader) {
  filter: blur(2px) !important;
  pointer-events: none !important;
  user-select: none !important;
  transition: filter 0.3s ease;
}

.page-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: color-mix(in srgb, var(--bg, #0a0e1a) 32%, transparent);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.page-lock-overlay--unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-lock-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 24px 64px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 32px 28px;
  text-align: center;
  box-sizing: border-box;
  animation: pageLockPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 100000;
}

@keyframes pageLockPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.page-lock-card.page-lock-card--shake {
  animation: pageLockShake 0.4s ease-in-out;
}

@keyframes pageLockShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.page-lock-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}

.page-lock-icon svg {
  width: 26px;
  height: 26px;
}

.page-lock-title {
  font-size: 20px;
  font-weight: 750;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.page-lock-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.4;
}

.page-lock-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.page-lock-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-lock-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.page-lock-input {
  width: 100%;
  height: 42px;
  padding: 0 42px 0 14px;
  font-size: 15px;
  letter-spacing: 0.1em;
  font-family: var(--mono);
  box-sizing: border-box;
}

.page-lock-eye-btn {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: var(--radius-xs, 4px);
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.page-lock-eye-btn:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.page-lock-eye-btn svg {
  width: 16px;
  height: 16px;
}

.page-lock-error {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger, #ef4444);
  margin-top: 2px;
}

.page-lock-submit-btn {
  height: 42px;
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ==========================================================================
   CutCompress — PDF Studio Workspace
   ========================================================================== */

.page--pdfs {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 14px 2.5% 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

/* --- Dropzone ------------------------------------------------------------- */

.pdfs-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 48px 24px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.pdfs-drop:hover,
.pdfs-drop.pdfs-drop--over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -8px color-mix(in srgb, var(--accent) 25%, transparent);
}

.pdfs-drop.pdfs-drop--over { border-style: solid; }

.pdfs-drop__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdfs-drop__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.pdfs-drop__sub {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

.pdfs-drop__actions {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.pdfs-drop__note { margin: 14px auto 0; max-width: 520px; }

.pdfs-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 560px;
  margin: 22px auto 0;
  cursor: default;
}

.pdfs-url-row--compact {
  margin: 8px 0 0;
  max-width: none;
}

.pdfs-url-row .input { flex: 1 1 auto; min-width: 0; }

.pdfs-url-row__icon {
  color: var(--text-faint);
  display: flex;
  flex-shrink: 0;
}

/* --- Banner / undo -------------------------------------------------------- */

.pdfs-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  position: relative;
  z-index: 10;
}
.pdfs-banner[hidden] { display: none; }

.pdfs-banner .input { max-width: 260px; }

.pdfs-undo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--overlay);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 13px;
}
.pdfs-undo[hidden] { display: none; }

/* --- Single-Row Modern Studio Toolbar ------------------------------------- */

.pdfs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 12px;
  min-height: 48px;
}
.pdfs-toolbar::-webkit-scrollbar {
  display: none;
}

.pdfs-toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

.pdfs-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  overflow: visible;
  flex-shrink: 0;
}

.pdfs-tools--actions {
  padding-left: 0;
  border-left: 0;
}

.pdfs-tool {
  flex: 0 0 auto;
  height: 34px;
  min-height: 34px;
  padding: 0 9px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-xs, 5px);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  box-shadow: none;
  transition: all 0.12s ease;
  user-select: none;
}

.pdfs-tool:hover {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--border);
}

.pdfs-tool--on,
.pdfs-tool[aria-pressed="true"] {
  color: #fff !important;
  background: var(--accent) !important;
  border-color: transparent !important;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
  font-weight: 700;
}

.pdfs-tool--on .pdfs-tool__glyph svg,
.pdfs-tool[aria-pressed="true"] .pdfs-tool__glyph svg {
  stroke: #fff;
}

.pdfs-tool--danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-soft);
}

.pdfs-tool--action {
  padding: 0 7px;
}

.pdfs-tool--sm {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 4px;
}

.pdfs-tool__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pdfs-tool__glyph svg {
  width: 15px;
  height: 15px;
}

.pdfs-tool__label {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.pdfs-toolbar__zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  flex-shrink: 0;
}

.pdfs-zoom-label {
  min-width: 42px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  user-select: none;
}

.pdfs-toolbar__end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pdfs-badges-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pdfs-badges-group .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pdfs-download-btn {
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0 14px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
}
.pdfs-download-btn:hover {
  filter: brightness(1.1);
}

.btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Studio 3-Column Layout ----------------------------------------------- */

.pdfs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 14px;
  height: calc(100vh - 150px);
  height: calc(100dvh - 150px);
  min-height: 560px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.pdfs-rail,
.pdfs-stage-card,
.pdfs-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.pdfs-rail .card__head,
.pdfs-stage-card .card__head,
.pdfs-side .card__head {
  padding: 10px 14px;
  min-height: 44px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.pdfs-rail__body,
.pdfs-side__body,
.pdfs-stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdfs-stage-wrap { position: relative; padding: 0; }

.pdfs-thumbs {
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
}

.pdfs-rail__add {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdfs-thumb {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  cursor: grab;
  overflow: hidden;
  padding: 6px;
}

.pdfs-thumb:hover { border-color: var(--border-strong); }

.pdfs-thumb--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}

.pdfs-thumb--over { outline: 2px dashed var(--accent); }

.pdfs-thumb canvas,
.pdfs-thumb__blank {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  background: #fff;
}

.pdfs-thumb__blank {
  aspect-ratio: 1 / 1.35;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 11px;
}

.pdfs-thumb__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.pdfs-thumb__actions {
  display: inline-flex;
  gap: 2px;
}

.pdfs-thumb__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

/* --- Stage / overlays ----------------------------------------------------- */

.pdfs-stage {
  flex: 1 1 auto;
  overflow: auto;
  background: color-mix(in srgb, var(--bg-sunken) 70%, #000);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.pdfs-stage.pdfs-stage--text,
.pdfs-stage.pdfs-stage--comment,
.pdfs-stage.pdfs-stage--link { cursor: text; }
.pdfs-stage.pdfs-stage--image { cursor: copy; }
.pdfs-stage.pdfs-stage--highlight,
.pdfs-stage.pdfs-stage--shape,
.pdfs-stage.pdfs-stage--redact,
.pdfs-stage.pdfs-stage--draw { cursor: crosshair; }

.pdfs-ov--highlight {
  background: rgba(250, 204, 21, 0.4);
  mix-blend-mode: multiply;
}
.pdfs-ov--shape {
  background: transparent;
  border: 2px solid var(--accent);
}
.pdfs-ov--redact { background: #111827; }
.pdfs-ov--comment {
  background: #fef08a;
  border: 1px solid #eab308;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  padding: 4px 6px;
}
.pdfs-ov--link .pdfs-ov__edit {
  color: var(--accent);
  text-decoration: underline;
  font-size: 13px;
}
.pdfs-ov--ink {
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pdfs-ov--ink svg { display: block; }

.pdfs-page-stack {
  position: relative;
  box-shadow: 0 16px 45px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  background: #fff;
  flex: 0 0 auto;
  border-radius: 2px;
  margin-bottom: 24px;
}

.pdfs-page-canvas { display: block; }

.pdfs-overlay {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.pdfs-hit {
  position: absolute;
  box-sizing: border-box;
}

.pdfs-hit--text {
  cursor: text;
  border-radius: 2px;
}

.pdfs-hit--text:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.pdfs-hit--image {
  cursor: pointer;
  outline: 1px dashed transparent;
}

.pdfs-hit--image:hover,
.pdfs-hit--image.pdfs-hit--on {
  outline: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.pdfs-ov {
  position: absolute;
  box-sizing: border-box;
}

.pdfs-ov--cover {
  background: #fff;
}

.pdfs-ov--text {
  cursor: text;
  outline: 1px solid transparent;
}

.pdfs-ov--text.pdfs-ov--on,
.pdfs-ov--text:focus-within {
  outline: 1px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.pdfs-ov__edit {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.15;
  font-family: Helvetica, Arial, sans-serif;
  color: #111827;
}

.pdfs-ov--image {
  outline: 1px dashed var(--accent);
  overflow: hidden;
}

.pdfs-ov--image img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.pdfs-ov__handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border: 1px solid #fff;
  border-radius: 1px;
  right: -4px;
  bottom: -4px;
  cursor: nwse-resize;
  z-index: 2;
}

.pdfs-ov__move {
  position: absolute;
  top: -18px;
  left: 0;
  height: 16px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 3px 3px 0 0;
  cursor: grab;
  user-select: none;
}

.pdfs-formatbar {
  position: absolute;
  z-index: 4;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  background: var(--overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transform: translateY(-100%);
  margin-top: -8px;
}

.pdfs-formatbar .pdfs-slider { width: 88px; }

/* --- Side panel ----------------------------------------------------------- */

.pdfs-side__body {
  overflow: auto;
  gap: 18px;
}

.pdfs-side__block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pdfs-side__block[hidden] { display: none; }

.pdfs-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.pdfs-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.pdfs-check input { margin-top: 2px; }

.pdfs-slider {
  width: 100%;
  accent-color: var(--accent);
}

.pdfs-color {
  width: 100%;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

/* --- Busy overlay --------------------------------------------------------- */

.pdfs-busy {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 6;
  color: var(--text);
  font-size: 13px;
}
.pdfs-busy[hidden] { display: none; }

.pdfs-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pdfs-spin .7s linear infinite;
}

@keyframes pdfs-spin { to { transform: rotate(360deg); } }

.pdfs-stage-card .card__head .hint {
  max-width: 52ch;
  text-align: right;
}

@media (max-width: 1240px) and (min-width: 769px) {
  .pdfs-layout {
    grid-template-columns: 200px minmax(0, 1fr) 250px;
    gap: 10px;
  }
  .pdfs-tool__label {
    display: none;
  }
  .pdfs-tool {
    padding: 0 7px;
  }
}

@media (max-width: 768px) {
  .page--pdfs {
    padding: 12px 1px 24px !important;
    width: 100% !important;
  }

  .pdfs-toolbar {
    padding: 6px 8px;
    gap: 6px;
  }

  .pdfs-tool__label {
    display: none;
  }

  .pdfs-tool {
    padding: 0 6px;
  }

  .pdfs-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .pdfs-rail,
  .pdfs-stage-card,
  .pdfs-side {
    height: auto;
    min-height: 0;
  }

  .pdfs-thumbs {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    padding: 6px 4px;
    gap: 8px;
  }

  .pdfs-thumb {
    min-width: 110px;
    flex-shrink: 0;
  }

  .pdfs-stage {
    min-height: 360px;
    height: 52vh;
    padding: 12px;
  }

  .pdfs-stage-card .card__head .hint {
    display: none;
  }

  .pdfs-drop {
    padding: 32px 16px 24px;
  }
}
