/* ==========================================================================
   PDFongo Tool Pages — modern design, green/white brand only
   Scoped under .pdg-tool-page so it's safe to reuse across every tool page
   as they get migrated one by one.
   ========================================================================== */

.pdg-tool-page {
  --g-900: #0b3d2e;
  --g-700: #12805a;
  --g-600: #1a9c63;
  --g-500: #27ae60;
  --g-400: #3ddc84;
  --g-100: #e4f6ec;
  --paper: #f6faf8;
  --white: #ffffff;
  --ink: #0f1a15;
  --ink-soft: #4b5d55;
  --ink-faint: #7c8f87;
  --line: #dfece5;
  --danger: #d64545;
  --danger-bg: #fdecec;
  --shadow-sm: 0 2px 10px rgba(11, 61, 46, 0.06);
  --shadow-md: 0 10px 30px rgba(11, 61, 46, 0.10);

  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--ink);
}
.pdg-tool-page * { box-sizing: border-box; }
.pdg-tool-page h1, .pdg-tool-page h2, .pdg-tool-page h3 { font-family: "Sora", "Segoe UI", sans-serif; }

.pdg-wrap { max-width: 940px; margin: 0 auto; padding: 0 24px; }

/* ---------------------------------- HERO --------------------------------- */
.pdg-tool-hero {
  padding: 56px 0 40px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
}
.pdg-tool-icon-badge {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: var(--g-100);
  color: var(--g-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 18px;
}
.pdg-tool-hero h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  color: var(--g-900);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.pdg-tool-hero p {
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 52ch;
  margin: 0 auto;
}

/* -------------------------------- FEATURES -------------------------------- */
.pdg-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 26px 0 0;
}
.pdg-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
}
.pdg-chip i { color: var(--g-500); }

/* -------------------------------- UPLOAD CARD ------------------------------ */
.pdg-upload-section { padding: 40px 0 60px; }

.pdg-upload-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 34px;
}

.pdg-upload-card h2 {
  font-size: 1.15rem;
  color: var(--g-900);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pdg-upload-card h2 i { color: var(--g-500); }

.pdg-input-note {
  font-size: 0.86rem;
  color: var(--ink-faint);
  margin-bottom: 20px;
}

.pdg-dropzone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 42px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  position: relative;
}
.pdg-dropzone:hover,
.pdg-dropzone.is-dragover {
  border-color: var(--g-500);
  background: var(--g-100);
}
.pdg-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.pdg-dropzone-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--g-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin: 0 auto 14px;
}
.pdg-dropzone-title { font-weight: 600; color: var(--g-900); margin-bottom: 4px; }
.pdg-dropzone-sub { font-size: 0.86rem; color: var(--ink-faint); }

.pdg-file-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: none;
}
.pdg-file-list.has-files { display: block; }
.pdg-file-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.pdg-file-list li i.fa-file-pdf { color: var(--g-500); }
.pdg-file-list li .pdg-file-size { margin-left: auto; color: var(--ink-faint); font-size: 0.78rem; font-family: "JetBrains Mono", monospace; }

/* Reorderable rows (Merge order control) */
.pdg-file-list li.pdg-file-row { gap: 0; padding: 8px 10px 8px 14px; }
.pdg-file-order {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--g-100);
  color: var(--g-700);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}
