/* Styles for the online tool pages. Loaded after pages.css. */
.wrap { max-width: 820px; }
main { padding: 40px 0 96px; }

.crumbs { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--ink); }
.lead { font-size: 18px; color: var(--muted); margin-bottom: 28px; }

.tool {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 24px; box-shadow: 0 12px 40px rgba(20, 30, 60, .06);
}
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed #c9cfe2; border-radius: 18px; padding: 36px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--orange); background: #fff8f1; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong {
  display: inline-block; background: var(--orange); color: var(--navy);
  padding: 12px 24px; border-radius: 14px; font-size: 16px; margin-top: 6px;
}
.drop span { color: var(--muted); font-size: 14px; }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.settings label { font-size: 13px; font-weight: 700; color: var(--muted); display: grid; gap: 6px; }
.field {
  display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 0 12px; background: var(--bg); color: var(--muted); font-weight: 600;
}
.field:focus-within { border-color: var(--orange); }
.field input {
  border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink);
  width: 100%; min-width: 0; padding: 11px 0; outline: none;
}

.status { margin-top: 14px; font-weight: 600; font-size: 15px; color: var(--muted); min-height: 1.5em; }
.status[data-kind="ok"] { color: var(--mint-ink); }
.status[data-kind="error"] { color: #b42318; }

.result { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; margin-top: 14px; }
.result[hidden] { display: none; }
.result img {
  width: 100%; max-height: 240px; object-fit: contain; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
}
.stats { display: grid; gap: 4px; font-size: 15px; color: var(--muted); }
.stats b { color: var(--ink); }
.btn-download {
  display: inline-block; margin-top: 12px; background: var(--navy); color: #fff !important;
  padding: 12px 22px; border-radius: 14px; font-weight: 700; text-decoration: none;
}
.tool .note { margin-top: 16px; font-size: 14px; color: var(--mint-ink); font-weight: 600; }

main ol.how { margin: 10px 0 0 22px; display: grid; gap: 6px; }
.sizes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.sizes a {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 15px; text-decoration: none; color: var(--ink);
}
.sizes a:hover { border-color: var(--orange); }

.app-cta { background: var(--orange-soft); border-radius: 18px; padding: 24px 26px; margin-top: 44px; }
.app-cta h2 { margin-top: 0; }

@media (max-width: 600px) {
  .tool { padding: 16px; }
  .settings { grid-template-columns: 1fr 1fr; }
  .settings label:first-child { grid-column: 1 / -1; }
  .result { grid-template-columns: 1fr; }
}

/* Merge PDF / Images to PDF */
.file-list { list-style: none; margin: 16px 0 0; display: grid; gap: 8px; }
.file-list[hidden] { display: none; }
.file-list li {
  display: flex; align-items: center; gap: 12px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; color: var(--ink);
}
.file-list img, .pdf-icon {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: #fff;
}
.pdf-icon {
  display: grid; place-items: center; background: #fde4e1; color: #b42318; font-weight: 800; font-size: 12px;
}
.file-list .info { flex: 1; min-width: 0; display: grid; }
.file-list .info b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-list .info span { font-size: 13px; color: var(--muted); }
.row-btns { display: flex; gap: 4px; flex: none; }
.row-btns button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: 15px; cursor: pointer; color: var(--ink);
}
.row-btns button:disabled { opacity: .35; cursor: default; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 16px; }
.tool-actions[hidden] { display: none; }
.tool-actions label { font-size: 13px; font-weight: 700; color: var(--muted); display: grid; gap: 6px; flex: 1; min-width: 180px; }
.field select {
  border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink);
  width: 100%; padding: 11px 0; outline: none;
}
button.btn-download { border: 0; font: inherit; font-weight: 700; cursor: pointer; margin-top: 0; }
button.btn-download:disabled { opacity: .45; cursor: default; }
a.btn-download.ok { background: var(--mint-ink); }
.btn-download[hidden] { display: none; }
.tool .where { margin-bottom: 0; }
.page-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.app-cta ul { margin-top: 8px; }
.app-cta .btn-download { margin-top: 14px; }

