.pdf-viewer {
    width: 100%;
    height: 80vh;
    background: #1e1e1e;
    display: grid;
    grid-template-rows: 1fr auto;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 8px;
    margin-bottom: 20px;
}
.viewer-stage {
    background: #2a2a2a;
    overflow: hidden; /* Single page mode, no stage scrolling */
    padding: 0;
    min-height: 0;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.viewer-pages-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.viewer-page-slot {
    width: 100%;
    height: 100%;
    background: #111;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto; /* Panning when zoomed */
    position: relative;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}
.viewer-page-slot:active {
    cursor: grabbing;
}
.pdf-main-image {
    max-width: none !important;
    width: 100%;
    height: auto !important;
    display: block;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    flex-shrink: 0;
    margin: auto;
}
.viewer-page-placeholder {
    padding: 100px 20px;
    color: #666;
    font-size: 14px;
}
.viewer-toolbar {
    background: #111;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #333;
}
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    align-items: center;
}
.viewer-toolbar button,
.viewer-download-btn {
    padding: 6px 12px;
    font-size: 14px;
    background: #333;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.viewer-toolbar button:hover,
.viewer-download-btn:hover { background: #444; }
.viewer-download-btn {
    background: #059669;
    border-color: #059669;
}
.viewer-download-btn:hover {
    background: #047857;
}
.pdf-viewer.mobile-fs .viewer-download-btn {
    display: none;
}
.viewer-toolbar input {
    padding: 6px;
    font-size: 16px; /* Increased to 16px to prevent auto-zoom on iOS */
    border-radius: 4px;
    border: 1px solid #444;
    background: #222;
    color: #fff;
    width: 60px;
    text-align: center;
}
.pdf-viewer.mobile-fs .viewer-toolbar input:read-only {
    cursor: pointer;
    background: #222;
    color: #fff;
    -webkit-text-fill-color: #fff;
}
.pdf-viewer:fullscreen,
.pdf-viewer:-webkit-full-screen,
.pdf-viewer:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    background: #1e1e1e;
}
.pdf-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    color: #fff;
    z-index: 10;
}
.custom-pdf-prompt-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.custom-pdf-prompt-box {
    background: #222;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #444;
    width: 280px;
    max-width: 90vw;
    text-align: center;
    color: #fff;
    box-shadow: 0 5px 25px rgba(0,0,0,0.8);
}
.prompt-title { margin-bottom: 15px; font-weight: bold; font-size: 18px; }
.prompt-display {
    background: #111;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 15px;
    font-size: 32px;
    margin-bottom: 20px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: monospace;
    letter-spacing: 2px;
}
.prompt-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.keypad-btn {
    padding: 15px 5px;
    font-size: 20px;
    background: #333;
    border: 1px solid #555;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    touch-action: manipulation;
}
.keypad-btn:active { background: #555; }
.keypad-btn.btn-clear { color: #ff4444; }
.keypad-btn.btn-back { color: #aaaaaa; }
.prompt-btns {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}
.prompt-btns button {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #444;
    background: #333;
    color: #fff;
}
.prompt-btns button.prompt-ok {
    background: #2563eb;
    border-color: #2563eb;
}
