/* KSC PDF Viewer Styles */

.pdf-viewer-title {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5em;
    text-align: center;
    padding: 0 20px;
}

.ksc-pdf-viewer {
    position: relative;
    background: #f8f9fa;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.pdf-viewer-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #fff;
    min-height: 400px;
}

/* Loading Indicator */
.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #004b93;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* PDF Toolbar */
.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 15px;
    background: #3467a7;
    color: white;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 10px;
}

.pdf-page-info {
    font-size: 14px;
    white-space: nowrap;
}

.pdf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 14px;
}

.pdf-btn {
    background: #004b93;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    transition: all 0.2s ease;
    font-weight: bold;
}

.pdf-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.pdf-btn:active {
    transform: translateY(0);
}

.pdf-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.pdf-download {
    background: #28a745;
}

.pdf-download:hover {
    background: #218838;
}

/* PDF Canvas Container */
.pdf-canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    overflow: auto;
    background: #f8f9fa;
    width: 100%;
    position: relative;
    touch-action: pan-y;
}

.pdf-canvas {
    width: 100%;
    max-width: none;
    height: auto;
    box-shadow: none;
    border: none;
    background: white;
    transition: opacity 0.2s ease, transform 0.1s ease;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.pdf-canvas:hover {
    opacity: 0.95;
}

.pdf-canvas:active {
    transform: scale(0.98);
}

/* PDF Annotation Layer */
.pdf-annotation-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 15;
}

.pdf-annotation-link {
    pointer-events: auto;
    background: rgba(0, 75, 147, 0.1);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.pdf-annotation-link:hover {
    background: rgba(0, 75, 147, 0.2);
    border-color: rgba(0, 75, 147, 0.5);
    box-shadow: 0 2px 8px rgba(0, 75, 147, 0.3);
}

.pdf-annotation-link:focus {
    outline: 2px solid #004b93;
    outline-offset: 2px;
    background: rgba(0, 75, 147, 0.2);
}

.pdf-annotation-link:active {
    background: rgba(0, 75, 147, 0.3);
    transform: scale(0.98);
}

.pdf-navigation-hint {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.pdf-canvas-container:hover .pdf-navigation-hint {
    opacity: 1;
}

/* PDF Sidebar */
.pdf-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 100%;
    background: #fff;
    border-left: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 5;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.ksc-pdf-viewer[data-show-sidebar="1"] .pdf-sidebar {
    transform: translateX(0);
}

.ksc-pdf-viewer[data-show-sidebar="1"] .pdf-canvas-container {
    margin-right: 200px;
}

.pdf-sidebar-content {
    padding: 15px;
}

.pdf-sidebar-content h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

/* PDF Thumbnails */
.pdf-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdf-thumbnail {
    cursor: pointer;
    border: 2px solid transparent;
    padding: 8px;
    text-align: center;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.pdf-thumbnail:hover {
    border-color: #004b93;
    background: #e7f3ff;
}

.pdf-thumbnail.active {
    border-color: #004b93;
    background: #cce7ff;
}

.pdf-thumbnail canvas {
    width: 100%;
    height: auto;
    border: 1px solid #dee2e6;
    margin-bottom: 5px;
}

.pdf-thumbnail span {
    font-size: 12px;
    color: #666;
    display: block;
}

/* Error Message */
.pdf-error {
    text-align: center;
    padding: 40px 20px;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px;
}

.pdf-download-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: #004b93;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.pdf-download-link:hover {
    background: #0056b3;
    text-decoration: none;
    color: white;
}

/* Fullscreen Styles */
.ksc-pdf-viewer:-webkit-full-screen {
    background: #000;
}

.ksc-pdf-viewer:-moz-full-screen {
    background: #000;
}

.ksc-pdf-viewer:-ms-fullscreen {
    background: #000;
}

.ksc-pdf-viewer:fullscreen {
    background: #000;
}

.ksc-pdf-viewer:fullscreen .pdf-canvas-container {
    background: #000;
    padding: 0;
}

.ksc-pdf-viewer:fullscreen .pdf-canvas {
    max-height: 100vh;
    object-fit: contain;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ksc-pdf-viewer-wrapper {
        margin: 10px 0;
        padding-left: 0;
        padding-right: 0;
    }
    
    .pdf-viewer-title {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
    
    .pdf-navigation-hint {
        top: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }

    .pdf-zoom-controls {
        justify-content: center;
    }
    
    .ksc-pdf-viewer[data-show-sidebar="1"] .pdf-sidebar {
        width: 100%;
        height: 300px;
        position: static;
        transform: none;
        border-left: none;
        border-top: 1px solid #dee2e6;
    }
    
    .ksc-pdf-viewer[data-show-sidebar="1"] .pdf-canvas-container {
        margin-right: 0;
    }
    
    .pdf-thumbnails {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .pdf-thumbnail {
        flex: 0 0 120px;
    }
}

@media (max-width: 480px) {
    .pdf-viewer-title {
        font-size: 1.2em;
        padding: 0 15px;
    }
    
    .pdf-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 30px;
    }
    
    .pdf-toolbar {
        padding: 8px 10px;
    }
}

/* Alert Styles */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
} 