.pdg-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
}
.pdg-file-row .pdg-file-size { flex-shrink: 0; }
.pdg-file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  flex-shrink: 0;
}
.pdg-file-btn {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pdg-file-btn:hover:not(:disabled) { background: var(--g-100); color: var(--g-700); border-color: #c9ecd9; }
.pdg-file-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pdg-file-btn-remove:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger); border-color: #f4c6c6; }

@media (max-width: 560px) {
  .pdg-file-name { max-width: 34vw; }
}

/* Honeypot field: invisible to real users, present for bots */
.pdg-hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pdg-submit-btn {
  width: 100%;
  margin-top: 22px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: var(--g-500);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 10px 24px rgba(39,174,96,0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.pdg-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(39,174,96,0.34); }
.pdg-submit-btn:disabled { background: #a9c9b8; cursor: not-allowed; transform: none; box-shadow: none; }

.pdg-secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.pdg-secure-note i { color: var(--g-500); }

/* --------------------------------- ERRORS ---------------------------------- */
.pdg-alert {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.pdg-alert-error { background: var(--danger-bg); color: #9c2b2b; border: 1px solid #f4c6c6; }
.pdg-alert-error i { margin-top: 2px; }

/* Restyle the shared display_error() output (functions.php) without touching it globally */
.pdg-tool-page .response-box.error-message {
  background: var(--danger-bg);
  color: #9c2b2b;
  border: 1px solid #f4c6c6;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
  text-align: left;
}
.pdg-tool-page .response-box.error-message h3 {
  font-size: 0.95rem;
  color: #9c2b2b;
  margin: 0 0 6px;
}
.pdg-tool-page .response-box.error-message h4 {
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0 0 4px;
  color: #9c2b2b;
}

/* -------------------------------- SUCCESS CARD ----------------------------- */
.pdg-success-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 44px 34px;
  text-align: center;
}
.pdg-success-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--g-100);
  color: var(--g-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 18px;
}
.pdg-success-card h4 { font-size: 1.2rem; color: var(--g-900); margin-bottom: 8px; }
.pdg-success-card p { color: var(--ink-soft); font-size: 0.94rem; margin-bottom: 24px; }
.pdg-success-card .pdg-submit-btn { width: auto; padding: 13px 26px; margin: 0 auto; }
.pdg-success-card form { display: flex; justify-content: center; }
.pdg-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  color: var(--g-600);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}
.pdg-back-link:hover { color: var(--g-700); }

/* -------------------------------- SEO CONTENT (modern) ---------------------- */
.pdg-seo-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 24px 70px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.pdg-seo-intro {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 28px;
  margin-bottom: 40px;
}
.pdg-seo-intro h2 {
  font-size: 1.3rem;
  color: var(--g-900);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pdg-seo-intro h2 i { color: var(--g-500); font-size: 1.1rem; }
.pdg-seo-intro p { margin: 0; }
.pdg-seo-intro p + p { margin-top: 12px; }

.pdg-seo-section { margin-bottom: 44px; }
.pdg-seo-heading {
  font-family: "Sora", sans-serif;
  font-size: 1.2rem;
  color: var(--g-900);
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pdg-seo-heading i {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--g-100);
  color: var(--g-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.92rem;
  flex-shrink: 0;
}

/* Step cards */
.pdg-seo-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  counter-reset: pdg-seo-step;
}
.pdg-seo-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 16px;
}
.pdg-seo-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--g-500);
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.76rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.pdg-seo-step p { font-size: 0.86rem; color: var(--ink-soft); margin: 0; }
.pdg-seo-step strong { color: var(--ink); }

@media (max-width: 900px) { .pdg-seo-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pdg-seo-steps { grid-template-columns: 1fr; } }

/* Feature checklist */
.pdg-seo-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.pdg-seo-feature {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.pdg-seo-feature i {
  color: var(--g-500);
  font-size: 1.05rem;
  margin-top: 2px;
  flex-shrink: 0;
}
.pdg-seo-feature strong { display: block; color: var(--ink); font-size: 0.92rem; margin-bottom: 2px; }
.pdg-seo-feature span { font-size: 0.84rem; color: var(--ink-soft); }

@media (max-width: 900px) { .pdg-seo-features { grid-template-columns: 1fr; } }

/* FAQ accordion */
.pdg-seo-faq-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 10px;
}
.pdg-seo-faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--g-900);
  font-size: 0.96rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pdg-seo-faq-item summary::-webkit-details-marker { display: none; }
.pdg-seo-faq-item summary::after {
  content: "+";
  font-family: "Sora", sans-serif;
  font-size: 1.2rem;
  color: var(--g-500);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
}
.pdg-seo-faq-item[open] summary::after { transform: rotate(45deg); }
.pdg-seo-faq-item p {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* Bottom CTA strip */
.pdg-seo-cta {
  text-align: center;
  background: var(--g-100);
  border: 1px solid #c9ecd9;
  border-radius: 14px;
  padding: 24px;
}
.pdg-seo-cta p { margin: 0; color: var(--g-900); font-size: 0.96rem; }
.pdg-seo-cta a.pdg-seo-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  background: var(--g-500);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
}
.pdg-seo-cta a.pdg-seo-cta-link:hover { background: var(--g-600); }

/* --------------------------------- AD SLOT --------------------------------- */
.pdg-ad-slot { max-width: 860px; margin: 0 auto; padding: 10px 24px 70px; text-align: center; }
.pdg-ad-label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; font-family: "JetBrains Mono", monospace; }

