/* Noble Pixel PDF tools (compress, JPG to PDF, merge, split, PDF to JPG, sign). Mobile first; theme vars with fallbacks. */
.pdf-app [hidden] { display: none !important; }
.pdf-app .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.pdf-app .btn--lg { min-height: 52px; }
.pdf-drop { padding: 34px 18px; }
.pdf-drop strong { color: var(--blue, #1f7cec); font-size: 1.08rem; }
.pdf-note { display: flex; align-items: flex-start; gap: 6px; margin: 18px 0 0; color: var(--muted, #66768a); font-size: .86rem; }
.pdf-note svg { color: #12a150; flex: 0 0 auto; margin-top: 2px; }
.pdf-opts { margin-top: 18px; }
.pdf-actions { margin-top: 20px; }
.pdf-out:empty { display: none; }
.pdf-out { margin-top: 20px; }
.pdf-app input[type="number"] { font: inherit; color: var(--ink, #17222f); background: #fff; border: 1.5px solid var(--line, #e2e8f0); border-radius: 12px; padding: 10px 12px; width: 140px; max-width: 100%; }
.pdf-app #sg-img { font: inherit; font-size: .92rem; max-width: 100%; }
.pdf-range { width: 100%; accent-color: var(--blue, #1f7cec); height: 32px; }
.pdf-app input[type="radio"], .pdf-app input[type="checkbox"] { accent-color: var(--blue, #1f7cec); width: 18px; height: 18px; }

/* chosen file line */
.pdf-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface, #f5f8fc); border-radius: 14px; }
.pdf-file__ic, .pdf-item__ic { flex: 0 0 auto; width: 42px; height: 48px; border-radius: 8px; background: #fdeee9; color: #c23a1f; font-weight: 800; font-size: .72rem; display: grid; place-items: center; letter-spacing: .04em; }
.pdf-file__name { font-weight: 700; word-break: break-word; min-width: 0; }
.pdf-file__name small, .pdf-item__name small { display: block; font-weight: 500; color: var(--muted, #66768a); font-size: .85rem; }

/* level cards */
.pdf-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pdf-choice label { position: relative; cursor: pointer; }
.pdf-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pdf-choice span { display: block; height: 100%; padding: 12px 10px; border: 1.5px solid var(--line, #e2e8f0); border-radius: 12px; background: #fff; text-align: center; transition: border-color .15s, background .15s; }
.pdf-choice b { display: block; color: var(--ink, #17222f); }
.pdf-choice small { display: block; color: var(--muted, #66768a); font-size: .8rem; margin-top: 2px; }
.pdf-choice input:checked + span { border-color: var(--blue, #1f7cec); background: var(--blue-50, #ebf3fe); box-shadow: 0 0 0 3px rgba(31,124,236,.12); }
.pdf-choice input:focus-visible + span { outline: 2px solid var(--blue, #1f7cec); outline-offset: 2px; }
.pdf-target { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pdf-target select { flex: 1 1 220px; width: auto; }
.pdf-custom { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.pdf-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.pdf-grid3 .tool-label select { margin-top: 6px; font-weight: 500; }
.pdf-num { width: 120px; }

/* file list (reorder) */
.pdf-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: pdfi; }
.pdf-list:empty { display: none; }
.pdf-item { counter-increment: pdfi; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line, #e2e8f0); border-radius: 14px; background: #fff; }
.pdf-item::before { content: counter(pdfi); flex: 0 0 auto; width: 24px; text-align: center; font-weight: 800; color: var(--muted, #66768a); font-size: .9rem; }
.pdf-item__thumb { flex: 0 0 auto; width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: #eef2f7; }
.pdf-item__name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: .93rem; overflow-wrap: anywhere; }
.pdf-item__btns { display: flex; gap: 6px; flex: 0 0 auto; }
.pdf-ib { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line, #e2e8f0); background: #fff; color: var(--ink, #17222f); font-size: 1.15rem; font-weight: 700; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.pdf-ib:hover:not(:disabled) { border-color: var(--blue, #1f7cec); color: var(--blue, #1f7cec); }
.pdf-ib:disabled { opacity: .35; cursor: default; }
.pdf-ib--x { color: #b3311a; }

/* split: page chips */
.pdf-pages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 260px; overflow: auto; padding: 2px; }
.pdf-chip { min-width: 44px; height: 44px; padding: 0 8px; border-radius: 10px; border: 1.5px solid var(--line, #e2e8f0); background: #fff; font: inherit; font-weight: 700; color: var(--text, #3d4b5c); cursor: pointer; }
.pdf-chip.is-on { background: var(--blue, #1f7cec); border-color: var(--blue, #1f7cec); color: #fff; }
.pdf-app .tool-error[data-sp-err], .pdf-app .tool-error[data-pj-err] { margin-top: 12px; }
.pdf-parts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pdf-parts li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; font-weight: 600; }
.pdf-parts .btn { padding: .6em 1em; font-size: .9rem; }
.pdf-app .btn.is-done { border-color: #12a150; color: #0c7a3d; }

/* progress */
.pdf-progress { padding: 18px; background: var(--surface, #f5f8fc); border-radius: 14px; }
.pdf-progress__top { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text, #3d4b5c); }
.pdf-progress__top span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pdf-progress__bar { height: 10px; margin-top: 12px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.pdf-progress__bar i { display: block; height: 100%; background: var(--blue, #1f7cec); border-radius: 99px; transition: width .2s; }

/* result card */
.pdf-result { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 20px; border-radius: 18px; background: linear-gradient(135deg, var(--blue-50, #ebf3fe), #f6fbff); border: 1px solid #d7e6fb; }
.pdf-result--plain { background: var(--surface, #f5f8fc); border-color: var(--line, #e2e8f0); }
.pdf-result__icon { flex: 0 0 auto; width: 56px; height: 64px; border-radius: 10px; background: #fff; color: #c23a1f; font-weight: 800; display: grid; place-items: center; box-shadow: 0 6px 16px -8px rgba(17,28,41,.3); }
.pdf-result__body { flex: 1 1 260px; min-width: 0; }
.pdf-result__body h3 { margin: 0 0 6px; font-size: 1.15rem; color: var(--ink, #17222f); }
.pdf-result__body p { margin: 6px 0 0; }
.pdf-result__meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pdf-result__meta .tb { font-size: .85rem; }
.pdf-result__btns { flex: 1 1 100%; }
.pdf-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .95rem; }
.pdf-ok { color: #0c7a3d; font-weight: 600; }
.pdf-warn { padding: 12px 14px; background: #fff8e6; border: 1px solid #f3dca2; color: #6e4a00; border-radius: 12px; font-size: .92rem; margin: 12px 0 0; }
.pdf-note-sm { font-size: .9rem; color: var(--text, #3d4b5c); }

/* PDF to JPG thumbnails */
.pdf-allrow { margin: 14px 0 0; }
.pdf-thumbs { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pdf-thumb { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line, #e2e8f0); border-radius: 14px; background: #fff; }
.pdf-thumb img { width: 100%; height: 170px; object-fit: contain; background: #eef2f7; border-radius: 8px; }
.pdf-thumb__meta b { display: block; }
.pdf-thumb__meta small { color: var(--muted, #66768a); font-size: .8rem; }
.pdf-thumb .btn { width: 100%; padding: .65em 1em; font-size: .9rem; }

/* Sign PDF */
.sg-work { margin-top: 18px; }
.sg-step { padding: 18px 0; border-bottom: 1px solid var(--line, #e2e8f0); }
.sg-step:first-child { padding-top: 0; }
.pdf-step { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 1.08rem; color: var(--ink, #17222f); }
.pdf-step span { width: 28px; height: 28px; border-radius: 50%; background: var(--blue, #1f7cec); color: #fff; display: grid; place-items: center; font-size: .9rem; flex: 0 0 auto; }
.sg-pad { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border: 2px dashed #b9c6d6; border-radius: 14px; touch-action: none; cursor: crosshair; background-image: linear-gradient(to top, transparent 24%, #dbe4ef 24%, #dbe4ef calc(24% + 1px), transparent calc(24% + 1px)); }
.sg-fonts { display: grid; gap: 8px; }
.sg-font { position: relative; cursor: pointer; }
.sg-font input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sg-font span { display: block; padding: 10px 14px; border: 1.5px solid var(--line, #e2e8f0); border-radius: 12px; font-size: 1.7rem; font-style: italic; line-height: 1.3; color: var(--ink, #17222f); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sg-font input:checked + span { border-color: var(--blue, #1f7cec); background: var(--blue-50, #ebf3fe); }
.sg-font input:focus-visible + span { outline: 2px solid var(--blue, #1f7cec); outline-offset: 2px; }
.sg-preview { margin-top: 14px; min-height: 70px; padding: 12px; border-radius: 12px; background: repeating-conic-gradient(#f1f4f8 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.sg-preview img { max-width: 100%; max-height: 120px; }
.sg-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-weight: 700; }
.sg-nav .btn { padding: .6em 1em; }
.sg-stage { position: relative; border: 1px solid var(--line, #e2e8f0); border-radius: 6px; overflow: hidden; background: #eef2f7; box-shadow: 0 8px 24px -14px rgba(17,28,41,.35); cursor: copy; -webkit-user-select: none; user-select: none; }
.sg-stage canvas { display: block; width: 100%; height: auto; }
.sg-place { position: absolute; touch-action: none; cursor: move; outline: 1.5px dashed rgba(31,124,236,.6); outline-offset: 2px; }
.sg-place img { display: block; width: 100%; height: auto; pointer-events: none; }
.sg-place.is-sel { outline: 2px solid var(--blue, #1f7cec); background: rgba(31,124,236,.06); }
.sg-x { position: absolute; top: -16px; right: -16px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #e2462b; color: #fff; font-size: 1.1rem; font-weight: 700; line-height: 1; cursor: pointer; display: none; place-items: center; padding: 0; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.sg-place.is-sel .sg-x { display: grid; }
.sg-sel { margin-top: 12px; }
.sg-sel .btn-row { margin-top: 10px; gap: 8px; }
.sg-sel .btn { padding: .6em 1em; font-size: .92rem; }
.sg-work > .pdf-warn { margin-top: 18px; }

@media (max-width: 640px) {
	.pdf-grid3 { grid-template-columns: 1fr; }
	.pdf-choice span { padding: 10px 6px; }
	.pdf-choice small { font-size: .74rem; }
	.pdf-actions .btn, .pdf-result__btns .btn, .pdf-allrow .btn { width: 100%; }
	.pdf-item { flex-wrap: wrap; }
	.pdf-item__name { flex-basis: calc(100% - 100px); }
	.pdf-item__btns { width: 100%; justify-content: flex-end; }
	.pdf-thumbs { grid-template-columns: 1fr 1fr; }
	.pdf-thumb img { height: 130px; }
	.sg-font span { font-size: 1.45rem; }
}
