/**
 * Herbert Digital Catalog - Public PDF.js Viewer Stylesheet
 */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #525659; /* Standard neutral PDF canvas background */
}

.viewer-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
    background-color: #525659;
    position: relative;
}

/* Minimal Topbar */
.viewer-topbar {
    height: 52px;
    background-color: var(--hbt-primary, #023564);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    user-select: none;
    flex-shrink: 0;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-brand svg {
    flex-shrink: 0;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.viewer-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.viewer-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
}

.viewer-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.96);
}

.page-indicator {
    font-size: 0.85rem;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    white-space: nowrap;
    color: #E2E8F0;
    font-variant-numeric: tabular-nums;
}

/* Main Continuous Vertical Scroll Container */
.pdf-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 12px 80px 12px;
    scroll-behavior: smooth;
    position: relative;
    width: 100%;
}

/* Individual Page Wrappers - flex-shrink: 0 is CRUCIAL so flexbox doesn't squash pages */
.pdf-page-wrapper {
    position: relative;
    background-color: #FFFFFF;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    margin-bottom: 24px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s ease;
}

.pdf-page-wrapper:hover {
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
}

.pdf-page-wrapper canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.pdf-page-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    color: #94A3B8;
    font-size: 0.9rem;
    gap: 8px;
    width: 100%;
    height: 100%;
}

/* Loading Overlay - Positioned over entire viewer area below topbar */
.viewer-loading-overlay {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: opacity 0.3s ease;
}

.spinner-herbert {
    width: 50px;
    height: 50px;
    border: 4px solid #E2E8F0;
    border-top-color: var(--hbt-primary, #023564);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--hbt-primary, #023564);
}

/* Floating Bottom Controls for Mobile */
.mobile-floating-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(2, 53, 100, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 6px 14px;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 90;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
    .mobile-floating-bar {
        display: flex;
    }
    .topbar-controls .desktop-only {
        display: none !important;
    }
    .topbar-brand span {
        max-width: 170px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .pdf-scroll-container {
        padding: 14px 6px 90px 6px;
    }
    .pdf-page-wrapper {
        margin-bottom: 14px;
    }
}

/* Empty State */
.viewer-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background-color: #F7F9FC;
}

.empty-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(2, 53, 100, 0.08);
    max-width: 500px;
    width: 100%;
    padding: 40px 32px;
    text-align: center;
}