/* Save to My files */
.btn-save {
  display: inline-block; margin: 12px 0 0 8px; padding: 11px 18px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 700; font-size: 15px;
  color: var(--ink); cursor: pointer;
}
.btn-save[hidden] { display: none; }
.btn-save:disabled { cursor: default; color: var(--mint-ink); }
.btn-save a { color: #c25e00; }
.tool-actions .btn-save { margin: 0; }

/* Scan a document */
.scan-start { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.drop.alt strong { background: var(--surface); border: 1.5px solid var(--line); }
.crop[hidden], .editor[hidden] { display: none; }
.crop { margin-top: 18px; }
.crop-stage { position: relative; margin: 10px auto 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.crop-stage canvas { width: 100%; height: auto; display: block; border-radius: 12px; }
.crop-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-stage polygon { fill: rgba(255, 138, 31, .14); stroke: var(--orange); stroke-width: 3; vector-effect: non-scaling-stroke; }
.handle {
  position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: #fff; border: 3px solid var(--orange); box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  cursor: grab; touch-action: none;
}
.crop-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 14px; }
.small-btn {
  display: inline-block; padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; font: inherit; font-weight: 700; font-size: 14.5px; color: var(--ink) !important; cursor: pointer; text-decoration: none;
}
.small-btn.danger { color: #b42318 !important; }
.scan-pages { list-style: none; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.scan-pages[hidden] { display: none; }
.scan-pages li { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: grid; gap: 8px; }
.scan-pages .thumb { width: 100%; height: 150px; object-fit: contain; background: #fff; border-radius: 8px; }
.scan-pages .row-btns { justify-content: space-between; align-items: center; }
.scan-pages .row-btns button { width: 30px; height: 30px; font-size: 13px; display: grid; place-items: center; padding: 0; }
.scan-pages .num { font-weight: 800; font-size: 13px; color: var(--muted); padding-left: 4px; }
.scan-downloads { display: flex; flex-wrap: wrap; gap: 0 8px; }
.scan-downloads .btn-download { margin-top: 12px; }

/* Edit PDF text */
.editor-help { margin-top: 16px; font-size: 15px; color: var(--muted); }
.pdf-pages { display: grid; gap: 16px; margin-top: 12px; }
.pdf-page { position: relative; container-type: inline-size; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pdf-page canvas { width: 100%; height: 100%; display: block; }
.pdf-text {
  position: absolute; border: 0; padding: 0; margin: 0; background: transparent; cursor: text;
  border-radius: 2px; font-family: Helvetica, Arial, sans-serif; line-height: 1; white-space: nowrap;
  overflow: visible; text-align: left; color: transparent;
}
.pdf-text:hover { background: rgba(255, 138, 31, .18); }
.pdf-text.changed { outline: 2px solid rgba(26, 122, 76, .55); }
.pdf-text.editing { background: #fff; outline: 2px solid var(--orange); z-index: 2; }
.pdf-text input {
  width: 100%; min-width: 120px; height: 100%; border: 0; outline: none; padding: 0 2px;
  font: inherit; font-family: Helvetica, Arial, sans-serif; color: var(--ink); background: #fff;
}
.edit-bar { position: sticky; bottom: 12px; z-index: 3; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(20, 30, 60, .12); }
.edit-bar #edit-count { font-weight: 700; color: var(--muted); flex: 1; align-self: center; }
.edit-bar .btn-preview {
  display: inline-block; padding: 11px 18px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 700; text-decoration: none;
}
.edit-bar .btn-preview[hidden], .edit-bar #run[hidden] { display: none; }
.edit-bar #download { margin-top: 0; }

/* My files */
.files-list { list-style: none; margin: 0; display: grid; gap: 10px; }
.files-list li {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 10px 12px; flex-wrap: wrap;
}
.files-list img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; }
.files-list .pdf-icon { width: 48px; height: 48px; }
.files-list .info { flex: 1; min-width: 160px; display: grid; }
.files-list .info b { font-size: 15.5px; word-break: break-all; }
.files-list .info span { font-size: 13px; color: var(--muted); }
.file-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.file-btns .small-btn { padding: 8px 12px; font-size: 14px; }
.files-empty { background: var(--surface); border: 1px dashed #c9cfe2; border-radius: 16px; padding: 28px; text-align: center; color: var(--muted); }
.files-empty[hidden] { display: none; }

@media (max-width: 600px) {
  .scan-start { grid-template-columns: 1fr; }
  .crop-actions { justify-content: stretch; }
  .crop-actions > * { flex: 1; text-align: center; }
}

/* Share row under the tool */
.share-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-top: 14px; padding: 14px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.share-row > span { font-size: 15px; color: var(--muted); font-weight: 600; }
.share-row > div { display: flex; gap: 8px; }

/* Quick size buttons */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.chips > span { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 14.5px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--orange); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Requirement tables */
table.spec { width: 100%; border-collapse: collapse; margin-top: 12px; background: var(--surface); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
table.spec th, table.spec td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 15.5px; color: #2e3858; }
table.spec th { background: var(--bg); font-size: 14px; color: var(--muted); }
table.spec tr:last-child td { border-bottom: 0; }
