/**
 * PDF Viewer Styles
 * Mimics Chrome/Edge PDF viewer interface
 */

.pdf-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #525659;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Toolbar */
.pdf-toolbar {
    background: #323639;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    height: 48px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

.pdf-toolbar-left,
.pdf-toolbar-center,
.pdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdf-filename {
    color: #e8eaed;
    font-size: 14px;
    font-weight: 500;
    margin-left: 12px;
}

.pdf-btn {
    background: transparent;
    border: none;
    color: #e8eaed;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
    min-width: 32px;
    text-align: center;
}

.pdf-btn:hover {
    background: rgba(255,255,255,0.1);
}

.pdf-btn:active {
    background: rgba(255,255,255,0.2);
}

.pdf-btn.active {
    background: rgba(66, 133, 244, 0.3);
    color: #8ab4f8;
}

.pdf-page-info {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #e8eaed;
    font-size: 13px;
}

#pdf-current-page {
    width: 50px;
    background: #202124;
    border: 1px solid #5f6368;
    color: #e8eaed;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
}

#pdf-current-page:focus {
    outline: 2px solid #8ab4f8;
    border-color: #8ab4f8;
}

.pdf-zoom-level {
    color: #e8eaed;
    font-size: 13px;
    min-width: 45px;
    text-align: center;
}

/* Main Content Area */
.pdf-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #525659;
}

/* Sidebar with Thumbnails */
.pdf-sidebar {
    width: 200px;
    background: #3c4043;
    border-right: 1px solid #202124;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s, margin-left 0.3s;
    scrollbar-width: thin;
    scrollbar-color: #5f6368 #3c4043;
}

.pdf-sidebar::-webkit-scrollbar {
    width: 8px;
}

.pdf-sidebar::-webkit-scrollbar-track {
    background: #3c4043;
}

.pdf-sidebar::-webkit-scrollbar-thumb {
    background: #5f6368;
    border-radius: 4px;
}

.pdf-sidebar::-webkit-scrollbar-thumb:hover {
    background: #80868b;
}

.pdf-sidebar.collapsed {
    width: 0;
    margin-left: -200px;
}

.pdf-thumbnails {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pdf-thumbnail {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #202124;
}

.pdf-thumbnail:hover {
    border-color: #5f6368;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.pdf-thumbnail.active {
    border-color: #8ab4f8;
    box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.3);
}

.pdf-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    background: white;
}

.pdf-thumbnail-number {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

/* Main Viewer */
.pdf-main-viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    background: #525659;
}

.pdf-page-container {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pdf-main-image {
    max-width: 100%;
    max-height: calc(100vh - 88px); /* Account for toolbar */
    width: auto;
    height: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    background: white;
    display: block;
    object-fit: contain;
}

/* Loading State */
.pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(82, 86, 89, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 100;
}

.pdf-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #8ab4f8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.pdf-loading p {
    color: #e8eaed;
    font-size: 16px;
}

/* Error State */
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #e8eaed;
    text-align: center;
    padding: 20px;
}

.pdf-error h2 {
    color: #f28b82;
    margin-bottom: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pdf-sidebar {
        width: 160px;
    }
    
    .pdf-toolbar {
        padding: 6px 12px;
        height: 44px;
    }
    
    .pdf-toolbar-left .pdf-filename {
        display: none;
    }
    
    .pdf-toolbar-right .pdf-zoom-level {
        display: none;
    }
    
    .pdf-btn {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .pdf-main-viewer {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .pdf-sidebar {
        position: absolute;
        left: 0;
        top: 48px;
        height: calc(100vh - 48px);
        z-index: 20;
        box-shadow: 2px 0 8px rgba(0,0,0,0.3);
    }
    
    .pdf-sidebar.collapsed {
        margin-left: -200px;
    }
}

/* Smooth Transitions */
.pdf-main-image {
    transition: opacity 0.3s ease-in-out;
}

/* Print Styles */
@media print {
    .pdf-toolbar,
    .pdf-sidebar {
        display: none !important;
    }
    
    .pdf-main-viewer {
        padding: 0;
    }
    
    .pdf-main-image {
        max-width: 100%;
        max-height: none;
        box-shadow: none;
    }
}

