/**
 * PDF Viewer Styles
 */

/* Container */
.pdf-display {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #525659;
}

.pdf-extracted {
    background: #fff;
}

/* Controls */
.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.pdf-controls button {
    padding: 4px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
}

.pdf-controls button:hover:not(:disabled) {
    background: #e9e9e9;
}

.pdf-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-page-info {
    font-size: 14px;
    color: #333;
    min-width: 60px;
    text-align: center;
}

.pdf-zoom-select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
}

/* Canvas Container */
.pdf-canvas-container {
    position: relative;
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 10px;
}

.pdf-canvas {
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Text Layer - for selection and annotation */
.pdf-text-layer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.2;
    line-height: 1.0;
    pointer-events: none;
}

.pdf-text-layer span {
    position: absolute;
    white-space: pre;
    color: transparent;
    pointer-events: auto;
}

.pdf-text-layer span::selection {
    background: rgba(0, 0, 255, 0.3);
}

/* Enable text selection when targeting spans */
.span-target-pdf .pdf-text-layer {
    pointer-events: auto;
}

.span-target-pdf .pdf-text-layer span {
    cursor: text;
}

/* Loading Indicator */
.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #fff;
    font-size: 14px;
}

.pdf-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pdf-spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* Error Display */
.pdf-error {
    padding: 20px;
    text-align: center;
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    margin: 10px;
}

/* Extracted Content (pre-processed) */
.pdf-content-wrapper {
    padding: 15px;
}

.pdf-extracted-text {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
}

.pdf-metadata {
    padding: 8px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
    color: #666;
}

/* Page Content (from format handler) */
.pdf-content {
    padding: 10px;
}

.pdf-page {
    padding: 15px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 4px;
}

.pdf-page::before {
    content: "Page " attr(data-page);
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.pdf-page-layout {
    background: #f9f9f9;
}

.pdf-layout-text {
    font-family: monospace;
    font-size: 12px;
    white-space: pre;
    overflow-x: auto;
}

.pdf-word {
    display: inline;
}

/* Span annotation highlights */
.pdf-word.highlighted,
.pdf-text-layer span.highlighted {
    background-color: rgba(255, 235, 59, 0.5);
    border-radius: 2px;
}

.pdf-word.span-active,
.pdf-text-layer span.span-active {
    background-color: rgba(33, 150, 243, 0.3);
    outline: 2px solid #2196f3;
}

/* View Modes */
.pdf-mode-scroll .pdf-canvas-container {
    max-height: 100%;
}

.pdf-mode-paginated .pdf-canvas-container {
    overflow: hidden;
}

.pdf-mode-side-by-side {
    display: flex;
    flex-direction: row;
}

.pdf-mode-side-by-side .pdf-canvas-container {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .pdf-controls {
        flex-wrap: wrap;
        gap: 5px;
    }

    .pdf-zoom-select {
        width: 100%;
        margin-top: 5px;
    }
}
