/* ========================================================
   PEEKER — Frutiger Aero PDF editor, Classic look!
   Orange glass sidebar and gel buttons (Cabinet Classic's
   recipe with tangerine gels)!
   ======================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --gel: linear-gradient(180deg, #FFB45E 0%, #FF7A00 100%);
    --gel-edge: #FFD7A8;
    --gel-glow: rgba(255, 122, 0, 0.38);
    --label: #FFD2A6;
    --ink: #f8ecdf;
    --mono: 'JetBrains Mono', monospace;
}
body {
    background: radial-gradient(circle at 50% 50%, #2c1d13 0%, #140b06 100%);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    color: var(--ink);
    height: 100vh;
    display: flex;
    overflow: hidden;
}
button { font: inherit; }
svg { flex: none; }

/* --- Glass sidebar --- */
.aero-sidebar {
    width: 260px;
    flex: none;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(90deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 2px solid rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px;
    color: #fff7ef;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.35) transparent;
}
.sidebar-brand h2 {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 6px rgba(255,122,0,0.65);
    padding-left: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand .brand-logo { width: 32px; height: 32px; filter: drop-shadow(0 3px 6px rgba(255,122,0,0.45)); }
.pad-selection-stack { display: flex; flex-direction: column; gap: 8px; flex: none; }
.pad-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: #fff7ef;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--mono);
    cursor: pointer;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.pad-toggle-btn svg { width: 17px; height: 17px; color: #fff; transition: transform 0.2s ease; }
.pad-toggle-btn:hover {
    background: var(--gel);
    border-color: var(--gel-edge);
    box-shadow: 0 4px 12px var(--gel-glow), inset 0 1px 2px #fff;
    transform: translateY(-1px);
}
.pad-toggle-btn:hover svg { transform: scale(1.12); }
.pad-toggle-btn:active { transform: translateY(1px); box-shadow: 0 2px 6px rgba(255,122,0,0.2); }
.pad-toggle-btn:disabled { opacity: 0.45; pointer-events: none; }
.section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--label);
    font-family: var(--mono);
    padding-left: 8px;
}
.doc-menu-box { display: flex; flex-direction: column; gap: 6px; min-height: 80px; flex: 1 1 auto; }
.doc-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 40px; flex: 1 1 auto; padding: 2px; scrollbar-width: thin; }
.doc-item { display: flex; gap: 4px; align-items: stretch; flex: none; }
.doc-pick {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 9px;
    color: #fff7ef;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--mono);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.doc-pick:hover { background: rgba(255,255,255,0.14); }
.doc-item.active .doc-pick { background: var(--gel); border-color: var(--gel-edge); box-shadow: 0 4px 12px var(--gel-glow), inset 0 1px 2px #fff; }
.doc-pick svg { width: 16px; height: 16px; }
.doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.doc-count { flex: none; font-size: 10px; font-weight: 800; background: rgba(255,255,255,0.16); border-radius: 10px; padding: 1px 7px; }
.doc-del { flex: none; width: 26px; background: none; border: 0; color: rgba(255,255,255,0.55); cursor: pointer; border-radius: 8px; font-size: 12px; }
.doc-del:hover { color: #fff; background: rgba(255,90,40,0.35); }
.doc-empty { font-size: 12px; color: rgba(255,255,255,0.55); padding: 4px 8px; }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; flex: none; }
.aero-input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 10px;
    color: #fff;
    padding: 9px 11px;
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
}
.aero-input:focus { border-color: var(--gel-edge); box-shadow: 0 0 0 3px rgba(255,122,0,0.25); }
.aero-input:disabled { opacity: 0.5; }
.doc-info { font-size: 12px; font-family: var(--mono); color: rgba(255,255,255,0.7); padding-left: 8px; }

/* --- Main area --- */
.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.pk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px 8px; }
.view-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.18);
}
.view-seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    color: rgba(255,247,239,0.82);
    padding: 6px 10px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}
