Files
EnvelopeGenerator/EnvelopeGenerator.ReceiverUI/wwwroot/css/envelope-viewer.css
TekH ca3b74f939 Improve PDF rendering quality and user experience
Added `image-rendering` properties and opacity transitions to `.pdf-canvas` for smoother visual effects during rendering. Introduced a `.pdf-canvas.rendering` class to indicate rendering state.

Enhanced `renderPage` method to support HiDPI displays by scaling the viewport based on device pixel ratio (up to 2) and setting both internal resolution and CSS display size for better rendering quality. Enabled high-quality rendering with `imageSmoothingEnabled` and `imageSmoothingQuality`.

Updated scroll container reference to `.pdf-canvas-wrapper` for proper alignment. Added logic to manage the `rendering` class during and after rendering, including error handling to ensure UI consistency. These changes improve both functionality and aesthetics of the PDF viewer.
2026-06-06 11:16:05 +02:00

545 lines
11 KiB
CSS

.envelope-viewer-layout {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
}
.envelope-action-bar {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20px);
border-bottom: 3px solid rgba(126, 34, 206, 0.3);
padding: 1.25rem 2rem;
flex-shrink: 0;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.envelope-action-bar__inner {
max-width: 1600px;
margin: 0 auto;
display: flex;
align-items: center;
gap: 2rem;
}
.envelope-logo svg {
filter: drop-shadow(0 2px 4px rgba(126, 34, 206, 0.3));
color: #7e22ce;
}
.envelope-title {
font-size: 1.125rem;
font-weight: 700;
color: #1e293b;
letter-spacing: -0.025em;
}
.envelope-key {
font-size: 0.8125rem;
color: #64748b;
font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
font-weight: 500;
margin-top: 0.25rem;
}
.envelope-content {
flex: 1;
min-height: 0;
padding: 1.5rem;
position: relative;
overflow: auto;
}
.pdf-viewer-container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
.pdf-thumbnails {
position: relative;
width: 260px;
background: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(20px);
border-radius: 16px 0 0 16px;
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.12),
0 0 0 1px rgba(126, 34, 206, 0.1);
border: 1px solid rgba(126, 34, 206, 0.15);
border-right: none;
display: flex;
flex-direction: column;
overflow: hidden;
flex-shrink: 0;
}
.pdf-thumbnails__content {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.pdf-thumbnails__content::-webkit-scrollbar {
width: 6px;
}
.pdf-thumbnails__content::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.05);
border-radius: 3px;
}
.pdf-thumbnails__content::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #7e22ce 0%, #2a5298 100%);
border-radius: 3px;
}
.pdf-thumbnails__content::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, #6b1cb0 0%, #1e3a72 100%);
}
.pdf-splitter {
width: 4px;
background: transparent;
cursor: col-resize;
flex-shrink: 0;
position: relative;
transition: background 0.2s ease;
z-index: 10;
user-select: none;
}
.pdf-splitter::before {
content: '';
position: absolute;
left: -4px;
right: -4px;
top: 0;
bottom: 0;
/* Enlarged hitbox for easier grabbing */
}
.pdf-splitter:hover,
.pdf-splitter.resizing {
background: linear-gradient(90deg,
rgba(126, 34, 206, 0.4) 0%,
rgba(42, 82, 152, 0.4) 100%);
}
.pdf-splitter:active {
background: linear-gradient(90deg,
rgba(126, 34, 206, 0.6) 0%,
rgba(42, 82, 152, 0.6) 100%);
}
/* Prevent text selection during resize */
body.resizing {
user-select: none;
cursor: col-resize !important;
}
.pdf-thumbnail {
cursor: pointer;
border-radius: 8px;
overflow: hidden;
background: white;
border: 2px solid transparent;
transition: all 0.2s ease;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.pdf-thumbnail:hover {
border-color: rgba(126, 34, 206, 0.3);
box-shadow: 0 4px 16px rgba(126, 34, 206, 0.2);
transform: translateY(-2px);
}
.pdf-thumbnail--active {
border-color: #7e22ce;
box-shadow:
0 4px 16px rgba(126, 34, 206, 0.3),
0 0 0 3px rgba(126, 34, 206, 0.1);
}
.pdf-thumbnail__preview {
width: 100%;
aspect-ratio: 210 / 297;
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.pdf-thumbnail__canvas {
width: 100%;
height: 100%;
object-fit: contain;
object-position: center;
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
.pdf-thumbnail__label {
padding: 0.5rem;
text-align: center;
font-size: 0.75rem;
font-weight: 600;
color: #64748b;
background: rgba(126, 34, 206, 0.03);
border-top: 1px solid rgba(126, 34, 206, 0.1);
}
.pdf-thumbnail--active .pdf-thumbnail__label {
background: linear-gradient(135deg, rgba(126, 34, 206, 0.1) 0%, rgba(42, 82, 152, 0.1) 100%);
color: #7e22ce;
font-weight: 700;
}
.pdf-toolbar__btn--toggle {
background: linear-gradient(135deg, rgba(126, 34, 206, 0.08) 0%, rgba(42, 82, 152, 0.08) 100%);
border-color: rgba(126, 34, 206, 0.25);
}
.pdf-toolbar__btn--toggle:hover:not(:disabled) {
background: linear-gradient(135deg, rgba(126, 34, 206, 0.15) 0%, rgba(42, 82, 152, 0.15) 100%);
border-color: rgba(126, 34, 206, 0.5);
}
.pdf-toolbar {
background: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(20px);
border-radius: 12px;
padding: 0.75rem 1.25rem;
display: flex;
align-items: center;
gap: 1rem;
box-shadow:
0 4px 16px rgba(0, 0, 0, 0.1),
0 0 0 1px rgba(126, 34, 206, 0.1);
border: 1px solid rgba(126, 34, 206, 0.15);
flex-shrink: 0;
max-width: 95%;
width: fit-content;
}
.pdf-toolbar__section {
display: flex;
align-items: center;
gap: 0.5rem;
}
.pdf-toolbar__zoom-section {
gap: 0.75rem;
}
.pdf-toolbar__divider {
width: 1px;
height: 32px;
background: linear-gradient(180deg, transparent 0%, rgba(126, 34, 206, 0.2) 50%, transparent 100%);
}
.pdf-toolbar__btn {
background: linear-gradient(135deg, rgba(126, 34, 206, 0.05) 0%, rgba(42, 82, 152, 0.05) 100%);
border: 1px solid rgba(126, 34, 206, 0.2);
border-radius: 8px;
padding: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
color: #1e293b;
min-width: 34px;
min-height: 34px;
}
.pdf-toolbar__btn:hover:not(:disabled) {
background: linear-gradient(135deg, rgba(126, 34, 206, 0.1) 0%, rgba(42, 82, 152, 0.1) 100%);
border-color: rgba(126, 34, 206, 0.4);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(126, 34, 206, 0.2);
}
.pdf-toolbar__btn:active:not(:disabled) {
transform: translateY(0);
box-shadow: 0 2px 6px rgba(126, 34, 206, 0.15);
}
.pdf-toolbar__btn:disabled {
opacity: 0.4;
cursor: not-allowed;
background: rgba(0, 0, 0, 0.02);
border-color: rgba(0, 0, 0, 0.1);
}
.pdf-toolbar__btn--preset {
padding: 0.5rem 0.875rem;
font-size: 0.813rem;
font-weight: 600;
color: #475569;
min-width: auto;
white-space: nowrap;
}
.pdf-toolbar__btn--preset svg {
flex-shrink: 0;
}
.pdf-toolbar__page-input-group {
display: flex;
align-items: center;
gap: 0.375rem;
background: white;
border: 1px solid rgba(126, 34, 206, 0.2);
border-radius: 8px;
padding: 0.25rem 0.625rem;
}
.pdf-toolbar__page-input {
width: 48px;
border: none;
outline: none;
text-align: center;
font-size: 0.875rem;
font-weight: 600;
color: #1e293b;
background: transparent;
-moz-appearance: textfield;
}
.pdf-toolbar__page-input::-webkit-outer-spin-button,
.pdf-toolbar__page-input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.pdf-toolbar__page-total {
font-size: 0.875rem;
font-weight: 500;
color: #64748b;
}
.pdf-toolbar__zoom-slider-container {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
}
.pdf-toolbar__zoom-slider {
-webkit-appearance: none;
width: 140px;
height: 6px;
border-radius: 3px;
background: linear-gradient(90deg,
rgba(126, 34, 206, 0.1) 0%,
rgba(126, 34, 206, 0.2) 50%,
rgba(126, 34, 206, 0.1) 100%);
outline: none;
cursor: pointer;
}
.pdf-toolbar__zoom-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 18px;
height: 18px;
border-radius: 50%;
background: linear-gradient(135deg, #7e22ce 0%, #2a5298 100%);
cursor: pointer;
box-shadow: 0 2px 8px rgba(126, 34, 206, 0.3);
transition: all 0.2s ease;
}
.pdf-toolbar__zoom-slider::-webkit-slider-thumb:hover {
transform: scale(1.15);
box-shadow: 0 4px 12px rgba(126, 34, 206, 0.4);
}
.pdf-toolbar__zoom-slider::-moz-range-thumb {
width: 18px;
height: 18px;
border-radius: 50%;
background: linear-gradient(135deg, #7e22ce 0%, #2a5298 100%);
cursor: pointer;
border: none;
box-shadow: 0 2px 8px rgba(126, 34, 206, 0.3);
transition: all 0.2s ease;
}
.pdf-toolbar__zoom-slider::-moz-range-thumb:hover {
transform: scale(1.15);
box-shadow: 0 4px 12px rgba(126, 34, 206, 0.4);
}
.pdf-toolbar__zoom-label {
font-size: 0.75rem;
font-weight: 700;
color: #7e22ce;
letter-spacing: 0.025em;
min-width: 45px;
text-align: center;
}
.pdf-frame {
background: white;
border-radius: 16px;
box-shadow:
0 25px 50px -12px rgba(0, 0, 0, 0.25),
0 0 0 1px rgba(255, 255, 255, 0.1);
overflow: hidden;
position: relative;
flex: 1;
width: 90%;
max-width: 1200px;
display: flex;
flex-direction: row;
align-items: stretch;
}
.pdf-frame::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, #7e22ce 0%, #2a5298 100%);
z-index: 1;
border-radius: 16px 16px 0 0;
}
.pdf-canvas-wrapper {
flex: 1;
overflow: auto;
padding: 2rem;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
}
.pdf-canvas {
display: inline-block;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
vertical-align: top;
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
transition: opacity 0.15s ease-out;
}
.pdf-canvas.rendering {
opacity: 0;
}
.error-container {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 2rem;
}
.alert {
border-radius: 12px;
border: none;
padding: 2rem;
max-width: 600px;
}
.alert-danger {
background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
color: #be123c;
border-left: 4px solid #e11d48;
}
.alert-warning {
background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
color: #92400e;
border-left: 4px solid #f59e0b;
}
.spinner-border {
border-width: 0.35rem;
}
@media (max-width: 768px) {
.envelope-content {
padding: 0.75rem;
}
.pdf-thumbnails {
width: 180px;
border-radius: 0 0 0 16px;
}
.pdf-thumbnails__content {
padding: 0.75rem;
gap: 0.5rem;
}
.pdf-toolbar {
flex-wrap: wrap;
padding: 0.625rem 1rem;
gap: 0.625rem;
max-width: 98%;
}
.pdf-toolbar__divider {
display: none;
}
.pdf-toolbar__zoom-slider {
width: 100px;
}
.pdf-toolbar__btn--preset {
padding: 0.425rem 0.75rem;
font-size: 0.75rem;
}
.pdf-frame {
border-radius: 12px;
width: 95%;
flex-direction: column;
}
.pdf-canvas-wrapper {
padding: 1rem;
}
.envelope-action-bar {
padding: 1rem 1.25rem;
}
.envelope-action-bar__inner {
flex-wrap: wrap;
}
.envelope-title {
font-size: 1rem;
}
.envelope-key {
font-size: 0.75rem;
}
.envelope-logo svg {
width: 20px;
height: 20px;
}
.alert {
padding: 1.5rem;
}
}