@media (max-width: 600px) {
  .pdg-upload-card { padding: 24px 18px; }
  .pdg-dropzone { padding: 30px 16px; }
}

/* ============================ ORGANIZE WORKSPACE ============================ */
.pdg-organize-page #pdg-organize-uploadcard { transition: opacity 0.2s ease; }

/* Loading overlay */
.pdg-organize-loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 61, 46, 0.55);
  backdrop-filter: blur(2px);
  z-index: 99999;
  color: #fff;
  font-size: 1.1rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.pdg-organize-spinner {
  width: 46px; height: 46px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pdg-organize-spin 0.9s linear infinite;
}
@keyframes pdg-organize-spin { to { transform: rotate(360deg); } }

/* Toolbar: single bar, left group (label + secondary actions) and
   right group (tip + single primary Save & Download action) */
.pdg-organize-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.pdg-organize-toolbar-left,
.pdg-organize-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.pdg-organize-stripe-label {
  font-weight: 600;
  color: var(--g-900);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
  border-right: 1px solid var(--line);
  margin-right: 4px;
}
.pdg-organize-stripe-label i { color: var(--g-500); }

.pdg-organize-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pdg-organize-btn:hover { background: var(--g-100); border-color: #c9ecd9; color: var(--g-700); }
.pdg-organize-tip { font-size: 0.82rem; color: var(--ink-faint); }

@media (max-width: 760px) {
  .pdg-organize-stripe-label { border-right: none; padding-right: 0; margin-right: 0; }
  .pdg-organize-toolbar-right { width: 100%; justify-content: space-between; }
}

/* Workspace layout */
.pdg-organize-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.pdg-organize-left { width: 68%; }
.pdg-organize-right { width: 32%; }

@media (max-width: 900px) {
  .pdg-organize-row { flex-direction: column; }
  .pdg-organize-left, .pdg-organize-right { width: 100%; }
}

/* Thumbnail grid (JS creates elements with these exact class names).
   NOTE: stylesheetv3.css has an older #thumbnails rule (width:20%; max-height:580px;
   overflow-y:auto;) reused from another feature. Since that link loads before
   tools.css but this rule never redeclared `width`/`max-height`/`overflow-y`,
   those specific properties were still falling back to the old rule. Redeclaring
   them explicitly here fixes it without touching the shared stylesheet. */
#thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 140px;
  width: 100%;
  max-height: none;
  overflow-y: visible;
}
.thumb {
  width: 150px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  cursor: grab;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.thumb:hover { border-color: var(--g-500); box-shadow: var(--shadow-sm); }
.thumb canvas { width: 100%; display: block; background: #fff; }
.thumb .label {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(11,61,46,0.82);
  color: #fff;
  font-size: 0.68rem;
  font-family: "JetBrains Mono", monospace;
  padding: 2px 6px;
  border-radius: 5px;
}
.thumb .toolbar {
  position: absolute;
  top: 6px; right: 6px;
}
.thumb .toolbar button {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.thumb .toolbar button:hover { background: #b83a3a; }

/* Preview panel */
.pdg-organize-preview-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
  align-items: center;
}
.pdg-organize-preview-head {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.pdg-organize-preview-title { font-weight: 600; color: var(--g-900); font-size: 0.9rem; }
.controlsSmall { display: flex; gap: 6px; flex-wrap: wrap; }
#previewCanvas {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transform-origin: top center;
}

/* Scrollable viewport for the canvas: when zoom pushes the canvas past its
   natural size, this scrolls instead of letting content spill outside the
   card (or get visually lost). Toolbar (zoom/rotate/etc.) lives outside
   this box, so it's always reachable regardless of zoom level. */
.pdg-organize-canvas-viewport {
  width: 100%;
  max-height: 600px;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 8px;
  background: var(--paper);
  border-radius: 8px;
}

.muted { color: var(--ink-faint); font-size: 0.82rem; }

.mobile-fullscreen {
  position: fixed; inset: 0;
  background: #000;
  display: flex; justify-content: center; align-items: center;
  z-index: 9999;
}

/* Bottom promo strip (external tool cross-promo) */
.pdg-organize-promo {
  max-width: 900px;
  margin: 0 auto 60px;
  padding: 16px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.pdg-organize-promo i { color: var(--g-500); margin-right: 6px; }
.pdg-organize-promo a { color: var(--g-600); font-weight: 600; text-decoration: none; }
.pdg-organize-promo a:hover { text-decoration: underline; }