.view-seg-btn svg { width: 15px; height: 15px; }
.view-seg-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.view-seg-btn.active { color: #fff; background: var(--gel); border-color: var(--gel-edge); box-shadow: 0 3px 10px var(--gel-glow), inset 0 1px 2px #fff; }
.pk-group { display: inline-flex; align-items: center; gap: 6px; }
.gel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.22);
    background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05));
    color: #fff7ef;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
    transition: all 0.18s ease;
}
.gel-btn svg { width: 15px; height: 15px; }
.gel-btn.icon { width: 32px; padding: 0; }
.gel-btn.small { min-height: 26px; padding: 3px 10px; font-size: 11px; }
.gel-btn.icon.small { width: 26px; }
.gel-btn:hover, .gel-btn.primary { background: var(--gel); border-color: var(--gel-edge); box-shadow: 0 4px 12px var(--gel-glow), inset 0 1px 2px #fff; color: #fff; }
.gel-btn:active { transform: translateY(1px); }
.gel-btn:disabled { opacity: 0.4; pointer-events: none; }
.gel-btn.danger:hover { background: linear-gradient(180deg, #ff8a75, #e5371c); border-color: #ffc2b5; box-shadow: 0 4px 12px rgba(229,55,28,0.4), inset 0 1px 2px #fff; }
.gel-btn.big { font-size: 15px; padding: 12px 26px; background: var(--gel); border-color: var(--gel-edge); box-shadow: 0 6px 18px var(--gel-glow), inset 0 1px 2px #fff; }
.zoom-label { min-width: 64px; }
.swatches { display: inline-flex; gap: 5px; }
.swatch {
    width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
    border: 2px solid rgba(255,255,255,0.6);
    box-shadow: inset 0 2px 3px rgba(255,255,255,0.55), inset 0 -3px 5px rgba(0,0,0,0.25), 0 2px 5px rgba(0,0,0,0.35);
}
.swatch.on { outline: 2px solid #fff; outline-offset: 2px; }
.pk-size { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--label); }
.pk-size input { width: 58px; padding: 5px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.08); color: #fff; font-family: var(--mono); }

.pk-pagebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 20px 10px; }
.pk-pageinfo { font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--label); margin-right: 6px; }

.pk-body { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 0 20px 18px; }
.pk-thumbs {
    width: 150px; flex: none; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 10px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14); border-radius: 14px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.pk-thumb { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 6px; border-radius: 10px; border: 1px solid transparent; }
.pk-thumb:hover { background: rgba(255,255,255,0.08); }
.pk-thumb.current { border-color: var(--gel-edge); background: rgba(255,122,0,0.16); }
.pk-thumb.picked { background: rgba(255,122,0,0.3); border-color: #ffb45e; }
.pk-thumb.drop-before { box-shadow: 0 -3px 0 #ff9a2e; }
.pk-thumb-box { position: relative; width: 110px; }
.pk-thumb-box canvas { position: absolute; left: 50%; top: 50%; }
.pk-thumb canvas { background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.45); border-radius: 2px; }
.pk-thumb span { font-family: var(--mono); font-size: 11px; font-weight: 700; color: rgba(255,247,239,0.8); }

.pk-viewer { position: relative; flex: 1; min-width: 0; overflow: auto; border-radius: 14px; background: rgba(0,0,0,0.22); border: 1px solid rgba(255,255,255,0.1); }
.pk-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px; min-width: max-content; }
.pk-page { position: relative; flex: none; }
.pk-sheet { position: absolute; background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,0.55); transform-origin: 50% 50%; overflow: hidden; }
.pk-page.current .pk-sheet { box-shadow: 0 0 0 3px rgba(255,154,46,0.85), 0 8px 28px rgba(0,0,0,0.55); }
.pk-sheet canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pk-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pk-ink path { pointer-events: none; }
.pk-annots { position: absolute; inset: 0; }
.pk-pnum { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; color: rgba(255,247,239,0.6); }
.pk-flash .pk-sheet { animation: pkFlash 1s ease; }
@keyframes pkFlash { 30% { box-shadow: 0 0 0 6px #ff9a2e, 0 8px 28px rgba(0,0,0,0.55); } }

/* tools change the cursor */
body[data-tool="text"] .pk-sheet { cursor: text; }
body[data-tool="hl"] .pk-sheet, body[data-tool="box"] .pk-sheet, body[data-tool="white"] .pk-sheet, body[data-tool="ink"] .pk-sheet { cursor: crosshair; }

/* marks on the page */
.pk-a { position: absolute; }
body[data-tool="select"] .pk-a { cursor: move; }
.pk-a.hl { mix-blend-mode: multiply; opacity: 0.42; }
.pk-a.white { background: #fff; }
.pk-a.white.sel, .pk-a.white:hover { outline: 1px dashed #ffb45e; }
.pk-a.img img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.pk-a.text { white-space: pre; line-height: 1.2; font-family: Helvetica, Arial, sans-serif; transform-origin: 0 0; min-width: 4px; outline: none; }
.pk-a.text[contenteditable] { cursor: text; outline: 1px dashed #ff8a1f; background: rgba(255,244,232,0.6); }
.pk-a.inkhit { pointer-events: auto; }
.pk-a.sel { outline: 2px dashed #ff7a00; outline-offset: 2px; }
.pk-handle { position: absolute; right: -7px; bottom: -7px; width: 12px; height: 12px; border-radius: 50%; background: var(--gel); border: 2px solid #fff; cursor: nwse-resize; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.pk-draft { position: absolute; border: 1.5px dashed #ff7a00; background: rgba(255,154,46,0.12); pointer-events: none; }

/* empty state */
.pk-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; }
.pk-empty[hidden] { display: none; }
.pk-empty-card {
    max-width: 460px; text-align: center; padding: 34px 30px; border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
    border: 1px solid rgba(255,255,255,0.22); box-shadow: 0 18px 50px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.3);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.pk-empty-ico { width: 86px; height: 86px; filter: drop-shadow(0 6px 14px rgba(255,122,0,0.45)); }
.pk-empty-card h1 { font-family: var(--mono); font-size: 24px; color: #fff; text-shadow: 0 2px 8px rgba(255,122,0,0.6); }
.pk-empty-card p { font-size: 14px; line-height: 1.55; color: rgba(255,247,239,0.85); }

/* side panel (Find + Forms) */
.pk-panel {
    width: 290px; flex: none; display: flex; flex-direction: column; min-height: 0;
    background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.16); border-radius: 14px;
}
.pk-panel[hidden] { display: none; }
.pk-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 14px; font-family: var(--mono); font-size: 13px; color: var(--label); }
.pk-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.pk-panel-body .aero-input { font-size: 12px; }
.pk-hit { text-align: left; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; color: #fff7ef; padding: 8px 10px; cursor: pointer; font-size: 12px; line-height: 1.4; }
.pk-hit:hover { border-color: var(--gel-edge); background: rgba(255,122,0,0.18); }
.pk-hit b { font-family: var(--mono); color: #ffc68a; }
.pk-hit mark { background: #ffb45e; color: #2c1d13; border-radius: 3px; padding: 0 2px; }
.pk-field { display: flex; flex-direction: column; gap: 4px; }
.pk-field > span { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--label); word-break: break-word; }
.pk-field select { color: #fff; }
.pk-field select option { color: #222; }
.pk-check { display: flex; align-items: center; gap: 8px; }
.pk-check input { width: 18px; height: 18px; accent-color: #ff7a00; }
.pk-note { font-size: 12px; color: rgba(255,247,239,0.7); line-height: 1.5; }

/* modal */
.modal-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(20,11,6,0.55); backdrop-filter: blur(6px); }
.modal-gate[hidden] { display: none; }
.modal-card { width: min(580px, calc(100vw - 32px)); padding: 20px; border-radius: 18px; background: linear-gradient(180deg, #3b2718, #24160d); border: 1px solid rgba(255,215,168,0.4); box-shadow: 0 24px 60px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 14px; }
.modal-title { font-family: var(--mono); font-weight: 800; font-size: 16px; color: #fff; }
#sign-pad { width: 100%; height: auto; aspect-ratio: 520 / 200; background: #fff; border-radius: 12px; touch-action: none; cursor: crosshair; }
.modal-actions { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }

.drop-veil { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; background: rgba(255,122,0,0.18); border: 4px dashed #ffb45e; font-family: var(--mono); font-size: 26px; font-weight: 800; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.6); pointer-events: none; }
.drop-veil.on { display: grid; }
.pk-toast {
    position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 70;
    padding: 10px 18px; border-radius: 999px; font-family: var(--mono); font-size: 13px; font-weight: 700; color: #fff;
    background: var(--gel); border: 1px solid var(--gel-edge); box-shadow: 0 6px 20px var(--gel-glow), inset 0 1px 2px #fff;
    transition: opacity 0.2s, transform 0.2s;
}
.pk-toast.show { opacity: 1; transform: translate(-50%, 0); }

body.no-doc .pk-pagebar, body.no-doc #thumbs { visibility: hidden; }

@media (max-width: 820px) {
    body { flex-direction: column; overflow: auto; height: auto; min-height: 100vh; }
    .aero-sidebar { width: 100%; border-right: 0; border-bottom: 2px solid rgba(255,255,255,0.2); }
    .pad-selection-stack { flex-direction: row; flex-wrap: wrap; }
    .doc-menu-box { min-height: 0; }
    .pk-toolbar, .pk-pagebar { padding-left: 16px; padding-right: 16px; }
    .pk-body { padding: 0 16px 16px; height: 75vh; }
    .pk-thumbs { display: none; }
    .pk-panel { position: fixed; inset: auto 16px 16px; width: auto; max-height: 60vh; z-index: 40; background: #2c1d13; }
}

/* Font controls: a font picker and B / I / U / S toggles */
.pk-font { font: inherit; font-size: 12px; min-height: 32px; padding: 4px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.9); background: linear-gradient(180deg, #fff, #fff4e8); color: #4a2a0a; box-shadow: inset 0 1px 2px #fff, 0 2px 6px rgba(0,0,0,0.08); cursor: pointer; }
.gel-btn.fmt { font-size: 14px; font-family: Georgia, "Times New Roman", serif; }
.gel-btn.fmt.on { background: var(--gel); border-color: var(--gel-edge); color: #fff; box-shadow: inset 0 2px 4px rgba(0,0,0,0.18); }
/* Keydown chips in text marks keep the text on one line, like the rest of the mark */
.pk-a.text .gel-bubble-chip, .pk-a.text [class*="-chip"] { white-space: nowrap; }

/* Edit tool: every line of text and picture that is already in the PDF gets an outline you can click */
.pk-ex { position: absolute; inset: 0; pointer-events: none; }
.pk-ex-hit { position: absolute; border-radius: 2px; outline: 1px dashed rgba(255, 122, 0, 0.6); cursor: text; pointer-events: none; }
body[data-tool="edit"] .pk-ex-hit { pointer-events: auto; }
.pk-ex-hit:hover { background: rgba(255, 122, 0, 0.16); outline: 2px solid #ff7a00; }
.pk-ex-hit.img { cursor: move; outline-color: rgba(29, 111, 224, 0.65); }
.pk-ex-hit.img:hover { background: rgba(29, 111, 224, 0.14); outline-color: #1d6fe0; }
body[data-tool="edit"] .pk-sheet { cursor: default; }
/* the marks layer lets clicks fall through to the outlines under it, and the marks themselves still take clicks */
.pk-annots { pointer-events: none; }
.pk-annots .pk-a { pointer-events: auto; }
