/* -- PDF export dialog. Loaded by both the Editor and the Viewer (see
      wwwroot/js/pdf-export.js); the modal shell classes it builds on (.share-backdrop,
      .share-modal, .share-modal-head) come from each page's own stylesheet. -- */
/* -- PDF export dialog: settings column plus a live preview of the print document
      (Web/Pages/Editor/_PdfExportModal.cshtml). Wider than the other modals because
      the preview has to show a page at a readable size next to the controls. -- */
.pdf-modal { width: min(940px, 94vw); max-height: 90vh; display: flex; flex-direction: column; }
.pdf-modal-body { display: flex; gap: 16px; min-height: 0; flex: 1; padding-top: 12px; border-top: 1px solid var(--border); }
.pdf-settings { width: 250px; flex-shrink: 0; overflow-y: auto; padding-right: 4px; }
.pdf-group { padding: 10px 0; border-top: 1px solid var(--border); }
.pdf-group:first-child { border-top: none; padding-top: 0; }
.pdf-group-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 8px;
}
.pdf-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; min-width: 0; }
.pdf-field > span { font-size: 11.5px; color: var(--text-dim); }
.pdf-field select, .pdf-field input[type="number"] {
    width: 100%; background: var(--panel-alt); color: var(--text);
    border: 1px solid var(--border); border-radius: 7px; padding: 5px 7px;
    font-family: var(--sans); font-size: 12.5px;
}
.pdf-field select:focus, .pdf-field input:focus { outline: none; border-color: var(--accent); }
.pdf-field-row { display: flex; gap: 8px; }
.pdf-field-row .pdf-field { flex: 1; }
/* Just wide enough for a two-digit point size next to a full-width select. */
.pdf-field-row .pdf-field-narrow { flex: 0 0 72px; }
.pdf-margin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.pdf-field-color { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.pdf-field-color input[type="color"] {
    width: 46px; height: 26px; flex-shrink: 0; padding: 2px;
    background: var(--panel-alt); border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
/* The individual colour overrides — folded away, since the scheme selector above
   covers what most exports need. */
.pdf-advanced { margin-top: 4px; }
.pdf-advanced > summary {
    cursor: pointer; list-style: none; padding: 4px 0;
    font-size: 11.5px; color: var(--text-dim);
}
.pdf-advanced > summary::-webkit-details-marker { display: none; }
.pdf-advanced > summary::before { content: '▸ '; }
.pdf-advanced[open] > summary::before { content: '▾ '; }
.pdf-advanced > summary:hover { color: var(--text); }
.pdf-advanced .pdf-field { margin-bottom: 5px; }
.pdf-check { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 7px; font-size: 11.5px; color: var(--text-dim); cursor: pointer; }
.pdf-check input { margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }

.pdf-preview-column { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pdf-preview-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim);
}
.pdf-preview-hint { text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 11px; }
/* Neutral grey stage so a white sheet reads as a sheet in dark mode too. */
.pdf-preview-stage {
    flex: 1; min-height: 320px; overflow: auto; padding: 12px;
    background: #6b7280; border: 1px solid var(--border); border-radius: 8px;
    /* The sheet is scaled to the stage's width (fitPdfPreviewFrame). Without a
       reserved gutter that width changes the moment the vertical scrollbar appears —
       the scale is then computed against a width that no longer exists, and the sheet
       ends up exactly one scrollbar too wide. */
    scrollbar-gutter: stable;
}
/* Width/height/transform are set from JS (fitPdfPreviewFrame): the frame renders the
   page at its true size and is scaled to fit the stage, so the whole sheet is visible. */
.pdf-preview-stage iframe { display: block; border: none; background: transparent; }
.pdf-modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; }
.pdf-secondary-btn {
    background: transparent; color: var(--text-dim); border: 1px solid var(--border); border-radius: 7px;
    padding: 5px 12px; font-family: var(--sans); font-size: 12px; cursor: pointer;
}
.pdf-secondary-btn:hover { color: var(--text); border-color: var(--accent); }

@media (max-width: 768px) {
    .pdf-modal-body { flex-direction: column; }
    .pdf-settings { width: 100%; }
}

/* The dialog's own primary button: the Editor's .panel-primary-btn belongs to the side
   panel and does not exist on the Viewer at all. */
.pdf-primary-btn {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    background: var(--accent); color: var(--bg); border: none; border-radius: 7px;
    padding: 5px 12px; font-family: var(--sans); font-size: 12px; font-weight: 600; cursor: pointer;
}
.pdf-primary-btn:disabled { opacity: .5; cursor: default; }
