/* PDF Viewer Styles */
.pdf-viewer-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    position: relative; /* allow bottom overlay controls */
}

.pdf-controls-minimal {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    flex-wrap: wrap;
}

.pdf-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: background 0.2s;
}

.pdf-btn:hover {
    background: #2563eb;
}

.pdf-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.pdf-zoom-display {
    color: #9ca3af;
    font-size: 0.875rem;
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

.pdf-pages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto; /* allow horizontal scroll when zoomed */
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* keep origin at left when zoomed */
    padding: 0.75rem 0; /* slightly tighter for mobile */
    background: #1a1a1a;
    gap: 0.75rem; /* spacing between pages */
}

.pdf-page-wrapper {
    display: flex;
    justify-content: flex-start; /* start from left to avoid clipping */
    align-items: center;
    width: 100%;
    min-width: min-content; /* allow page to exceed container width when zoomed */
    background: #1a1a1a;
    padding: 0 0.5rem;
    flex-shrink: 0; /* prevent flex from shrinking the page */
}

.pdf-canvas-continuous {
    max-width: none; /* allow canvas to exceed container when zoomed */
    height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    display: block;
    background: #fff; /* white backdrop for clarity */
}

.pdf-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #9ca3af;
}

.pdf-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #ef4444;
    text-align: center;
    padding: 2rem;
}

.pdf-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .pdf-viewer-container {
    background: #0f172a;
}

[data-theme="dark"] .pdf-controls-minimal {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-theme="dark"] .pdf-zoom-display {
    color: #cbd5e1;
}

[data-theme="dark"] .pdf-pages-container {
    background: #0f172a;
}

/* Floating bottom zoom controls */
.pdf-zoom-controls-bottom {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    background: rgba(31, 41, 55, 0.9);
    padding: 0.5rem 0.6rem;
    border-radius: 9999px; /* pill */
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
    z-index: 5;
}

.pdf-zoom-controls-bottom .pdf-btn {
    background: #2563eb;
    padding: 0.4rem 0.6rem;
}

.pdf-zoom-controls-bottom .pdf-zoom-display {
    color: #e5e7eb;
    font-weight: 600;
    line-height: 25px;
}

/* Hide zoom controls when printing */
@media print {
    #pdfZoomControls,
    #zoomControls {
        display: none !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pdf-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .pdf-zoom-display {
        font-size: 0.75rem;
        min-width: 45px;
    }

    .pdf-pages-container {
        padding: 0.5rem 0;
        gap: 0.5rem;
    }

    .pdf-page-wrapper {
        padding: 0 0.25rem;
    }

    .pdf-canvas-continuous {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    }
}
